summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/Reassociate/fp-commute.ll
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2012-05-07 20:47:23 +0000
committerOwen Anderson <resistor@mac.com>2012-05-07 20:47:23 +0000
commitf4f80e1f39a2da2de2623eb9d176b77bdbcac009 (patch)
treee2b5d9f3556922e72be93d9b05088ca0237b7a6d /llvm/test/Transforms/Reassociate/fp-commute.ll
parent4496c44e5f64bc5ac52ed8d1a77c0a3dfe8b4f6c (diff)
downloadbcm5719-llvm-f4f80e1f39a2da2de2623eb9d176b77bdbcac009.tar.gz
bcm5719-llvm-f4f80e1f39a2da2de2623eb9d176b77bdbcac009.zip
Teach reassociate to commute FMul's and FAdd's in order to canonicalize the order of their operands across instructions. This allows for greater CSE opportunities.
llvm-svn: 156323
Diffstat (limited to 'llvm/test/Transforms/Reassociate/fp-commute.ll')
-rw-r--r--llvm/test/Transforms/Reassociate/fp-commute.ll16
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/test/Transforms/Reassociate/fp-commute.ll b/llvm/test/Transforms/Reassociate/fp-commute.ll
new file mode 100644
index 00000000000..5644f7ca701
--- /dev/null
+++ b/llvm/test/Transforms/Reassociate/fp-commute.ll
@@ -0,0 +1,16 @@
+; RUN: opt -reassociate -S < %s | FileCheck %s
+
+target triple = "armv7-apple-ios"
+
+; CHECK: test
+define float @test(float %x, float %y) {
+entry:
+; CHECK: fmul float %x, %y
+; CHECK: fmul float %x, %y
+ %0 = fmul float %x, %y
+ %1 = fmul float %y, %x
+ %2 = fsub float %0, %1
+ ret float %1
+}
+
+
OpenPOWER on IntegriCloud