[cfe-commits] r73015 - in /cfe/trunk: include/clang/AST/X86Builtins.def lib/CodeGen/CGBuiltin.cpp lib/Headers/xmmintrin.h test/CodeGen/builtins-x86.c

Eli Friedman eli.friedman at gmail.com
Sun Jun 7 00:12:56 PDT 2009


Author: efriedma
Date: Sun Jun  7 02:12:56 2009
New Revision: 73015

URL: http://llvm.org/viewvc/llvm-project?rev=73015&view=rev
Log:
Now that LLVM CodeGen can handle the generic variations a bit better, 
get rid of a few more clang vector builtins.


Modified:
    cfe/trunk/include/clang/AST/X86Builtins.def
    cfe/trunk/lib/CodeGen/CGBuiltin.cpp
    cfe/trunk/lib/Headers/xmmintrin.h
    cfe/trunk/test/CodeGen/builtins-x86.c

Modified: cfe/trunk/include/clang/AST/X86Builtins.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/X86Builtins.def?rev=73015&r1=73014&r2=73015&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/X86Builtins.def (original)
+++ cfe/trunk/include/clang/AST/X86Builtins.def Sun Jun  7 02:12:56 2009
@@ -175,8 +175,6 @@
 BUILTIN(__builtin_ia32_maskmovq, "vV8cV8cc*", "")
 BUILTIN(__builtin_ia32_loadups, "V4ffC*", "")
 BUILTIN(__builtin_ia32_storeups, "vf*V4f", "")
-BUILTIN(__builtin_ia32_loadhps, "V4fV4fV2i*", "")
-BUILTIN(__builtin_ia32_loadlps, "V4fV4fV2i*", "")
 BUILTIN(__builtin_ia32_storehps, "vV2i*V4f", "")
 BUILTIN(__builtin_ia32_storelps, "vV2i*V4f", "")
 BUILTIN(__builtin_ia32_movmskps, "iV4f", "")
@@ -194,8 +192,6 @@
 BUILTIN(__builtin_ia32_maskmovdqu, "vV16cV16cc*", "")
 BUILTIN(__builtin_ia32_loadupd, "V2ddC*", "")
 BUILTIN(__builtin_ia32_storeupd, "vd*V2d", "")
-BUILTIN(__builtin_ia32_loadhpd, "V2dV2ddC*", "")
-BUILTIN(__builtin_ia32_loadlpd, "V2dV2ddC*", "")
 BUILTIN(__builtin_ia32_movmskpd, "iV2d", "")
 BUILTIN(__builtin_ia32_pmovmskb128, "iV16c", "")
 BUILTIN(__builtin_ia32_movnti, "vi*i", "")

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=73015&r1=73014&r2=73015&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Sun Jun  7 02:12:56 2009
@@ -764,28 +764,6 @@
     llvm::Function *F = CGM.getIntrinsic(Intrinsic::x86_sse2_cmp_sd);
     return Builder.CreateCall(F, &Ops[0], &Ops[0] + Ops.size(), "cmpsd");
   }
-  case X86::BI__builtin_ia32_loadlps:
-  case X86::BI__builtin_ia32_loadhps: {
-    // FIXME: This should probably be represented as 
-    // shuffle (dst, (v4f32 (insert undef, (load i64), 0)), shuf mask hi/lo)
-    const llvm::Type *EltTy = llvm::Type::DoubleTy;
-    const llvm::Type *VecTy = llvm::VectorType::get(EltTy, 2);
-    const llvm::Type *OrigTy = Ops[0]->getType();
-    unsigned Index = BuiltinID == X86::BI__builtin_ia32_loadlps ? 0 : 1;
-    llvm::Value *Idx = llvm::ConstantInt::get(llvm::Type::Int32Ty, Index);
-    Ops[1] = Builder.CreateBitCast(Ops[1], llvm::PointerType::getUnqual(EltTy));
-    Ops[1] = Builder.CreateLoad(Ops[1], "tmp");
-    Ops[0] = Builder.CreateBitCast(Ops[0], VecTy, "cast");
-    Ops[0] = Builder.CreateInsertElement(Ops[0], Ops[1], Idx, "loadps");
-    return Builder.CreateBitCast(Ops[0], OrigTy, "loadps");
-  }
-  case X86::BI__builtin_ia32_loadlpd:
-  case X86::BI__builtin_ia32_loadhpd: {
-    Ops[1] = Builder.CreateLoad(Ops[1], "tmp");
-    unsigned Index = BuiltinID == X86::BI__builtin_ia32_loadlpd ? 0 : 1;
-    llvm::Value *Idx = llvm::ConstantInt::get(llvm::Type::Int32Ty, Index);
-    return Builder.CreateInsertElement(Ops[0], Ops[1], Idx, "loadpd");
-  }
   case X86::BI__builtin_ia32_storehps:
   case X86::BI__builtin_ia32_storelps: {
     const llvm::Type *EltTy = llvm::Type::Int64Ty;

Modified: cfe/trunk/lib/Headers/xmmintrin.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/xmmintrin.h?rev=73015&r1=73014&r2=73015&view=diff

==============================================================================
--- cfe/trunk/lib/Headers/xmmintrin.h (original)
+++ cfe/trunk/lib/Headers/xmmintrin.h Sun Jun  7 02:12:56 2009
@@ -464,20 +464,19 @@
 static inline __m128 __attribute__((__always_inline__, __nodebug__))
 _mm_loadh_pi(__m128 a, __m64 const *p)
 {
-  return __builtin_ia32_loadhps(a, (__v2si *)p);
+  __m128 b;
+  b[0] = *(float*)p;
+  b[1] = *((float*)p+1);
+  return __builtin_shufflevector(a, b, 0, 1, 4, 5);
 }
 
 static inline __m128 __attribute__((__always_inline__, __nodebug__))
 _mm_loadl_pi(__m128 a, __m64 const *p)
 {
-#if 0
-  // FIXME: This should work, but gives really crappy code at the moment
   __m128 b;
   b[0] = *(float*)p;
   b[1] = *((float*)p+1);
-  return __builtin_shufflevector(a, b, 0, 1, 4, 5);
-#endif
-  return __builtin_ia32_loadlps(a, (__v2si *)p);
+  return __builtin_shufflevector(a, b, 4, 5, 2, 3);
 }
 
 static inline __m128 __attribute__((__always_inline__, __nodebug__))
@@ -899,8 +898,6 @@
   (row3) = _mm_movelh_ps(tmp3, tmp1); \
 } while (0)
 
-#include <emmintrin.h>
-
 #endif /* __SSE__ */
 
 #endif /* __XMMINTRIN_H */

Modified: cfe/trunk/test/CodeGen/builtins-x86.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-x86.c?rev=73015&r1=73014&r2=73015&view=diff

==============================================================================
--- cfe/trunk/test/CodeGen/builtins-x86.c (original)
+++ cfe/trunk/test/CodeGen/builtins-x86.c Sun Jun  7 02:12:56 2009
@@ -250,8 +250,6 @@
   (void) __builtin_ia32_maskmovq(tmp_V8c, tmp_V8c, tmp_cp);
   tmp_V4f = __builtin_ia32_loadups(tmp_fCp);
   (void) __builtin_ia32_storeups(tmp_fp, tmp_V4f);
-  tmp_V4f = __builtin_ia32_loadhps(tmp_V4f, tmp_V2ip);
-  tmp_V4f = __builtin_ia32_loadlps(tmp_V4f, tmp_V2ip);
   (void) __builtin_ia32_storehps(tmp_V2ip, tmp_V4f);
   (void) __builtin_ia32_storelps(tmp_V2ip, tmp_V4f);
   tmp_i = __builtin_ia32_movmskps(tmp_V4f);
@@ -270,8 +268,6 @@
   (void) __builtin_ia32_maskmovdqu(tmp_V16c, tmp_V16c, tmp_cp);
   tmp_V2d = __builtin_ia32_loadupd(tmp_dCp);
   (void) __builtin_ia32_storeupd(tmp_dp, tmp_V2d);
-  tmp_V2d = __builtin_ia32_loadhpd(tmp_V2d, tmp_dCp);
-  tmp_V2d = __builtin_ia32_loadlpd(tmp_V2d, tmp_dCp);
   tmp_i = __builtin_ia32_movmskpd(tmp_V2d);
   tmp_i = __builtin_ia32_pmovmskb128(tmp_V16c);
   (void) __builtin_ia32_movnti(tmp_ip, tmp_i);





More information about the cfe-commits mailing list