]> granicus.if.org Git - clang/commitdiff
[X86] Implement __builtin_ia32_vec_ext_v2si correctly even though we only use it...
authorCraig Topper <craig.topper@intel.com>
Tue, 5 Jun 2018 22:40:03 +0000 (22:40 +0000)
committerCraig Topper <craig.topper@intel.com>
Tue, 5 Jun 2018 22:40:03 +0000 (22:40 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334054 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGBuiltin.cpp

index c6c9df460e617b27311c5a7c2b66182240974e22..6379f53d17f0067c0b8b880b0bc69f85464a4070 100644 (file)
@@ -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<ConstantInt>(Ops[1])->getZExtValue());
   case X86::BI_mm_setcsr:
   case X86::BI__builtin_ia32_ldmxcsr: {
     Address Tmp = CreateMemTemp(E->getArg(0)->getType());