[InstCombine] add tests for 'afn' FMF; NFC

llvm-svn: 318423
This commit is contained in:
Sanjay Patel 2017-11-16 17:06:36 +00:00
parent 13a3cf3b6a
commit cebbfacc9e
1 changed files with 21 additions and 0 deletions

View File

@ -19,6 +19,27 @@ define double @pow_neghalf(double %x) {
ret double %pow
}
define double @pow_half_approx(double %x) {
; CHECK-LABEL: @pow_half_approx(
; CHECK-NEXT: [[SQRT:%.*]] = call double @sqrt(double %x) #1
; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.fabs.f64(double [[SQRT]])
; CHECK-NEXT: [[TMP2:%.*]] = fcmp oeq double %x, 0xFFF0000000000000
; CHECK-NEXT: [[TMP3:%.*]] = select i1 [[TMP2]], double 0x7FF0000000000000, double [[TMP1]]
; CHECK-NEXT: ret double [[TMP3]]
;
%pow = call afn double @llvm.pow.f64(double %x, double 5.000000e-01)
ret double %pow
}
define double @pow_neghalf_approx(double %x) {
; CHECK-LABEL: @pow_neghalf_approx(
; CHECK-NEXT: [[POW:%.*]] = call afn double @llvm.pow.f64(double %x, double -5.000000e-01)
; CHECK-NEXT: ret double [[POW]]
;
%pow = call afn double @llvm.pow.f64(double %x, double -5.000000e-01)
ret double %pow
}
declare double @llvm.pow.f64(double, double) #0
attributes #0 = { nounwind readnone speculatable }