diff options
| author | Sanjay Patel <spatel@rotateright.com> | 2019-07-26 19:44:53 +0000 |
|---|---|---|
| committer | Sanjay Patel <spatel@rotateright.com> | 2019-07-26 19:44:53 +0000 |
| commit | 487e95777593e264c26b35377b53c703fd535ef3 (patch) | |
| tree | 9739e3dcb43e74ce7a44702cbbd2555119d7a0d6 | |
| parent | f184ce53a7cba35201e587cbf3a1a75d6a40a722 (diff) | |
| download | bcm5719-llvm-487e95777593e264c26b35377b53c703fd535ef3.tar.gz bcm5719-llvm-487e95777593e264c26b35377b53c703fd535ef3.zip | |
[InstCombine] add tests for fdiv with negated operand; NFC
llvm-svn: 367145
| -rw-r--r-- | llvm/test/Transforms/InstCombine/fdiv.ll | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/fdiv.ll b/llvm/test/Transforms/InstCombine/fdiv.ll index 619554e6253..62ef758d9e3 100644 --- a/llvm/test/Transforms/InstCombine/fdiv.ll +++ b/llvm/test/Transforms/InstCombine/fdiv.ll @@ -499,3 +499,38 @@ define <2 x float> @div_constant_dividend3(<2 x float> %x) { ret <2 x float> %t2 } +define double @fdiv_fneg1(double %x, double %y) { +; CHECK-LABEL: @fdiv_fneg1( +; CHECK-NEXT: [[NEG:%.*]] = fsub double -0.000000e+00, [[X:%.*]] +; CHECK-NEXT: [[DIV:%.*]] = fdiv double [[NEG]], [[Y:%.*]] +; CHECK-NEXT: ret double [[DIV]] +; + %neg = fsub double -0.0, %x + %div = fdiv double %neg, %y + ret double %div +} + +define <2 x float> @fdiv_fneg2(<2 x float> %x, <2 x float> %y) { +; CHECK-LABEL: @fdiv_fneg2( +; CHECK-NEXT: [[NEG:%.*]] = fsub <2 x float> <float -0.000000e+00, float -0.000000e+00>, [[X:%.*]] +; CHECK-NEXT: [[DIV:%.*]] = fdiv <2 x float> [[Y:%.*]], [[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> %y, %neg + ret <2 x float> %div +} + +define float @fdiv_fneg1_extra_use(float %x, float %y) { +; CHECK-LABEL: @fdiv_fneg1_extra_use( +; CHECK-NEXT: [[NEG:%.*]] = fsub float -0.000000e+00, [[X:%.*]] +; CHECK-NEXT: call void @use_f32(float [[NEG]]) +; CHECK-NEXT: [[DIV:%.*]] = fdiv float [[NEG]], [[Y:%.*]] +; CHECK-NEXT: ret float [[DIV]] +; + %neg = fsub float -0.0, %x + call void @use_f32(float %neg) + %div = fdiv float %neg, %y + ret float %div +} + |

