1 ; This test makes sure that these instructions are properly eliminated.
3 ; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
4 ; RUN: grep -v xor | not grep {or }
19 ubyte %test2a(ubyte %A) {
24 bool %test3(bool %A) {
25 %B = or bool %A, false
29 bool %test4(bool %A) {
34 bool %test5(bool %A) {
44 int %test7(int %A) { ; A | ~A == -1
45 %NotA = xor int -1, %A
50 ubyte %test8(ubyte %A) {
56 ubyte %test9(ubyte %A, ubyte %B) { ; Test that (A|c1)|(B|c2) == (A|B)|(c1|c2)
63 ubyte %test10(ubyte %A) {
65 %C = and ubyte %B, 254
66 %D = or ubyte %C, 254 ; (X & C1) | C2 --> (X | C2) & (C1|C2)
70 ubyte %test11(ubyte %A) {
73 %D = or ubyte %C, 1 ; (X ^ C1) | C2 --> (X | C2) ^ (C1&~C2)
78 uint %test12(uint %A) {
79 %B = or uint %A, 4 ; Should be eliminated
84 uint %test13(uint %A) {
86 %C = and uint %B, 8 ; Always equal to 8
90 bool %test14(uint %A, uint %B) {
91 %C1 = setlt uint %A, %B
92 %C2 = setgt uint %A, %B
93 %D = or bool %C1, %C2 ; (A < B) | (A > B) === A != B
97 bool %test15(uint %A, uint %B) {
98 %C1 = setlt uint %A, %B
99 %C2 = seteq uint %A, %B
100 %D = or bool %C1, %C2 ; (A < B) | (A == B) === A <= B
104 int %test16(int %A) {
106 %C = and int %A, -2 ; -2 = ~1
107 %D = or int %B, %C ; %D = and int %B, -1 == %B
111 int %test17(int %A) {
114 %D = or int %B, %C ; %D = and int %B, 5
118 bool %test18(int %A) {
119 %B = setge int %A, 100
120 %C = setlt int %A, 50
121 %D = or bool %B, %C ;; (A-50) >u 50
125 bool %test19(int %A) {
126 %B = seteq int %A, 50
127 %C = seteq int %A, 51
128 %D = or bool %B, %C ;; (A-50) < 2
132 int %test20(int %x) {
138 uint %test21(uint %tmp.1) {
139 %tmp.1.mask1 = add uint %tmp.1, 2
140 %tmp.3 = and uint %tmp.1.mask1, 4294967294
141 %tmp.5 = and uint %tmp.1, 1
142 %tmp.6 = or uint %tmp.5, %tmp.3 ;; add tmp.1, 2
146 int %test22(int %B) {
147 %ELIM41 = and int %B, 1 ; <int> [#uses=1]
148 %ELIM7 = and int %B, -2 ; <int> [#uses=1]
149 %ELIM5 = or int %ELIM41, %ELIM7 ; <int> [#uses=1]
153 ushort %test23(ushort %A) {
154 %B = shr ushort %A, ubyte 1
155 %C = or ushort %B, 32768 ;; fold or into xor
156 %D = xor ushort %C, 8193