summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2011-03-31 10:12:07 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2011-03-31 10:12:07 +0000
commitb194bdc03b6aa932ba4f719a8aa02db8d498f364 (patch)
tree28804355f79af5e0e726722459be2c1190c56a75 /test
parentcd0274ca189040a2fd883b00a678184afc2cda3a (diff)
downloadllvm-b194bdc03b6aa932ba4f719a8aa02db8d498f364.tar.gz
llvm-b194bdc03b6aa932ba4f719a8aa02db8d498f364.tar.bz2
llvm-b194bdc03b6aa932ba4f719a8aa02db8d498f364.tar.xz
InstCombine: Shrink "fcmp (fpext x), C" to "fcmp x, C" if C can be losslessly converted to the type of x.
Fixes PR9592. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128625 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Transforms/InstCombine/fcmp.ll23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/fcmp.ll b/test/Transforms/InstCombine/fcmp.ll
index bef4855a0e..49bd50717d 100644
--- a/test/Transforms/InstCombine/fcmp.ll
+++ b/test/Transforms/InstCombine/fcmp.ll
@@ -9,3 +9,26 @@ define i1 @test1(float %x, float %y) nounwind {
; CHECK-NEXT: fcmp ogt float %x, %y
}
+define i1 @test2(float %a) nounwind {
+ %ext = fpext float %a to double
+ %cmp = fcmp ogt double %ext, 1.000000e+00
+ ret i1 %cmp
+; CHECK: @test2
+; CHECK-NEXT: fcmp ogt float %a, 1.0
+}
+
+define i1 @test3(float %a) nounwind {
+ %ext = fpext float %a to double
+ %cmp = fcmp ogt double %ext, 0x3FF0000000000001 ; more precision than float.
+ ret i1 %cmp
+; CHECK: @test3
+; CHECK-NEXT: fpext float %a to double
+}
+
+define i1 @test4(float %a) nounwind {
+ %ext = fpext float %a to double
+ %cmp = fcmp ogt double %ext, 0x36A0000000000000 ; denormal in float.
+ ret i1 %cmp
+; CHECK: @test4
+; CHECK-NEXT: fpext float %a to double
+}