1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -instcombine -S | FileCheck %s
7 define i32 @test1(i32 %A) {
9 ; CHECK-NEXT: ret i32 [[A:%.*]]
16 define i1 @invert_icmp(i32 %A, i32 %B) {
17 ; CHECK-LABEL: @invert_icmp(
18 ; CHECK-NEXT: [[CMP_NOT:%.*]] = icmp sgt i32 [[A:%.*]], [[B:%.*]]
19 ; CHECK-NEXT: ret i1 [[CMP_NOT]]
21 %cmp = icmp sle i32 %A, %B
22 %not = xor i1 %cmp, true
28 define i1 @invert_fcmp(float %X, float %Y) {
29 ; CHECK-LABEL: @invert_fcmp(
30 ; CHECK-NEXT: [[CMP:%.*]] = fcmp uge float [[X:%.*]], [[Y:%.*]]
31 ; CHECK-NEXT: ret i1 [[CMP]]
33 %cmp = fcmp olt float %X, %Y
34 %not = xor i1 %cmp, true
40 define i1 @not_not_cmp(i32 %a, i32 %b) {
41 ; CHECK-LABEL: @not_not_cmp(
42 ; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[B:%.*]], [[A:%.*]]
43 ; CHECK-NEXT: ret i1 [[CMP]]
45 %nota = xor i32 %a, -1
46 %notb = xor i32 %b, -1
47 %cmp = icmp slt i32 %nota, %notb
51 define <2 x i1> @not_not_cmp_vector(<2 x i32> %a, <2 x i32> %b) {
52 ; CHECK-LABEL: @not_not_cmp_vector(
53 ; CHECK-NEXT: [[CMP:%.*]] = icmp ugt <2 x i32> [[B:%.*]], [[A:%.*]]
54 ; CHECK-NEXT: ret <2 x i1> [[CMP]]
56 %nota = xor <2 x i32> %a, <i32 -1, i32 -1>
57 %notb = xor <2 x i32> %b, <i32 -1, i32 -1>
58 %cmp = icmp ugt <2 x i32> %nota, %notb
62 define i1 @not_cmp_constant(i32 %a) {
63 ; CHECK-LABEL: @not_cmp_constant(
64 ; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 [[A:%.*]], -43
65 ; CHECK-NEXT: ret i1 [[CMP]]
67 %nota = xor i32 %a, -1
68 %cmp = icmp ugt i32 %nota, 42
72 define <2 x i1> @not_cmp_constant_vector(<2 x i32> %a) {
73 ; CHECK-LABEL: @not_cmp_constant_vector(
74 ; CHECK-NEXT: [[CMP:%.*]] = icmp sgt <2 x i32> [[A:%.*]], <i32 -43, i32 -43>
75 ; CHECK-NEXT: ret <2 x i1> [[CMP]]
77 %nota = xor <2 x i32> %a, <i32 -1, i32 -1>
78 %cmp = icmp slt <2 x i32> %nota, <i32 42, i32 42>
82 define <2 x i1> @test7(<2 x i32> %A, <2 x i32> %B) {
83 ; CHECK-LABEL: @test7(
84 ; CHECK-NEXT: [[COND_NOT:%.*]] = icmp sgt <2 x i32> [[A:%.*]], [[B:%.*]]
85 ; CHECK-NEXT: ret <2 x i1> [[COND_NOT]]
87 %cond = icmp sle <2 x i32> %A, %B
88 %Ret = xor <2 x i1> %cond, <i1 true, i1 true>
92 define i32 @not_ashr_not(i32 %A, i32 %B) {
93 ; CHECK-LABEL: @not_ashr_not(
94 ; CHECK-NEXT: [[NOT1_NOT:%.*]] = ashr i32 [[A:%.*]], [[B:%.*]]
95 ; CHECK-NEXT: ret i32 [[NOT1_NOT]]
97 %not1 = xor i32 %A, -1
98 %ashr = ashr i32 %not1, %B
99 %not2 = xor i32 %ashr, -1
103 define i8 @not_ashr_const(i8 %x) {
104 ; CHECK-LABEL: @not_ashr_const(
105 ; CHECK-NEXT: [[NOT:%.*]] = lshr i8 41, [[X:%.*]]
106 ; CHECK-NEXT: ret i8 [[NOT]]
108 %shr = ashr i8 -42, %x
109 %not = xor i8 %shr, -1
113 define <2 x i8> @not_ashr_const_splat(<2 x i8> %x) {
114 ; CHECK-LABEL: @not_ashr_const_splat(
115 ; CHECK-NEXT: [[NOT:%.*]] = lshr <2 x i8> <i8 41, i8 41>, [[X:%.*]]
116 ; CHECK-NEXT: ret <2 x i8> [[NOT]]
118 %shr = ashr <2 x i8> <i8 -42, i8 -42>, %x
119 %not = xor <2 x i8> %shr, <i8 -1, i8 -1>
123 ; We can't get rid of the 'not' on a logical shift of a negative constant.
125 define i8 @not_lshr_const_negative(i8 %x) {
126 ; CHECK-LABEL: @not_lshr_const_negative(
127 ; CHECK-NEXT: [[SHR:%.*]] = lshr i8 -42, [[X:%.*]]
128 ; CHECK-NEXT: [[NOT:%.*]] = xor i8 [[SHR]], -1
129 ; CHECK-NEXT: ret i8 [[NOT]]
131 %shr = lshr i8 -42, %x
132 %not = xor i8 %shr, -1
136 define i8 @not_lshr_const(i8 %x) {
137 ; CHECK-LABEL: @not_lshr_const(
138 ; CHECK-NEXT: [[NOT:%.*]] = ashr i8 -43, [[X:%.*]]
139 ; CHECK-NEXT: ret i8 [[NOT]]
141 %shr = lshr i8 42, %x
142 %not = xor i8 %shr, -1
146 define <2 x i8> @not_lshr_const_splat(<2 x i8> %x) {
147 ; CHECK-LABEL: @not_lshr_const_splat(
148 ; CHECK-NEXT: [[NOT:%.*]] = ashr <2 x i8> <i8 -43, i8 -43>, [[X:%.*]]
149 ; CHECK-NEXT: ret <2 x i8> [[NOT]]
151 %shr = lshr <2 x i8> <i8 42, i8 42>, %x
152 %not = xor <2 x i8> %shr, <i8 -1, i8 -1>
156 define i32 @not_sub(i32 %y) {
157 ; CHECK-LABEL: @not_sub(
158 ; CHECK-NEXT: [[R:%.*]] = add i32 [[Y:%.*]], -124
159 ; CHECK-NEXT: ret i32 [[R]]
166 define i32 @not_sub_extra_use(i32 %y, i32* %p) {
167 ; CHECK-LABEL: @not_sub_extra_use(
168 ; CHECK-NEXT: [[S:%.*]] = sub i32 123, [[Y:%.*]]
169 ; CHECK-NEXT: store i32 [[S]], i32* [[P:%.*]], align 4
170 ; CHECK-NEXT: [[R:%.*]] = add i32 [[Y]], -124
171 ; CHECK-NEXT: ret i32 [[R]]
174 store i32 %s, i32* %p
179 define <2 x i32> @not_sub_splat(<2 x i32> %y) {
180 ; CHECK-LABEL: @not_sub_splat(
181 ; CHECK-NEXT: [[R:%.*]] = add <2 x i32> [[Y:%.*]], <i32 -124, i32 -124>
182 ; CHECK-NEXT: ret <2 x i32> [[R]]
184 %s = sub <2 x i32> <i32 123, i32 123>, %y
185 %r = xor <2 x i32> %s, <i32 -1, i32 -1>
189 define <2 x i32> @not_sub_extra_use_splat(<2 x i32> %y, <2 x i32>* %p) {
190 ; CHECK-LABEL: @not_sub_extra_use_splat(
191 ; CHECK-NEXT: [[S:%.*]] = sub <2 x i32> <i32 123, i32 123>, [[Y:%.*]]
192 ; CHECK-NEXT: store <2 x i32> [[S]], <2 x i32>* [[P:%.*]], align 8
193 ; CHECK-NEXT: [[R:%.*]] = add <2 x i32> [[Y]], <i32 -124, i32 -124>
194 ; CHECK-NEXT: ret <2 x i32> [[R]]
196 %s = sub <2 x i32> <i32 123, i32 123>, %y
197 store <2 x i32> %s, <2 x i32>* %p
198 %r = xor <2 x i32> %s, <i32 -1, i32 -1>
202 define <2 x i32> @not_sub_vec(<2 x i32> %y) {
203 ; CHECK-LABEL: @not_sub_vec(
204 ; CHECK-NEXT: [[R:%.*]] = add <2 x i32> [[Y:%.*]], <i32 -43, i32 -124>
205 ; CHECK-NEXT: ret <2 x i32> [[R]]
207 %s = sub <2 x i32> <i32 42, i32 123>, %y
208 %r = xor <2 x i32> %s, <i32 -1, i32 -1>
212 define <2 x i32> @not_sub_extra_use_vec(<2 x i32> %y, <2 x i32>* %p) {
213 ; CHECK-LABEL: @not_sub_extra_use_vec(
214 ; CHECK-NEXT: [[S:%.*]] = sub <2 x i32> <i32 123, i32 42>, [[Y:%.*]]
215 ; CHECK-NEXT: store <2 x i32> [[S]], <2 x i32>* [[P:%.*]], align 8
216 ; CHECK-NEXT: [[R:%.*]] = add <2 x i32> [[Y]], <i32 -124, i32 -43>
217 ; CHECK-NEXT: ret <2 x i32> [[R]]
219 %s = sub <2 x i32> <i32 123, i32 42>, %y
220 store <2 x i32> %s, <2 x i32>* %p
221 %r = xor <2 x i32> %s, <i32 -1, i32 -1>
225 ; ~(X + C) --> -X - C - 1 --> -(C + 1) - X
227 define i32 @not_add(i32 %x) {
228 ; CHECK-LABEL: @not_add(
229 ; CHECK-NEXT: [[R:%.*]] = sub i32 -124, [[X:%.*]]
230 ; CHECK-NEXT: ret i32 [[R]]
237 define <2 x i32> @not_add_splat(<2 x i32> %x) {
238 ; CHECK-LABEL: @not_add_splat(
239 ; CHECK-NEXT: [[R:%.*]] = sub <2 x i32> <i32 -124, i32 -124>, [[X:%.*]]
240 ; CHECK-NEXT: ret <2 x i32> [[R]]
242 %a = add <2 x i32> %x, <i32 123, i32 123>
243 %r = xor <2 x i32> %a, <i32 -1, i32 -1>
247 define <2 x i32> @not_add_vec(<2 x i32> %x) {
248 ; CHECK-LABEL: @not_add_vec(
249 ; CHECK-NEXT: [[R:%.*]] = sub <2 x i32> <i32 -43, i32 -124>, [[X:%.*]]
250 ; CHECK-NEXT: ret <2 x i32> [[R]]
252 %a = add <2 x i32> %x, <i32 42, i32 123>
253 %r = xor <2 x i32> %a, <i32 -1, i32 -1>
257 define i1 @not_select_cmp_cmp(i32 %x, i32 %y, float %z, float %w, i1 %cond) {
258 ; CHECK-LABEL: @not_select_cmp_cmp(
259 ; CHECK-NEXT: [[CMPT:%.*]] = icmp sgt i32 [[X:%.*]], [[Y:%.*]]
260 ; CHECK-NEXT: [[CMPF:%.*]] = fcmp ole float [[Z:%.*]], [[W:%.*]]
261 ; CHECK-NEXT: [[SEL:%.*]] = select i1 [[COND:%.*]], i1 [[CMPT]], i1 [[CMPF]]
262 ; CHECK-NEXT: ret i1 [[SEL]]
264 %cmpt = icmp sle i32 %x, %y
265 %cmpf = fcmp ugt float %z, %w
266 %sel = select i1 %cond, i1 %cmpt, i1 %cmpf
267 %not = xor i1 %sel, true
271 ; TODO: Missed canonicalization - hoist 'not'?
273 define i1 @not_select_cmp_cmp_extra_use1(i32 %x, i32 %y, float %z, float %w, i1 %cond) {
274 ; CHECK-LABEL: @not_select_cmp_cmp_extra_use1(
275 ; CHECK-NEXT: [[CMPT:%.*]] = icmp sle i32 [[X:%.*]], [[Y:%.*]]
276 ; CHECK-NEXT: call void @use1(i1 [[CMPT]])
277 ; CHECK-NEXT: [[CMPF:%.*]] = fcmp ugt float [[Z:%.*]], [[W:%.*]]
278 ; CHECK-NEXT: [[SEL:%.*]] = select i1 [[COND:%.*]], i1 [[CMPT]], i1 [[CMPF]]
279 ; CHECK-NEXT: [[NOT:%.*]] = xor i1 [[SEL]], true
280 ; CHECK-NEXT: ret i1 [[NOT]]
282 %cmpt = icmp sle i32 %x, %y
283 call void @use1(i1 %cmpt)
284 %cmpf = fcmp ugt float %z, %w
285 %sel = select i1 %cond, i1 %cmpt, i1 %cmpf
286 %not = xor i1 %sel, true
290 ; TODO: Missed canonicalization - hoist 'not'?
292 define i1 @not_select_cmp_cmp_extra_use2(i32 %x, i32 %y, float %z, float %w, i1 %cond) {
293 ; CHECK-LABEL: @not_select_cmp_cmp_extra_use2(
294 ; CHECK-NEXT: [[CMPT:%.*]] = icmp sle i32 [[X:%.*]], [[Y:%.*]]
295 ; CHECK-NEXT: [[CMPF:%.*]] = fcmp ugt float [[Z:%.*]], [[W:%.*]]
296 ; CHECK-NEXT: call void @use1(i1 [[CMPF]])
297 ; CHECK-NEXT: [[SEL:%.*]] = select i1 [[COND:%.*]], i1 [[CMPT]], i1 [[CMPF]]
298 ; CHECK-NEXT: [[NOT:%.*]] = xor i1 [[SEL]], true
299 ; CHECK-NEXT: ret i1 [[NOT]]
301 %cmpt = icmp sle i32 %x, %y
302 %cmpf = fcmp ugt float %z, %w
303 call void @use1(i1 %cmpf)
304 %sel = select i1 %cond, i1 %cmpt, i1 %cmpf
305 %not = xor i1 %sel, true
309 ; Negative test - extra uses would require more instructions.
311 define i1 @not_select_cmp_cmp_extra_use3(i32 %x, i32 %y, float %z, float %w, i1 %cond) {
312 ; CHECK-LABEL: @not_select_cmp_cmp_extra_use3(
313 ; CHECK-NEXT: [[CMPT:%.*]] = icmp sle i32 [[X:%.*]], [[Y:%.*]]
314 ; CHECK-NEXT: call void @use1(i1 [[CMPT]])
315 ; CHECK-NEXT: [[CMPF:%.*]] = fcmp ugt float [[Z:%.*]], [[W:%.*]]
316 ; CHECK-NEXT: call void @use1(i1 [[CMPF]])
317 ; CHECK-NEXT: [[SEL:%.*]] = select i1 [[COND:%.*]], i1 [[CMPT]], i1 [[CMPF]]
318 ; CHECK-NEXT: [[NOT:%.*]] = xor i1 [[SEL]], true
319 ; CHECK-NEXT: ret i1 [[NOT]]
321 %cmpt = icmp sle i32 %x, %y
322 call void @use1(i1 %cmpt)
323 %cmpf = fcmp ugt float %z, %w
324 call void @use1(i1 %cmpf)
325 %sel = select i1 %cond, i1 %cmpt, i1 %cmpf
326 %not = xor i1 %sel, true
330 ; Negative test - extra uses would require more instructions.
332 define i1 @not_select_cmp_cmp_extra_use4(i32 %x, i32 %y, float %z, float %w, i1 %cond) {
333 ; CHECK-LABEL: @not_select_cmp_cmp_extra_use4(
334 ; CHECK-NEXT: [[CMPT:%.*]] = icmp sle i32 [[X:%.*]], [[Y:%.*]]
335 ; CHECK-NEXT: [[CMPF:%.*]] = fcmp ugt float [[Z:%.*]], [[W:%.*]]
336 ; CHECK-NEXT: [[SEL:%.*]] = select i1 [[COND:%.*]], i1 [[CMPT]], i1 [[CMPF]]
337 ; CHECK-NEXT: call void @use1(i1 [[SEL]])
338 ; CHECK-NEXT: [[NOT:%.*]] = xor i1 [[SEL]], true
339 ; CHECK-NEXT: ret i1 [[NOT]]
341 %cmpt = icmp sle i32 %x, %y
342 %cmpf = fcmp ugt float %z, %w
343 %sel = select i1 %cond, i1 %cmpt, i1 %cmpf
344 call void @use1(i1 %sel)
345 %not = xor i1 %sel, true
349 ; TODO: Missed canonicalization - hoist 'not'?
351 define i1 @not_select_cmpt(double %x, double %y, i1 %z, i1 %cond) {
352 ; CHECK-LABEL: @not_select_cmpt(
353 ; CHECK-NEXT: [[CMPT:%.*]] = fcmp oeq double [[X:%.*]], [[Y:%.*]]
354 ; CHECK-NEXT: [[SEL:%.*]] = select i1 [[COND:%.*]], i1 [[CMPT]], i1 [[Z:%.*]]
355 ; CHECK-NEXT: [[NOT:%.*]] = xor i1 [[SEL]], true
356 ; CHECK-NEXT: ret i1 [[NOT]]
358 %cmpt = fcmp oeq double %x, %y
359 %sel = select i1 %cond, i1 %cmpt, i1 %z
360 %not = xor i1 %sel, true
364 ; TODO: Missed canonicalization - hoist 'not'?
366 define i1 @not_select_cmpf(i1 %x, i32 %z, i32 %w, i1 %cond) {
367 ; CHECK-LABEL: @not_select_cmpf(
368 ; CHECK-NEXT: [[CMPF:%.*]] = icmp ugt i32 [[Z:%.*]], [[W:%.*]]
369 ; CHECK-NEXT: [[SEL:%.*]] = select i1 [[COND:%.*]], i1 [[X:%.*]], i1 [[CMPF]]
370 ; CHECK-NEXT: [[NOT:%.*]] = xor i1 [[SEL]], true
371 ; CHECK-NEXT: ret i1 [[NOT]]
373 %cmpf = icmp ugt i32 %z, %w
374 %sel = select i1 %cond, i1 %x, i1 %cmpf
375 %not = xor i1 %sel, true
379 define i1 @not_select_cmpt_extra_use(double %x, double %y, i1 %z, i1 %cond) {
380 ; CHECK-LABEL: @not_select_cmpt_extra_use(
381 ; CHECK-NEXT: [[CMPT:%.*]] = fcmp oeq double [[X:%.*]], [[Y:%.*]]
382 ; CHECK-NEXT: call void @use1(i1 [[CMPT]])
383 ; CHECK-NEXT: [[SEL:%.*]] = select i1 [[COND:%.*]], i1 [[CMPT]], i1 [[Z:%.*]]
384 ; CHECK-NEXT: [[NOT:%.*]] = xor i1 [[SEL]], true
385 ; CHECK-NEXT: ret i1 [[NOT]]
387 %cmpt = fcmp oeq double %x, %y
388 call void @use1(i1 %cmpt)
389 %sel = select i1 %cond, i1 %cmpt, i1 %z
390 %not = xor i1 %sel, true
394 define i1 @not_select_cmpf_extra_use(i1 %x, i32 %z, i32 %w, i1 %cond) {
395 ; CHECK-LABEL: @not_select_cmpf_extra_use(
396 ; CHECK-NEXT: [[CMPF:%.*]] = icmp ugt i32 [[Z:%.*]], [[W:%.*]]
397 ; CHECK-NEXT: call void @use1(i1 [[CMPF]])
398 ; CHECK-NEXT: [[SEL:%.*]] = select i1 [[COND:%.*]], i1 [[X:%.*]], i1 [[CMPF]]
399 ; CHECK-NEXT: [[NOT:%.*]] = xor i1 [[SEL]], true
400 ; CHECK-NEXT: ret i1 [[NOT]]
402 %cmpf = icmp ugt i32 %z, %w
403 call void @use1(i1 %cmpf)
404 %sel = select i1 %cond, i1 %x, i1 %cmpf
405 %not = xor i1 %sel, true
409 define i8 @not_or_neg(i8 %x, i8 %y) {
410 ; CHECK-LABEL: @not_or_neg(
411 ; CHECK-NEXT: [[TMP1:%.*]] = add i8 [[Y:%.*]], -1
412 ; CHECK-NEXT: [[TMP2:%.*]] = xor i8 [[X:%.*]], -1
413 ; CHECK-NEXT: [[NOT:%.*]] = and i8 [[TMP1]], [[TMP2]]
414 ; CHECK-NEXT: ret i8 [[NOT]]
422 define <3 x i5> @not_or_neg_commute_vec(<3 x i5> %x, <3 x i5> %p) {
423 ; CHECK-LABEL: @not_or_neg_commute_vec(
424 ; CHECK-NEXT: [[Y:%.*]] = mul <3 x i5> [[P:%.*]], <i5 1, i5 2, i5 3>
425 ; CHECK-NEXT: [[TMP1:%.*]] = add <3 x i5> [[X:%.*]], <i5 -1, i5 -1, i5 -1>
426 ; CHECK-NEXT: [[TMP2:%.*]] = xor <3 x i5> [[Y]], <i5 -1, i5 -1, i5 -1>
427 ; CHECK-NEXT: [[NOT:%.*]] = and <3 x i5> [[TMP1]], [[TMP2]]
428 ; CHECK-NEXT: ret <3 x i5> [[NOT]]
430 %y = mul <3 x i5> %p, <i5 1, i5 2, i5 3> ; thwart complexity-based-canonicalization
431 %s = sub <3 x i5> <i5 0, i5 0, i5 undef>, %x
432 %o = or <3 x i5> %y, %s
433 %not = xor <3 x i5> %o, <i5 -1, i5 undef, i5 -1>
439 define i8 @not_or_neg_use1(i8 %x, i8 %y) {
440 ; CHECK-LABEL: @not_or_neg_use1(
441 ; CHECK-NEXT: [[S:%.*]] = sub i8 0, [[Y:%.*]]
442 ; CHECK-NEXT: call void @use8(i8 [[S]])
443 ; CHECK-NEXT: [[O:%.*]] = or i8 [[S]], [[X:%.*]]
444 ; CHECK-NEXT: [[NOT:%.*]] = xor i8 [[O]], -1
445 ; CHECK-NEXT: ret i8 [[NOT]]
448 call void @use8(i8 %s)
456 define i8 @not_or_neg_use2(i8 %x, i8 %y) {
457 ; CHECK-LABEL: @not_or_neg_use2(
458 ; CHECK-NEXT: [[S:%.*]] = sub i8 0, [[Y:%.*]]
459 ; CHECK-NEXT: [[O:%.*]] = or i8 [[S]], [[X:%.*]]
460 ; CHECK-NEXT: call void @use8(i8 [[O]])
461 ; CHECK-NEXT: [[NOT:%.*]] = xor i8 [[O]], -1
462 ; CHECK-NEXT: ret i8 [[NOT]]
466 call void @use8(i8 %o)
471 define i1 @not_select_bool(i1 %x, i1 %y, i1 %z) {
472 ; CHECK-LABEL: @not_select_bool(
473 ; CHECK-NEXT: [[SEL:%.*]] = select i1 [[X:%.*]], i1 [[Y:%.*]], i1 [[Z:%.*]]
474 ; CHECK-NEXT: [[R:%.*]] = xor i1 [[SEL]], true
475 ; CHECK-NEXT: ret i1 [[R]]
477 %sel = select i1 %x, i1 %y, i1 %z
478 %r = xor i1 %sel, true
482 define i1 @not_select_bool_const1(i1 %x, i1 %y) {
483 ; CHECK-LABEL: @not_select_bool_const1(
484 ; CHECK-NEXT: [[NOT_X:%.*]] = xor i1 [[X:%.*]], true
485 ; CHECK-NEXT: [[SEL:%.*]] = select i1 [[NOT_X]], i1 true, i1 [[Y:%.*]]
486 ; CHECK-NEXT: [[R:%.*]] = xor i1 [[SEL]], true
487 ; CHECK-NEXT: ret i1 [[R]]
489 %sel = select i1 %x, i1 %y, i1 true
490 %r = xor i1 %sel, true
494 define i1 @not_select_bool_const2(i1 %x, i1 %y) {
495 ; CHECK-LABEL: @not_select_bool_const2(
496 ; CHECK-NEXT: [[SEL:%.*]] = select i1 [[X:%.*]], i1 [[Y:%.*]], i1 false
497 ; CHECK-NEXT: [[R:%.*]] = xor i1 [[SEL]], true
498 ; CHECK-NEXT: ret i1 [[R]]
500 %sel = select i1 %x, i1 %y, i1 false
501 %r = xor i1 %sel, true
505 define i1 @not_select_bool_const3(i1 %x, i1 %y) {
506 ; CHECK-LABEL: @not_select_bool_const3(
507 ; CHECK-NEXT: [[SEL:%.*]] = select i1 [[X:%.*]], i1 true, i1 [[Y:%.*]]
508 ; CHECK-NEXT: [[R:%.*]] = xor i1 [[SEL]], true
509 ; CHECK-NEXT: ret i1 [[R]]
511 %sel = select i1 %x, i1 true, i1 %y
512 %r = xor i1 %sel, true
516 define i1 @not_select_bool_const4(i1 %x, i1 %y) {
517 ; CHECK-LABEL: @not_select_bool_const4(
518 ; CHECK-NEXT: [[NOT_X:%.*]] = xor i1 [[X:%.*]], true
519 ; CHECK-NEXT: [[SEL:%.*]] = select i1 [[NOT_X]], i1 [[Y:%.*]], i1 false
520 ; CHECK-NEXT: [[R:%.*]] = xor i1 [[SEL]], true
521 ; CHECK-NEXT: ret i1 [[R]]
523 %sel = select i1 %x, i1 false, i1 %y
524 %r = xor i1 %sel, true