diff options
| author | Sanjay Patel <spatel@rotateright.com> | 2017-11-19 16:13:14 +0000 |
|---|---|---|
| committer | Sanjay Patel <spatel@rotateright.com> | 2017-11-19 16:13:14 +0000 |
| commit | fbd3e66b9ac094e57ad2ead5a3113260d5975504 (patch) | |
| tree | 85cc8baccd4542055bcedb2ce5a275dc8efab094 /llvm/test/Transforms | |
| parent | eb731b09f3cbea16487d1abc63029d5fa2d899b2 (diff) | |
| download | bcm5719-llvm-fbd3e66b9ac094e57ad2ead5a3113260d5975504.tar.gz bcm5719-llvm-fbd3e66b9ac094e57ad2ead5a3113260d5975504.zip | |
[LibCallSimplifier] partly fix pow(x, 0.5) -> sqrt() transforms
As the first test shows, we could transform an llvm intrinsic which never sets errno
into a libcall which could set errno (even though it's marked readnone?), so that's
not ideal.
It's possible that we can also transform a libcall which could set errno to an
intrinsic given the fast-math-flags constraint, but that's deferred to determine
exactly which set of FMF are needed.
Differential Revision: https://reviews.llvm.org/D40150
llvm-svn: 318628
Diffstat (limited to 'llvm/test/Transforms')
| -rw-r--r-- | llvm/test/Transforms/InstCombine/pow-sqrt.ll | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/test/Transforms/InstCombine/pow-sqrt.ll b/llvm/test/Transforms/InstCombine/pow-sqrt.ll index 2aeba8d5f99..09856eee792 100644 --- a/llvm/test/Transforms/InstCombine/pow-sqrt.ll +++ b/llvm/test/Transforms/InstCombine/pow-sqrt.ll @@ -2,8 +2,8 @@ define double @pow_intrinsic_half_fast(double %x) { ; CHECK-LABEL: @pow_intrinsic_half_fast( -; CHECK-NEXT: [[SQRT:%.*]] = call fast double @sqrt(double %x) #1 -; CHECK-NEXT: ret double [[SQRT]] +; CHECK-NEXT: [[TMP1:%.*]] = call fast double @llvm.sqrt.f64(double %x) +; CHECK-NEXT: ret double [[TMP1]] ; %pow = call fast double @llvm.pow.f64(double %x, double 5.000000e-01) ret double %pow @@ -51,8 +51,8 @@ define double @pow_intrinsic_neghalf_approx(double %x) { define float @pow_libcall_neghalf_fast(float %x) { ; CHECK-LABEL: @pow_libcall_neghalf_fast( ; CHECK-NEXT: [[SQRTF:%.*]] = call fast float @sqrtf(float %x) -; CHECK-NEXT: [[SQRTRECIP:%.*]] = fdiv fast float 1.000000e+00, [[SQRTF]] -; CHECK-NEXT: ret float [[SQRTRECIP]] +; CHECK-NEXT: [[TMP1:%.*]] = fdiv fast float 1.000000e+00, [[SQRTF]] +; CHECK-NEXT: ret float [[TMP1]] ; %pow = call fast float @powf(float %x, float -5.0e-01) ret float %pow |

