r334964 - Fix a bug introduced by rL334850
Tomasz Krupa via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 18 10:57:06 PDT 2018
Author: tkrupa
Date: Mon Jun 18 10:57:05 2018
New Revision: 334964
URL: http://llvm.org/viewvc/llvm-project?rev=334964&view=rev
Log:
Fix a bug introduced by rL334850
Summary: All *_sqrt_round_s[s|d] intrinsics should execute a square root on
zeroth element from B (Ops[1]) and insert in to A (Ops[0]), not the other way around.
Reviewers: itaraban, craig.topper
Reviewed By: craig.topper
Subscribers: craig.topper, cfe-commits
Differential Revision: https://reviews.llvm.org/D48288
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=334964&r1=334963&r2=334964&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Mon Jun 18 10:57:05 2018
@@ -9907,7 +9907,7 @@ Value *CodeGenFunction::EmitX86BuiltinEx
Intrinsic::x86_avx512_mask_sqrt_ss;
return Builder.CreateCall(CGM.getIntrinsic(IID), Ops);
}
- Value *A = Builder.CreateExtractElement(Ops[0], (uint64_t)0);
+ Value *A = Builder.CreateExtractElement(Ops[1], (uint64_t)0);
Function *F = CGM.getIntrinsic(Intrinsic::sqrt, A->getType());
Value *Src = Builder.CreateExtractElement(Ops[2], (uint64_t)0);
int MaskSize = Ops[3]->getType()->getScalarSizeInBits();
@@ -9915,7 +9915,7 @@ Value *CodeGenFunction::EmitX86BuiltinEx
Value *Mask = Builder.CreateBitCast(Ops[3], MaskTy);
Mask = Builder.CreateExtractElement(Mask, (uint64_t)0);
A = Builder.CreateSelect(Mask, Builder.CreateCall(F, {A}), Src);
- return Builder.CreateInsertElement(Ops[1], A, (uint64_t)0);
+ return Builder.CreateInsertElement(Ops[0], A, (uint64_t)0);
}
case X86::BI__builtin_ia32_sqrtpd256:
case X86::BI__builtin_ia32_sqrtpd:
More information about the cfe-commits
mailing list