Skip to content

Commit

Permalink
[InstCombine] add tests for 'afn' FMF; NFC
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318423 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
rotateright committed Nov 16, 2017
1 parent dbaffd4 commit da65f7f
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/Transforms/InstCombine/pow-sqrt.ll
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down

0 comments on commit da65f7f

Please sign in to comment.