diff options
Diffstat (limited to 'llvm/test/Transforms/InstCombine/fdiv.ll')
| -rw-r--r-- | llvm/test/Transforms/InstCombine/fdiv.ll | 37 |
1 files changed, 37 insertions, 0 deletions
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 +} + |

