diff options
| author | Sanjay Patel <spatel@rotateright.com> | 2018-02-19 21:13:39 +0000 |
|---|---|---|
| committer | Sanjay Patel <spatel@rotateright.com> | 2018-02-19 21:13:39 +0000 |
| commit | e82cc6fcc5f763445fd8416b7f4786f226cc4420 (patch) | |
| tree | 37f6e35ee1924d7898619ea032d27eec95662a8c /llvm | |
| parent | 58434db0980466ae4f9403b9e165144d1da094d4 (diff) | |
| download | bcm5719-llvm-e82cc6fcc5f763445fd8416b7f4786f226cc4420.tar.gz bcm5719-llvm-e82cc6fcc5f763445fd8416b7f4786f226cc4420.zip | |
[InstCombine] move fdiv tests; NFC
Also, use vector constants just to prove that already works.
llvm-svn: 325530
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/test/Transforms/InstCombine/fast-math.ll | 33 | ||||
| -rw-r--r-- | llvm/test/Transforms/InstCombine/fdiv.ll | 37 |
2 files changed, 37 insertions, 33 deletions
diff --git a/llvm/test/Transforms/InstCombine/fast-math.ll b/llvm/test/Transforms/InstCombine/fast-math.ll index 0037317dfb6..4a0244561e0 100644 --- a/llvm/test/Transforms/InstCombine/fast-math.ll +++ b/llvm/test/Transforms/InstCombine/fast-math.ll @@ -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 diff --git a/llvm/test/Transforms/InstCombine/fdiv.ll b/llvm/test/Transforms/InstCombine/fdiv.ll index 6b41168044a..b632899f002 100644 --- a/llvm/test/Transforms/InstCombine/fdiv.ll +++ b/llvm/test/Transforms/InstCombine/fdiv.ll @@ -233,3 +233,40 @@ define <2 x float> @div_factor_commute(<2 x float> %x, <2 x float> %y) { 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 +} + |

