1 ; NOTE: This test case is borrowed from undef-ops.ll
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
4 define i32 @add_poison_rhs(i32 %x) {
5 ; CHECK-LABEL: add_poison_rhs:
8 %r = add i32 %x, poison
12 define <4 x i32> @add_poison_rhs_vec(<4 x i32> %x) {
13 ; CHECK-LABEL: add_poison_rhs_vec:
16 %r = add <4 x i32> %x, poison
20 define i32 @add_poison_lhs(i32 %x) {
21 ; CHECK-LABEL: add_poison_lhs:
24 %r = add i32 poison, %x
28 define <4 x i32> @add_poison_lhs_vec(<4 x i32> %x) {
29 ; CHECK-LABEL: add_poison_lhs_vec:
32 %r = add <4 x i32> poison, %x
36 define i32 @sub_poison_rhs(i32 %x) {
37 ; CHECK-LABEL: sub_poison_rhs:
40 %r = sub i32 %x, poison
44 define <4 x i32> @sub_poison_rhs_vec(<4 x i32> %x) {
45 ; CHECK-LABEL: sub_poison_rhs_vec:
48 %r = sub <4 x i32> %x, poison
52 define i32 @sub_poison_lhs(i32 %x) {
53 ; CHECK-LABEL: sub_poison_lhs:
56 %r = sub i32 poison, %x
60 define <4 x i32> @sub_poison_lhs_vec(<4 x i32> %x) {
61 ; CHECK-LABEL: sub_poison_lhs_vec:
64 %r = sub <4 x i32> poison, %x
68 define i32 @mul_poison_rhs(i32 %x) {
69 ; CHECK-LABEL: mul_poison_rhs:
71 ; CHECK-NEXT: xorl %eax, %eax
73 %r = mul i32 %x, poison
77 define <4 x i32> @mul_poison_rhs_vec(<4 x i32> %x) {
78 ; CHECK-LABEL: mul_poison_rhs_vec:
80 ; CHECK-NEXT: xorps %xmm0, %xmm0
82 %r = mul <4 x i32> %x, poison
86 define i32 @mul_poison_lhs(i32 %x) {
87 ; CHECK-LABEL: mul_poison_lhs:
89 ; CHECK-NEXT: xorl %eax, %eax
91 %r = mul i32 poison, %x
95 define <4 x i32> @mul_poison_lhs_vec(<4 x i32> %x) {
96 ; CHECK-LABEL: mul_poison_lhs_vec:
98 ; CHECK-NEXT: xorps %xmm0, %xmm0
100 %r = mul <4 x i32> poison, %x
104 define i32 @sdiv_poison_rhs(i32 %x) {
105 ; CHECK-LABEL: sdiv_poison_rhs:
108 %r = sdiv i32 %x, poison
112 define <4 x i32> @sdiv_poison_rhs_vec(<4 x i32> %x) {
113 ; CHECK-LABEL: sdiv_poison_rhs_vec:
116 %r = sdiv <4 x i32> %x, poison
120 define i32 @sdiv_poison_lhs(i32 %x) {
121 ; CHECK-LABEL: sdiv_poison_lhs:
123 ; CHECK-NEXT: xorl %eax, %eax
125 %r = sdiv i32 poison, %x
129 define <4 x i32> @sdiv_poison_lhs_vec(<4 x i32> %x) {
130 ; CHECK-LABEL: sdiv_poison_lhs_vec:
132 ; CHECK-NEXT: xorps %xmm0, %xmm0
134 %r = sdiv <4 x i32> poison, %x
138 define i32 @udiv_poison_rhs(i32 %x) {
139 ; CHECK-LABEL: udiv_poison_rhs:
142 %r = udiv i32 %x, poison
146 define <4 x i32> @udiv_poison_rhs_vec(<4 x i32> %x) {
147 ; CHECK-LABEL: udiv_poison_rhs_vec:
150 %r = udiv <4 x i32> %x, poison
154 define i32 @udiv_poison_lhs(i32 %x) {
155 ; CHECK-LABEL: udiv_poison_lhs:
157 ; CHECK-NEXT: xorl %eax, %eax
159 %r = udiv i32 poison, %x
163 define <4 x i32> @udiv_poison_lhs_vec(<4 x i32> %x) {
164 ; CHECK-LABEL: udiv_poison_lhs_vec:
166 ; CHECK-NEXT: xorps %xmm0, %xmm0
168 %r = udiv <4 x i32> poison, %x
172 define i32 @srem_poison_rhs(i32 %x) {
173 ; CHECK-LABEL: srem_poison_rhs:
176 %r = srem i32 %x, poison
180 define <4 x i32> @srem_poison_rhs_vec(<4 x i32> %x) {
181 ; CHECK-LABEL: srem_poison_rhs_vec:
184 %r = srem <4 x i32> %x, poison
188 define i32 @srem_poison_lhs(i32 %x) {
189 ; CHECK-LABEL: srem_poison_lhs:
191 ; CHECK-NEXT: xorl %eax, %eax
193 %r = srem i32 poison, %x
197 define <4 x i32> @srem_poison_lhs_vec(<4 x i32> %x) {
198 ; CHECK-LABEL: srem_poison_lhs_vec:
200 ; CHECK-NEXT: xorps %xmm0, %xmm0
202 %r = srem <4 x i32> poison, %x
206 define i32 @urem_poison_rhs(i32 %x) {
207 ; CHECK-LABEL: urem_poison_rhs:
210 %r = urem i32 %x, poison
214 define <4 x i32> @urem_poison_rhs_vec(<4 x i32> %x) {
215 ; CHECK-LABEL: urem_poison_rhs_vec:
218 %r = urem <4 x i32> %x, poison
222 define i32 @urem_poison_lhs(i32 %x) {
223 ; CHECK-LABEL: urem_poison_lhs:
225 ; CHECK-NEXT: xorl %eax, %eax
227 %r = urem i32 poison, %x
231 define <4 x i32> @urem_poison_lhs_vec(<4 x i32> %x) {
232 ; CHECK-LABEL: urem_poison_lhs_vec:
234 ; CHECK-NEXT: xorps %xmm0, %xmm0
236 %r = urem <4 x i32> poison, %x
240 define i32 @ashr_poison_rhs(i32 %x) {
241 ; CHECK-LABEL: ashr_poison_rhs:
244 %r = ashr i32 %x, poison
248 define <4 x i32> @ashr_poison_rhs_vec(<4 x i32> %x) {
249 ; CHECK-LABEL: ashr_poison_rhs_vec:
252 %r = ashr <4 x i32> %x, poison
256 define i32 @ashr_poison_lhs(i32 %x) {
257 ; CHECK-LABEL: ashr_poison_lhs:
259 ; CHECK-NEXT: xorl %eax, %eax
261 %r = ashr i32 poison, %x
265 define <4 x i32> @ashr_poison_lhs_vec(<4 x i32> %x) {
266 ; CHECK-LABEL: ashr_poison_lhs_vec:
268 ; CHECK-NEXT: xorps %xmm0, %xmm0
270 %r = ashr <4 x i32> poison, %x
274 define i32 @lshr_poison_rhs(i32 %x) {
275 ; CHECK-LABEL: lshr_poison_rhs:
278 %r = lshr i32 %x, poison
282 define <4 x i32> @lshr_poison_rhs_vec(<4 x i32> %x) {
283 ; CHECK-LABEL: lshr_poison_rhs_vec:
286 %r = lshr <4 x i32> %x, poison
290 define i32 @lshr_poison_lhs(i32 %x) {
291 ; CHECK-LABEL: lshr_poison_lhs:
293 ; CHECK-NEXT: xorl %eax, %eax
295 %r = lshr i32 poison, %x
299 define <4 x i32> @lshr_poison_lhs_vec(<4 x i32> %x) {
300 ; CHECK-LABEL: lshr_poison_lhs_vec:
302 ; CHECK-NEXT: xorps %xmm0, %xmm0
304 %r = lshr <4 x i32> poison, %x
308 define i32 @shl_poison_rhs(i32 %x) {
309 ; CHECK-LABEL: shl_poison_rhs:
312 %r = shl i32 %x, poison
316 define <4 x i32> @shl_poison_rhs_vec(<4 x i32> %x) {
317 ; CHECK-LABEL: shl_poison_rhs_vec:
320 %r = shl <4 x i32> %x, poison
324 define i32 @shl_poison_lhs(i32 %x) {
325 ; CHECK-LABEL: shl_poison_lhs:
327 ; CHECK-NEXT: xorl %eax, %eax
329 %r = shl i32 poison, %x
333 define <4 x i32> @shl_poison_lhs_vec(<4 x i32> %x) {
334 ; CHECK-LABEL: shl_poison_lhs_vec:
336 ; CHECK-NEXT: xorps %xmm0, %xmm0
338 %r = shl <4 x i32> poison, %x
342 define i32 @and_poison_rhs(i32 %x) {
343 ; CHECK-LABEL: and_poison_rhs:
345 ; CHECK-NEXT: xorl %eax, %eax
347 %r = and i32 %x, poison
351 define <4 x i32> @and_poison_rhs_vec(<4 x i32> %x) {
352 ; CHECK-LABEL: and_poison_rhs_vec:
354 ; CHECK-NEXT: xorps %xmm0, %xmm0
356 %r = and <4 x i32> %x, poison
360 define i32 @and_poison_lhs(i32 %x) {
361 ; CHECK-LABEL: and_poison_lhs:
363 ; CHECK-NEXT: xorl %eax, %eax
365 %r = and i32 poison, %x
369 define <4 x i32> @and_poison_lhs_vec(<4 x i32> %x) {
370 ; CHECK-LABEL: and_poison_lhs_vec:
372 ; CHECK-NEXT: xorps %xmm0, %xmm0
374 %r = and <4 x i32> poison, %x
378 define i32 @or_poison_rhs(i32 %x) {
379 ; CHECK-LABEL: or_poison_rhs:
381 ; CHECK-NEXT: movl $-1, %eax
383 %r = or i32 %x, poison
387 define <4 x i32> @or_poison_rhs_vec(<4 x i32> %x) {
388 ; CHECK-LABEL: or_poison_rhs_vec:
390 ; CHECK-NEXT: pcmpeqd %xmm0, %xmm0
392 %r = or <4 x i32> %x, poison
396 define i32 @or_poison_lhs(i32 %x) {
397 ; CHECK-LABEL: or_poison_lhs:
399 ; CHECK-NEXT: movl $-1, %eax
401 %r = or i32 poison, %x
405 define <4 x i32> @or_poison_lhs_vec(<4 x i32> %x) {
406 ; CHECK-LABEL: or_poison_lhs_vec:
408 ; CHECK-NEXT: pcmpeqd %xmm0, %xmm0
410 %r = or <4 x i32> poison, %x
414 define i32 @xor_poison_rhs(i32 %x) {
415 ; CHECK-LABEL: xor_poison_rhs:
418 %r = xor i32 %x, poison
422 define <4 x i32> @xor_poison_rhs_vec(<4 x i32> %x) {
423 ; CHECK-LABEL: xor_poison_rhs_vec:
426 %r = xor <4 x i32> %x, poison
430 define i32 @xor_poison_lhs(i32 %x) {
431 ; CHECK-LABEL: xor_poison_lhs:
434 %r = xor i32 poison, %x
438 define <4 x i32> @xor_poison_lhs_vec(<4 x i32> %x) {
439 ; CHECK-LABEL: xor_poison_lhs_vec:
442 %r = xor <4 x i32> poison, %x
446 ; This would crash because the shift amount is an i8 operand,
447 ; but the result of the shift is i32. We can't just propagate
448 ; the existing poison as the result.
450 define i1 @poison_operand_size_not_same_as_result() {
451 ; CHECK-LABEL: poison_operand_size_not_same_as_result:
454 %sh = shl i32 7, poison
455 %cmp = icmp eq i32 0, %sh