mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-21 03:53:04 +02:00
[InstCombine] add test for pow(x, -1.0) with FMF; NFC
llvm-svn: 320311
This commit is contained in:
parent
21aca283f0
commit
6680806ac4
@ -133,6 +133,15 @@ define float @pow2_strict(float %x) {
|
|||||||
ret float %r
|
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 )
|
; Don't drop the FMF - PR35601 ( https://bugs.llvm.org/show_bug.cgi?id=35601 )
|
||||||
|
|
||||||
define float @pow2_fast(float %x) {
|
define float @pow2_fast(float %x) {
|
||||||
@ -144,30 +153,24 @@ define float @pow2_fast(float %x) {
|
|||||||
ret float %r
|
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.
|
; Check pow(x, -1.0) -> 1.0/x.
|
||||||
|
|
||||||
define float @test_simplify15(float %x) {
|
define float @pow_neg1_strict(float %x) {
|
||||||
; CHECK-LABEL: @test_simplify15(
|
; CHECK-LABEL: @pow_neg1_strict(
|
||||||
%retval = call float @powf(float %x, float -1.0)
|
; CHECK-NEXT: [[POWRECIP:%.*]] = fdiv float 1.000000e+00, %x
|
||||||
; CHECK-NEXT: [[RECIPROCAL:%[a-z0-9]+]] = fdiv float 1.000000e+00, %x
|
; CHECK-NEXT: ret float [[POWRECIP]]
|
||||||
ret float %retval
|
;
|
||||||
; CHECK-NEXT: ret float [[RECIPROCAL]]
|
%r = call float @powf(float %x, float -1.0)
|
||||||
|
ret float %r
|
||||||
}
|
}
|
||||||
|
|
||||||
define double @test_simplify16(double %x) {
|
define double @pow_neg1_double_fast(double %x) {
|
||||||
; CHECK-LABEL: @test_simplify16(
|
; CHECK-LABEL: @pow_neg1_double_fast(
|
||||||
%retval = call double @pow(double %x, double -1.0)
|
; CHECK-NEXT: [[POWRECIP:%.*]] = fdiv double 1.000000e+00, %x
|
||||||
; CHECK-NEXT: [[RECIPROCAL:%[a-z0-9]+]] = fdiv double 1.000000e+00, %x
|
; CHECK-NEXT: ret double [[POWRECIP]]
|
||||||
ret double %retval
|
;
|
||||||
; CHECK-NEXT: ret double [[RECIPROCAL]]
|
%r = call fast double @pow(double %x, double -1.0)
|
||||||
|
ret double %r
|
||||||
}
|
}
|
||||||
|
|
||||||
declare double @llvm.pow.f64(double %Val, double %Power)
|
declare double @llvm.pow.f64(double %Val, double %Power)
|
||||||
|
Loading…
Reference in New Issue
Block a user