summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2018-06-13 15:01:07 +0000
committerSanjay Patel <spatel@rotateright.com>2018-06-13 15:01:07 +0000
commit9f3f18d6f6257621083032c1e74ed089ffb1e6b3 (patch)
tree7d376c70893e7824ad39df8a25c0f6b6ede5af82 /llvm
parent0d78a90a7dac97c1b15f9ae4fbcc887accf6b422 (diff)
downloadbcm5719-llvm-9f3f18d6f6257621083032c1e74ed089ffb1e6b3.tar.gz
bcm5719-llvm-9f3f18d6f6257621083032c1e74ed089ffb1e6b3.zip
[x86] add test for fadd with more than one use; NFC
The equivalent AArch64 test added at rL334556 isn't showing the expected output from the DAGCombiner code change that would fix this example. That's a machine combiner bug from what I see. llvm-svn: 334605
Diffstat (limited to 'llvm')
-rw-r--r--llvm/test/CodeGen/X86/fadd-combines.ll19
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/fadd-combines.ll b/llvm/test/CodeGen/X86/fadd-combines.ll
index ce7ee94e0fb..1f9740da49d 100644
--- a/llvm/test/CodeGen/X86/fadd-combines.ll
+++ b/llvm/test/CodeGen/X86/fadd-combines.ll
@@ -221,4 +221,23 @@ define <4 x float> @fadd_fadd_x_x_fadd_x_x_4f32(<4 x float> %x) #0 {
ret <4 x float> %z
}
+; FIXME:
+; ((x + 42.0) + 17.0) + (x + 42.0) --> (x + 59.0) + (x + 17.0)
+; It's still 3 adds, but the first two are independent.
+; More reassocation could get this to 2 adds or 1 FMA (that's done in IR, but not in the DAG).
+
+define float @fadd_const_multiuse_attr(float %x) #0 {
+; CHECK-LABEL: fadd_const_multiuse_attr:
+; CHECK: # %bb.0:
+; CHECK-NEXT: addss {{.*}}(%rip), %xmm0
+; CHECK-NEXT: movss {{.*#+}} xmm1 = mem[0],zero,zero,zero
+; CHECK-NEXT: addss %xmm0, %xmm1
+; CHECK-NEXT: addss %xmm1, %xmm0
+; CHECK-NEXT: retq
+ %a1 = fadd float %x, 42.0
+ %a2 = fadd float %a1, 17.0
+ %a3 = fadd float %a1, %a2
+ ret float %a3
+}
+
attributes #0 = { "less-precise-fpmad"="true" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "unsafe-fp-math"="true" "no-signed-zeros-fp-math"="true" }
OpenPOWER on IntegriCloud