[llvm] r318423 - [InstCombine] add tests for 'afn' FMF; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 16 09:06:36 PST 2017


Author: spatel
Date: Thu Nov 16 09:06:36 2017
New Revision: 318423

URL: http://llvm.org/viewvc/llvm-project?rev=318423&view=rev
Log:
[InstCombine] add tests for 'afn' FMF; NFC

Modified:
    llvm/trunk/test/Transforms/InstCombine/pow-sqrt.ll

Modified: llvm/trunk/test/Transforms/InstCombine/pow-sqrt.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/pow-sqrt.ll?rev=318423&r1=318422&r2=318423&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/pow-sqrt.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/pow-sqrt.ll Thu Nov 16 09:06:36 2017
@@ -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 }




More information about the llvm-commits mailing list