aboutsummaryrefslogtreecommitdiff
path: root/test/Transforms/Reassociate/mul_neg.ll
diff options
context:
space:
mode:
Diffstat (limited to 'test/Transforms/Reassociate/mul_neg.ll')
-rw-r--r--test/Transforms/Reassociate/mul_neg.ll13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/Transforms/Reassociate/mul_neg.ll b/test/Transforms/Reassociate/mul_neg.ll
new file mode 100644
index 0000000000..e8765ffaa4
--- /dev/null
+++ b/test/Transforms/Reassociate/mul_neg.ll
@@ -0,0 +1,13 @@
+; RUN: opt -S -reassociate < %s | FileCheck %s
+
+; t=-a; retval = t*7|t => t-a; retval => a*-7|t
+define i32 @mulneg(i32 %a) nounwind uwtable ssp {
+entry:
+ %sub = sub nsw i32 0, %a
+ %tmp1 = mul i32 %sub, 7
+ %tmp2 = xor i32 %sub, %tmp1
+ ret i32 %tmp2
+; CHECK: entry
+; CHECK: %tmp1 = mul i32 %a, -7
+; CHECK: ret
+}