[cfe-commits] r166743 - in /cfe/trunk: lib/Headers/xmmintrin.h test/CodeGen/sse-builtins.c

Manman Ren mren at apple.com
Thu Oct 25 17:25:11 PDT 2012


Author: mren
Date: Thu Oct 25 19:25:10 2012
New Revision: 166743

URL: http://llvm.org/viewvc/llvm-project?rev=166743&view=rev
Log:
X86 SSE Intrinsics: update header for sqrt_ss, rsqrt_ss and rcp_ss.

There intrinsics pass through the upper FP values from the input.
rdar://12558838

Modified:
    cfe/trunk/lib/Headers/xmmintrin.h
    cfe/trunk/test/CodeGen/sse-builtins.c

Modified: cfe/trunk/lib/Headers/xmmintrin.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/xmmintrin.h?rev=166743&r1=166742&r2=166743&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/xmmintrin.h (original)
+++ cfe/trunk/lib/Headers/xmmintrin.h Thu Oct 25 19:25:10 2012
@@ -95,7 +95,8 @@
 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
 _mm_sqrt_ss(__m128 a)
 {
-  return __builtin_ia32_sqrtss(a);
+  __m128 c = __builtin_ia32_sqrtss(a);
+  return (__m128) { c[0], a[1], a[2], a[3] };
 }
 
 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
@@ -107,7 +108,8 @@
 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
 _mm_rcp_ss(__m128 a)
 {
-  return __builtin_ia32_rcpss(a);
+  __m128 c = __builtin_ia32_rcpss(a);
+  return (__m128) { c[0], a[1], a[2], a[3] };
 }
 
 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
@@ -119,7 +121,8 @@
 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
 _mm_rsqrt_ss(__m128 a)
 {
-  return __builtin_ia32_rsqrtss(a);
+  __m128 c = __builtin_ia32_rsqrtss(a);
+  return (__m128) { c[0], a[1], a[2], a[3] };
 }
 
 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))

Modified: cfe/trunk/test/CodeGen/sse-builtins.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/sse-builtins.c?rev=166743&r1=166742&r2=166743&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/sse-builtins.c (original)
+++ cfe/trunk/test/CodeGen/sse-builtins.c Thu Oct 25 19:25:10 2012
@@ -1,8 +1,39 @@
 // RUN: %clang_cc1 -ffreestanding -triple i386-apple-darwin9 -target-cpu pentium4 -target-feature +sse4.1 -g -emit-llvm %s -o - | FileCheck %s
 
+#include <xmmintrin.h>
 #include <emmintrin.h>
 #include <smmintrin.h>
 
+__m128 test_rsqrt_ss(__m128 x) {
+  // CHECK: define {{.*}} @test_rsqrt_ss
+  // CHECK: call <4 x float> @llvm.x86.sse.rsqrt.ss
+  // CHECK: extractelement <4 x float> {{.*}}, i32 0
+  // CHECK: extractelement <4 x float> {{.*}}, i32 1
+  // CHECK: extractelement <4 x float> {{.*}}, i32 2
+  // CHECK: extractelement <4 x float> {{.*}}, i32 3
+  return _mm_rsqrt_ss(x);
+}
+
+__m128 test_rcp_ss(__m128 x) {
+  // CHECK: define {{.*}} @test_rcp_ss
+  // CHECK: call <4 x float> @llvm.x86.sse.rcp.ss
+  // CHECK: extractelement <4 x float> {{.*}}, i32 0
+  // CHECK: extractelement <4 x float> {{.*}}, i32 1
+  // CHECK: extractelement <4 x float> {{.*}}, i32 2
+  // CHECK: extractelement <4 x float> {{.*}}, i32 3
+  return _mm_rcp_ss(x);
+}
+
+__m128 test_sqrt_ss(__m128 x) {
+  // CHECK: define {{.*}} @test_sqrt_ss
+  // CHECK: call <4 x float> @llvm.x86.sse.sqrt.ss
+  // CHECK: extractelement <4 x float> {{.*}}, i32 0
+  // CHECK: extractelement <4 x float> {{.*}}, i32 1
+  // CHECK: extractelement <4 x float> {{.*}}, i32 2
+  // CHECK: extractelement <4 x float> {{.*}}, i32 3
+  return _mm_sqrt_ss(x);
+}
+
 __m128 test_loadl_pi(__m128 x, void* y) {
   // CHECK: define {{.*}} @test_loadl_pi
   // CHECK: load <2 x float>* {{.*}}, align 1{{$}}





More information about the cfe-commits mailing list