summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorFiona Glaser <escha@apple.com>2015-06-05 17:52:34 +0000
committerFiona Glaser <escha@apple.com>2015-06-05 17:52:34 +0000
commit666e3524407e1978743281f044dff19db3c2668a (patch)
treef470cbb0f714d59e9a08bc494185767a69eda2db /llvm/test
parent4849aa35b776c0bd9591eb9b7a61f5d9748bc9ef (diff)
downloadbcm5719-llvm-666e3524407e1978743281f044dff19db3c2668a.tar.gz
bcm5719-llvm-666e3524407e1978743281f044dff19db3c2668a.zip
DAGCombiner: don't duplicate (fmul x, c) in visitFNEG if fneg is free
For targets with a free fneg, this fold is always a net loss if it ends up duplicating the multiply, so definitely avoid it. This might be true for some targets without a free fneg too, but I'll leave that for future investigation. llvm-svn: 239167
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/CodeGen/R600/fmul.ll16
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/R600/fmul.ll b/llvm/test/CodeGen/R600/fmul.ll
index 68ebc4dedfe..addc409c9eb 100644
--- a/llvm/test/CodeGen/R600/fmul.ll
+++ b/llvm/test/CodeGen/R600/fmul.ll
@@ -73,4 +73,20 @@ define void @test_mul_2_k_inv(float addrspace(1)* %out, float %x) #0 {
ret void
}
+; There should be three multiplies here; %a should be used twice (once
+; negated), not duplicated into mul x, 5.0 and mul x, -5.0.
+; FUNC-LABEL: {{^}}test_mul_twouse:
+; SI: v_mul_f32
+; SI: v_mul_f32
+; SI: v_mul_f32
+; SI-NOT: v_mul_f32
+define void @test_mul_twouse(float addrspace(1)* %out, float %x, float %y) #0 {
+ %a = fmul float %x, 5.0
+ %b = fsub float -0.0, %a
+ %c = fmul float %b, %y
+ %d = fmul float %c, %a
+ store float %d, float addrspace(1)* %out
+ ret void
+}
+
attributes #0 = { "less-precise-fpmad"="true" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "unsafe-fp-math"="true" }
OpenPOWER on IntegriCloud