1 ; This test makes sure that these instructions are properly eliminated.
4 ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep -v xor | 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) {
43 int %test7(int %A) { ; A | ~A == -1
44 %NotA = xor int -1, %A
49 ubyte %test8(ubyte %A) {
55 ubyte %test9(ubyte %A, ubyte %B) { ; Test that (A|c1)|(B|c2) == (A|B)|(c1|c2)
62 ubyte %test10(ubyte %A) {
64 %C = and ubyte %B, 254
65 %D = or ubyte %C, 254 ; (X & C1) | C2 --> (X | C2) & (C1|C2)
69 ubyte %test11(ubyte %A) {
72 %D = or ubyte %C, 1 ; (X ^ C1) | C2 --> (X | C2) ^ (C1&~C2)
77 uint %test12(uint %A) {
78 %B = or uint %A, 4 ; Should be eliminated
83 uint %test13(uint %A) {
85 %C = and uint %B, 8 ; Always equal to 8
89 bool %test14(uint %A, uint %B) {
90 %C1 = setlt uint %A, %B
91 %C2 = setgt uint %A, %B
92 %D = or bool %C1, %C2 ; (A < B) | (A > B) === A != B
96 bool %test15(uint %A, uint %B) {
97 %C1 = setlt uint %A, %B
98 %C2 = seteq uint %A, %B
99 %D = or bool %C1, %C2 ; (A < B) | (A == B) === A <= B
103 int %test16(int %A) {
105 %C = and int %A, -2 ; -2 = ~1
106 %D = or int %B, %C ; %D = and int %B, -1 == %B
110 int %test17(int %A) {
113 %D = or int %B, %C ; %D = and int %B, 5