aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/Transforms/InstCombine/add.ll12
-rw-r--r--test/Transforms/InstCombine/sub.ll12
2 files changed, 24 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/add.ll b/test/Transforms/InstCombine/add.ll
index 70bb85a6c8..19fa6261cd 100644
--- a/test/Transforms/InstCombine/add.ll
+++ b/test/Transforms/InstCombine/add.ll
@@ -39,3 +39,15 @@ int %test5(int %A, int %B) {
ret int %D
}
+int %test6(int %A) {
+ %B = mul int 7, %A
+ %C = add int %B, %A ; C = 7*A+A == 8*A == A << 3
+ ret int %C
+}
+
+int %test7(int %A) {
+ %B = mul int 7, %A
+ %C = add int %A, %B ; C = A+7*A == 8*A == A << 3
+ ret int %C
+}
+
diff --git a/test/Transforms/InstCombine/sub.ll b/test/Transforms/InstCombine/sub.ll
index 8b164cb51e..0dd2b7d930 100644
--- a/test/Transforms/InstCombine/sub.ll
+++ b/test/Transforms/InstCombine/sub.ll
@@ -47,3 +47,15 @@ int %test7(int %A) {
ret int %B
}
+int %test8(int %A) {
+ %B = mul int 9, %A
+ %C = sub int %B, %A ; C = 9*A-A == A*8 == A << 3
+ ret int %C
+}
+
+int %test9(int %A) {
+ %B = mul int 3, %A
+ %C = sub int %A, %B ; C = A-3*A == A*-2
+ ret int %C
+}
+