diff options
| author | Sanjay Patel <spatel@rotateright.com> | 2018-02-20 23:51:16 +0000 |
|---|---|---|
| committer | Sanjay Patel <spatel@rotateright.com> | 2018-02-20 23:51:16 +0000 |
| commit | d8dd0151fc12fbbb3f15f71174452c81001a902c (patch) | |
| tree | 2d3c6877ff9f208307efa09b672016b7111747b9 /llvm/test/Transforms | |
| parent | cd8758233ebacf36b373481a1dc1e025ee487a39 (diff) | |
| download | bcm5719-llvm-d8dd0151fc12fbbb3f15f71174452c81001a902c.tar.gz bcm5719-llvm-d8dd0151fc12fbbb3f15f71174452c81001a902c.zip | |
[InstCombine] -X / C --> X / -C for FP
We already do this in DAGCombiner, but it should
also be good to eliminate the fsub use in IR.
llvm-svn: 325648
Diffstat (limited to 'llvm/test/Transforms')
| -rw-r--r-- | llvm/test/Transforms/InstCombine/fdiv.ll | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/llvm/test/Transforms/InstCombine/fdiv.ll b/llvm/test/Transforms/InstCombine/fdiv.ll index 506deaa3a0f..a70907eb85a 100644 --- a/llvm/test/Transforms/InstCombine/fdiv.ll +++ b/llvm/test/Transforms/InstCombine/fdiv.ll @@ -215,45 +215,43 @@ define <2 x float> @fneg_fneg_vec(<2 x float> %x, <2 x float> %y) { 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: [[DIV:%.*]] = fdiv nsz float [[X:%.*]], -3.000000e+00 ; CHECK-NEXT: ret float [[DIV]] ; %neg = fsub float -0.0, %x - %div = fdiv float %neg, 3.0 + %div = fdiv nsz 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: [[DIV:%.*]] = fdiv nnan float -3.000000e+00, [[NEG]] ; CHECK-NEXT: ret float [[DIV]] ; %neg = fsub float -0.0, %x - %div = fdiv float -3.0, %neg + %div = fdiv nnan 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: [[DIV:%.*]] = fdiv ninf <2 x float> [[X:%.*]], <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> + %div = fdiv ninf <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: [[DIV:%.*]] = fdiv afn <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 + %div = fdiv afn <2 x float> <float -3.0, float 5.0>, %neg ret <2 x float> %div } |

