- (A & C1)+(B & C2) -> (A & C1)|(B & C2) iff C1&C2 == 0
- (A & C1)^(B & C2) -> (A & C1)|(B & C2) iff C1&C2 == 0
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5741
91177308-0d34-0410-b5e6-
96231b3b80d8
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
+}
%C = and ubyte %B, 4
ret ubyte %C
}
+
; 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
%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
+}
+