1 ; This test makes sure that these instructions are properly eliminated.
4 ; RUN: as < %s | opt -instcombine | dis | grep -v '%OROK = or' | not grep 'or '
18 ubyte %test2a(ubyte %A) {
23 bool %test3(bool %A) {
24 %B = or bool %A, false
28 bool %test4(bool %A) {
33 bool %test5(bool %A) {
34 %B = xor bool %A, false
43 bool %test7(bool %A) {
53 bool %test9(bool %A) {
63 int %test11(int %A) { ; A ^ ~A == -1
64 %NotA = xor int -1, %A
65 %B = xor int %A, %NotA
69 int %test12(int %A) { ; A | ~A == -1
70 %NotA = xor int -1, %A
75 uint %test13(uint %A) { ; (A|B)^B == A & (~B)
77 %r = xor uint %t1, 123
81 ubyte %test14(ubyte %A) {
86 ubyte %test15(ubyte %A) {
92 int %test16(int %A, int %B) { ; (A & C1)^(B & C2) -> (A & C1)|(B & C2) iff C1&C2 == 0
95 %OROK = xor int %A1, %B1
99 ubyte %test17(ubyte %A, ubyte %B) { ; Test that (A|c1)|(B|c2) == (A|B)|(c1|c2)
101 %D = or ubyte %B, 254
106 ubyte %test18(bool %c) {
107 %d = xor bool %c, true ; invert the condition
108 br bool %d, label %True, label %False
115 bool %test19(ubyte %A) {
116 %B = xor ubyte %A, 123 ; xor can be eliminated
117 %C = seteq ubyte %B, 34
121 ubyte %test21(ubyte %A) {
123 %C = and ubyte %B, 254
124 %D = or ubyte %C, 254 ; (X & C1) | C2 --> (X | C2) & (C1|C2)
128 ubyte %test22(ubyte %A) {
129 %B = or ubyte %A, 254
130 %C = xor ubyte %B, 13
131 %D = or ubyte %C, 1 ; (X ^ C1) | C2 --> (X | C2) ^ (C1&~C2)
132 %E = xor ubyte %D, 12
136 uint %test23(uint %A) {
137 %B = or uint %A, 4 ; Should be eliminated
142 uint %test24(uint %A) {
144 %C = and uint %B, 8 ; Always equal to 8