diff options
| author | Sanjay Patel <spatel@rotateright.com> | 2018-02-20 23:34:43 +0000 |
|---|---|---|
| committer | Sanjay Patel <spatel@rotateright.com> | 2018-02-20 23:34:43 +0000 |
| commit | 83573718611b7765722ee92b6bfda7313a918285 (patch) | |
| tree | 5962220b18b4b953edeeed4adedc8c6fce35decf /llvm/test/Transforms | |
| parent | 5c1237a1fd94243b7cf7bcd7cb85619977ceaf03 (diff) | |
| download | bcm5719-llvm-83573718611b7765722ee92b6bfda7313a918285.tar.gz bcm5719-llvm-83573718611b7765722ee92b6bfda7313a918285.zip | |
[InstCombine] add tests for fdiv with negated op and constant op; NFC
llvm-svn: 325644
Diffstat (limited to 'llvm/test/Transforms')
| -rw-r--r-- | llvm/test/Transforms/InstCombine/fdiv.ll | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/fdiv.ll b/llvm/test/Transforms/InstCombine/fdiv.ll index 02eb046d8ab..506deaa3a0f 100644 --- a/llvm/test/Transforms/InstCombine/fdiv.ll +++ b/llvm/test/Transforms/InstCombine/fdiv.ll @@ -213,6 +213,50 @@ define <2 x float> @fneg_fneg_vec(<2 x float> %x, <2 x float> %y) { ret <2 x float> %div } +define float @fneg_dividend_constant_divisor(float %x) { +; CHECK-LABEL: @fneg_dividend_constant_divisor( +; CHECK-NEXT: [[NEG:%.*]] = fsub float -0.000000e+00, [[X:%.*]] +; CHECK-NEXT: [[DIV:%.*]] = fdiv float [[NEG]], 3.000000e+00 +; CHECK-NEXT: ret float [[DIV]] +; + %neg = fsub float -0.0, %x + %div = fdiv float %neg, 3.0 + ret float %div +} + +define float @fneg_divisor_constant_dividend(float %x) { +; CHECK-LABEL: @fneg_divisor_constant_dividend( +; CHECK-NEXT: [[NEG:%.*]] = fsub float -0.000000e+00, [[X:%.*]] +; CHECK-NEXT: [[DIV:%.*]] = fdiv float -3.000000e+00, [[NEG]] +; CHECK-NEXT: ret float [[DIV]] +; + %neg = fsub float -0.0, %x + %div = fdiv float -3.0, %neg + ret float %div +} + +define <2 x float> @fneg_dividend_constant_divisor_vec(<2 x float> %x) { +; CHECK-LABEL: @fneg_dividend_constant_divisor_vec( +; CHECK-NEXT: [[NEG:%.*]] = fsub <2 x float> <float -0.000000e+00, float -0.000000e+00>, [[X:%.*]] +; CHECK-NEXT: [[DIV:%.*]] = fdiv <2 x float> [[NEG]], <float 3.000000e+00, float -8.000000e+00> +; CHECK-NEXT: ret <2 x float> [[DIV]] +; + %neg = fsub <2 x float> <float -0.0, float -0.0>, %x + %div = fdiv <2 x float> %neg, <float 3.0, float -8.0> + ret <2 x float> %div +} + +define <2 x float> @fneg_divisor_constant_dividend_vec(<2 x float> %x) { +; CHECK-LABEL: @fneg_divisor_constant_dividend_vec( +; CHECK-NEXT: [[NEG:%.*]] = fsub <2 x float> <float -0.000000e+00, float -0.000000e+00>, [[X:%.*]] +; CHECK-NEXT: [[DIV:%.*]] = fdiv <2 x float> <float -3.000000e+00, float 5.000000e+00>, [[NEG]] +; CHECK-NEXT: ret <2 x float> [[DIV]] +; + %neg = fsub <2 x float> <float -0.0, float -0.0>, %x + %div = fdiv <2 x float> <float -3.0, float 5.0>, %neg + ret <2 x float> %div +} + ; X / (X * Y) --> 1.0 / Y define float @div_factor(float %x, float %y) { |

