mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-14 23:48:56 +00:00
[SimplifyLibCalls] Restore the old behaviour, emit a libcall.
Hal pointed out that the semantic of our intrinsic and the libc call are slightly different. Add a comment while I'm here to explain why we can't emit an intrinsic. Thanks Hal! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278200 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
74dacfe33e
commit
1ea5b393e5
@ -1052,9 +1052,11 @@ Value *LibCallSimplifier::optimizePow(CallInst *CI, IRBuilder<> &B) {
|
||||
if (CI->hasUnsafeAlgebra()) {
|
||||
IRBuilder<>::FastMathFlagGuard Guard(B);
|
||||
B.setFastMathFlags(CI->getFastMathFlags());
|
||||
Value *Sqrt = Intrinsic::getDeclaration(CI->getModule(), Intrinsic::sqrt,
|
||||
Op1->getType());
|
||||
return B.CreateCall(Sqrt, Op1, "sqrt");
|
||||
|
||||
// Unlike other math intrinsics, sqrt has differerent semantics
|
||||
// from the libc function. See LangRef for details.
|
||||
return emitUnaryFloatFnCall(Op1, TLI->getName(LibFunc::sqrt), B,
|
||||
Callee->getAttributes());
|
||||
}
|
||||
|
||||
// Expand pow(x, 0.5) to (x == -infinity ? +infinity : fabs(sqrt(x))).
|
||||
|
@ -6,7 +6,7 @@ define double @pow_half(double %x) {
|
||||
}
|
||||
|
||||
; CHECK-LABEL: define double @pow_half(
|
||||
; CHECK-NEXT: %sqrt = call fast double @llvm.sqrt.f64(double %x)
|
||||
; CHECK-NEXT: %sqrt = call fast double @sqrt(double %x)
|
||||
; CHECK-NEXT: ret double %sqrt
|
||||
|
||||
declare double @llvm.pow.f64(double, double)
|
||||
|
Loading…
Reference in New Issue
Block a user