[cfe-commits] r129420 - /cfe/trunk/lib/CodeGen/CGBuiltin.cpp

Bill Wendling isanbard at gmail.com
Tue Apr 12 17:36:37 PDT 2011


Author: void
Date: Tue Apr 12 19:36:37 2011
New Revision: 129420

URL: http://llvm.org/viewvc/llvm-project?rev=129420&view=rev
Log:
Convert the unaligned load builtins to the first-class versions.

Modified:
    cfe/trunk/lib/CodeGen/CGBuiltin.cpp

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=129420&r1=129419&r2=129420&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Tue Apr 12 19:36:37 2011
@@ -2092,6 +2092,19 @@
     // If palignr is shifting the pair of vectors more than 32 bytes, emit zero.
     return llvm::Constant::getNullValue(ConvertType(E->getType()));
   }
+  case X86::BI__builtin_ia32_loadups:
+  case X86::BI__builtin_ia32_loadupd:
+  case X86::BI__builtin_ia32_loaddqu: {
+    const llvm::Type *VecTy = ConvertType(E->getType());
+    const llvm::Type *IntTy = llvm::IntegerType::get(getLLVMContext(), 128);
+
+    Value *BC = Builder.CreateBitCast(Ops[0],
+                                      llvm::PointerType::getUnqual(IntTy),
+                                      "cast");
+    LoadInst *LI = Builder.CreateLoad(BC);
+    LI->setAlignment(1); // Unaligned load.
+    return Builder.CreateBitCast(LI, VecTy, "loadu.cast");
+  }
   }
 }
 





More information about the cfe-commits mailing list