1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
4 define i32 @add_undef_rhs(i32 %x) {
5 ; CHECK-LABEL: add_undef_rhs:
12 define <4 x i32> @add_undef_rhs_vec(<4 x i32> %x) {
13 ; CHECK-LABEL: add_undef_rhs_vec:
16 %r = add <4 x i32> %x, undef
20 define i32 @add_undef_lhs(i32 %x) {
21 ; CHECK-LABEL: add_undef_lhs:
24 %r = add i32 undef, %x
28 define <4 x i32> @add_undef_lhs_vec(<4 x i32> %x) {
29 ; CHECK-LABEL: add_undef_lhs_vec:
32 %r = add <4 x i32> undef, %x
36 define i32 @sub_undef_rhs(i32 %x) {
37 ; CHECK-LABEL: sub_undef_rhs:
40 %r = sub i32 %x, undef
44 define <4 x i32> @sub_undef_rhs_vec(<4 x i32> %x) {
45 ; CHECK-LABEL: sub_undef_rhs_vec:
48 %r = sub <4 x i32> %x, undef
52 define i32 @sub_undef_lhs(i32 %x) {
53 ; CHECK-LABEL: sub_undef_lhs:
56 %r = sub i32 undef, %x
60 define <4 x i32> @sub_undef_lhs_vec(<4 x i32> %x) {
61 ; CHECK-LABEL: sub_undef_lhs_vec:
64 %r = sub <4 x i32> undef, %x
68 define i32 @mul_undef_rhs(i32 %x) {
69 ; CHECK-LABEL: mul_undef_rhs:
71 ; CHECK-NEXT: xorl %eax, %eax
73 %r = mul i32 %x, undef
77 define <4 x i32> @mul_undef_rhs_vec(<4 x i32> %x) {
78 ; CHECK-LABEL: mul_undef_rhs_vec:
80 ; CHECK-NEXT: xorps %xmm0, %xmm0
82 %r = mul <4 x i32> %x, undef
86 define i32 @mul_undef_lhs(i32 %x) {
87 ; CHECK-LABEL: mul_undef_lhs:
89 ; CHECK-NEXT: xorl %eax, %eax
91 %r = mul i32 undef, %x
95 define <4 x i32> @mul_undef_lhs_vec(<4 x i32> %x) {
96 ; CHECK-LABEL: mul_undef_lhs_vec:
98 ; CHECK-NEXT: xorps %xmm0, %xmm0
100 %r = mul <4 x i32> undef, %x
104 define i32 @sdiv_undef_rhs(i32 %x) {
105 ; CHECK-LABEL: sdiv_undef_rhs:
108 %r = sdiv i32 %x, undef
112 define <4 x i32> @sdiv_undef_rhs_vec(<4 x i32> %x) {
113 ; CHECK-LABEL: sdiv_undef_rhs_vec:
116 %r = sdiv <4 x i32> %x, undef
120 define i32 @sdiv_undef_lhs(i32 %x) {
121 ; CHECK-LABEL: sdiv_undef_lhs:
123 ; CHECK-NEXT: xorl %eax, %eax
125 %r = sdiv i32 undef, %x
129 define <4 x i32> @sdiv_undef_lhs_vec(<4 x i32> %x) {
130 ; CHECK-LABEL: sdiv_undef_lhs_vec:
132 ; CHECK-NEXT: xorps %xmm0, %xmm0
134 %r = sdiv <4 x i32> undef, %x
138 define i32 @udiv_undef_rhs(i32 %x) {
139 ; CHECK-LABEL: udiv_undef_rhs:
142 %r = udiv i32 %x, undef
146 define <4 x i32> @udiv_undef_rhs_vec(<4 x i32> %x) {
147 ; CHECK-LABEL: udiv_undef_rhs_vec:
150 %r = udiv <4 x i32> %x, undef
154 define i32 @udiv_undef_lhs(i32 %x) {
155 ; CHECK-LABEL: udiv_undef_lhs:
157 ; CHECK-NEXT: xorl %eax, %eax
159 %r = udiv i32 undef, %x
163 define <4 x i32> @udiv_undef_lhs_vec(<4 x i32> %x) {
164 ; CHECK-LABEL: udiv_undef_lhs_vec:
166 ; CHECK-NEXT: xorps %xmm0, %xmm0
168 %r = udiv <4 x i32> undef, %x
172 define i32 @srem_undef_rhs(i32 %x) {
173 ; CHECK-LABEL: srem_undef_rhs:
176 %r = srem i32 %x, undef
180 define <4 x i32> @srem_undef_rhs_vec(<4 x i32> %x) {
181 ; CHECK-LABEL: srem_undef_rhs_vec:
184 %r = srem <4 x i32> %x, undef
188 define i32 @srem_undef_lhs(i32 %x) {
189 ; CHECK-LABEL: srem_undef_lhs:
191 ; CHECK-NEXT: xorl %eax, %eax
193 %r = srem i32 undef, %x
197 define <4 x i32> @srem_undef_lhs_vec(<4 x i32> %x) {
198 ; CHECK-LABEL: srem_undef_lhs_vec:
200 ; CHECK-NEXT: xorps %xmm0, %xmm0
202 %r = srem <4 x i32> undef, %x
206 define i32 @urem_undef_rhs(i32 %x) {
207 ; CHECK-LABEL: urem_undef_rhs:
210 %r = urem i32 %x, undef
214 define <4 x i32> @urem_undef_rhs_vec(<4 x i32> %x) {
215 ; CHECK-LABEL: urem_undef_rhs_vec:
218 %r = urem <4 x i32> %x, undef
222 define i32 @urem_undef_lhs(i32 %x) {
223 ; CHECK-LABEL: urem_undef_lhs:
225 ; CHECK-NEXT: xorl %eax, %eax
227 %r = urem i32 undef, %x
231 define <4 x i32> @urem_undef_lhs_vec(<4 x i32> %x) {
232 ; CHECK-LABEL: urem_undef_lhs_vec:
234 ; CHECK-NEXT: xorps %xmm0, %xmm0
236 %r = urem <4 x i32> undef, %x
240 define i32 @ashr_undef_rhs(i32 %x) {
241 ; CHECK-LABEL: ashr_undef_rhs:
244 %r = ashr i32 %x, undef
248 define <4 x i32> @ashr_undef_rhs_vec(<4 x i32> %x) {
249 ; CHECK-LABEL: ashr_undef_rhs_vec:
252 %r = ashr <4 x i32> %x, undef
256 define i32 @ashr_undef_lhs(i32 %x) {
257 ; CHECK-LABEL: ashr_undef_lhs:
259 ; CHECK-NEXT: xorl %eax, %eax
261 %r = ashr i32 undef, %x
265 define <4 x i32> @ashr_undef_lhs_vec(<4 x i32> %x) {
266 ; CHECK-LABEL: ashr_undef_lhs_vec:
268 ; CHECK-NEXT: xorps %xmm0, %xmm0
270 %r = ashr <4 x i32> undef, %x
274 define i32 @lshr_undef_rhs(i32 %x) {
275 ; CHECK-LABEL: lshr_undef_rhs:
278 %r = lshr i32 %x, undef
282 define <4 x i32> @lshr_undef_rhs_vec(<4 x i32> %x) {
283 ; CHECK-LABEL: lshr_undef_rhs_vec:
286 %r = lshr <4 x i32> %x, undef
290 define i32 @lshr_undef_lhs(i32 %x) {
291 ; CHECK-LABEL: lshr_undef_lhs:
293 ; CHECK-NEXT: xorl %eax, %eax
295 %r = lshr i32 undef, %x
299 define <4 x i32> @lshr_undef_lhs_vec(<4 x i32> %x) {
300 ; CHECK-LABEL: lshr_undef_lhs_vec:
302 ; CHECK-NEXT: xorps %xmm0, %xmm0
304 %r = lshr <4 x i32> undef, %x
308 define i32 @shl_undef_rhs(i32 %x) {
309 ; CHECK-LABEL: shl_undef_rhs:
312 %r = shl i32 %x, undef
316 define <4 x i32> @shl_undef_rhs_vec(<4 x i32> %x) {
317 ; CHECK-LABEL: shl_undef_rhs_vec:
320 %r = shl <4 x i32> %x, undef
324 define i32 @shl_undef_lhs(i32 %x) {
325 ; CHECK-LABEL: shl_undef_lhs:
327 ; CHECK-NEXT: xorl %eax, %eax
329 %r = shl i32 undef, %x
333 define <4 x i32> @shl_undef_lhs_vec(<4 x i32> %x) {
334 ; CHECK-LABEL: shl_undef_lhs_vec:
336 ; CHECK-NEXT: xorps %xmm0, %xmm0
338 %r = shl <4 x i32> undef, %x
342 define i32 @and_undef_rhs(i32 %x) {
343 ; CHECK-LABEL: and_undef_rhs:
345 ; CHECK-NEXT: xorl %eax, %eax
347 %r = and i32 %x, undef
351 define <4 x i32> @and_undef_rhs_vec(<4 x i32> %x) {
352 ; CHECK-LABEL: and_undef_rhs_vec:
354 ; CHECK-NEXT: xorps %xmm0, %xmm0
356 %r = and <4 x i32> %x, undef
360 define i32 @and_undef_lhs(i32 %x) {
361 ; CHECK-LABEL: and_undef_lhs:
363 ; CHECK-NEXT: xorl %eax, %eax
365 %r = and i32 undef, %x
369 define <4 x i32> @and_undef_lhs_vec(<4 x i32> %x) {
370 ; CHECK-LABEL: and_undef_lhs_vec:
372 ; CHECK-NEXT: xorps %xmm0, %xmm0
374 %r = and <4 x i32> undef, %x
378 define i32 @or_undef_rhs(i32 %x) {
379 ; CHECK-LABEL: or_undef_rhs:
381 ; CHECK-NEXT: movl $-1, %eax
383 %r = or i32 %x, undef
387 define <4 x i32> @or_undef_rhs_vec(<4 x i32> %x) {
388 ; CHECK-LABEL: or_undef_rhs_vec:
390 ; CHECK-NEXT: pcmpeqd %xmm0, %xmm0
392 %r = or <4 x i32> %x, undef
396 define i32 @or_undef_lhs(i32 %x) {
397 ; CHECK-LABEL: or_undef_lhs:
399 ; CHECK-NEXT: movl $-1, %eax
401 %r = or i32 undef, %x
405 define <4 x i32> @or_undef_lhs_vec(<4 x i32> %x) {
406 ; CHECK-LABEL: or_undef_lhs_vec:
408 ; CHECK-NEXT: pcmpeqd %xmm0, %xmm0
410 %r = or <4 x i32> undef, %x
414 define i32 @xor_undef_rhs(i32 %x) {
415 ; CHECK-LABEL: xor_undef_rhs:
418 %r = xor i32 %x, undef
422 define <4 x i32> @xor_undef_rhs_vec(<4 x i32> %x) {
423 ; CHECK-LABEL: xor_undef_rhs_vec:
426 %r = xor <4 x i32> %x, undef
430 define i32 @xor_undef_lhs(i32 %x) {
431 ; CHECK-LABEL: xor_undef_lhs:
434 %r = xor i32 undef, %x
438 define <4 x i32> @xor_undef_lhs_vec(<4 x i32> %x) {
439 ; CHECK-LABEL: xor_undef_lhs_vec:
442 %r = xor <4 x i32> undef, %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 undef as the result.
450 define i1 @undef_operand_size_not_same_as_result() {
451 ; CHECK-LABEL: undef_operand_size_not_same_as_result:
454 %sh = shl i32 7, undef
455 %cmp = icmp eq i32 0, %sh