[llvm-commits] [llvm-gcc-4.2] r64621 - /llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp

Dan Gohman gohman at apple.com
Sun Feb 15 15:55:25 PST 2009


Author: djg
Date: Sun Feb 15 17:55:24 2009
New Revision: 64621

URL: http://llvm.org/viewvc/llvm-project?rev=64621&view=rev
Log:
The LLVM IR intrinsics for movups, movupd, and movdqu will be going away,
as these operations can be represented with loads and stores with an
alignment of 1. This commit adds llvm-gcc support for translating the
GCC builtins to LLVM IR. This code is not used yet.

Modified:
    llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp

Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=64621&r1=64620&r2=64621&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Sun Feb 15 17:55:24 2009
@@ -284,6 +284,60 @@
     Result = Builder.CreateBitCast(Result, ResultType, "tmp");
     return true;
   }
+  case IX86_BUILTIN_LOADUPS: {
+    VectorType *v4f32 = VectorType::get(Type::FloatTy, 4);
+    PointerType *v4f32Ptr = PointerType::getUnqual(v4f32);
+    Value *BC = Builder.CreateBitCast(Ops[0], v4f32Ptr, "tmp");
+    LoadInst *LI = Builder.CreateLoad(BC, "tmp");
+    LI->setAlignment(1);
+    Result = LI;
+    return true;
+  }
+  case IX86_BUILTIN_LOADUPD: {
+    VectorType *v2f64 = VectorType::get(Type::DoubleTy, 2);
+    PointerType *v2f64Ptr = PointerType::getUnqual(v2f64);
+    Value *BC = Builder.CreateBitCast(Ops[0], v2f64Ptr, "tmp");
+    LoadInst *LI = Builder.CreateLoad(BC, "tmp");
+    LI->setAlignment(1);
+    Result = LI;
+    return true;
+  }
+  case IX86_BUILTIN_LOADDQU: {
+    VectorType *v16i8 = VectorType::get(Type::Int8Ty, 16);
+    PointerType *v16i8Ptr = PointerType::getUnqual(v16i8);
+    Value *BC = Builder.CreateBitCast(Ops[0], v16i8Ptr, "tmp");
+    LoadInst *LI = Builder.CreateLoad(BC, "tmp");
+    LI->setAlignment(1);
+    Result = LI;
+    return true;
+  }
+  case IX86_BUILTIN_STOREUPS: {
+    VectorType *v4f32 = VectorType::get(Type::FloatTy, 4);
+    PointerType *v4f32Ptr = PointerType::getUnqual(v4f32);
+    Value *BC = Builder.CreateBitCast(Ops[0], v4f32Ptr, "tmp");
+    StoreInst *SI = Builder.CreateStore(Ops[1], BC);
+    SI->setAlignment(1);
+    Result = SI;
+    return true;
+  }
+  case IX86_BUILTIN_STOREUPD: {
+    VectorType *v2f64 = VectorType::get(Type::DoubleTy, 2);
+    PointerType *v2f64Ptr = PointerType::getUnqual(v2f64);
+    Value *BC = Builder.CreateBitCast(Ops[0], v2f64Ptr, "tmp");
+    StoreInst *SI = Builder.CreateStore(Ops[1], BC);
+    SI->setAlignment(1);
+    Result = SI;
+    return true;
+  }
+  case IX86_BUILTIN_STOREDQU: {
+    VectorType *v16i8 = VectorType::get(Type::Int8Ty, 16);
+    PointerType *v16i8Ptr = PointerType::getUnqual(v16i8);
+    Value *BC = Builder.CreateBitCast(Ops[0], v16i8Ptr, "tmp");
+    StoreInst *SI = Builder.CreateStore(Ops[1], BC);
+    SI->setAlignment(1);
+    Result = SI;
+    return true;
+  }
   case IX86_BUILTIN_LOADHPS: {
     PointerType *f64Ptr = PointerType::getUnqual(Type::DoubleTy);
     Ops[1] = Builder.CreateBitCast(Ops[1], f64Ptr, "tmp");





More information about the llvm-commits mailing list