[llvm] r320311 - [InstCombine] add test for pow(x, -1.0) with FMF; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 10 09:21:51 PST 2017
Author: spatel
Date: Sun Dec 10 09:21:51 2017
New Revision: 320311
URL: http://llvm.org/viewvc/llvm-project?rev=320311&view=rev
Log:
[InstCombine] add test for pow(x, -1.0) with FMF; NFC
Modified:
llvm/trunk/test/Transforms/InstCombine/pow-1.ll
Modified: llvm/trunk/test/Transforms/InstCombine/pow-1.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/pow-1.ll?rev=320311&r1=320310&r2=320311&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/pow-1.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/pow-1.ll Sun Dec 10 09:21:51 2017
@@ -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)
More information about the llvm-commits
mailing list