1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -instcombine -S | FileCheck %s
4 target datalayout = "n8:16:32:64"
7 declare void @use_vec(<2 x i8>)
9 define i32 @select_icmp_eq_and_1_0_or_2(i32 %x, i32 %y) {
10 ; CHECK-LABEL: @select_icmp_eq_and_1_0_or_2(
11 ; CHECK-NEXT: [[AND:%.*]] = shl i32 [[X:%.*]], 1
12 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[AND]], 2
13 ; CHECK-NEXT: [[TMP2:%.*]] = or i32 [[TMP1]], [[Y:%.*]]
14 ; CHECK-NEXT: ret i32 [[TMP2]]
17 %cmp = icmp eq i32 %and, 0
19 %select = select i1 %cmp, i32 %y, i32 %or
23 define <2 x i32> @select_icmp_eq_and_1_0_or_2_vec(<2 x i32> %x, <2 x i32> %y) {
24 ; CHECK-LABEL: @select_icmp_eq_and_1_0_or_2_vec(
25 ; CHECK-NEXT: [[AND:%.*]] = shl <2 x i32> [[X:%.*]], <i32 1, i32 1>
26 ; CHECK-NEXT: [[TMP1:%.*]] = and <2 x i32> [[AND]], <i32 2, i32 2>
27 ; CHECK-NEXT: [[TMP2:%.*]] = or <2 x i32> [[TMP1]], [[Y:%.*]]
28 ; CHECK-NEXT: ret <2 x i32> [[TMP2]]
30 %and = and <2 x i32> %x, <i32 1, i32 1>
31 %cmp = icmp eq <2 x i32> %and, zeroinitializer
32 %or = or <2 x i32> %y, <i32 2, i32 2>
33 %select = select <2 x i1> %cmp, <2 x i32> %y, <2 x i32> %or
37 define i32 @select_icmp_eq_and_1_0_xor_2(i32 %x, i32 %y) {
38 ; CHECK-LABEL: @select_icmp_eq_and_1_0_xor_2(
39 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 1
40 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[AND]], 0
41 ; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[Y:%.*]], 2
42 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP]], i32 [[Y]], i32 [[XOR]]
43 ; CHECK-NEXT: ret i32 [[SELECT]]
46 %cmp = icmp eq i32 %and, 0
48 %select = select i1 %cmp, i32 %y, i32 %xor
52 define i32 @select_icmp_eq_and_1_0_and_not_2(i32 %x, i32 %y) {
53 ; CHECK-LABEL: @select_icmp_eq_and_1_0_and_not_2(
54 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 1
55 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[AND]], 0
56 ; CHECK-NEXT: [[AND2:%.*]] = and i32 [[Y:%.*]], -3
57 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP]], i32 [[Y]], i32 [[AND2]]
58 ; CHECK-NEXT: ret i32 [[SELECT]]
61 %cmp = icmp eq i32 %and, 0
62 %and2 = and i32 %y, -3
63 %select = select i1 %cmp, i32 %y, i32 %and2
67 define i32 @select_icmp_eq_and_32_0_or_8(i32 %x, i32 %y) {
68 ; CHECK-LABEL: @select_icmp_eq_and_32_0_or_8(
69 ; CHECK-NEXT: [[AND:%.*]] = lshr i32 [[X:%.*]], 2
70 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[AND]], 8
71 ; CHECK-NEXT: [[TMP2:%.*]] = or i32 [[TMP1]], [[Y:%.*]]
72 ; CHECK-NEXT: ret i32 [[TMP2]]
75 %cmp = icmp eq i32 %and, 0
77 %select = select i1 %cmp, i32 %y, i32 %or
81 define <2 x i32> @select_icmp_eq_and_32_0_or_8_vec(<2 x i32> %x, <2 x i32> %y) {
82 ; CHECK-LABEL: @select_icmp_eq_and_32_0_or_8_vec(
83 ; CHECK-NEXT: [[AND:%.*]] = lshr <2 x i32> [[X:%.*]], <i32 2, i32 2>
84 ; CHECK-NEXT: [[TMP1:%.*]] = and <2 x i32> [[AND]], <i32 8, i32 8>
85 ; CHECK-NEXT: [[TMP2:%.*]] = or <2 x i32> [[TMP1]], [[Y:%.*]]
86 ; CHECK-NEXT: ret <2 x i32> [[TMP2]]
88 %and = and <2 x i32> %x, <i32 32, i32 32>
89 %cmp = icmp eq <2 x i32> %and, zeroinitializer
90 %or = or <2 x i32> %y, <i32 8, i32 8>
91 %select = select <2 x i1> %cmp, <2 x i32> %y, <2 x i32> %or
95 define i32 @select_icmp_eq_and_32_0_xor_8(i32 %x, i32 %y) {
96 ; CHECK-LABEL: @select_icmp_eq_and_32_0_xor_8(
97 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 32
98 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[AND]], 0
99 ; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[Y:%.*]], 8
100 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP]], i32 [[Y]], i32 [[XOR]]
101 ; CHECK-NEXT: ret i32 [[SELECT]]
103 %and = and i32 %x, 32
104 %cmp = icmp eq i32 %and, 0
106 %select = select i1 %cmp, i32 %y, i32 %xor
110 define i32 @select_icmp_eq_and_32_0_and_not_8(i32 %x, i32 %y) {
111 ; CHECK-LABEL: @select_icmp_eq_and_32_0_and_not_8(
112 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 32
113 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[AND]], 0
114 ; CHECK-NEXT: [[AND2:%.*]] = and i32 [[Y:%.*]], -9
115 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP]], i32 [[Y]], i32 [[AND2]]
116 ; CHECK-NEXT: ret i32 [[SELECT]]
118 %and = and i32 %x, 32
119 %cmp = icmp eq i32 %and, 0
120 %and2 = and i32 %y, -9
121 %select = select i1 %cmp, i32 %y, i32 %and2
125 define i32 @select_icmp_ne_0_and_4096_or_4096(i32 %x, i32 %y) {
126 ; CHECK-LABEL: @select_icmp_ne_0_and_4096_or_4096(
127 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 4096
128 ; CHECK-NEXT: [[TMP1:%.*]] = xor i32 [[AND]], 4096
129 ; CHECK-NEXT: [[TMP2:%.*]] = or i32 [[TMP1]], [[Y:%.*]]
130 ; CHECK-NEXT: ret i32 [[TMP2]]
132 %and = and i32 %x, 4096
133 %cmp = icmp ne i32 0, %and
134 %or = or i32 %y, 4096
135 %select = select i1 %cmp, i32 %y, i32 %or
139 define <2 x i32> @select_icmp_ne_0_and_4096_or_4096_vec(<2 x i32> %x, <2 x i32> %y) {
140 ; CHECK-LABEL: @select_icmp_ne_0_and_4096_or_4096_vec(
141 ; CHECK-NEXT: [[AND:%.*]] = and <2 x i32> [[X:%.*]], <i32 4096, i32 4096>
142 ; CHECK-NEXT: [[TMP1:%.*]] = xor <2 x i32> [[AND]], <i32 4096, i32 4096>
143 ; CHECK-NEXT: [[TMP2:%.*]] = or <2 x i32> [[TMP1]], [[Y:%.*]]
144 ; CHECK-NEXT: ret <2 x i32> [[TMP2]]
146 %and = and <2 x i32> %x, <i32 4096, i32 4096>
147 %cmp = icmp ne <2 x i32> zeroinitializer, %and
148 %or = or <2 x i32> %y, <i32 4096, i32 4096>
149 %select = select <2 x i1> %cmp, <2 x i32> %y, <2 x i32> %or
150 ret <2 x i32> %select
153 define i32 @select_icmp_ne_0_and_4096_xor_4096(i32 %x, i32 %y) {
154 ; CHECK-LABEL: @select_icmp_ne_0_and_4096_xor_4096(
155 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 4096
156 ; CHECK-NEXT: [[CMP_NOT:%.*]] = icmp eq i32 [[AND]], 0
157 ; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[Y:%.*]], 4096
158 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP_NOT]], i32 [[XOR]], i32 [[Y]]
159 ; CHECK-NEXT: ret i32 [[SELECT]]
161 %and = and i32 %x, 4096
162 %cmp = icmp ne i32 0, %and
163 %xor = xor i32 %y, 4096
164 %select = select i1 %cmp, i32 %y, i32 %xor
168 define i32 @select_icmp_ne_0_and_4096_and_not_4096(i32 %x, i32 %y) {
169 ; CHECK-LABEL: @select_icmp_ne_0_and_4096_and_not_4096(
170 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 4096
171 ; CHECK-NEXT: [[CMP_NOT:%.*]] = icmp eq i32 [[AND]], 0
172 ; CHECK-NEXT: [[AND2:%.*]] = and i32 [[Y:%.*]], -4097
173 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP_NOT]], i32 [[AND2]], i32 [[Y]]
174 ; CHECK-NEXT: ret i32 [[SELECT]]
176 %and = and i32 %x, 4096
177 %cmp = icmp ne i32 0, %and
178 %and2 = and i32 %y, -4097
179 %select = select i1 %cmp, i32 %y, i32 %and2
183 define i32 @select_icmp_eq_and_4096_0_or_4096(i32 %x, i32 %y) {
184 ; CHECK-LABEL: @select_icmp_eq_and_4096_0_or_4096(
185 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 4096
186 ; CHECK-NEXT: [[TMP1:%.*]] = or i32 [[AND]], [[Y:%.*]]
187 ; CHECK-NEXT: ret i32 [[TMP1]]
189 %and = and i32 %x, 4096
190 %cmp = icmp eq i32 %and, 0
191 %or = or i32 %y, 4096
192 %select = select i1 %cmp, i32 %y, i32 %or
196 define <2 x i32> @select_icmp_eq_and_4096_0_or_4096_vec(<2 x i32> %x, <2 x i32> %y) {
197 ; CHECK-LABEL: @select_icmp_eq_and_4096_0_or_4096_vec(
198 ; CHECK-NEXT: [[AND:%.*]] = and <2 x i32> [[X:%.*]], <i32 4096, i32 4096>
199 ; CHECK-NEXT: [[TMP1:%.*]] = or <2 x i32> [[AND]], [[Y:%.*]]
200 ; CHECK-NEXT: ret <2 x i32> [[TMP1]]
202 %and = and <2 x i32> %x, <i32 4096, i32 4096>
203 %cmp = icmp eq <2 x i32> %and, zeroinitializer
204 %or = or <2 x i32> %y, <i32 4096, i32 4096>
205 %select = select <2 x i1> %cmp, <2 x i32> %y, <2 x i32> %or
206 ret <2 x i32> %select
209 define i32 @select_icmp_eq_and_4096_0_xor_4096(i32 %x, i32 %y) {
210 ; CHECK-LABEL: @select_icmp_eq_and_4096_0_xor_4096(
211 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 4096
212 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[AND]], 0
213 ; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[Y:%.*]], 4096
214 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP]], i32 [[Y]], i32 [[XOR]]
215 ; CHECK-NEXT: ret i32 [[SELECT]]
217 %and = and i32 %x, 4096
218 %cmp = icmp eq i32 %and, 0
219 %xor = xor i32 %y, 4096
220 %select = select i1 %cmp, i32 %y, i32 %xor
224 define i32 @select_icmp_eq_and_4096_0_and_not_4096(i32 %x, i32 %y) {
225 ; CHECK-LABEL: @select_icmp_eq_and_4096_0_and_not_4096(
226 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 4096
227 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[AND]], 0
228 ; CHECK-NEXT: [[AND2:%.*]] = and i32 [[Y:%.*]], -4097
229 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP]], i32 [[Y]], i32 [[AND2]]
230 ; CHECK-NEXT: ret i32 [[SELECT]]
232 %and = and i32 %x, 4096
233 %cmp = icmp eq i32 %and, 0
234 %and2 = and i32 %y, -4097
235 %select = select i1 %cmp, i32 %y, i32 %and2
239 define i32 @select_icmp_eq_0_and_1_or_1(i64 %x, i32 %y) {
240 ; CHECK-LABEL: @select_icmp_eq_0_and_1_or_1(
241 ; CHECK-NEXT: [[TMP1:%.*]] = trunc i64 [[X:%.*]] to i32
242 ; CHECK-NEXT: [[TMP2:%.*]] = and i32 [[TMP1]], 1
243 ; CHECK-NEXT: [[TMP3:%.*]] = or i32 [[TMP2]], [[Y:%.*]]
244 ; CHECK-NEXT: ret i32 [[TMP3]]
247 %cmp = icmp eq i64 %and, 0
249 %select = select i1 %cmp, i32 %y, i32 %or
253 define <2 x i32> @select_icmp_eq_0_and_1_or_1_vec(<2 x i64> %x, <2 x i32> %y) {
254 ; CHECK-LABEL: @select_icmp_eq_0_and_1_or_1_vec(
255 ; CHECK-NEXT: [[TMP1:%.*]] = trunc <2 x i64> [[X:%.*]] to <2 x i32>
256 ; CHECK-NEXT: [[TMP2:%.*]] = and <2 x i32> [[TMP1]], <i32 1, i32 1>
257 ; CHECK-NEXT: [[TMP3:%.*]] = or <2 x i32> [[TMP2]], [[Y:%.*]]
258 ; CHECK-NEXT: ret <2 x i32> [[TMP3]]
260 %and = and <2 x i64> %x, <i64 1, i64 1>
261 %cmp = icmp eq <2 x i64> %and, zeroinitializer
262 %or = or <2 x i32> %y, <i32 1, i32 1>
263 %select = select <2 x i1> %cmp, <2 x i32> %y, <2 x i32> %or
264 ret <2 x i32> %select
267 define i32 @select_icmp_eq_0_and_1_xor_1(i64 %x, i32 %y) {
268 ; CHECK-LABEL: @select_icmp_eq_0_and_1_xor_1(
269 ; CHECK-NEXT: [[TMP1:%.*]] = trunc i64 [[X:%.*]] to i32
270 ; CHECK-NEXT: [[TMP2:%.*]] = and i32 [[TMP1]], 1
271 ; CHECK-NEXT: [[SELECT:%.*]] = xor i32 [[TMP2]], [[Y:%.*]]
272 ; CHECK-NEXT: ret i32 [[SELECT]]
275 %cmp = icmp eq i64 %and, 0
277 %select = select i1 %cmp, i32 %y, i32 %xor
281 define i32 @select_icmp_eq_0_and_1_and_not_1(i64 %x, i32 %y) {
282 ; CHECK-LABEL: @select_icmp_eq_0_and_1_and_not_1(
283 ; CHECK-NEXT: [[AND:%.*]] = and i64 [[X:%.*]], 1
284 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i64 [[AND]], 0
285 ; CHECK-NEXT: [[AND2:%.*]] = and i32 [[Y:%.*]], -2
286 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP]], i32 [[Y]], i32 [[AND2]]
287 ; CHECK-NEXT: ret i32 [[SELECT]]
290 %cmp = icmp eq i64 %and, 0
291 %and2 = and i32 %y, -2
292 %select = select i1 %cmp, i32 %y, i32 %and2
296 define i32 @select_icmp_ne_0_and_4096_or_32(i32 %x, i32 %y) {
297 ; CHECK-LABEL: @select_icmp_ne_0_and_4096_or_32(
298 ; CHECK-NEXT: [[AND:%.*]] = lshr i32 [[X:%.*]], 7
299 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[AND]], 32
300 ; CHECK-NEXT: [[TMP2:%.*]] = xor i32 [[TMP1]], 32
301 ; CHECK-NEXT: [[TMP3:%.*]] = or i32 [[TMP2]], [[Y:%.*]]
302 ; CHECK-NEXT: ret i32 [[TMP3]]
304 %and = and i32 %x, 4096
305 %cmp = icmp ne i32 0, %and
307 %select = select i1 %cmp, i32 %y, i32 %or
311 define i32 @select_icmp_ne_0_and_4096_xor_32(i32 %x, i32 %y) {
312 ; CHECK-LABEL: @select_icmp_ne_0_and_4096_xor_32(
313 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 4096
314 ; CHECK-NEXT: [[CMP_NOT:%.*]] = icmp eq i32 [[AND]], 0
315 ; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[Y:%.*]], 32
316 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP_NOT]], i32 [[XOR]], i32 [[Y]]
317 ; CHECK-NEXT: ret i32 [[SELECT]]
319 %and = and i32 %x, 4096
320 %cmp = icmp ne i32 0, %and
321 %xor = xor i32 %y, 32
322 %select = select i1 %cmp, i32 %y, i32 %xor
326 define i32 @select_icmp_ne_0_and_4096_and_not_32(i32 %x, i32 %y) {
327 ; CHECK-LABEL: @select_icmp_ne_0_and_4096_and_not_32(
328 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 4096
329 ; CHECK-NEXT: [[CMP_NOT:%.*]] = icmp eq i32 [[AND]], 0
330 ; CHECK-NEXT: [[AND2:%.*]] = and i32 [[Y:%.*]], -33
331 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP_NOT]], i32 [[AND2]], i32 [[Y]]
332 ; CHECK-NEXT: ret i32 [[SELECT]]
334 %and = and i32 %x, 4096
335 %cmp = icmp ne i32 0, %and
336 %and2 = and i32 %y, -33
337 %select = select i1 %cmp, i32 %y, i32 %and2
341 define i32 @select_icmp_ne_0_and_32_or_4096(i32 %x, i32 %y) {
342 ; CHECK-LABEL: @select_icmp_ne_0_and_32_or_4096(
343 ; CHECK-NEXT: [[AND:%.*]] = shl i32 [[X:%.*]], 7
344 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[AND]], 4096
345 ; CHECK-NEXT: [[TMP2:%.*]] = xor i32 [[TMP1]], 4096
346 ; CHECK-NEXT: [[TMP3:%.*]] = or i32 [[TMP2]], [[Y:%.*]]
347 ; CHECK-NEXT: ret i32 [[TMP3]]
349 %and = and i32 %x, 32
350 %cmp = icmp ne i32 0, %and
351 %or = or i32 %y, 4096
352 %select = select i1 %cmp, i32 %y, i32 %or
356 define <2 x i32> @select_icmp_ne_0_and_32_or_4096_vec(<2 x i32> %x, <2 x i32> %y) {
357 ; CHECK-LABEL: @select_icmp_ne_0_and_32_or_4096_vec(
358 ; CHECK-NEXT: [[AND:%.*]] = shl <2 x i32> [[X:%.*]], <i32 7, i32 7>
359 ; CHECK-NEXT: [[TMP1:%.*]] = and <2 x i32> [[AND]], <i32 4096, i32 4096>
360 ; CHECK-NEXT: [[TMP2:%.*]] = xor <2 x i32> [[TMP1]], <i32 4096, i32 4096>
361 ; CHECK-NEXT: [[TMP3:%.*]] = or <2 x i32> [[TMP2]], [[Y:%.*]]
362 ; CHECK-NEXT: ret <2 x i32> [[TMP3]]
364 %and = and <2 x i32> %x, <i32 32, i32 32>
365 %cmp = icmp ne <2 x i32> zeroinitializer, %and
366 %or = or <2 x i32> %y, <i32 4096, i32 4096>
367 %select = select <2 x i1> %cmp, <2 x i32> %y, <2 x i32> %or
368 ret <2 x i32> %select
371 define i32 @select_icmp_ne_0_and_32_xor_4096(i32 %x, i32 %y) {
372 ; CHECK-LABEL: @select_icmp_ne_0_and_32_xor_4096(
373 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 32
374 ; CHECK-NEXT: [[CMP_NOT:%.*]] = icmp eq i32 [[AND]], 0
375 ; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[Y:%.*]], 4096
376 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP_NOT]], i32 [[XOR]], i32 [[Y]]
377 ; CHECK-NEXT: ret i32 [[SELECT]]
379 %and = and i32 %x, 32
380 %cmp = icmp ne i32 0, %and
381 %xor = xor i32 %y, 4096
382 %select = select i1 %cmp, i32 %y, i32 %xor
386 define i32 @select_icmp_ne_0_and_32_and_not_4096(i32 %x, i32 %y) {
387 ; CHECK-LABEL: @select_icmp_ne_0_and_32_and_not_4096(
388 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 32
389 ; CHECK-NEXT: [[CMP_NOT:%.*]] = icmp eq i32 [[AND]], 0
390 ; CHECK-NEXT: [[AND2:%.*]] = and i32 [[Y:%.*]], -4097
391 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP_NOT]], i32 [[AND2]], i32 [[Y]]
392 ; CHECK-NEXT: ret i32 [[SELECT]]
394 %and = and i32 %x, 32
395 %cmp = icmp ne i32 0, %and
396 %and2 = and i32 %y, -4097
397 %select = select i1 %cmp, i32 %y, i32 %and2
401 define i8 @select_icmp_ne_0_and_1073741824_or_8(i32 %x, i8 %y) {
402 ; CHECK-LABEL: @select_icmp_ne_0_and_1073741824_or_8(
403 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 1073741824
404 ; CHECK-NEXT: [[CMP_NOT:%.*]] = icmp eq i32 [[AND]], 0
405 ; CHECK-NEXT: [[OR:%.*]] = or i8 [[Y:%.*]], 8
406 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP_NOT]], i8 [[OR]], i8 [[Y]]
407 ; CHECK-NEXT: ret i8 [[SELECT]]
409 %and = and i32 %x, 1073741824
410 %cmp = icmp ne i32 0, %and
412 %select = select i1 %cmp, i8 %y, i8 %or
416 define i8 @select_icmp_ne_0_and_1073741824_xor_8(i32 %x, i8 %y) {
417 ; CHECK-LABEL: @select_icmp_ne_0_and_1073741824_xor_8(
418 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 1073741824
419 ; CHECK-NEXT: [[CMP_NOT:%.*]] = icmp eq i32 [[AND]], 0
420 ; CHECK-NEXT: [[XOR:%.*]] = xor i8 [[Y:%.*]], 8
421 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP_NOT]], i8 [[XOR]], i8 [[Y]]
422 ; CHECK-NEXT: ret i8 [[SELECT]]
424 %and = and i32 %x, 1073741824
425 %cmp = icmp ne i32 0, %and
427 %select = select i1 %cmp, i8 %y, i8 %xor
431 define i8 @select_icmp_ne_0_and_1073741824_and_not_8(i32 %x, i8 %y) {
432 ; CHECK-LABEL: @select_icmp_ne_0_and_1073741824_and_not_8(
433 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 1073741824
434 ; CHECK-NEXT: [[CMP_NOT:%.*]] = icmp eq i32 [[AND]], 0
435 ; CHECK-NEXT: [[AND2:%.*]] = and i8 [[Y:%.*]], -9
436 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP_NOT]], i8 [[AND2]], i8 [[Y]]
437 ; CHECK-NEXT: ret i8 [[SELECT]]
439 %and = and i32 %x, 1073741824
440 %cmp = icmp ne i32 0, %and
441 %and2 = and i8 %y, -9
442 %select = select i1 %cmp, i8 %y, i8 %and2
446 define i32 @select_icmp_ne_0_and_8_or_1073741824(i8 %x, i32 %y) {
447 ; CHECK-LABEL: @select_icmp_ne_0_and_8_or_1073741824(
448 ; CHECK-NEXT: [[AND:%.*]] = and i8 [[X:%.*]], 8
449 ; CHECK-NEXT: [[CMP_NOT:%.*]] = icmp eq i8 [[AND]], 0
450 ; CHECK-NEXT: [[OR:%.*]] = or i32 [[Y:%.*]], 1073741824
451 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP_NOT]], i32 [[OR]], i32 [[Y]]
452 ; CHECK-NEXT: ret i32 [[SELECT]]
455 %cmp = icmp ne i8 0, %and
456 %or = or i32 %y, 1073741824
457 %select = select i1 %cmp, i32 %y, i32 %or
461 define i32 @select_icmp_ne_0_and_8_xor_1073741824(i8 %x, i32 %y) {
462 ; CHECK-LABEL: @select_icmp_ne_0_and_8_xor_1073741824(
463 ; CHECK-NEXT: [[AND:%.*]] = and i8 [[X:%.*]], 8
464 ; CHECK-NEXT: [[CMP_NOT:%.*]] = icmp eq i8 [[AND]], 0
465 ; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[Y:%.*]], 1073741824
466 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP_NOT]], i32 [[XOR]], i32 [[Y]]
467 ; CHECK-NEXT: ret i32 [[SELECT]]
470 %cmp = icmp ne i8 0, %and
471 %xor = xor i32 %y, 1073741824
472 %select = select i1 %cmp, i32 %y, i32 %xor
476 define i32 @select_icmp_ne_0_and_8_and_not_1073741824(i8 %x, i32 %y) {
477 ; CHECK-LABEL: @select_icmp_ne_0_and_8_and_not_1073741824(
478 ; CHECK-NEXT: [[AND:%.*]] = and i8 [[X:%.*]], 8
479 ; CHECK-NEXT: [[CMP_NOT:%.*]] = icmp eq i8 [[AND]], 0
480 ; CHECK-NEXT: [[AND2:%.*]] = and i32 [[Y:%.*]], -1073741825
481 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP_NOT]], i32 [[AND2]], i32 [[Y]]
482 ; CHECK-NEXT: ret i32 [[SELECT]]
485 %cmp = icmp ne i8 0, %and
486 %and2 = and i32 %y, -1073741825
487 %select = select i1 %cmp, i32 %y, i32 %and2
491 ; We can't combine here, because the cmp is scalar and the or vector.
492 ; Just make sure we don't assert.
493 define <2 x i32> @select_icmp_eq_and_1_0_or_vector_of_2s(i32 %x, <2 x i32> %y) {
494 ; CHECK-LABEL: @select_icmp_eq_and_1_0_or_vector_of_2s(
495 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 1
496 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[AND]], 0
497 ; CHECK-NEXT: [[OR:%.*]] = or <2 x i32> [[Y:%.*]], <i32 2, i32 2>
498 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP]], <2 x i32> [[Y]], <2 x i32> [[OR]]
499 ; CHECK-NEXT: ret <2 x i32> [[SELECT]]
502 %cmp = icmp eq i32 %and, 0
503 %or = or <2 x i32> %y, <i32 2, i32 2>
504 %select = select i1 %cmp, <2 x i32> %y, <2 x i32> %or
505 ret <2 x i32> %select
508 define i32 @select_icmp_and_8_ne_0_xor_8(i32 %x) {
509 ; CHECK-LABEL: @select_icmp_and_8_ne_0_xor_8(
510 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], -9
511 ; CHECK-NEXT: ret i32 [[TMP1]]
514 %cmp = icmp eq i32 %and, 0
516 %x.xor = select i1 %cmp, i32 %x, i32 %xor
520 define i32 @select_icmp_and_8_eq_0_xor_8(i32 %x) {
521 ; CHECK-LABEL: @select_icmp_and_8_eq_0_xor_8(
522 ; CHECK-NEXT: [[TMP1:%.*]] = or i32 [[X:%.*]], 8
523 ; CHECK-NEXT: ret i32 [[TMP1]]
526 %cmp = icmp eq i32 %and, 0
528 %xor.x = select i1 %cmp, i32 %xor, i32 %x
532 define i64 @select_icmp_x_and_8_eq_0_y_xor_8(i32 %x, i64 %y) {
533 ; CHECK-LABEL: @select_icmp_x_and_8_eq_0_y_xor_8(
534 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 8
535 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[AND]], 0
536 ; CHECK-NEXT: [[XOR:%.*]] = xor i64 [[Y:%.*]], 8
537 ; CHECK-NEXT: [[Y_XOR:%.*]] = select i1 [[CMP]], i64 [[Y]], i64 [[XOR]]
538 ; CHECK-NEXT: ret i64 [[Y_XOR]]
541 %cmp = icmp eq i32 %and, 0
543 %y.xor = select i1 %cmp, i64 %y, i64 %xor
547 define i64 @select_icmp_x_and_8_ne_0_y_xor_8(i32 %x, i64 %y) {
548 ; CHECK-LABEL: @select_icmp_x_and_8_ne_0_y_xor_8(
549 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 8
550 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[AND]], 0
551 ; CHECK-NEXT: [[XOR:%.*]] = xor i64 [[Y:%.*]], 8
552 ; CHECK-NEXT: [[XOR_Y:%.*]] = select i1 [[CMP]], i64 [[XOR]], i64 [[Y]]
553 ; CHECK-NEXT: ret i64 [[XOR_Y]]
556 %cmp = icmp eq i32 %and, 0
558 %xor.y = select i1 %cmp, i64 %xor, i64 %y
562 define i64 @select_icmp_x_and_8_ne_0_y_or_8(i32 %x, i64 %y) {
563 ; CHECK-LABEL: @select_icmp_x_and_8_ne_0_y_or_8(
564 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 8
565 ; CHECK-NEXT: [[TMP1:%.*]] = xor i32 [[AND]], 8
566 ; CHECK-NEXT: [[TMP2:%.*]] = zext i32 [[TMP1]] to i64
567 ; CHECK-NEXT: [[TMP3:%.*]] = or i64 [[TMP2]], [[Y:%.*]]
568 ; CHECK-NEXT: ret i64 [[TMP3]]
571 %cmp = icmp eq i32 %and, 0
573 %or.y = select i1 %cmp, i64 %or, i64 %y
577 define <2 x i64> @select_icmp_x_and_8_ne_0_y_or_8_vec(<2 x i32> %x, <2 x i64> %y) {
578 ; CHECK-LABEL: @select_icmp_x_and_8_ne_0_y_or_8_vec(
579 ; CHECK-NEXT: [[AND:%.*]] = and <2 x i32> [[X:%.*]], <i32 8, i32 8>
580 ; CHECK-NEXT: [[TMP1:%.*]] = xor <2 x i32> [[AND]], <i32 8, i32 8>
581 ; CHECK-NEXT: [[TMP2:%.*]] = zext <2 x i32> [[TMP1]] to <2 x i64>
582 ; CHECK-NEXT: [[TMP3:%.*]] = or <2 x i64> [[TMP2]], [[Y:%.*]]
583 ; CHECK-NEXT: ret <2 x i64> [[TMP3]]
585 %and = and <2 x i32> %x, <i32 8, i32 8>
586 %cmp = icmp eq <2 x i32> %and, zeroinitializer
587 %or = or <2 x i64> %y, <i64 8, i64 8>
588 %or.y = select <2 x i1> %cmp, <2 x i64> %or, <2 x i64> %y
592 define i64 @select_icmp_x_and_8_ne_0_y_and_not_8(i32 %x, i64 %y) {
593 ; CHECK-LABEL: @select_icmp_x_and_8_ne_0_y_and_not_8(
594 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 8
595 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[AND]], 0
596 ; CHECK-NEXT: [[AND2:%.*]] = and i64 [[Y:%.*]], -9
597 ; CHECK-NEXT: [[AND_Y:%.*]] = select i1 [[CMP]], i64 [[AND2]], i64 [[Y]]
598 ; CHECK-NEXT: ret i64 [[AND_Y]]
601 %cmp = icmp eq i32 %and, 0
602 %and2 = and i64 %y, -9
603 %and.y = select i1 %cmp, i64 %and2, i64 %y
607 define i32 @select_icmp_and_2147483648_ne_0_xor_2147483648(i32 %x) {
608 ; CHECK-LABEL: @select_icmp_and_2147483648_ne_0_xor_2147483648(
609 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 2147483647
610 ; CHECK-NEXT: ret i32 [[TMP1]]
612 %and = and i32 %x, 2147483648
613 %cmp = icmp eq i32 %and, 0
614 %xor = xor i32 %x, 2147483648
615 %x.xor = select i1 %cmp, i32 %x, i32 %xor
619 define i32 @select_icmp_and_2147483648_eq_0_xor_2147483648(i32 %x) {
620 ; CHECK-LABEL: @select_icmp_and_2147483648_eq_0_xor_2147483648(
621 ; CHECK-NEXT: [[TMP1:%.*]] = or i32 [[X:%.*]], -2147483648
622 ; CHECK-NEXT: ret i32 [[TMP1]]
624 %and = and i32 %x, 2147483648
625 %cmp = icmp eq i32 %and, 0
626 %xor = xor i32 %x, 2147483648
627 %xor.x = select i1 %cmp, i32 %xor, i32 %x
631 define i32 @select_icmp_x_and_2147483648_ne_0_or_2147483648(i32 %x) {
632 ; CHECK-LABEL: @select_icmp_x_and_2147483648_ne_0_or_2147483648(
633 ; CHECK-NEXT: [[OR:%.*]] = or i32 [[X:%.*]], -2147483648
634 ; CHECK-NEXT: ret i32 [[OR]]
636 %and = and i32 %x, 2147483648
637 %cmp = icmp eq i32 %and, 0
638 %or = or i32 %x, 2147483648
639 %or.x = select i1 %cmp, i32 %or, i32 %x
643 define i32 @test68(i32 %x, i32 %y) {
644 ; CHECK-LABEL: @test68(
645 ; CHECK-NEXT: [[TMP1:%.*]] = lshr i32 [[X:%.*]], 6
646 ; CHECK-NEXT: [[TMP2:%.*]] = and i32 [[TMP1]], 2
647 ; CHECK-NEXT: [[TMP3:%.*]] = or i32 [[TMP2]], [[Y:%.*]]
648 ; CHECK-NEXT: ret i32 [[TMP3]]
650 %and = and i32 %x, 128
651 %cmp = icmp eq i32 %and, 0
653 %select = select i1 %cmp, i32 %y, i32 %or
657 define <2 x i32> @test68vec(<2 x i32> %x, <2 x i32> %y) {
658 ; CHECK-LABEL: @test68vec(
659 ; CHECK-NEXT: [[TMP1:%.*]] = lshr <2 x i32> [[X:%.*]], <i32 6, i32 6>
660 ; CHECK-NEXT: [[TMP2:%.*]] = and <2 x i32> [[TMP1]], <i32 2, i32 2>
661 ; CHECK-NEXT: [[TMP3:%.*]] = or <2 x i32> [[TMP2]], [[Y:%.*]]
662 ; CHECK-NEXT: ret <2 x i32> [[TMP3]]
664 %and = and <2 x i32> %x, <i32 128, i32 128>
665 %cmp = icmp eq <2 x i32> %and, zeroinitializer
666 %or = or <2 x i32> %y, <i32 2, i32 2>
667 %select = select <2 x i1> %cmp, <2 x i32> %y, <2 x i32> %or
668 ret <2 x i32> %select
671 define i32 @test68_xor(i32 %x, i32 %y) {
672 ; CHECK-LABEL: @test68_xor(
673 ; CHECK-NEXT: [[TMP1:%.*]] = trunc i32 [[X:%.*]] to i8
674 ; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i8 [[TMP1]], -1
675 ; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[Y:%.*]], 2
676 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP]], i32 [[Y]], i32 [[XOR]]
677 ; CHECK-NEXT: ret i32 [[SELECT]]
679 %and = and i32 %x, 128
680 %cmp = icmp eq i32 %and, 0
682 %select = select i1 %cmp, i32 %y, i32 %xor
686 define i32 @test68_and(i32 %x, i32 %y) {
687 ; CHECK-LABEL: @test68_and(
688 ; CHECK-NEXT: [[TMP1:%.*]] = trunc i32 [[X:%.*]] to i8
689 ; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i8 [[TMP1]], -1
690 ; CHECK-NEXT: [[AND2:%.*]] = and i32 [[Y:%.*]], -3
691 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP]], i32 [[Y]], i32 [[AND2]]
692 ; CHECK-NEXT: ret i32 [[SELECT]]
694 %and = and i32 %x, 128
695 %cmp = icmp eq i32 %and, 0
696 %and2 = and i32 %y, -3
697 %select = select i1 %cmp, i32 %y, i32 %and2
701 define i32 @test69(i32 %x, i32 %y) {
702 ; CHECK-LABEL: @test69(
703 ; CHECK-NEXT: [[TMP1:%.*]] = lshr i32 [[X:%.*]], 6
704 ; CHECK-NEXT: [[TMP2:%.*]] = and i32 [[TMP1]], 2
705 ; CHECK-NEXT: [[TMP3:%.*]] = xor i32 [[TMP2]], 2
706 ; CHECK-NEXT: [[TMP4:%.*]] = or i32 [[TMP3]], [[Y:%.*]]
707 ; CHECK-NEXT: ret i32 [[TMP4]]
709 %and = and i32 %x, 128
710 %cmp = icmp ne i32 %and, 0
712 %select = select i1 %cmp, i32 %y, i32 %or
716 define <2 x i32> @test69vec(<2 x i32> %x, <2 x i32> %y) {
717 ; CHECK-LABEL: @test69vec(
718 ; CHECK-NEXT: [[TMP1:%.*]] = lshr <2 x i32> [[X:%.*]], <i32 6, i32 6>
719 ; CHECK-NEXT: [[TMP2:%.*]] = and <2 x i32> [[TMP1]], <i32 2, i32 2>
720 ; CHECK-NEXT: [[TMP3:%.*]] = xor <2 x i32> [[TMP2]], <i32 2, i32 2>
721 ; CHECK-NEXT: [[TMP4:%.*]] = or <2 x i32> [[TMP3]], [[Y:%.*]]
722 ; CHECK-NEXT: ret <2 x i32> [[TMP4]]
724 %and = and <2 x i32> %x, <i32 128, i32 128>
725 %cmp = icmp ne <2 x i32> %and, zeroinitializer
726 %or = or <2 x i32> %y, <i32 2, i32 2>
727 %select = select <2 x i1> %cmp, <2 x i32> %y, <2 x i32> %or
728 ret <2 x i32> %select
731 define i32 @test69_xor(i32 %x, i32 %y) {
732 ; CHECK-LABEL: @test69_xor(
733 ; CHECK-NEXT: [[TMP1:%.*]] = trunc i32 [[X:%.*]] to i8
734 ; CHECK-NEXT: [[CMP_NOT:%.*]] = icmp sgt i8 [[TMP1]], -1
735 ; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[Y:%.*]], 2
736 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP_NOT]], i32 [[XOR]], i32 [[Y]]
737 ; CHECK-NEXT: ret i32 [[SELECT]]
739 %and = and i32 %x, 128
740 %cmp = icmp ne i32 %and, 0
742 %select = select i1 %cmp, i32 %y, i32 %xor
746 define i32 @test69_and(i32 %x, i32 %y) {
747 ; CHECK-LABEL: @test69_and(
748 ; CHECK-NEXT: [[TMP1:%.*]] = trunc i32 [[X:%.*]] to i8
749 ; CHECK-NEXT: [[CMP_NOT:%.*]] = icmp sgt i8 [[TMP1]], -1
750 ; CHECK-NEXT: [[AND2:%.*]] = and i32 [[Y:%.*]], 2
751 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP_NOT]], i32 [[AND2]], i32 [[Y]]
752 ; CHECK-NEXT: ret i32 [[SELECT]]
754 %and = and i32 %x, 128
755 %cmp = icmp ne i32 %and, 0
756 %and2 = and i32 %y, 2
757 %select = select i1 %cmp, i32 %y, i32 %and2
761 define i8 @test70(i8 %x, i8 %y) {
762 ; CHECK-LABEL: @test70(
763 ; CHECK-NEXT: [[CMP:%.*]] = icmp slt i8 [[X:%.*]], 0
764 ; CHECK-NEXT: [[OR:%.*]] = or i8 [[Y:%.*]], 2
765 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP]], i8 [[OR]], i8 [[Y]]
766 ; CHECK-NEXT: ret i8 [[SELECT]]
768 %cmp = icmp slt i8 %x, 0
770 %select = select i1 %cmp, i8 %or, i8 %y
774 define i32 @shift_no_xor_multiuse_or(i32 %x, i32 %y) {
775 ; CHECK-LABEL: @shift_no_xor_multiuse_or(
776 ; CHECK-NEXT: [[OR:%.*]] = or i32 [[Y:%.*]], 2
777 ; CHECK-NEXT: [[AND:%.*]] = shl i32 [[X:%.*]], 1
778 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[AND]], 2
779 ; CHECK-NEXT: [[TMP2:%.*]] = or i32 [[TMP1]], [[Y]]
780 ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[TMP2]], [[OR]]
781 ; CHECK-NEXT: ret i32 [[RES]]
784 %cmp = icmp eq i32 %and, 0
786 %select = select i1 %cmp, i32 %y, i32 %or
787 %res = mul i32 %select, %or ; to bump up use count of the Or
791 define i32 @shift_no_xor_multiuse_xor(i32 %x, i32 %y) {
792 ; CHECK-LABEL: @shift_no_xor_multiuse_xor(
793 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 1
794 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[AND]], 0
795 ; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[Y:%.*]], 2
796 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP]], i32 [[Y]], i32 [[XOR]]
797 ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[SELECT]], [[XOR]]
798 ; CHECK-NEXT: ret i32 [[RES]]
801 %cmp = icmp eq i32 %and, 0
803 %select = select i1 %cmp, i32 %y, i32 %xor
804 %res = mul i32 %select, %xor ; to bump up use count of the Xor
808 define i32 @shift_no_xor_multiuse_and(i32 %x, i32 %y) {
809 ; CHECK-LABEL: @shift_no_xor_multiuse_and(
810 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 1
811 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[AND]], 0
812 ; CHECK-NEXT: [[AND2:%.*]] = and i32 [[Y:%.*]], -3
813 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP]], i32 [[Y]], i32 [[AND2]]
814 ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[SELECT]], [[AND2]]
815 ; CHECK-NEXT: ret i32 [[RES]]
818 %cmp = icmp eq i32 %and, 0
819 %and2 = and i32 %y, -3
820 %select = select i1 %cmp, i32 %y, i32 %and2
821 %res = mul i32 %select, %and2 ; to bump up use count of the And
825 define i32 @no_shift_no_xor_multiuse_or(i32 %x, i32 %y) {
826 ; CHECK-LABEL: @no_shift_no_xor_multiuse_or(
827 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 4096
828 ; CHECK-NEXT: [[OR:%.*]] = or i32 [[Y:%.*]], 4096
829 ; CHECK-NEXT: [[TMP1:%.*]] = or i32 [[AND]], [[Y]]
830 ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[TMP1]], [[OR]]
831 ; CHECK-NEXT: ret i32 [[RES]]
833 %and = and i32 %x, 4096
834 %cmp = icmp eq i32 %and, 0
835 %or = or i32 %y, 4096
836 %select = select i1 %cmp, i32 %y, i32 %or
837 %res = mul i32 %select, %or ; to bump up use count of the Or
841 define i32 @no_shift_no_xor_multiuse_xor(i32 %x, i32 %y) {
842 ; CHECK-LABEL: @no_shift_no_xor_multiuse_xor(
843 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 4096
844 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[AND]], 0
845 ; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[Y:%.*]], 4096
846 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP]], i32 [[Y]], i32 [[XOR]]
847 ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[SELECT]], [[XOR]]
848 ; CHECK-NEXT: ret i32 [[RES]]
850 %and = and i32 %x, 4096
851 %cmp = icmp eq i32 %and, 0
852 %xor = xor i32 %y, 4096
853 %select = select i1 %cmp, i32 %y, i32 %xor
854 %res = mul i32 %select, %xor ; to bump up use count of the Xor
858 define i32 @no_shift_no_xor_multiuse_and(i32 %x, i32 %y) {
859 ; CHECK-LABEL: @no_shift_no_xor_multiuse_and(
860 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 4096
861 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[AND]], 0
862 ; CHECK-NEXT: [[AND2:%.*]] = add i32 [[Y:%.*]], -4097
863 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP]], i32 [[Y]], i32 [[AND2]]
864 ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[SELECT]], [[AND2]]
865 ; CHECK-NEXT: ret i32 [[RES]]
867 %and = and i32 %x, 4096
868 %cmp = icmp eq i32 %and, 0
869 %and2 = add i32 %y, -4097
870 %select = select i1 %cmp, i32 %y, i32 %and2
871 %res = mul i32 %select, %and2 ; to bump up use count of the And
875 define i32 @no_shift_xor_multiuse_or(i32 %x, i32 %y) {
876 ; CHECK-LABEL: @no_shift_xor_multiuse_or(
877 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 4096
878 ; CHECK-NEXT: [[OR:%.*]] = or i32 [[Y:%.*]], 4096
879 ; CHECK-NEXT: [[TMP1:%.*]] = xor i32 [[AND]], 4096
880 ; CHECK-NEXT: [[TMP2:%.*]] = or i32 [[TMP1]], [[Y]]
881 ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[TMP2]], [[OR]]
882 ; CHECK-NEXT: ret i32 [[RES]]
884 %and = and i32 %x, 4096
885 %cmp = icmp ne i32 0, %and
886 %or = or i32 %y, 4096
887 %select = select i1 %cmp, i32 %y, i32 %or
888 %res = mul i32 %select, %or ; to bump up use count of the Or
892 define i32 @no_shift_xor_multiuse_xor(i32 %x, i32 %y) {
893 ; CHECK-LABEL: @no_shift_xor_multiuse_xor(
894 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 4096
895 ; CHECK-NEXT: [[CMP_NOT:%.*]] = icmp eq i32 [[AND]], 0
896 ; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[Y:%.*]], 4096
897 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP_NOT]], i32 [[XOR]], i32 [[Y]]
898 ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[SELECT]], [[XOR]]
899 ; CHECK-NEXT: ret i32 [[RES]]
901 %and = and i32 %x, 4096
902 %cmp = icmp ne i32 0, %and
903 %xor = xor i32 %y, 4096
904 %select = select i1 %cmp, i32 %y, i32 %xor
905 %res = mul i32 %select, %xor ; to bump up use count of the Xor
909 define i32 @no_shift_xor_multiuse_and(i32 %x, i32 %y) {
910 ; CHECK-LABEL: @no_shift_xor_multiuse_and(
911 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 4096
912 ; CHECK-NEXT: [[CMP_NOT:%.*]] = icmp eq i32 [[AND]], 0
913 ; CHECK-NEXT: [[AND2:%.*]] = and i32 [[Y:%.*]], -4097
914 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP_NOT]], i32 [[AND2]], i32 [[Y]]
915 ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[SELECT]], [[AND2]]
916 ; CHECK-NEXT: ret i32 [[RES]]
918 %and = and i32 %x, 4096
919 %cmp = icmp ne i32 0, %and
920 %and2 = and i32 %y, -4097
921 %select = select i1 %cmp, i32 %y, i32 %and2
922 %res = mul i32 %select, %and2 ; to bump up use count of the And
926 define i32 @shift_xor_multiuse_or(i32 %x, i32 %y) {
927 ; CHECK-LABEL: @shift_xor_multiuse_or(
928 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 4096
929 ; CHECK-NEXT: [[CMP_NOT:%.*]] = icmp eq i32 [[AND]], 0
930 ; CHECK-NEXT: [[OR:%.*]] = or i32 [[Y:%.*]], 2048
931 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP_NOT]], i32 [[OR]], i32 [[Y]]
932 ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[SELECT]], [[OR]]
933 ; CHECK-NEXT: ret i32 [[RES]]
935 %and = and i32 %x, 4096
936 %cmp = icmp ne i32 0, %and
937 %or = or i32 %y, 2048
938 %select = select i1 %cmp, i32 %y, i32 %or
939 %res = mul i32 %select, %or ; to bump up use count of the Or
943 define i32 @shift_xor_multiuse_xor(i32 %x, i32 %y) {
944 ; CHECK-LABEL: @shift_xor_multiuse_xor(
945 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 4096
946 ; CHECK-NEXT: [[CMP_NOT:%.*]] = icmp eq i32 [[AND]], 0
947 ; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[Y:%.*]], 2048
948 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP_NOT]], i32 [[XOR]], i32 [[Y]]
949 ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[SELECT]], [[XOR]]
950 ; CHECK-NEXT: ret i32 [[RES]]
952 %and = and i32 %x, 4096
953 %cmp = icmp ne i32 0, %and
954 %xor = xor i32 %y, 2048
955 %select = select i1 %cmp, i32 %y, i32 %xor
956 %res = mul i32 %select, %xor ; to bump up use count of the Xor
960 define i32 @shift_xor_multiuse_and(i32 %x, i32 %y) {
961 ; CHECK-LABEL: @shift_xor_multiuse_and(
962 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 4096
963 ; CHECK-NEXT: [[CMP_NOT:%.*]] = icmp eq i32 [[AND]], 0
964 ; CHECK-NEXT: [[AND2:%.*]] = and i32 [[Y:%.*]], -2049
965 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP_NOT]], i32 [[AND2]], i32 [[Y]]
966 ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[SELECT]], [[AND2]]
967 ; CHECK-NEXT: ret i32 [[RES]]
969 %and = and i32 %x, 4096
970 %cmp = icmp ne i32 0, %and
971 %and2 = and i32 %y, -2049
972 %select = select i1 %cmp, i32 %y, i32 %and2
973 %res = mul i32 %select, %and2 ; to bump up use count of the and
977 define i32 @shift_no_xor_multiuse_cmp(i32 %x, i32 %y, i32 %z, i32 %w) {
978 ; CHECK-LABEL: @shift_no_xor_multiuse_cmp(
979 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 1
980 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[AND]], 0
981 ; CHECK-NEXT: [[TMP1:%.*]] = shl nuw nsw i32 [[AND]], 1
982 ; CHECK-NEXT: [[TMP2:%.*]] = or i32 [[TMP1]], [[Y:%.*]]
983 ; CHECK-NEXT: [[SELECT2:%.*]] = select i1 [[CMP]], i32 [[Z:%.*]], i32 [[W:%.*]]
984 ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[TMP2]], [[SELECT2]]
985 ; CHECK-NEXT: ret i32 [[RES]]
988 %cmp = icmp eq i32 %and, 0
990 %select = select i1 %cmp, i32 %y, i32 %or
991 %select2 = select i1 %cmp, i32 %z, i32 %w ; to bump up use count of the cmp
992 %res = mul i32 %select, %select2
996 define i32 @shift_no_xor_multiuse_cmp_with_xor(i32 %x, i32 %y, i32 %z, i32 %w) {
997 ; CHECK-LABEL: @shift_no_xor_multiuse_cmp_with_xor(
998 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 1
999 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[AND]], 0
1000 ; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[Y:%.*]], 2
1001 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP]], i32 [[Y]], i32 [[XOR]]
1002 ; CHECK-NEXT: [[SELECT2:%.*]] = select i1 [[CMP]], i32 [[Z:%.*]], i32 [[W:%.*]]
1003 ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[SELECT]], [[SELECT2]]
1004 ; CHECK-NEXT: ret i32 [[RES]]
1006 %and = and i32 %x, 1
1007 %cmp = icmp eq i32 %and, 0
1008 %xor = xor i32 %y, 2
1009 %select = select i1 %cmp, i32 %y, i32 %xor
1010 %select2 = select i1 %cmp, i32 %z, i32 %w ; to bump up use count of the cmp
1011 %res = mul i32 %select, %select2
1015 define i32 @shift_no_xor_multiuse_cmp_with_and(i32 %x, i32 %y, i32 %z, i32 %w) {
1016 ; CHECK-LABEL: @shift_no_xor_multiuse_cmp_with_and(
1017 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 1
1018 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[AND]], 0
1019 ; CHECK-NEXT: [[AND2:%.*]] = and i32 [[Y:%.*]], -3
1020 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP]], i32 [[Y]], i32 [[AND2]]
1021 ; CHECK-NEXT: [[SELECT2:%.*]] = select i1 [[CMP]], i32 [[Z:%.*]], i32 [[W:%.*]]
1022 ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[SELECT]], [[SELECT2]]
1023 ; CHECK-NEXT: ret i32 [[RES]]
1025 %and = and i32 %x, 1
1026 %cmp = icmp eq i32 %and, 0
1027 %and2 = and i32 %y, -3
1028 %select = select i1 %cmp, i32 %y, i32 %and2
1029 %select2 = select i1 %cmp, i32 %z, i32 %w ; to bump up use count of the cmp
1030 %res = mul i32 %select, %select2
1034 define i32 @no_shift_no_xor_multiuse_cmp(i32 %x, i32 %y, i32 %z, i32 %w) {
1035 ; CHECK-LABEL: @no_shift_no_xor_multiuse_cmp(
1036 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 4096
1037 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[AND]], 0
1038 ; CHECK-NEXT: [[TMP1:%.*]] = or i32 [[AND]], [[Y:%.*]]
1039 ; CHECK-NEXT: [[SELECT2:%.*]] = select i1 [[CMP]], i32 [[Z:%.*]], i32 [[W:%.*]]
1040 ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[TMP1]], [[SELECT2]]
1041 ; CHECK-NEXT: ret i32 [[RES]]
1043 %and = and i32 %x, 4096
1044 %cmp = icmp eq i32 %and, 0
1045 %or = or i32 %y, 4096
1046 %select = select i1 %cmp, i32 %y, i32 %or
1047 %select2 = select i1 %cmp, i32 %z, i32 %w ; to bump up use count of the cmp
1048 %res = mul i32 %select, %select2
1052 define i32 @no_shift_no_xor_multiuse_cmp_with_xor(i32 %x, i32 %y, i32 %z, i32 %w) {
1053 ; CHECK-LABEL: @no_shift_no_xor_multiuse_cmp_with_xor(
1054 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 4096
1055 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[AND]], 0
1056 ; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[Y:%.*]], 4096
1057 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP]], i32 [[Y]], i32 [[XOR]]
1058 ; CHECK-NEXT: [[SELECT2:%.*]] = select i1 [[CMP]], i32 [[Z:%.*]], i32 [[W:%.*]]
1059 ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[SELECT]], [[SELECT2]]
1060 ; CHECK-NEXT: ret i32 [[RES]]
1062 %and = and i32 %x, 4096
1063 %cmp = icmp eq i32 %and, 0
1064 %xor = xor i32 %y, 4096
1065 %select = select i1 %cmp, i32 %y, i32 %xor
1066 %select2 = select i1 %cmp, i32 %z, i32 %w ; to bump up use count of the cmp
1067 %res = mul i32 %select, %select2
1071 define i32 @no_shift_no_xor_multiuse_cmp_with_and(i32 %x, i32 %y, i32 %z, i32 %w) {
1072 ; CHECK-LABEL: @no_shift_no_xor_multiuse_cmp_with_and(
1073 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 4096
1074 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[AND]], 0
1075 ; CHECK-NEXT: [[AND2:%.*]] = and i32 [[Y:%.*]], -4097
1076 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP]], i32 [[Y]], i32 [[AND2]]
1077 ; CHECK-NEXT: [[SELECT2:%.*]] = select i1 [[CMP]], i32 [[Z:%.*]], i32 [[W:%.*]]
1078 ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[SELECT]], [[SELECT2]]
1079 ; CHECK-NEXT: ret i32 [[RES]]
1081 %and = and i32 %x, 4096
1082 %cmp = icmp eq i32 %and, 0
1083 %and2 = and i32 %y, -4097
1084 %select = select i1 %cmp, i32 %y, i32 %and2
1085 %select2 = select i1 %cmp, i32 %z, i32 %w ; to bump up use count of the cmp
1086 %res = mul i32 %select, %select2
1090 define i32 @no_shift_xor_multiuse_cmp(i32 %x, i32 %y, i32 %z, i32 %w) {
1091 ; CHECK-LABEL: @no_shift_xor_multiuse_cmp(
1092 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 4096
1093 ; CHECK-NEXT: [[CMP_NOT:%.*]] = icmp eq i32 [[AND]], 0
1094 ; CHECK-NEXT: [[TMP1:%.*]] = xor i32 [[AND]], 4096
1095 ; CHECK-NEXT: [[TMP2:%.*]] = or i32 [[TMP1]], [[Y:%.*]]
1096 ; CHECK-NEXT: [[SELECT2:%.*]] = select i1 [[CMP_NOT]], i32 [[W:%.*]], i32 [[Z:%.*]]
1097 ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[TMP2]], [[SELECT2]]
1098 ; CHECK-NEXT: ret i32 [[RES]]
1100 %and = and i32 %x, 4096
1101 %cmp = icmp ne i32 0, %and
1102 %or = or i32 %y, 4096
1103 %select = select i1 %cmp, i32 %y, i32 %or
1104 %select2 = select i1 %cmp, i32 %z, i32 %w ; to bump up use count of the cmp
1105 %res = mul i32 %select, %select2
1109 define i32 @no_shift_xor_multiuse_cmp_with_xor(i32 %x, i32 %y, i32 %z, i32 %w) {
1110 ; CHECK-LABEL: @no_shift_xor_multiuse_cmp_with_xor(
1111 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 4096
1112 ; CHECK-NEXT: [[CMP_NOT:%.*]] = icmp eq i32 [[AND]], 0
1113 ; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[Y:%.*]], 4096
1114 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP_NOT]], i32 [[XOR]], i32 [[Y]]
1115 ; CHECK-NEXT: [[SELECT2:%.*]] = select i1 [[CMP_NOT]], i32 [[W:%.*]], i32 [[Z:%.*]]
1116 ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[SELECT]], [[SELECT2]]
1117 ; CHECK-NEXT: ret i32 [[RES]]
1119 %and = and i32 %x, 4096
1120 %cmp = icmp ne i32 0, %and
1121 %xor = xor i32 %y, 4096
1122 %select = select i1 %cmp, i32 %y, i32 %xor
1123 %select2 = select i1 %cmp, i32 %z, i32 %w ; to bump up use count of the cmp
1124 %res = mul i32 %select, %select2
1128 define i32 @no_shift_xor_multiuse_cmp_with_and(i32 %x, i32 %y, i32 %z, i32 %w) {
1129 ; CHECK-LABEL: @no_shift_xor_multiuse_cmp_with_and(
1130 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 4096
1131 ; CHECK-NEXT: [[CMP_NOT:%.*]] = icmp eq i32 [[AND]], 0
1132 ; CHECK-NEXT: [[AND2:%.*]] = and i32 [[Y:%.*]], -4097
1133 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP_NOT]], i32 [[AND2]], i32 [[Y]]
1134 ; CHECK-NEXT: [[SELECT2:%.*]] = select i1 [[CMP_NOT]], i32 [[W:%.*]], i32 [[Z:%.*]]
1135 ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[SELECT]], [[SELECT2]]
1136 ; CHECK-NEXT: ret i32 [[RES]]
1138 %and = and i32 %x, 4096
1139 %cmp = icmp ne i32 0, %and
1140 %and2 = and i32 %y, -4097
1141 %select = select i1 %cmp, i32 %y, i32 %and2
1142 %select2 = select i1 %cmp, i32 %z, i32 %w ; to bump up use count of the cmp
1143 %res = mul i32 %select, %select2
1147 define i32 @shift_xor_multiuse_cmp(i32 %x, i32 %y, i32 %z, i32 %w) {
1148 ; CHECK-LABEL: @shift_xor_multiuse_cmp(
1149 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 4096
1150 ; CHECK-NEXT: [[CMP_NOT:%.*]] = icmp eq i32 [[AND]], 0
1151 ; CHECK-NEXT: [[OR:%.*]] = or i32 [[Y:%.*]], 2048
1152 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP_NOT]], i32 [[OR]], i32 [[Y]]
1153 ; CHECK-NEXT: [[SELECT2:%.*]] = select i1 [[CMP_NOT]], i32 [[W:%.*]], i32 [[Z:%.*]]
1154 ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[SELECT]], [[SELECT2]]
1155 ; CHECK-NEXT: ret i32 [[RES]]
1157 %and = and i32 %x, 4096
1158 %cmp = icmp ne i32 0, %and
1159 %or = or i32 %y, 2048
1160 %select = select i1 %cmp, i32 %y, i32 %or
1161 %select2 = select i1 %cmp, i32 %z, i32 %w ; to bump up use count of the cmp
1162 %res = mul i32 %select, %select2
1166 define i32 @shift_xor_multiuse_cmp_with_xor(i32 %x, i32 %y, i32 %z, i32 %w) {
1167 ; CHECK-LABEL: @shift_xor_multiuse_cmp_with_xor(
1168 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 4096
1169 ; CHECK-NEXT: [[CMP_NOT:%.*]] = icmp eq i32 [[AND]], 0
1170 ; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[Y:%.*]], 2048
1171 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP_NOT]], i32 [[XOR]], i32 [[Y]]
1172 ; CHECK-NEXT: [[SELECT2:%.*]] = select i1 [[CMP_NOT]], i32 [[W:%.*]], i32 [[Z:%.*]]
1173 ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[SELECT]], [[SELECT2]]
1174 ; CHECK-NEXT: ret i32 [[RES]]
1176 %and = and i32 %x, 4096
1177 %cmp = icmp ne i32 0, %and
1178 %xor = xor i32 %y, 2048
1179 %select = select i1 %cmp, i32 %y, i32 %xor
1180 %select2 = select i1 %cmp, i32 %z, i32 %w ; to bump up use count of the cmp
1181 %res = mul i32 %select, %select2
1185 define i32 @shift_xor_multiuse_cmp_with_and(i32 %x, i32 %y, i32 %z, i32 %w) {
1186 ; CHECK-LABEL: @shift_xor_multiuse_cmp_with_and(
1187 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 4096
1188 ; CHECK-NEXT: [[CMP_NOT:%.*]] = icmp eq i32 [[AND]], 0
1189 ; CHECK-NEXT: [[AND2:%.*]] = and i32 [[Y:%.*]], -2049
1190 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP_NOT]], i32 [[AND2]], i32 [[Y]]
1191 ; CHECK-NEXT: [[SELECT2:%.*]] = select i1 [[CMP_NOT]], i32 [[W:%.*]], i32 [[Z:%.*]]
1192 ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[SELECT]], [[SELECT2]]
1193 ; CHECK-NEXT: ret i32 [[RES]]
1195 %and = and i32 %x, 4096
1196 %cmp = icmp ne i32 0, %and
1197 %and2 = and i32 %y, -2049
1198 %select = select i1 %cmp, i32 %y, i32 %and2
1199 %select2 = select i1 %cmp, i32 %z, i32 %w ; to bump up use count of the cmp
1200 %res = mul i32 %select, %select2
1204 define i32 @shift_no_xor_multiuse_cmp_or(i32 %x, i32 %y, i32 %z, i32 %w) {
1205 ; CHECK-LABEL: @shift_no_xor_multiuse_cmp_or(
1206 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 1
1207 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[AND]], 0
1208 ; CHECK-NEXT: [[OR:%.*]] = or i32 [[Y:%.*]], 2
1209 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP]], i32 [[Y]], i32 [[OR]]
1210 ; CHECK-NEXT: [[SELECT2:%.*]] = select i1 [[CMP]], i32 [[Z:%.*]], i32 [[W:%.*]]
1211 ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[SELECT]], [[SELECT2]]
1212 ; CHECK-NEXT: [[RES2:%.*]] = mul i32 [[RES]], [[OR]]
1213 ; CHECK-NEXT: ret i32 [[RES2]]
1215 %and = and i32 %x, 1
1216 %cmp = icmp eq i32 %and, 0
1218 %select = select i1 %cmp, i32 %y, i32 %or
1219 %select2 = select i1 %cmp, i32 %z, i32 %w ; to bump up use count of the cmp
1220 %res = mul i32 %select, %select2
1221 %res2 = mul i32 %res, %or ; to bump up the use count of the or
1225 define i32 @shift_no_xor_multiuse_cmp_xor(i32 %x, i32 %y, i32 %z, i32 %w) {
1226 ; CHECK-LABEL: @shift_no_xor_multiuse_cmp_xor(
1227 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 1
1228 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[AND]], 0
1229 ; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[Y:%.*]], 2
1230 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP]], i32 [[Y]], i32 [[XOR]]
1231 ; CHECK-NEXT: [[SELECT2:%.*]] = select i1 [[CMP]], i32 [[Z:%.*]], i32 [[W:%.*]]
1232 ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[SELECT]], [[SELECT2]]
1233 ; CHECK-NEXT: [[RES2:%.*]] = mul i32 [[RES]], [[XOR]]
1234 ; CHECK-NEXT: ret i32 [[RES2]]
1236 %and = and i32 %x, 1
1237 %cmp = icmp eq i32 %and, 0
1238 %xor = xor i32 %y, 2
1239 %select = select i1 %cmp, i32 %y, i32 %xor
1240 %select2 = select i1 %cmp, i32 %z, i32 %w ; to bump up use count of the cmp
1241 %res = mul i32 %select, %select2
1242 %res2 = mul i32 %res, %xor ; to bump up the use count of the xor
1246 define i32 @shift_no_xor_multiuse_cmp_and(i32 %x, i32 %y, i32 %z, i32 %w) {
1247 ; CHECK-LABEL: @shift_no_xor_multiuse_cmp_and(
1248 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 1
1249 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[AND]], 0
1250 ; CHECK-NEXT: [[AND2:%.*]] = and i32 [[Y:%.*]], -3
1251 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP]], i32 [[Y]], i32 [[AND2]]
1252 ; CHECK-NEXT: [[SELECT2:%.*]] = select i1 [[CMP]], i32 [[Z:%.*]], i32 [[W:%.*]]
1253 ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[SELECT]], [[SELECT2]]
1254 ; CHECK-NEXT: [[RES2:%.*]] = mul i32 [[RES]], [[AND2]]
1255 ; CHECK-NEXT: ret i32 [[RES2]]
1257 %and = and i32 %x, 1
1258 %cmp = icmp eq i32 %and, 0
1259 %and2 = and i32 %y, -3
1260 %select = select i1 %cmp, i32 %y, i32 %and2
1261 %select2 = select i1 %cmp, i32 %z, i32 %w ; to bump up use count of the cmp
1262 %res = mul i32 %select, %select2
1263 %res2 = mul i32 %res, %and2 ; to bump up the use count of the and
1267 define i32 @no_shift_no_xor_multiuse_cmp_or(i32 %x, i32 %y, i32 %z, i32 %w) {
1268 ; CHECK-LABEL: @no_shift_no_xor_multiuse_cmp_or(
1269 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 4096
1270 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[AND]], 0
1271 ; CHECK-NEXT: [[OR:%.*]] = or i32 [[Y:%.*]], 4096
1272 ; CHECK-NEXT: [[TMP1:%.*]] = or i32 [[AND]], [[Y]]
1273 ; CHECK-NEXT: [[SELECT2:%.*]] = select i1 [[CMP]], i32 [[Z:%.*]], i32 [[W:%.*]]
1274 ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[TMP1]], [[SELECT2]]
1275 ; CHECK-NEXT: [[RES2:%.*]] = mul i32 [[RES]], [[OR]]
1276 ; CHECK-NEXT: ret i32 [[RES2]]
1278 %and = and i32 %x, 4096
1279 %cmp = icmp eq i32 %and, 0
1280 %or = or i32 %y, 4096
1281 %select = select i1 %cmp, i32 %y, i32 %or
1282 %select2 = select i1 %cmp, i32 %z, i32 %w ; to bump up use count of the cmp
1283 %res = mul i32 %select, %select2
1284 %res2 = mul i32 %res, %or ; to bump up the use count of the or
1288 define i32 @no_shift_no_xor_multiuse_cmp_xor(i32 %x, i32 %y, i32 %z, i32 %w) {
1289 ; CHECK-LABEL: @no_shift_no_xor_multiuse_cmp_xor(
1290 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 4096
1291 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[AND]], 0
1292 ; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[Y:%.*]], 4096
1293 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP]], i32 [[Y]], i32 [[XOR]]
1294 ; CHECK-NEXT: [[SELECT2:%.*]] = select i1 [[CMP]], i32 [[Z:%.*]], i32 [[W:%.*]]
1295 ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[SELECT]], [[SELECT2]]
1296 ; CHECK-NEXT: [[RES2:%.*]] = mul i32 [[RES]], [[XOR]]
1297 ; CHECK-NEXT: ret i32 [[RES2]]
1299 %and = and i32 %x, 4096
1300 %cmp = icmp eq i32 %and, 0
1301 %xor = xor i32 %y, 4096
1302 %select = select i1 %cmp, i32 %y, i32 %xor
1303 %select2 = select i1 %cmp, i32 %z, i32 %w ; to bump up use count of the cmp
1304 %res = mul i32 %select, %select2
1305 %res2 = mul i32 %res, %xor ; to bump up the use count of the xor
1309 define i32 @no_shift_no_xor_multiuse_cmp_and(i32 %x, i32 %y, i32 %z, i32 %w) {
1310 ; CHECK-LABEL: @no_shift_no_xor_multiuse_cmp_and(
1311 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 4096
1312 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[AND]], 0
1313 ; CHECK-NEXT: [[AND2:%.*]] = and i32 [[Y:%.*]], -4097
1314 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP]], i32 [[Y]], i32 [[AND2]]
1315 ; CHECK-NEXT: [[SELECT2:%.*]] = select i1 [[CMP]], i32 [[Z:%.*]], i32 [[W:%.*]]
1316 ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[SELECT]], [[SELECT2]]
1317 ; CHECK-NEXT: [[RES2:%.*]] = mul i32 [[RES]], [[AND2]]
1318 ; CHECK-NEXT: ret i32 [[RES2]]
1320 %and = and i32 %x, 4096
1321 %cmp = icmp eq i32 %and, 0
1322 %and2 = and i32 %y, -4097
1323 %select = select i1 %cmp, i32 %y, i32 %and2
1324 %select2 = select i1 %cmp, i32 %z, i32 %w ; to bump up use count of the cmp
1325 %res = mul i32 %select, %select2
1326 %res2 = mul i32 %res, %and2 ; to bump up the use count of the and
1330 define i32 @no_shift_xor_multiuse_cmp_or(i32 %x, i32 %y, i32 %z, i32 %w) {
1331 ; CHECK-LABEL: @no_shift_xor_multiuse_cmp_or(
1332 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 4096
1333 ; CHECK-NEXT: [[CMP_NOT:%.*]] = icmp eq i32 [[AND]], 0
1334 ; CHECK-NEXT: [[OR:%.*]] = or i32 [[Y:%.*]], 4096
1335 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP_NOT]], i32 [[OR]], i32 [[Y]]
1336 ; CHECK-NEXT: [[SELECT2:%.*]] = select i1 [[CMP_NOT]], i32 [[W:%.*]], i32 [[Z:%.*]]
1337 ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[SELECT]], [[SELECT2]]
1338 ; CHECK-NEXT: [[RES2:%.*]] = mul i32 [[RES]], [[OR]]
1339 ; CHECK-NEXT: ret i32 [[RES2]]
1341 %and = and i32 %x, 4096
1342 %cmp = icmp ne i32 0, %and
1343 %or = or i32 %y, 4096
1344 %select = select i1 %cmp, i32 %y, i32 %or
1345 %select2 = select i1 %cmp, i32 %z, i32 %w ; to bump up use count of the cmp
1346 %res = mul i32 %select, %select2
1347 %res2 = mul i32 %res, %or ; to bump up the use count of the or
1351 define i32 @no_shift_xor_multiuse_cmp_xor(i32 %x, i32 %y, i32 %z, i32 %w) {
1352 ; CHECK-LABEL: @no_shift_xor_multiuse_cmp_xor(
1353 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 4096
1354 ; CHECK-NEXT: [[CMP_NOT:%.*]] = icmp eq i32 [[AND]], 0
1355 ; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[Y:%.*]], 4096
1356 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP_NOT]], i32 [[XOR]], i32 [[Y]]
1357 ; CHECK-NEXT: [[SELECT2:%.*]] = select i1 [[CMP_NOT]], i32 [[W:%.*]], i32 [[Z:%.*]]
1358 ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[SELECT]], [[SELECT2]]
1359 ; CHECK-NEXT: [[RES2:%.*]] = mul i32 [[RES]], [[XOR]]
1360 ; CHECK-NEXT: ret i32 [[RES2]]
1362 %and = and i32 %x, 4096
1363 %cmp = icmp ne i32 0, %and
1364 %xor = xor i32 %y, 4096
1365 %select = select i1 %cmp, i32 %y, i32 %xor
1366 %select2 = select i1 %cmp, i32 %z, i32 %w ; to bump up use count of the cmp
1367 %res = mul i32 %select, %select2
1368 %res2 = mul i32 %res, %xor ; to bump up the use count of the xor
1372 define i32 @no_shift_xor_multiuse_cmp_and(i32 %x, i32 %y, i32 %z, i32 %w) {
1373 ; CHECK-LABEL: @no_shift_xor_multiuse_cmp_and(
1374 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 4096
1375 ; CHECK-NEXT: [[CMP_NOT:%.*]] = icmp eq i32 [[AND]], 0
1376 ; CHECK-NEXT: [[AND2:%.*]] = and i32 [[Y:%.*]], -4097
1377 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP_NOT]], i32 [[AND2]], i32 [[Y]]
1378 ; CHECK-NEXT: [[SELECT2:%.*]] = select i1 [[CMP_NOT]], i32 [[W:%.*]], i32 [[Z:%.*]]
1379 ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[SELECT]], [[SELECT2]]
1380 ; CHECK-NEXT: [[RES2:%.*]] = mul i32 [[RES]], [[AND2]]
1381 ; CHECK-NEXT: ret i32 [[RES2]]
1383 %and = and i32 %x, 4096
1384 %cmp = icmp ne i32 0, %and
1385 %and2 = and i32 %y, -4097
1386 %select = select i1 %cmp, i32 %y, i32 %and2
1387 %select2 = select i1 %cmp, i32 %z, i32 %w ; to bump up use count of the cmp
1388 %res = mul i32 %select, %select2
1389 %res2 = mul i32 %res, %and2 ; to bump up the use count of the and
1393 define i32 @shift_xor_multiuse_cmp_or(i32 %x, i32 %y, i32 %z, i32 %w) {
1394 ; CHECK-LABEL: @shift_xor_multiuse_cmp_or(
1395 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 4096
1396 ; CHECK-NEXT: [[CMP_NOT:%.*]] = icmp eq i32 [[AND]], 0
1397 ; CHECK-NEXT: [[OR:%.*]] = or i32 [[Y:%.*]], 2048
1398 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP_NOT]], i32 [[OR]], i32 [[Y]]
1399 ; CHECK-NEXT: [[SELECT2:%.*]] = select i1 [[CMP_NOT]], i32 [[W:%.*]], i32 [[Z:%.*]]
1400 ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[SELECT]], [[SELECT2]]
1401 ; CHECK-NEXT: [[RES2:%.*]] = mul i32 [[RES]], [[OR]]
1402 ; CHECK-NEXT: ret i32 [[RES2]]
1404 %and = and i32 %x, 4096
1405 %cmp = icmp ne i32 0, %and
1406 %or = or i32 %y, 2048
1407 %select = select i1 %cmp, i32 %y, i32 %or
1408 %select2 = select i1 %cmp, i32 %z, i32 %w ; to bump up use count of the cmp
1409 %res = mul i32 %select, %select2
1410 %res2 = mul i32 %res, %or ; to bump up the use count of the or
1414 define i32 @shift_xor_multiuse_cmp_xor(i32 %x, i32 %y, i32 %z, i32 %w) {
1415 ; CHECK-LABEL: @shift_xor_multiuse_cmp_xor(
1416 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 4096
1417 ; CHECK-NEXT: [[CMP_NOT:%.*]] = icmp eq i32 [[AND]], 0
1418 ; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[Y:%.*]], 2048
1419 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP_NOT]], i32 [[XOR]], i32 [[Y]]
1420 ; CHECK-NEXT: [[SELECT2:%.*]] = select i1 [[CMP_NOT]], i32 [[W:%.*]], i32 [[Z:%.*]]
1421 ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[SELECT]], [[SELECT2]]
1422 ; CHECK-NEXT: [[RES2:%.*]] = mul i32 [[RES]], [[XOR]]
1423 ; CHECK-NEXT: ret i32 [[RES2]]
1425 %and = and i32 %x, 4096
1426 %cmp = icmp ne i32 0, %and
1427 %xor = xor i32 %y, 2048
1428 %select = select i1 %cmp, i32 %y, i32 %xor
1429 %select2 = select i1 %cmp, i32 %z, i32 %w ; to bump up use count of the cmp
1430 %res = mul i32 %select, %select2
1431 %res2 = mul i32 %res, %xor ; to bump up the use count of the xor
1435 define i32 @shift_xor_multiuse_cmp_and(i32 %x, i32 %y, i32 %z, i32 %w) {
1436 ; CHECK-LABEL: @shift_xor_multiuse_cmp_and(
1437 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 4096
1438 ; CHECK-NEXT: [[CMP_NOT:%.*]] = icmp eq i32 [[AND]], 0
1439 ; CHECK-NEXT: [[AND2:%.*]] = and i32 [[Y:%.*]], 2048
1440 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP_NOT]], i32 [[AND2]], i32 [[Y]]
1441 ; CHECK-NEXT: [[SELECT2:%.*]] = select i1 [[CMP_NOT]], i32 [[W:%.*]], i32 [[Z:%.*]]
1442 ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[SELECT]], [[SELECT2]]
1443 ; CHECK-NEXT: [[RES2:%.*]] = mul i32 [[RES]], [[AND2]]
1444 ; CHECK-NEXT: ret i32 [[RES2]]
1446 %and = and i32 %x, 4096
1447 %cmp = icmp ne i32 0, %and
1448 %and2 = and i32 %y, 2048
1449 %select = select i1 %cmp, i32 %y, i32 %and2
1450 %select2 = select i1 %cmp, i32 %z, i32 %w ; to bump up use count of the cmp
1451 %res = mul i32 %select, %select2
1452 %res2 = mul i32 %res, %and2 ; to bump up the use count of the and
1456 define i8 @set_bits(i8 %x, i1 %b) {
1457 ; CHECK-LABEL: @set_bits(
1458 ; CHECK-NEXT: [[AND:%.*]] = and i8 [[X:%.*]], -6
1459 ; CHECK-NEXT: [[MASKSEL:%.*]] = select i1 [[B:%.*]], i8 5, i8 0
1460 ; CHECK-NEXT: [[COND:%.*]] = or i8 [[AND]], [[MASKSEL]]
1461 ; CHECK-NEXT: ret i8 [[COND]]
1463 %and = and i8 %x, 250
1465 %cond = select i1 %b, i8 %or, i8 %and
1471 define i8 @set_bits_not_inverse_constant(i8 %x, i1 %b) {
1472 ; CHECK-LABEL: @set_bits_not_inverse_constant(
1473 ; CHECK-NEXT: [[AND:%.*]] = and i8 [[X:%.*]], -6
1474 ; CHECK-NEXT: [[OR:%.*]] = or i8 [[X]], 7
1475 ; CHECK-NEXT: [[COND:%.*]] = select i1 [[B:%.*]], i8 [[OR]], i8 [[AND]]
1476 ; CHECK-NEXT: ret i8 [[COND]]
1478 %and = and i8 %x, 250
1480 %cond = select i1 %b, i8 %or, i8 %and
1484 define i8 @set_bits_extra_use1(i8 %x, i1 %b) {
1485 ; CHECK-LABEL: @set_bits_extra_use1(
1486 ; CHECK-NEXT: [[AND:%.*]] = and i8 [[X:%.*]], -6
1487 ; CHECK-NEXT: call void @use(i8 [[AND]])
1488 ; CHECK-NEXT: [[MASKSEL:%.*]] = select i1 [[B:%.*]], i8 5, i8 0
1489 ; CHECK-NEXT: [[COND:%.*]] = or i8 [[AND]], [[MASKSEL]]
1490 ; CHECK-NEXT: ret i8 [[COND]]
1492 %and = and i8 %x, 250
1493 call void @use(i8 %and)
1495 %cond = select i1 %b, i8 %or, i8 %and
1501 define i8 @set_bits_extra_use2(i8 %x, i1 %b) {
1502 ; CHECK-LABEL: @set_bits_extra_use2(
1503 ; CHECK-NEXT: [[AND:%.*]] = and i8 [[X:%.*]], -6
1504 ; CHECK-NEXT: [[OR:%.*]] = or i8 [[X]], 5
1505 ; CHECK-NEXT: call void @use(i8 [[OR]])
1506 ; CHECK-NEXT: [[COND:%.*]] = select i1 [[B:%.*]], i8 [[OR]], i8 [[AND]]
1507 ; CHECK-NEXT: ret i8 [[COND]]
1509 %and = and i8 %x, 250
1511 call void @use(i8 %or)
1512 %cond = select i1 %b, i8 %or, i8 %and
1516 define <2 x i8> @clear_bits(<2 x i8> %x, <2 x i1> %b) {
1517 ; CHECK-LABEL: @clear_bits(
1518 ; CHECK-NEXT: [[AND:%.*]] = and <2 x i8> [[X:%.*]], <i8 37, i8 37>
1519 ; CHECK-NEXT: [[MASKSEL:%.*]] = select <2 x i1> [[B:%.*]], <2 x i8> zeroinitializer, <2 x i8> <i8 -38, i8 -38>
1520 ; CHECK-NEXT: [[COND:%.*]] = or <2 x i8> [[AND]], [[MASKSEL]]
1521 ; CHECK-NEXT: ret <2 x i8> [[COND]]
1523 %and = and <2 x i8> %x, <i8 37, i8 37>
1524 %or = or <2 x i8> %x, <i8 218, i8 218>
1525 %cond = select <2 x i1> %b, <2 x i8> %and, <2 x i8> %or
1531 define <2 x i8> @clear_bits_not_inverse_constant(<2 x i8> %x, <2 x i1> %b) {
1532 ; CHECK-LABEL: @clear_bits_not_inverse_constant(
1533 ; CHECK-NEXT: [[AND:%.*]] = and <2 x i8> [[X:%.*]], <i8 undef, i8 37>
1534 ; CHECK-NEXT: [[OR:%.*]] = or <2 x i8> [[X]], <i8 -38, i8 -38>
1535 ; CHECK-NEXT: [[COND:%.*]] = select <2 x i1> [[B:%.*]], <2 x i8> [[AND]], <2 x i8> [[OR]]
1536 ; CHECK-NEXT: ret <2 x i8> [[COND]]
1538 %and = and <2 x i8> %x, <i8 undef, i8 37>
1539 %or = or <2 x i8> %x, <i8 218, i8 218>
1540 %cond = select <2 x i1> %b, <2 x i8> %and, <2 x i8> %or
1544 define <2 x i8> @clear_bits_extra_use1(<2 x i8> %x, i1 %b) {
1545 ; CHECK-LABEL: @clear_bits_extra_use1(
1546 ; CHECK-NEXT: [[AND:%.*]] = and <2 x i8> [[X:%.*]], <i8 37, i8 37>
1547 ; CHECK-NEXT: call void @use_vec(<2 x i8> [[AND]])
1548 ; CHECK-NEXT: [[MASKSEL:%.*]] = select i1 [[B:%.*]], <2 x i8> zeroinitializer, <2 x i8> <i8 -38, i8 -38>
1549 ; CHECK-NEXT: [[COND:%.*]] = or <2 x i8> [[AND]], [[MASKSEL]]
1550 ; CHECK-NEXT: ret <2 x i8> [[COND]]
1552 %and = and <2 x i8> %x, <i8 37, i8 37>
1553 call void @use_vec(<2 x i8> %and)
1554 %or = or <2 x i8> %x, <i8 218, i8 218>
1555 %cond = select i1 %b, <2 x i8> %and, <2 x i8> %or
1561 define i8 @clear_bits_extra_use2(i8 %x, i1 %b) {
1562 ; CHECK-LABEL: @clear_bits_extra_use2(
1563 ; CHECK-NEXT: [[AND:%.*]] = and i8 [[X:%.*]], -6
1564 ; CHECK-NEXT: [[OR:%.*]] = or i8 [[X]], 5
1565 ; CHECK-NEXT: call void @use(i8 [[OR]])
1566 ; CHECK-NEXT: [[COND:%.*]] = select i1 [[B:%.*]], i8 [[AND]], i8 [[OR]]
1567 ; CHECK-NEXT: ret i8 [[COND]]
1569 %and = and i8 %x, 250
1571 call void @use(i8 %or)
1572 %cond = select i1 %b, i8 %and, i8 %or