1Pull in r209489 from upstream clang trunk (by Akira Hatanaka): 2 3 Fix a bug in xmmintrin.h. 4 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 7 values. 8 9 <rdar://problem/16873717> 10 11Pull in r209559 from upstream clang trunk (by Akira Hatanaka): 12 13 Recommit r209532 with -ffreestanding. 14 15 This is a test case for r209489. 16 17Introduced here: http://svnweb.freebsd.org/changeset/base/266674 18 19Index: 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); 26 27- return _mm_packs_pi16(__b, __c); 28+ return _mm_packs_pi32(__b, __c); 29 } 30 31 static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) 32Index: tools/clang/test/Headers/xmmintrin.c 33=================================================================== 34--- tools/clang/test/Headers/xmmintrin.c 35+++ tools/clang/test/Headers/xmmintrin.c 36@@ -0,0 +1,13 @@ 37+// RUN: %clang_cc1 %s -ffreestanding -triple x86_64-apple-macosx10.9.0 -emit-llvm -o - | FileCheck %s 38+ 39+#include <xmmintrin.h> 40+ 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. 43+ 44+// CHECK: define i64 @test_mm_cvtps_pi16 45+// CHECK: call x86_mmx @llvm.x86.mmx.packssdw 46+ 47+__m64 test_mm_cvtps_pi16(__m128 a) { 48+ return _mm_cvtps_pi16(a); 49+} 50