1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s --check-prefixes=ALL,X64
3 ; RUN: llc < %s -mtriple=i686-unknown-unknown | FileCheck %s --check-prefixes=ALL,X32
7 define i32 @and_signbit_shl(i32 %x, i32* %dst) {
8 ; X64-LABEL: and_signbit_shl:
10 ; X64-NEXT: movl %edi, %eax
11 ; X64-NEXT: shll $8, %eax
12 ; X64-NEXT: andl $-16777216, %eax # imm = 0xFF000000
13 ; X64-NEXT: movl %eax, (%rsi)
16 ; X32-LABEL: and_signbit_shl:
18 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
19 ; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax
20 ; X32-NEXT: shll $24, %eax
21 ; X32-NEXT: movl %eax, (%ecx)
23 %t0 = and i32 %x, 4294901760 ; 0xFFFF0000
25 store i32 %r, i32* %dst
28 define i32 @and_nosignbit_shl(i32 %x, i32* %dst) {
29 ; X64-LABEL: and_nosignbit_shl:
31 ; X64-NEXT: movl %edi, %eax
32 ; X64-NEXT: shll $8, %eax
33 ; X64-NEXT: andl $-16777216, %eax # imm = 0xFF000000
34 ; X64-NEXT: movl %eax, (%rsi)
37 ; X32-LABEL: and_nosignbit_shl:
39 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
40 ; X32-NEXT: movzbl {{[0-9]+}}(%esp), %eax
41 ; X32-NEXT: shll $24, %eax
42 ; X32-NEXT: movl %eax, (%ecx)
44 %t0 = and i32 %x, 2147418112 ; 0x7FFF0000
46 store i32 %r, i32* %dst
50 define i32 @or_signbit_shl(i32 %x, i32* %dst) {
51 ; X64-LABEL: or_signbit_shl:
53 ; X64-NEXT: movl %edi, %eax
54 ; X64-NEXT: shll $8, %eax
55 ; X64-NEXT: orl $-16777216, %eax # imm = 0xFF000000
56 ; X64-NEXT: movl %eax, (%rsi)
59 ; X32-LABEL: or_signbit_shl:
61 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
62 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
63 ; X32-NEXT: shll $8, %eax
64 ; X32-NEXT: orl $-16777216, %eax # imm = 0xFF000000
65 ; X32-NEXT: movl %eax, (%ecx)
67 %t0 = or i32 %x, 4294901760 ; 0xFFFF0000
69 store i32 %r, i32* %dst
72 define i32 @or_nosignbit_shl(i32 %x, i32* %dst) {
73 ; X64-LABEL: or_nosignbit_shl:
75 ; X64-NEXT: movl %edi, %eax
76 ; X64-NEXT: shll $8, %eax
77 ; X64-NEXT: orl $-16777216, %eax # imm = 0xFF000000
78 ; X64-NEXT: movl %eax, (%rsi)
81 ; X32-LABEL: or_nosignbit_shl:
83 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
84 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
85 ; X32-NEXT: shll $8, %eax
86 ; X32-NEXT: orl $-16777216, %eax # imm = 0xFF000000
87 ; X32-NEXT: movl %eax, (%ecx)
89 %t0 = or i32 %x, 2147418112 ; 0x7FFF0000
91 store i32 %r, i32* %dst
95 define i32 @xor_signbit_shl(i32 %x, i32* %dst) {
96 ; X64-LABEL: xor_signbit_shl:
98 ; X64-NEXT: movl %edi, %eax
99 ; X64-NEXT: shll $8, %eax
100 ; X64-NEXT: xorl $-16777216, %eax # imm = 0xFF000000
101 ; X64-NEXT: movl %eax, (%rsi)
104 ; X32-LABEL: xor_signbit_shl:
106 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
107 ; X32-NEXT: movl $16711680, %eax # imm = 0xFF0000
108 ; X32-NEXT: xorl {{[0-9]+}}(%esp), %eax
109 ; X32-NEXT: shll $8, %eax
110 ; X32-NEXT: movl %eax, (%ecx)
112 %t0 = xor i32 %x, 4294901760 ; 0xFFFF0000
114 store i32 %r, i32* %dst
117 define i32 @xor_nosignbit_shl(i32 %x, i32* %dst) {
118 ; X64-LABEL: xor_nosignbit_shl:
120 ; X64-NEXT: movl %edi, %eax
121 ; X64-NEXT: shll $8, %eax
122 ; X64-NEXT: xorl $-16777216, %eax # imm = 0xFF000000
123 ; X64-NEXT: movl %eax, (%rsi)
126 ; X32-LABEL: xor_nosignbit_shl:
128 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
129 ; X32-NEXT: movl $16711680, %eax # imm = 0xFF0000
130 ; X32-NEXT: xorl {{[0-9]+}}(%esp), %eax
131 ; X32-NEXT: shll $8, %eax
132 ; X32-NEXT: movl %eax, (%ecx)
134 %t0 = xor i32 %x, 2147418112 ; 0x7FFF0000
136 store i32 %r, i32* %dst
140 define i32 @add_signbit_shl(i32 %x, i32* %dst) {
141 ; X64-LABEL: add_signbit_shl:
143 ; X64-NEXT: movl %edi, %eax
144 ; X64-NEXT: shll $8, %eax
145 ; X64-NEXT: addl $-16777216, %eax # imm = 0xFF000000
146 ; X64-NEXT: movl %eax, (%rsi)
149 ; X32-LABEL: add_signbit_shl:
151 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
152 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
153 ; X32-NEXT: shll $8, %eax
154 ; X32-NEXT: addl $-16777216, %eax # imm = 0xFF000000
155 ; X32-NEXT: movl %eax, (%ecx)
157 %t0 = add i32 %x, 4294901760 ; 0xFFFF0000
159 store i32 %r, i32* %dst
162 define i32 @add_nosignbit_shl(i32 %x, i32* %dst) {
163 ; X64-LABEL: add_nosignbit_shl:
165 ; X64-NEXT: movl %edi, %eax
166 ; X64-NEXT: shll $8, %eax
167 ; X64-NEXT: addl $-16777216, %eax # imm = 0xFF000000
168 ; X64-NEXT: movl %eax, (%rsi)
171 ; X32-LABEL: add_nosignbit_shl:
173 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
174 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
175 ; X32-NEXT: shll $8, %eax
176 ; X32-NEXT: addl $-16777216, %eax # imm = 0xFF000000
177 ; X32-NEXT: movl %eax, (%ecx)
179 %t0 = add i32 %x, 2147418112 ; 0x7FFF0000
181 store i32 %r, i32* %dst
185 ; logical shift right
187 define i32 @and_signbit_lshr(i32 %x, i32* %dst) {
188 ; X64-LABEL: and_signbit_lshr:
190 ; X64-NEXT: movl %edi, %eax
191 ; X64-NEXT: shrl $8, %eax
192 ; X64-NEXT: andl $16776960, %eax # imm = 0xFFFF00
193 ; X64-NEXT: movl %eax, (%rsi)
196 ; X32-LABEL: and_signbit_lshr:
198 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
199 ; X32-NEXT: shll $16, %eax
200 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
201 ; X32-NEXT: shrl $8, %eax
202 ; X32-NEXT: movl %eax, (%ecx)
204 %t0 = and i32 %x, 4294901760 ; 0xFFFF0000
206 store i32 %r, i32* %dst
209 define i32 @and_nosignbit_lshr(i32 %x, i32* %dst) {
210 ; X64-LABEL: and_nosignbit_lshr:
212 ; X64-NEXT: movl %edi, %eax
213 ; X64-NEXT: shrl $8, %eax
214 ; X64-NEXT: andl $8388352, %eax # imm = 0x7FFF00
215 ; X64-NEXT: movl %eax, (%rsi)
218 ; X32-LABEL: and_nosignbit_lshr:
220 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
221 ; X32-NEXT: movl $2147418112, %eax # imm = 0x7FFF0000
222 ; X32-NEXT: andl {{[0-9]+}}(%esp), %eax
223 ; X32-NEXT: shrl $8, %eax
224 ; X32-NEXT: movl %eax, (%ecx)
226 %t0 = and i32 %x, 2147418112 ; 0x7FFF0000
228 store i32 %r, i32* %dst
232 define i32 @or_signbit_lshr(i32 %x, i32* %dst) {
233 ; X64-LABEL: or_signbit_lshr:
235 ; X64-NEXT: movl %edi, %eax
236 ; X64-NEXT: shrl $8, %eax
237 ; X64-NEXT: orl $16776960, %eax # imm = 0xFFFF00
238 ; X64-NEXT: movl %eax, (%rsi)
241 ; X32-LABEL: or_signbit_lshr:
243 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
244 ; X32-NEXT: movl $-65536, %eax # imm = 0xFFFF0000
245 ; X32-NEXT: orl {{[0-9]+}}(%esp), %eax
246 ; X32-NEXT: shrl $8, %eax
247 ; X32-NEXT: movl %eax, (%ecx)
249 %t0 = or i32 %x, 4294901760 ; 0xFFFF0000
251 store i32 %r, i32* %dst
254 define i32 @or_nosignbit_lshr(i32 %x, i32* %dst) {
255 ; X64-LABEL: or_nosignbit_lshr:
257 ; X64-NEXT: movl %edi, %eax
258 ; X64-NEXT: shrl $8, %eax
259 ; X64-NEXT: orl $8388352, %eax # imm = 0x7FFF00
260 ; X64-NEXT: movl %eax, (%rsi)
263 ; X32-LABEL: or_nosignbit_lshr:
265 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
266 ; X32-NEXT: movl $2147418112, %eax # imm = 0x7FFF0000
267 ; X32-NEXT: orl {{[0-9]+}}(%esp), %eax
268 ; X32-NEXT: shrl $8, %eax
269 ; X32-NEXT: movl %eax, (%ecx)
271 %t0 = or i32 %x, 2147418112 ; 0x7FFF0000
273 store i32 %r, i32* %dst
277 define i32 @xor_signbit_lshr(i32 %x, i32* %dst) {
278 ; X64-LABEL: xor_signbit_lshr:
280 ; X64-NEXT: movl %edi, %eax
281 ; X64-NEXT: shrl $8, %eax
282 ; X64-NEXT: xorl $16776960, %eax # imm = 0xFFFF00
283 ; X64-NEXT: movl %eax, (%rsi)
286 ; X32-LABEL: xor_signbit_lshr:
288 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
289 ; X32-NEXT: movl $-65536, %eax # imm = 0xFFFF0000
290 ; X32-NEXT: xorl {{[0-9]+}}(%esp), %eax
291 ; X32-NEXT: shrl $8, %eax
292 ; X32-NEXT: movl %eax, (%ecx)
294 %t0 = xor i32 %x, 4294901760 ; 0xFFFF0000
296 store i32 %r, i32* %dst
299 define i32 @xor_nosignbit_lshr(i32 %x, i32* %dst) {
300 ; X64-LABEL: xor_nosignbit_lshr:
302 ; X64-NEXT: movl %edi, %eax
303 ; X64-NEXT: shrl $8, %eax
304 ; X64-NEXT: xorl $8388352, %eax # imm = 0x7FFF00
305 ; X64-NEXT: movl %eax, (%rsi)
308 ; X32-LABEL: xor_nosignbit_lshr:
310 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
311 ; X32-NEXT: movl $2147418112, %eax # imm = 0x7FFF0000
312 ; X32-NEXT: xorl {{[0-9]+}}(%esp), %eax
313 ; X32-NEXT: shrl $8, %eax
314 ; X32-NEXT: movl %eax, (%ecx)
316 %t0 = xor i32 %x, 2147418112 ; 0x7FFF0000
318 store i32 %r, i32* %dst
322 define i32 @add_signbit_lshr(i32 %x, i32* %dst) {
323 ; X64-LABEL: add_signbit_lshr:
325 ; X64-NEXT: movl %edi, %eax
326 ; X64-NEXT: addl $-65536, %eax # imm = 0xFFFF0000
327 ; X64-NEXT: shrl $8, %eax
328 ; X64-NEXT: movl %eax, (%rsi)
331 ; X32-LABEL: add_signbit_lshr:
333 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
334 ; X32-NEXT: movl $-65536, %eax # imm = 0xFFFF0000
335 ; X32-NEXT: addl {{[0-9]+}}(%esp), %eax
336 ; X32-NEXT: shrl $8, %eax
337 ; X32-NEXT: movl %eax, (%ecx)
339 %t0 = add i32 %x, 4294901760 ; 0xFFFF0000
341 store i32 %r, i32* %dst
344 define i32 @add_nosignbit_lshr(i32 %x, i32* %dst) {
345 ; X64-LABEL: add_nosignbit_lshr:
347 ; X64-NEXT: movl %edi, %eax
348 ; X64-NEXT: addl $2147418112, %eax # imm = 0x7FFF0000
349 ; X64-NEXT: shrl $8, %eax
350 ; X64-NEXT: movl %eax, (%rsi)
353 ; X32-LABEL: add_nosignbit_lshr:
355 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
356 ; X32-NEXT: movl $2147418112, %eax # imm = 0x7FFF0000
357 ; X32-NEXT: addl {{[0-9]+}}(%esp), %eax
358 ; X32-NEXT: shrl $8, %eax
359 ; X32-NEXT: movl %eax, (%ecx)
361 %t0 = add i32 %x, 2147418112 ; 0x7FFF0000
363 store i32 %r, i32* %dst
367 ; arithmetic shift right
369 define i32 @and_signbit_ashr(i32 %x, i32* %dst) {
370 ; X64-LABEL: and_signbit_ashr:
372 ; X64-NEXT: movl %edi, %eax
373 ; X64-NEXT: sarl $8, %eax
374 ; X64-NEXT: andl $-256, %eax
375 ; X64-NEXT: movl %eax, (%rsi)
378 ; X32-LABEL: and_signbit_ashr:
380 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
381 ; X32-NEXT: movswl {{[0-9]+}}(%esp), %eax
382 ; X32-NEXT: shll $8, %eax
383 ; X32-NEXT: movl %eax, (%ecx)
385 %t0 = and i32 %x, 4294901760 ; 0xFFFF0000
387 store i32 %r, i32* %dst
390 define i32 @and_nosignbit_ashr(i32 %x, i32* %dst) {
391 ; X64-LABEL: and_nosignbit_ashr:
393 ; X64-NEXT: movl %edi, %eax
394 ; X64-NEXT: shrl $8, %eax
395 ; X64-NEXT: andl $8388352, %eax # imm = 0x7FFF00
396 ; X64-NEXT: movl %eax, (%rsi)
399 ; X32-LABEL: and_nosignbit_ashr:
401 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
402 ; X32-NEXT: movl $2147418112, %eax # imm = 0x7FFF0000
403 ; X32-NEXT: andl {{[0-9]+}}(%esp), %eax
404 ; X32-NEXT: shrl $8, %eax
405 ; X32-NEXT: movl %eax, (%ecx)
407 %t0 = and i32 %x, 2147418112 ; 0x7FFF0000
409 store i32 %r, i32* %dst
413 define i32 @or_signbit_ashr(i32 %x, i32* %dst) {
414 ; X64-LABEL: or_signbit_ashr:
416 ; X64-NEXT: movl %edi, %eax
417 ; X64-NEXT: shrl $8, %eax
418 ; X64-NEXT: orl $-256, %eax
419 ; X64-NEXT: movl %eax, (%rsi)
422 ; X32-LABEL: or_signbit_ashr:
424 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
425 ; X32-NEXT: movl $-65536, %eax # imm = 0xFFFF0000
426 ; X32-NEXT: orl {{[0-9]+}}(%esp), %eax
427 ; X32-NEXT: sarl $8, %eax
428 ; X32-NEXT: movl %eax, (%ecx)
430 %t0 = or i32 %x, 4294901760 ; 0xFFFF0000
432 store i32 %r, i32* %dst
435 define i32 @or_nosignbit_ashr(i32 %x, i32* %dst) {
436 ; X64-LABEL: or_nosignbit_ashr:
438 ; X64-NEXT: movl %edi, %eax
439 ; X64-NEXT: sarl $8, %eax
440 ; X64-NEXT: orl $8388352, %eax # imm = 0x7FFF00
441 ; X64-NEXT: movl %eax, (%rsi)
444 ; X32-LABEL: or_nosignbit_ashr:
446 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
447 ; X32-NEXT: movl $2147418112, %eax # imm = 0x7FFF0000
448 ; X32-NEXT: orl {{[0-9]+}}(%esp), %eax
449 ; X32-NEXT: sarl $8, %eax
450 ; X32-NEXT: movl %eax, (%ecx)
452 %t0 = or i32 %x, 2147418112 ; 0x7FFF0000
454 store i32 %r, i32* %dst
458 define i32 @xor_signbit_ashr(i32 %x, i32* %dst) {
459 ; X64-LABEL: xor_signbit_ashr:
461 ; X64-NEXT: movl %edi, %eax
462 ; X64-NEXT: sarl $8, %eax
463 ; X64-NEXT: xorl $-256, %eax
464 ; X64-NEXT: movl %eax, (%rsi)
467 ; X32-LABEL: xor_signbit_ashr:
469 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
470 ; X32-NEXT: movl $-65536, %eax # imm = 0xFFFF0000
471 ; X32-NEXT: xorl {{[0-9]+}}(%esp), %eax
472 ; X32-NEXT: sarl $8, %eax
473 ; X32-NEXT: movl %eax, (%ecx)
475 %t0 = xor i32 %x, 4294901760 ; 0xFFFF0000
477 store i32 %r, i32* %dst
480 define i32 @xor_nosignbit_ashr(i32 %x, i32* %dst) {
481 ; X64-LABEL: xor_nosignbit_ashr:
483 ; X64-NEXT: movl %edi, %eax
484 ; X64-NEXT: sarl $8, %eax
485 ; X64-NEXT: xorl $8388352, %eax # imm = 0x7FFF00
486 ; X64-NEXT: movl %eax, (%rsi)
489 ; X32-LABEL: xor_nosignbit_ashr:
491 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
492 ; X32-NEXT: movl $2147418112, %eax # imm = 0x7FFF0000
493 ; X32-NEXT: xorl {{[0-9]+}}(%esp), %eax
494 ; X32-NEXT: sarl $8, %eax
495 ; X32-NEXT: movl %eax, (%ecx)
497 %t0 = xor i32 %x, 2147418112 ; 0x7FFF0000
499 store i32 %r, i32* %dst
503 define i32 @add_signbit_ashr(i32 %x, i32* %dst) {
504 ; X64-LABEL: add_signbit_ashr:
506 ; X64-NEXT: movl %edi, %eax
507 ; X64-NEXT: addl $-65536, %eax # imm = 0xFFFF0000
508 ; X64-NEXT: sarl $8, %eax
509 ; X64-NEXT: movl %eax, (%rsi)
512 ; X32-LABEL: add_signbit_ashr:
514 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
515 ; X32-NEXT: movl $-65536, %eax # imm = 0xFFFF0000
516 ; X32-NEXT: addl {{[0-9]+}}(%esp), %eax
517 ; X32-NEXT: sarl $8, %eax
518 ; X32-NEXT: movl %eax, (%ecx)
520 %t0 = add i32 %x, 4294901760 ; 0xFFFF0000
522 store i32 %r, i32* %dst
525 define i32 @add_nosignbit_ashr(i32 %x, i32* %dst) {
526 ; X64-LABEL: add_nosignbit_ashr:
528 ; X64-NEXT: movl %edi, %eax
529 ; X64-NEXT: addl $2147418112, %eax # imm = 0x7FFF0000
530 ; X64-NEXT: sarl $8, %eax
531 ; X64-NEXT: movl %eax, (%rsi)
534 ; X32-LABEL: add_nosignbit_ashr:
536 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
537 ; X32-NEXT: movl $2147418112, %eax # imm = 0x7FFF0000
538 ; X32-NEXT: addl {{[0-9]+}}(%esp), %eax
539 ; X32-NEXT: sarl $8, %eax
540 ; X32-NEXT: movl %eax, (%ecx)
542 %t0 = add i32 %x, 2147418112 ; 0x7FFF0000
544 store i32 %r, i32* %dst