1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-- -mcpu=corei7 | FileCheck %s --check-prefix=CHECK32 --check-prefix=X86
3 ; RUN: llc < %s -mtriple=i686-- -mcpu=corei7-avx | FileCheck %s --check-prefix=CHECK32 --check-prefix=SHLD
4 ; RUN: llc < %s -mtriple=i686-- -mcpu=core-avx2 | FileCheck %s --check-prefix=CHECK32 --check-prefix=BMI2
5 ; RUN: llc < %s -mtriple=x86_64-- -mcpu=corei7 | FileCheck %s --check-prefix=CHECK64 --check-prefix=X64
6 ; RUN: llc < %s -mtriple=x86_64-- -mcpu=corei7-avx | FileCheck %s --check-prefix=CHECK64 --check-prefix=SHLD64
7 ; RUN: llc < %s -mtriple=x86_64-- -mcpu=core-avx2 | FileCheck %s --check-prefix=CHECK64 --check-prefix=BMI264
9 define i32 @foo(i32 %x, i32 %y, i32 %z) nounwind readnone {
11 ; CHECK32: # %bb.0: # %entry
12 ; CHECK32-NEXT: movb {{[0-9]+}}(%esp), %cl
13 ; CHECK32-NEXT: movl {{[0-9]+}}(%esp), %eax
14 ; CHECK32-NEXT: roll %cl, %eax
18 ; CHECK64: # %bb.0: # %entry
19 ; CHECK64-NEXT: movl %edx, %ecx
20 ; CHECK64-NEXT: movl %edi, %eax
21 ; CHECK64-NEXT: # kill: def $cl killed $cl killed $ecx
22 ; CHECK64-NEXT: roll %cl, %eax
32 define i32 @bar(i32 %x, i32 %y, i32 %z) nounwind readnone {
34 ; CHECK32: # %bb.0: # %entry
35 ; CHECK32-NEXT: movb {{[0-9]+}}(%esp), %cl
36 ; CHECK32-NEXT: movl {{[0-9]+}}(%esp), %edx
37 ; CHECK32-NEXT: movl {{[0-9]+}}(%esp), %eax
38 ; CHECK32-NEXT: shldl %cl, %edx, %eax
42 ; CHECK64: # %bb.0: # %entry
43 ; CHECK64-NEXT: movl %edx, %ecx
44 ; CHECK64-NEXT: movl %esi, %eax
45 ; CHECK64-NEXT: # kill: def $cl killed $cl killed $ecx
46 ; CHECK64-NEXT: shldl %cl, %edi, %eax
56 define i32 @un(i32 %x, i32 %y, i32 %z) nounwind readnone {
58 ; CHECK32: # %bb.0: # %entry
59 ; CHECK32-NEXT: movb {{[0-9]+}}(%esp), %cl
60 ; CHECK32-NEXT: movl {{[0-9]+}}(%esp), %eax
61 ; CHECK32-NEXT: rorl %cl, %eax
65 ; CHECK64: # %bb.0: # %entry
66 ; CHECK64-NEXT: movl %edx, %ecx
67 ; CHECK64-NEXT: movl %edi, %eax
68 ; CHECK64-NEXT: # kill: def $cl killed $cl killed $ecx
69 ; CHECK64-NEXT: rorl %cl, %eax
79 define i32 @bu(i32 %x, i32 %y, i32 %z) nounwind readnone {
81 ; CHECK32: # %bb.0: # %entry
82 ; CHECK32-NEXT: movb {{[0-9]+}}(%esp), %cl
83 ; CHECK32-NEXT: movl {{[0-9]+}}(%esp), %edx
84 ; CHECK32-NEXT: movl {{[0-9]+}}(%esp), %eax
85 ; CHECK32-NEXT: shrdl %cl, %edx, %eax
89 ; CHECK64: # %bb.0: # %entry
90 ; CHECK64-NEXT: movl %edx, %ecx
91 ; CHECK64-NEXT: movl %esi, %eax
92 ; CHECK64-NEXT: # kill: def $cl killed $cl killed $ecx
93 ; CHECK64-NEXT: shrdl %cl, %edi, %eax
103 define i32 @xfoo(i32 %x, i32 %y, i32 %z) nounwind readnone {
105 ; X86: # %bb.0: # %entry
106 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
107 ; X86-NEXT: roll $7, %eax
111 ; SHLD: # %bb.0: # %entry
112 ; SHLD-NEXT: movl {{[0-9]+}}(%esp), %eax
113 ; SHLD-NEXT: shldl $7, %eax, %eax
117 ; BMI2: # %bb.0: # %entry
118 ; BMI2-NEXT: rorxl $25, {{[0-9]+}}(%esp), %eax
122 ; X64: # %bb.0: # %entry
123 ; X64-NEXT: movl %edi, %eax
124 ; X64-NEXT: roll $7, %eax
127 ; SHLD64-LABEL: xfoo:
128 ; SHLD64: # %bb.0: # %entry
129 ; SHLD64-NEXT: movl %edi, %eax
130 ; SHLD64-NEXT: shldl $7, %eax, %eax
133 ; BMI264-LABEL: xfoo:
134 ; BMI264: # %bb.0: # %entry
135 ; BMI264-NEXT: rorxl $25, %edi, %eax
144 define i32 @xfoop(i32* %p) nounwind readnone {
146 ; X86: # %bb.0: # %entry
147 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
148 ; X86-NEXT: movl (%eax), %eax
149 ; X86-NEXT: roll $7, %eax
153 ; SHLD: # %bb.0: # %entry
154 ; SHLD-NEXT: movl {{[0-9]+}}(%esp), %eax
155 ; SHLD-NEXT: movl (%eax), %eax
156 ; SHLD-NEXT: shldl $7, %eax, %eax
160 ; BMI2: # %bb.0: # %entry
161 ; BMI2-NEXT: movl {{[0-9]+}}(%esp), %eax
162 ; BMI2-NEXT: rorxl $25, (%eax), %eax
166 ; X64: # %bb.0: # %entry
167 ; X64-NEXT: movl (%rdi), %eax
168 ; X64-NEXT: roll $7, %eax
171 ; SHLD64-LABEL: xfoop:
172 ; SHLD64: # %bb.0: # %entry
173 ; SHLD64-NEXT: movl (%rdi), %eax
174 ; SHLD64-NEXT: shldl $7, %eax, %eax
177 ; BMI264-LABEL: xfoop:
178 ; BMI264: # %bb.0: # %entry
179 ; BMI264-NEXT: rorxl $25, (%rdi), %eax
182 %x = load i32, i32* %p
189 define i32 @xbar(i32 %x, i32 %y, i32 %z) nounwind readnone {
190 ; CHECK32-LABEL: xbar:
191 ; CHECK32: # %bb.0: # %entry
192 ; CHECK32-NEXT: movl {{[0-9]+}}(%esp), %ecx
193 ; CHECK32-NEXT: movl {{[0-9]+}}(%esp), %eax
194 ; CHECK32-NEXT: shldl $7, %ecx, %eax
197 ; CHECK64-LABEL: xbar:
198 ; CHECK64: # %bb.0: # %entry
199 ; CHECK64-NEXT: movl %edi, %eax
200 ; CHECK64-NEXT: shrdl $25, %esi, %eax
209 define i32 @xun(i32 %x, i32 %y, i32 %z) nounwind readnone {
211 ; X86: # %bb.0: # %entry
212 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
213 ; X86-NEXT: roll $25, %eax
217 ; SHLD: # %bb.0: # %entry
218 ; SHLD-NEXT: movl {{[0-9]+}}(%esp), %eax
219 ; SHLD-NEXT: shldl $25, %eax, %eax
223 ; BMI2: # %bb.0: # %entry
224 ; BMI2-NEXT: rorxl $7, {{[0-9]+}}(%esp), %eax
228 ; X64: # %bb.0: # %entry
229 ; X64-NEXT: movl %edi, %eax
230 ; X64-NEXT: roll $25, %eax
234 ; SHLD64: # %bb.0: # %entry
235 ; SHLD64-NEXT: movl %edi, %eax
236 ; SHLD64-NEXT: shldl $25, %eax, %eax
240 ; BMI264: # %bb.0: # %entry
241 ; BMI264-NEXT: rorxl $7, %edi, %eax
250 define i32 @xunp(i32* %p) nounwind readnone {
252 ; X86: # %bb.0: # %entry
253 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
254 ; X86-NEXT: movl (%eax), %eax
255 ; X86-NEXT: roll $25, %eax
259 ; SHLD: # %bb.0: # %entry
260 ; SHLD-NEXT: movl {{[0-9]+}}(%esp), %eax
261 ; SHLD-NEXT: movl (%eax), %eax
262 ; SHLD-NEXT: shldl $25, %eax, %eax
266 ; BMI2: # %bb.0: # %entry
267 ; BMI2-NEXT: movl {{[0-9]+}}(%esp), %eax
268 ; BMI2-NEXT: rorxl $7, (%eax), %eax
272 ; X64: # %bb.0: # %entry
273 ; X64-NEXT: movl (%rdi), %eax
274 ; X64-NEXT: roll $25, %eax
277 ; SHLD64-LABEL: xunp:
278 ; SHLD64: # %bb.0: # %entry
279 ; SHLD64-NEXT: movl (%rdi), %eax
280 ; SHLD64-NEXT: shldl $25, %eax, %eax
283 ; BMI264-LABEL: xunp:
284 ; BMI264: # %bb.0: # %entry
285 ; BMI264-NEXT: rorxl $7, (%rdi), %eax
290 %x = load i32, i32* %p
297 define i32 @xbu(i32 %x, i32 %y, i32 %z) nounwind readnone {
298 ; CHECK32-LABEL: xbu:
299 ; CHECK32: # %bb.0: # %entry
300 ; CHECK32-NEXT: movl {{[0-9]+}}(%esp), %ecx
301 ; CHECK32-NEXT: movl {{[0-9]+}}(%esp), %eax
302 ; CHECK32-NEXT: shldl $25, %ecx, %eax
305 ; CHECK64-LABEL: xbu:
306 ; CHECK64: # %bb.0: # %entry
307 ; CHECK64-NEXT: movl %edi, %eax
308 ; CHECK64-NEXT: shldl $25, %esi, %eax
317 define i32 @fshl(i32 %x) nounwind {
320 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
321 ; X86-NEXT: roll $7, %eax
326 ; SHLD-NEXT: movl {{[0-9]+}}(%esp), %eax
327 ; SHLD-NEXT: shldl $7, %eax, %eax
332 ; BMI2-NEXT: rorxl $25, {{[0-9]+}}(%esp), %eax
337 ; X64-NEXT: movl %edi, %eax
338 ; X64-NEXT: roll $7, %eax
341 ; SHLD64-LABEL: fshl:
343 ; SHLD64-NEXT: movl %edi, %eax
344 ; SHLD64-NEXT: shldl $7, %eax, %eax
347 ; BMI264-LABEL: fshl:
349 ; BMI264-NEXT: rorxl $25, %edi, %eax
351 %f = call i32 @llvm.fshl.i32(i32 %x, i32 %x, i32 7)
354 declare i32 @llvm.fshl.i32(i32, i32, i32)
356 define i32 @fshl1(i32 %x) nounwind {
359 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
360 ; X86-NEXT: roll %eax
365 ; SHLD-NEXT: movl {{[0-9]+}}(%esp), %eax
366 ; SHLD-NEXT: shldl $1, %eax, %eax
371 ; BMI2-NEXT: rorxl $31, {{[0-9]+}}(%esp), %eax
376 ; X64-NEXT: movl %edi, %eax
377 ; X64-NEXT: roll %eax
380 ; SHLD64-LABEL: fshl1:
382 ; SHLD64-NEXT: movl %edi, %eax
383 ; SHLD64-NEXT: shldl $1, %eax, %eax
386 ; BMI264-LABEL: fshl1:
388 ; BMI264-NEXT: rorxl $31, %edi, %eax
390 %f = call i32 @llvm.fshl.i32(i32 %x, i32 %x, i32 1)
394 define i32 @fshl31(i32 %x) nounwind {
397 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
398 ; X86-NEXT: rorl %eax
401 ; SHLD-LABEL: fshl31:
403 ; SHLD-NEXT: movl {{[0-9]+}}(%esp), %eax
404 ; SHLD-NEXT: shldl $31, %eax, %eax
407 ; BMI2-LABEL: fshl31:
409 ; BMI2-NEXT: rorxl $1, {{[0-9]+}}(%esp), %eax
414 ; X64-NEXT: movl %edi, %eax
415 ; X64-NEXT: rorl %eax
418 ; SHLD64-LABEL: fshl31:
420 ; SHLD64-NEXT: movl %edi, %eax
421 ; SHLD64-NEXT: shldl $31, %eax, %eax
424 ; BMI264-LABEL: fshl31:
426 ; BMI264-NEXT: rorxl $1, %edi, %eax
428 %f = call i32 @llvm.fshl.i32(i32 %x, i32 %x, i32 31)
432 define i32 @fshl_load(i32* %p) nounwind {
433 ; X86-LABEL: fshl_load:
435 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
436 ; X86-NEXT: movl (%eax), %eax
437 ; X86-NEXT: roll $7, %eax
440 ; SHLD-LABEL: fshl_load:
442 ; SHLD-NEXT: movl {{[0-9]+}}(%esp), %eax
443 ; SHLD-NEXT: movl (%eax), %eax
444 ; SHLD-NEXT: shldl $7, %eax, %eax
447 ; BMI2-LABEL: fshl_load:
449 ; BMI2-NEXT: movl {{[0-9]+}}(%esp), %eax
450 ; BMI2-NEXT: rorxl $25, (%eax), %eax
453 ; X64-LABEL: fshl_load:
455 ; X64-NEXT: movl (%rdi), %eax
456 ; X64-NEXT: roll $7, %eax
459 ; SHLD64-LABEL: fshl_load:
461 ; SHLD64-NEXT: movl (%rdi), %eax
462 ; SHLD64-NEXT: shldl $7, %eax, %eax
465 ; BMI264-LABEL: fshl_load:
467 ; BMI264-NEXT: rorxl $25, (%rdi), %eax
469 %x = load i32, i32* %p
470 %f = call i32 @llvm.fshl.i32(i32 %x, i32 %x, i32 7)
474 define i32 @fshr(i32 %x) nounwind {
477 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
478 ; X86-NEXT: rorl $7, %eax
483 ; SHLD-NEXT: movl {{[0-9]+}}(%esp), %eax
484 ; SHLD-NEXT: shrdl $7, %eax, %eax
489 ; BMI2-NEXT: rorxl $7, {{[0-9]+}}(%esp), %eax
494 ; X64-NEXT: movl %edi, %eax
495 ; X64-NEXT: rorl $7, %eax
498 ; SHLD64-LABEL: fshr:
500 ; SHLD64-NEXT: movl %edi, %eax
501 ; SHLD64-NEXT: shrdl $7, %eax, %eax
504 ; BMI264-LABEL: fshr:
506 ; BMI264-NEXT: rorxl $7, %edi, %eax
508 %f = call i32 @llvm.fshr.i32(i32 %x, i32 %x, i32 7)
511 declare i32 @llvm.fshr.i32(i32, i32, i32)
513 define i32 @fshr1(i32 %x) nounwind {
516 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
517 ; X86-NEXT: rorl %eax
522 ; SHLD-NEXT: movl {{[0-9]+}}(%esp), %eax
523 ; SHLD-NEXT: shrdl $1, %eax, %eax
528 ; BMI2-NEXT: rorxl $1, {{[0-9]+}}(%esp), %eax
533 ; X64-NEXT: movl %edi, %eax
534 ; X64-NEXT: rorl %eax
537 ; SHLD64-LABEL: fshr1:
539 ; SHLD64-NEXT: movl %edi, %eax
540 ; SHLD64-NEXT: shrdl $1, %eax, %eax
543 ; BMI264-LABEL: fshr1:
545 ; BMI264-NEXT: rorxl $1, %edi, %eax
547 %f = call i32 @llvm.fshr.i32(i32 %x, i32 %x, i32 1)
551 define i32 @fshr31(i32 %x) nounwind {
554 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
555 ; X86-NEXT: roll %eax
558 ; SHLD-LABEL: fshr31:
560 ; SHLD-NEXT: movl {{[0-9]+}}(%esp), %eax
561 ; SHLD-NEXT: shrdl $31, %eax, %eax
564 ; BMI2-LABEL: fshr31:
566 ; BMI2-NEXT: rorxl $31, {{[0-9]+}}(%esp), %eax
571 ; X64-NEXT: movl %edi, %eax
572 ; X64-NEXT: roll %eax
575 ; SHLD64-LABEL: fshr31:
577 ; SHLD64-NEXT: movl %edi, %eax
578 ; SHLD64-NEXT: shrdl $31, %eax, %eax
581 ; BMI264-LABEL: fshr31:
583 ; BMI264-NEXT: rorxl $31, %edi, %eax
585 %f = call i32 @llvm.fshr.i32(i32 %x, i32 %x, i32 31)
589 define i32 @fshr_load(i32* %p) nounwind {
590 ; X86-LABEL: fshr_load:
592 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
593 ; X86-NEXT: movl (%eax), %eax
594 ; X86-NEXT: rorl $7, %eax
597 ; SHLD-LABEL: fshr_load:
599 ; SHLD-NEXT: movl {{[0-9]+}}(%esp), %eax
600 ; SHLD-NEXT: movl (%eax), %eax
601 ; SHLD-NEXT: shrdl $7, %eax, %eax
604 ; BMI2-LABEL: fshr_load:
606 ; BMI2-NEXT: movl {{[0-9]+}}(%esp), %eax
607 ; BMI2-NEXT: rorxl $7, (%eax), %eax
610 ; X64-LABEL: fshr_load:
612 ; X64-NEXT: movl (%rdi), %eax
613 ; X64-NEXT: rorl $7, %eax
616 ; SHLD64-LABEL: fshr_load:
618 ; SHLD64-NEXT: movl (%rdi), %eax
619 ; SHLD64-NEXT: shrdl $7, %eax, %eax
622 ; BMI264-LABEL: fshr_load:
624 ; BMI264-NEXT: rorxl $7, (%rdi), %eax
626 %x = load i32, i32* %p
627 %f = call i32 @llvm.fshr.i32(i32 %x, i32 %x, i32 7)