[llvm] r325530 - [InstCombine] move fdiv tests; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 19 13:13:40 PST 2018


Author: spatel
Date: Mon Feb 19 13:13:39 2018
New Revision: 325530

URL: http://llvm.org/viewvc/llvm-project?rev=325530&view=rev
Log:
[InstCombine] move fdiv tests; NFC

Also, use vector constants just to prove that already works.

Modified:
    llvm/trunk/test/Transforms/InstCombine/fast-math.ll
    llvm/trunk/test/Transforms/InstCombine/fdiv.ll

Modified: llvm/trunk/test/Transforms/InstCombine/fast-math.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/fast-math.ll?rev=325530&r1=325529&r2=325530&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/fast-math.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/fast-math.ll Mon Feb 19 13:13:39 2018
@@ -477,39 +477,6 @@ define float @fdiv4(float %x) {
   ret float %div
 }
 
-; C1/(X*C2) => (C1/C2) / X
-define float @fdiv7(float %x) {
-; CHECK-LABEL: @fdiv7(
-; CHECK-NEXT:    [[T2:%.*]] = fdiv fast float 5.000000e+00, [[X:%.*]]
-; CHECK-NEXT:    ret float [[T2]]
-;
-  %t1 = fmul float %x, 3.0e0
-  %t2 = fdiv fast float 15.0e0, %t1
-  ret float %t2
-}
-
-; C1/(X/C2) => (C1*C2) / X
-define float @fdiv8(float %x) {
-; CHECK-LABEL: @fdiv8(
-; CHECK-NEXT:    [[T2:%.*]] = fdiv fast float 4.500000e+01, [[X:%.*]]
-; CHECK-NEXT:    ret float [[T2]]
-;
-  %t1 = fdiv float %x, 3.0e0
-  %t2 = fdiv fast float 15.0e0, %t1
-  ret float %t2
-}
-
-; C1/(C2/X) => (C1/C2) * X
-define float @fdiv9(float %x) {
-; CHECK-LABEL: @fdiv9(
-; CHECK-NEXT:    [[T2:%.*]] = fmul fast float [[X:%.*]], 5.000000e+00
-; CHECK-NEXT:    ret float [[T2]]
-;
-  %t1 = fdiv float 3.0e0, %x
-  %t2 = fdiv fast float 15.0e0, %t1
-  ret float %t2
-}
-
 ; =========================================================================
 ;
 ;   Testing-cases about factorization

Modified: llvm/trunk/test/Transforms/InstCombine/fdiv.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/fdiv.ll?rev=325530&r1=325529&r2=325530&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/fdiv.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/fdiv.ll Mon Feb 19 13:13:39 2018
@@ -233,3 +233,40 @@ define <2 x float> @div_factor_commute(<
   ret <2 x float> %d
 }
 
+; C1/(X*C2) => (C1/C2) / X
+
+define <2 x float> @div_constant_dividend1(<2 x float> %x) {
+; CHECK-LABEL: @div_constant_dividend1(
+; CHECK-NEXT:    [[T2:%.*]] = fdiv fast <2 x float> <float 5.000000e+00, float 1.000000e+00>, [[X:%.*]]
+; CHECK-NEXT:    ret <2 x float> [[T2]]
+;
+  %t1 = fmul <2 x float> %x, <float 3.0e0, float 7.0e0>
+  %t2 = fdiv fast <2 x float> <float 15.0e0, float 7.0e0>, %t1
+  ret <2 x float> %t2
+}
+
+; C1/(X/C2) => (C1*C2) / X
+
+define <2 x float> @div_constant_dividend2(<2 x float> %x) {
+; CHECK-LABEL: @div_constant_dividend2(
+; CHECK-NEXT:    [[T2:%.*]] = fdiv fast <2 x float> <float 4.500000e+01, float 4.900000e+01>, [[X:%.*]]
+; CHECK-NEXT:    ret <2 x float> [[T2]]
+;
+  %t1 = fdiv <2 x float> %x, <float 3.0e0, float -7.0e0>
+  %t2 = fdiv fast <2 x float> <float 15.0e0, float -7.0e0>, %t1
+  ret <2 x float> %t2
+}
+
+; C1/(C2/X) => (C1/C2) * X
+; This tests the combination of 2 folds: (C1 * X) / C2 --> (C1 / C2) * X
+
+define <2 x float> @div_constant_dividend3(<2 x float> %x) {
+; CHECK-LABEL: @div_constant_dividend3(
+; CHECK-NEXT:    [[T2:%.*]] = fmul fast <2 x float> [[X:%.*]], <float 5.000000e+00, float -1.000000e+00>
+; CHECK-NEXT:    ret <2 x float> [[T2]]
+;
+  %t1 = fdiv <2 x float> <float 3.0e0, float 7.0e0>, %x
+  %t2 = fdiv fast <2 x float> <float 15.0e0, float -7.0e0>, %t1
+  ret <2 x float> %t2
+}
+




More information about the llvm-commits mailing list