r334054 - [X86] Implement __builtin_ia32_vec_ext_v2si correctly even though we only use it with an index of 0.
Craig Topper via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 5 15:40:03 PDT 2018
Author: ctopper
Date: Tue Jun 5 15:40:03 2018
New Revision: 334054
URL: http://llvm.org/viewvc/llvm-project?rev=334054&view=rev
Log:
[X86] Implement __builtin_ia32_vec_ext_v2si correctly even though we only use it with an index of 0.
This builtin takes an index as its second operand, but the codegen hardcodes an index of 0 and doesn't use the operand. The only use of the builtin in the header file passes 0 to the operand so this works for that usage. But its more correct to use the real operand.
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=334054&r1=334053&r2=334054&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Tue Jun 5 15:40:03 2018
@@ -8779,7 +8779,7 @@ Value *CodeGenFunction::EmitX86BuiltinEx
llvm::Type::getX86_MMXTy(getLLVMContext()));
case X86::BI__builtin_ia32_vec_ext_v2si:
return Builder.CreateExtractElement(Ops[0],
- llvm::ConstantInt::get(Ops[1]->getType(), 0));
+ cast<ConstantInt>(Ops[1])->getZExtValue());
case X86::BI_mm_setcsr:
case X86::BI__builtin_ia32_ldmxcsr: {
Address Tmp = CreateMemTemp(E->getArg(0)->getType());
More information about the cfe-commits
mailing list