From: Bill Wendling Date: Wed, 13 Apr 2011 00:36:37 +0000 (+0000) Subject: Convert the unaligned load builtins to the first-class versions. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=aa48244cc043b1bcf166635745481d0d7f4f6838;p=clang Convert the unaligned load builtins to the first-class versions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129420 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGBuiltin.cpp b/lib/CodeGen/CGBuiltin.cpp index af8d37a221..fce2bf40ee 100644 --- a/lib/CodeGen/CGBuiltin.cpp +++ b/lib/CodeGen/CGBuiltin.cpp @@ -2092,6 +2092,19 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID, // 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"); + } } }