diff options
Diffstat (limited to 'test/Transforms/InstCombine/fcmp.ll')
-rw-r--r-- | test/Transforms/InstCombine/fcmp.ll | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/fcmp.ll b/test/Transforms/InstCombine/fcmp.ll index afc6782..ee39d10 100644 --- a/test/Transforms/InstCombine/fcmp.ll +++ b/test/Transforms/InstCombine/fcmp.ll @@ -1,5 +1,7 @@ ; RUN: opt -S -instcombine < %s | FileCheck %s +declare double @llvm.fabs.f64(double) nounwind readnone + define i1 @test1(float %x, float %y) nounwind { %ext1 = fpext float %x to double %ext2 = fpext float %y to double @@ -81,6 +83,16 @@ define i32 @test9(double %a) nounwind { ; CHECK: ret i32 0 } +define i32 @test9_intrinsic(double %a) nounwind { + %call = tail call double @llvm.fabs.f64(double %a) nounwind + %cmp = fcmp olt double %call, 0.000000e+00 + %conv = zext i1 %cmp to i32 + ret i32 %conv +; CHECK-LABEL: @test9_intrinsic( +; CHECK-NOT: fabs +; CHECK: ret i32 0 +} + define i32 @test10(double %a) nounwind { %call = tail call double @fabs(double %a) nounwind %cmp = fcmp ole double %call, 0.000000e+00 @@ -91,6 +103,16 @@ define i32 @test10(double %a) nounwind { ; CHECK: fcmp oeq double %a, 0.000000e+00 } +define i32 @test10_intrinsic(double %a) nounwind { + %call = tail call double @llvm.fabs.f64(double %a) nounwind + %cmp = fcmp ole double %call, 0.000000e+00 + %conv = zext i1 %cmp to i32 + ret i32 %conv +; CHECK-LABEL: @test10_intrinsic( +; CHECK-NOT: fabs +; CHECK: fcmp oeq double %a, 0.000000e+00 +} + define i32 @test11(double %a) nounwind { %call = tail call double @fabs(double %a) nounwind %cmp = fcmp ogt double %call, 0.000000e+00 @@ -101,6 +123,16 @@ define i32 @test11(double %a) nounwind { ; CHECK: fcmp one double %a, 0.000000e+00 } +define i32 @test11_intrinsic(double %a) nounwind { + %call = tail call double @llvm.fabs.f64(double %a) nounwind + %cmp = fcmp ogt double %call, 0.000000e+00 + %conv = zext i1 %cmp to i32 + ret i32 %conv +; CHECK-LABEL: @test11_intrinsic( +; CHECK-NOT: fabs +; CHECK: fcmp one double %a, 0.000000e+00 +} + define i32 @test12(double %a) nounwind { %call = tail call double @fabs(double %a) nounwind %cmp = fcmp oge double %call, 0.000000e+00 @@ -111,6 +143,16 @@ define i32 @test12(double %a) nounwind { ; CHECK: fcmp ord double %a, 0.000000e+00 } +define i32 @test12_intrinsic(double %a) nounwind { + %call = tail call double @llvm.fabs.f64(double %a) nounwind + %cmp = fcmp oge double %call, 0.000000e+00 + %conv = zext i1 %cmp to i32 + ret i32 %conv +; CHECK-LABEL: @test12_intrinsic( +; CHECK-NOT: fabs +; CHECK: fcmp ord double %a, 0.000000e+00 +} + define i32 @test13(double %a) nounwind { %call = tail call double @fabs(double %a) nounwind %cmp = fcmp une double %call, 0.000000e+00 @@ -121,6 +163,16 @@ define i32 @test13(double %a) nounwind { ; CHECK: fcmp une double %a, 0.000000e+00 } +define i32 @test13_intrinsic(double %a) nounwind { + %call = tail call double @llvm.fabs.f64(double %a) nounwind + %cmp = fcmp une double %call, 0.000000e+00 + %conv = zext i1 %cmp to i32 + ret i32 %conv +; CHECK-LABEL: @test13_intrinsic( +; CHECK-NOT: fabs +; CHECK: fcmp une double %a, 0.000000e+00 +} + define i32 @test14(double %a) nounwind { %call = tail call double @fabs(double %a) nounwind %cmp = fcmp oeq double %call, 0.000000e+00 @@ -131,6 +183,16 @@ define i32 @test14(double %a) nounwind { ; CHECK: fcmp oeq double %a, 0.000000e+00 } +define i32 @test14_intrinsic(double %a) nounwind { + %call = tail call double @llvm.fabs.f64(double %a) nounwind + %cmp = fcmp oeq double %call, 0.000000e+00 + %conv = zext i1 %cmp to i32 + ret i32 %conv +; CHECK-LABEL: @test14_intrinsic( +; CHECK-NOT: fabs +; CHECK: fcmp oeq double %a, 0.000000e+00 +} + define i32 @test15(double %a) nounwind { %call = tail call double @fabs(double %a) nounwind %cmp = fcmp one double %call, 0.000000e+00 @@ -141,6 +203,16 @@ define i32 @test15(double %a) nounwind { ; CHECK: fcmp one double %a, 0.000000e+00 } +define i32 @test15_intrinsic(double %a) nounwind { + %call = tail call double @llvm.fabs.f64(double %a) nounwind + %cmp = fcmp one double %call, 0.000000e+00 + %conv = zext i1 %cmp to i32 + ret i32 %conv +; CHECK-LABEL: @test15_intrinsic( +; CHECK-NOT: fabs +; CHECK: fcmp one double %a, 0.000000e+00 +} + define i32 @test16(double %a) nounwind { %call = tail call double @fabs(double %a) nounwind %cmp = fcmp ueq double %call, 0.000000e+00 @@ -151,6 +223,16 @@ define i32 @test16(double %a) nounwind { ; CHECK: fcmp ueq double %a, 0.000000e+00 } +define i32 @test16_intrinsic(double %a) nounwind { + %call = tail call double @llvm.fabs.f64(double %a) nounwind + %cmp = fcmp ueq double %call, 0.000000e+00 + %conv = zext i1 %cmp to i32 + ret i32 %conv +; CHECK-LABEL: @test16_intrinsic( +; CHECK-NOT: fabs +; CHECK: fcmp ueq double %a, 0.000000e+00 +} + ; Don't crash. define i32 @test17(double %a, double (double)* %p) nounwind { %call = tail call double %p(double %a) nounwind |