OSDN Git Service

[InstCombine] add test for pow(x, -1.0) with FMF; NFC
authorSanjay Patel <spatel@rotateright.com>
Sun, 10 Dec 2017 17:21:51 +0000 (17:21 +0000)
committerSanjay Patel <spatel@rotateright.com>
Sun, 10 Dec 2017 17:21:51 +0000 (17:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320311 91177308-0d34-0410-b5e6-96231b3b80d8

test/Transforms/InstCombine/pow-1.ll

index c7ca3cf..3559828 100644 (file)
@@ -133,6 +133,15 @@ define float @pow2_strict(float %x) {
   ret float %r
 }
 
+define double @pow2_double_strict(double %x) {
+; CHECK-LABEL: @pow2_double_strict(
+; CHECK-NEXT:    [[POW2:%.*]] = fmul double %x, %x
+; CHECK-NEXT:    ret double [[POW2]]
+;
+  %r = call double @pow(double %x, double 2.0)
+  ret double %r
+}
+
 ; Don't drop the FMF - PR35601 ( https://bugs.llvm.org/show_bug.cgi?id=35601 )
 
 define float @pow2_fast(float %x) {
@@ -144,30 +153,24 @@ define float @pow2_fast(float %x) {
   ret float %r
 }
 
-define double @test_simplify14(double %x) {
-; CHECK-LABEL: @test_simplify14(
-  %retval = call double @pow(double %x, double 2.0)
-; CHECK-NEXT: [[SQUARE:%[a-z0-9]+]] = fmul double %x, %x
-  ret double %retval
-; CHECK-NEXT: ret double [[SQUARE]]
-}
-
 ; Check pow(x, -1.0) -> 1.0/x.
 
-define float @test_simplify15(float %x) {
-; CHECK-LABEL: @test_simplify15(
-  %retval = call float @powf(float %x, float -1.0)
-; CHECK-NEXT: [[RECIPROCAL:%[a-z0-9]+]] = fdiv float 1.000000e+00, %x
-  ret float %retval
-; CHECK-NEXT: ret float [[RECIPROCAL]]
+define float @pow_neg1_strict(float %x) {
+; CHECK-LABEL: @pow_neg1_strict(
+; CHECK-NEXT:    [[POWRECIP:%.*]] = fdiv float 1.000000e+00, %x
+; CHECK-NEXT:    ret float [[POWRECIP]]
+;
+  %r = call float @powf(float %x, float -1.0)
+  ret float %r
 }
 
-define double @test_simplify16(double %x) {
-; CHECK-LABEL: @test_simplify16(
-  %retval = call double @pow(double %x, double -1.0)
-; CHECK-NEXT: [[RECIPROCAL:%[a-z0-9]+]] = fdiv double 1.000000e+00, %x
-  ret double %retval
-; CHECK-NEXT: ret double [[RECIPROCAL]]
+define double @pow_neg1_double_fast(double %x) {
+; CHECK-LABEL: @pow_neg1_double_fast(
+; CHECK-NEXT:    [[POWRECIP:%.*]] = fdiv double 1.000000e+00, %x
+; CHECK-NEXT:    ret double [[POWRECIP]]
+;
+  %r = call fast double @pow(double %x, double -1.0)
+  ret double %r
 }
 
 declare double @llvm.pow.f64(double %Val, double %Power)