diff options
author | Matthias Braun <matze@braunis.de> | 2014-12-03 21:46:33 +0000 |
---|---|---|
committer | Matthias Braun <matze@braunis.de> | 2014-12-03 21:46:33 +0000 |
commit | d34e4d235428e13810d695400e5a14f5b8752c13 (patch) | |
tree | 3f552197aa59ed38c9ee4dceb125b65e96b5fb84 /llvm/test/Transforms/InstCombine/float-shrink-compare.ll | |
parent | 892c923c469bf333909827ae5ae5f0ecd1b4b88f (diff) | |
download | bcm5719-llvm-d34e4d235428e13810d695400e5a14f5b8752c13.tar.gz bcm5719-llvm-d34e4d235428e13810d695400e5a14f5b8752c13.zip |
[SimplifyLibCalls] Improve double->float shrinking to consider constants
This allows cases like float x; fmin(1.0, x); to be optimized to fminf(1.0f, x);
rdar://19049359
Differential Revision: http://reviews.llvm.org/D6496
llvm-svn: 223270
Diffstat (limited to 'llvm/test/Transforms/InstCombine/float-shrink-compare.ll')
-rw-r--r-- | llvm/test/Transforms/InstCombine/float-shrink-compare.ll | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/float-shrink-compare.ll b/llvm/test/Transforms/InstCombine/float-shrink-compare.ll index ef1221b67c2..a08f9531d21 100644 --- a/llvm/test/Transforms/InstCombine/float-shrink-compare.ll +++ b/llvm/test/Transforms/InstCombine/float-shrink-compare.ll @@ -235,6 +235,30 @@ define i32 @test19(float %x, float %y, float %z) nounwind uwtable { ; CHECK-NEXT: fcmp oeq float %copysignf, %z } +define i32 @test20(float %x, float %y) nounwind uwtable { + %1 = fpext float %y to double + %2 = fpext float %x to double + %3 = call double @fmin(double 1.000000e+00, double %2) nounwind + %4 = fcmp oeq double %1, %3 + %5 = zext i1 %4 to i32 + ret i32 %5 +; CHECK-LABEL: @test20( +; CHECK-NEXT: %fminf = call float @fminf(float 1.000000e+00, float %x) +; CHECK-NEXT: fcmp oeq float %fminf, %y +} + +define i32 @test21(float %x, float %y) nounwind uwtable { + %1 = fpext float %y to double + %2 = fpext float %x to double + %3 = call double @fmin(double 1.300000e+00, double %2) nounwind + %4 = fcmp oeq double %1, %3 + %5 = zext i1 %4 to i32 + ret i32 %5 +; should not be changed to fminf as the constant would loose precision +; CHECK-LABEL: @test21( +; CHECK: %3 = call double @fmin(double 1.300000e+00, double %2) +} + declare double @fabs(double) nounwind readnone declare double @ceil(double) nounwind readnone declare double @copysign(double, double) nounwind readnone |