1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00

[InstCombine] add test for pow(x, -1.0) with FMF; NFC

llvm-svn: 320311
This commit is contained in:
Sanjay Patel 2017-12-10 17:21:51 +00:00
parent 21aca283f0
commit 6680806ac4

View 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)