From: Sanjay Patel Date: Sun, 10 Dec 2017 17:21:51 +0000 (+0000) Subject: [InstCombine] add test for pow(x, -1.0) with FMF; NFC X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=922e02340f9290f85f4786bddcef8c909e0bb800;p=llvm [InstCombine] add test for pow(x, -1.0) with FMF; NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320311 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Transforms/InstCombine/pow-1.ll b/test/Transforms/InstCombine/pow-1.ll index c7ca3cf7547..3559828058b 100644 --- a/test/Transforms/InstCombine/pow-1.ll +++ b/test/Transforms/InstCombine/pow-1.ll @@ -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)