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

Chris Lattner clattner at apple.com
Tue Apr 12 20:56:17 PDT 2011


On Apr 12, 2011, at 5:36 PM, Bill Wendling wrote:

> 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.

Hi Bill,

In Clang (unlike llvm-gcc), we can just remove these builtins, and switch xmmintrin.h (and friends) to just use the right unaligned load directly.

-Chris

> 
> 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");
> +  }
>   }
> }
> 
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list