1 Pull in r209489 from upstream clang trunk (by Akira Hatanaka):
3 Fix a bug in xmmintrin.h.
5 The last step of _mm_cvtps_pi16 should use _mm_packs_pi32, which is a function
6 that reads two __m64 values and packs four 32-bit values into four 16-bit
9 <rdar://problem/16873717>
11 Pull in r209559 from upstream clang trunk (by Akira Hatanaka):
13 Recommit r209532 with -ffreestanding.
15 This is a test case for r209489.
17 Introduced here: http://svnweb.freebsd.org/changeset/base/266674
19 Index: tools/clang/lib/Headers/xmmintrin.h
20 ===================================================================
21 --- tools/clang/lib/Headers/xmmintrin.h
22 +++ tools/clang/lib/Headers/xmmintrin.h
23 @@ -903,7 +903,7 @@ _mm_cvtps_pi16(__m128 __a)
24 __a = _mm_movehl_ps(__a, __a);
25 __c = _mm_cvtps_pi32(__a);
27 - return _mm_packs_pi16(__b, __c);
28 + return _mm_packs_pi32(__b, __c);
31 static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))
32 Index: tools/clang/test/Headers/xmmintrin.c
33 ===================================================================
34 --- tools/clang/test/Headers/xmmintrin.c
35 +++ tools/clang/test/Headers/xmmintrin.c
37 +// RUN: %clang_cc1 %s -ffreestanding -triple x86_64-apple-macosx10.9.0 -emit-llvm -o - | FileCheck %s
39 +#include <xmmintrin.h>
41 +// Make sure the last step of _mm_cvtps_pi16 converts <4 x i32> to <4 x i16> by
42 +// checking that clang emits PACKSSDW instead of PACKSSWB.
44 +// CHECK: define i64 @test_mm_cvtps_pi16
45 +// CHECK: call x86_mmx @llvm.x86.mmx.packssdw
47 +__m64 test_mm_cvtps_pi16(__m128 a) {
48 + return _mm_cvtps_pi16(a);