From 6b5b5ce06c2d294d093a3ad782e7546d5fccd25b Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Tue, 5 Jun 2018 22:40:03 +0000 Subject: [PATCH] [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. llvm-svn: 334054 --- clang/lib/CodeGen/CGBuiltin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index c6c9df460e61..6379f53d17f0 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -8779,7 +8779,7 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID, 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(Ops[1])->getZExtValue()); case X86::BI_mm_setcsr: case X86::BI__builtin_ia32_ldmxcsr: { Address Tmp = CreateMemTemp(E->getArg(0)->getType());