aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/Transforms/InstCombine/add.ll6
-rw-r--r--test/Transforms/InstCombine/and.ll1
-rw-r--r--test/Transforms/InstCombine/or.ll10
3 files changed, 16 insertions, 1 deletions
diff --git a/test/Transforms/InstCombine/add.ll b/test/Transforms/InstCombine/add.ll
index 19fa6261cd..4043a7f9c3 100644
--- a/test/Transforms/InstCombine/add.ll
+++ b/test/Transforms/InstCombine/add.ll
@@ -51,3 +51,9 @@ int %test7(int %A) {
ret int %C
}
+int %test8(int %A, int %B) { ; (A & C1)+(B & C2) -> (A & C1)|(B & C2) iff C1&C2 == 0
+ %A1 = and int %A, 7
+ %B1 = and int %B, 128
+ %C = add int %A1, %B1
+ ret int %C
+}
diff --git a/test/Transforms/InstCombine/and.ll b/test/Transforms/InstCombine/and.ll
index 03b67f57b6..269b33c285 100644
--- a/test/Transforms/InstCombine/and.ll
+++ b/test/Transforms/InstCombine/and.ll
@@ -49,3 +49,4 @@ ubyte %test8(ubyte %A) { ; AND associates
%C = and ubyte %B, 4
ret ubyte %C
}
+
diff --git a/test/Transforms/InstCombine/or.ll b/test/Transforms/InstCombine/or.ll
index 7ffd3461bc..ec28e20ad3 100644
--- a/test/Transforms/InstCombine/or.ll
+++ b/test/Transforms/InstCombine/or.ll
@@ -1,7 +1,7 @@
; This test makes sure that these instructions are properly eliminated.
;
-; RUN: if as < %s | opt -instcombine | dis | grep or\
+; RUN: if as < %s | opt -instcombine | dis | grep -v '%OROK = or' | grep or\
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
@@ -91,3 +91,11 @@ ubyte %test15(ubyte %A) {
%C = xor ubyte %B, 17
ret ubyte %C
}
+
+int %test16(int %A, int %B) { ; (A & C1)^(B & C2) -> (A & C1)|(B & C2) iff C1&C2 == 0
+ %A1 = and int %A, 7
+ %B1 = and int %B, 128
+ %OROK = xor int %A1, %B1
+ ret int %OROK
+}
+