1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-pc-linux | FileCheck %s --check-prefix=X64
3 ; RUN: llc < %s -mtriple=i386-pc-linux | FileCheck %s --check-prefix=X86
5 ; FIXME: We don't match this properly due to different size of 'rotate' and 'and'
6 define i16 @btr_16(i16 %x, i16 %n) {
9 ; X64-NEXT: movl %esi, %ecx
10 ; X64-NEXT: movw $-2, %ax
11 ; X64-NEXT: # kill: def $cl killed $cl killed $ecx
12 ; X64-NEXT: rolw %cl, %ax
13 ; X64-NEXT: andl %edi, %eax
14 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
19 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
20 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
21 ; X86-NEXT: btrw %cx, %ax
29 define i16 @bts_16(i16 %x, i16 %n) {
32 ; X64-NEXT: movl %edi, %eax
33 ; X64-NEXT: btsl %esi, %eax
34 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
39 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
40 ; X86-NEXT: movl $1, %eax
41 ; X86-NEXT: shll %cl, %eax
42 ; X86-NEXT: orw {{[0-9]+}}(%esp), %ax
43 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
50 define i16 @btc_16(i16 %x, i16 %n) {
53 ; X64-NEXT: movl %edi, %eax
54 ; X64-NEXT: btcl %esi, %eax
55 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
60 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
61 ; X86-NEXT: movl $1, %eax
62 ; X86-NEXT: shll %cl, %eax
63 ; X86-NEXT: xorw {{[0-9]+}}(%esp), %ax
64 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
71 define i32 @btr_32(i32 %x, i32 %n) {
74 ; X64-NEXT: movl %edi, %eax
75 ; X64-NEXT: btrl %esi, %eax
80 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
81 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
82 ; X86-NEXT: btrl %ecx, %eax
90 define i32 @bts_32(i32 %x, i32 %n) {
93 ; X64-NEXT: movl %edi, %eax
94 ; X64-NEXT: btsl %esi, %eax
99 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
100 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
101 ; X86-NEXT: btsl %ecx, %eax
108 define i32 @btc_32(i32 %x, i32 %n) {
111 ; X64-NEXT: movl %edi, %eax
112 ; X64-NEXT: btcl %esi, %eax
117 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
118 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
119 ; X86-NEXT: btcl %ecx, %eax
126 define i64 @btr_64(i64 %x, i64 %n) {
129 ; X64-NEXT: movq %rdi, %rax
130 ; X64-NEXT: btrq %rsi, %rax
135 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
136 ; X86-NEXT: movl $1, %eax
137 ; X86-NEXT: xorl %edx, %edx
138 ; X86-NEXT: shldl %cl, %eax, %edx
139 ; X86-NEXT: shll %cl, %eax
140 ; X86-NEXT: testb $32, %cl
141 ; X86-NEXT: je .LBB6_2
143 ; X86-NEXT: movl %eax, %edx
144 ; X86-NEXT: xorl %eax, %eax
146 ; X86-NEXT: notl %edx
147 ; X86-NEXT: notl %eax
148 ; X86-NEXT: andl {{[0-9]+}}(%esp), %edx
149 ; X86-NEXT: andl {{[0-9]+}}(%esp), %eax
157 define i64 @bts_64(i64 %x, i64 %n) {
160 ; X64-NEXT: movq %rdi, %rax
161 ; X64-NEXT: btsq %rsi, %rax
166 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
167 ; X86-NEXT: movl $1, %eax
168 ; X86-NEXT: xorl %edx, %edx
169 ; X86-NEXT: shldl %cl, %eax, %edx
170 ; X86-NEXT: shll %cl, %eax
171 ; X86-NEXT: testb $32, %cl
172 ; X86-NEXT: je .LBB7_2
174 ; X86-NEXT: movl %eax, %edx
175 ; X86-NEXT: xorl %eax, %eax
177 ; X86-NEXT: orl {{[0-9]+}}(%esp), %edx
178 ; X86-NEXT: orl {{[0-9]+}}(%esp), %eax
185 define i64 @btc_64(i64 %x, i64 %n) {
188 ; X64-NEXT: movq %rdi, %rax
189 ; X64-NEXT: btcq %rsi, %rax
194 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
195 ; X86-NEXT: movl $1, %eax
196 ; X86-NEXT: xorl %edx, %edx
197 ; X86-NEXT: shldl %cl, %eax, %edx
198 ; X86-NEXT: shll %cl, %eax
199 ; X86-NEXT: testb $32, %cl
200 ; X86-NEXT: je .LBB8_2
202 ; X86-NEXT: movl %eax, %edx
203 ; X86-NEXT: xorl %eax, %eax
205 ; X86-NEXT: xorl {{[0-9]+}}(%esp), %edx
206 ; X86-NEXT: xorl {{[0-9]+}}(%esp), %eax
213 define i16 @btr_16_mask(i16 %x, i16 %n) {
214 ; X64-LABEL: btr_16_mask:
216 ; X64-NEXT: movl %esi, %ecx
217 ; X64-NEXT: movw $-2, %ax
218 ; X64-NEXT: # kill: def $cl killed $cl killed $ecx
219 ; X64-NEXT: rolw %cl, %ax
220 ; X64-NEXT: andl %edi, %eax
221 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
224 ; X86-LABEL: btr_16_mask:
226 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
227 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
228 ; X86-NEXT: btrw %cx, %ax
237 define i16 @bts_16_mask(i16 %x, i16 %n) {
238 ; X64-LABEL: bts_16_mask:
240 ; X64-NEXT: movl %edi, %eax
241 ; X64-NEXT: andb $15, %sil
242 ; X64-NEXT: btsl %esi, %eax
243 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
246 ; X86-LABEL: bts_16_mask:
248 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
249 ; X86-NEXT: andb $15, %cl
250 ; X86-NEXT: movl $1, %eax
251 ; X86-NEXT: shll %cl, %eax
252 ; X86-NEXT: orw {{[0-9]+}}(%esp), %ax
253 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
261 define i16 @btc_16_mask(i16 %x, i16 %n) {
262 ; X64-LABEL: btc_16_mask:
264 ; X64-NEXT: movl %edi, %eax
265 ; X64-NEXT: andb $15, %sil
266 ; X64-NEXT: btcl %esi, %eax
267 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
270 ; X86-LABEL: btc_16_mask:
272 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
273 ; X86-NEXT: andb $15, %cl
274 ; X86-NEXT: movl $1, %eax
275 ; X86-NEXT: shll %cl, %eax
276 ; X86-NEXT: xorw {{[0-9]+}}(%esp), %ax
277 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
285 define i32 @btr_32_mask(i32 %x, i32 %n) {
286 ; X64-LABEL: btr_32_mask:
288 ; X64-NEXT: movl %edi, %eax
289 ; X64-NEXT: btrl %esi, %eax
292 ; X86-LABEL: btr_32_mask:
294 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
295 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
296 ; X86-NEXT: btrl %ecx, %eax
305 define i32 @bts_32_mask(i32 %x, i32 %n) {
306 ; X64-LABEL: bts_32_mask:
308 ; X64-NEXT: movl %edi, %eax
309 ; X64-NEXT: btsl %esi, %eax
312 ; X86-LABEL: bts_32_mask:
314 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
315 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
316 ; X86-NEXT: btsl %ecx, %eax
324 define i32 @btc_32_mask(i32 %x, i32 %n) {
325 ; X64-LABEL: btc_32_mask:
327 ; X64-NEXT: movl %edi, %eax
328 ; X64-NEXT: btcl %esi, %eax
331 ; X86-LABEL: btc_32_mask:
333 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
334 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
335 ; X86-NEXT: btcl %ecx, %eax
343 define i64 @btr_64_mask(i64 %x, i64 %n) {
344 ; X64-LABEL: btr_64_mask:
346 ; X64-NEXT: movq %rdi, %rax
347 ; X64-NEXT: btrq %rsi, %rax
350 ; X86-LABEL: btr_64_mask:
352 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
353 ; X86-NEXT: movl $1, %eax
354 ; X86-NEXT: xorl %edx, %edx
355 ; X86-NEXT: shldl %cl, %eax, %edx
356 ; X86-NEXT: shll %cl, %eax
357 ; X86-NEXT: testb $32, %cl
358 ; X86-NEXT: je .LBB15_2
360 ; X86-NEXT: movl %eax, %edx
361 ; X86-NEXT: xorl %eax, %eax
362 ; X86-NEXT: .LBB15_2:
363 ; X86-NEXT: notl %edx
364 ; X86-NEXT: notl %eax
365 ; X86-NEXT: andl {{[0-9]+}}(%esp), %edx
366 ; X86-NEXT: andl {{[0-9]+}}(%esp), %eax
375 define i64 @bts_64_mask(i64 %x, i64 %n) {
376 ; X64-LABEL: bts_64_mask:
378 ; X64-NEXT: movq %rdi, %rax
379 ; X64-NEXT: btsq %rsi, %rax
382 ; X86-LABEL: bts_64_mask:
384 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
385 ; X86-NEXT: movl $1, %eax
386 ; X86-NEXT: xorl %edx, %edx
387 ; X86-NEXT: shldl %cl, %eax, %edx
388 ; X86-NEXT: shll %cl, %eax
389 ; X86-NEXT: testb $32, %cl
390 ; X86-NEXT: je .LBB16_2
392 ; X86-NEXT: movl %eax, %edx
393 ; X86-NEXT: xorl %eax, %eax
394 ; X86-NEXT: .LBB16_2:
395 ; X86-NEXT: orl {{[0-9]+}}(%esp), %edx
396 ; X86-NEXT: orl {{[0-9]+}}(%esp), %eax
404 define i64 @btc_64_mask(i64 %x, i64 %n) {
405 ; X64-LABEL: btc_64_mask:
407 ; X64-NEXT: movq %rdi, %rax
408 ; X64-NEXT: btcq %rsi, %rax
411 ; X86-LABEL: btc_64_mask:
413 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
414 ; X86-NEXT: movl $1, %eax
415 ; X86-NEXT: xorl %edx, %edx
416 ; X86-NEXT: shldl %cl, %eax, %edx
417 ; X86-NEXT: shll %cl, %eax
418 ; X86-NEXT: testb $32, %cl
419 ; X86-NEXT: je .LBB17_2
421 ; X86-NEXT: movl %eax, %edx
422 ; X86-NEXT: xorl %eax, %eax
423 ; X86-NEXT: .LBB17_2:
424 ; X86-NEXT: xorl {{[0-9]+}}(%esp), %edx
425 ; X86-NEXT: xorl {{[0-9]+}}(%esp), %eax
433 ; Tests below use loads and we favor folding those over matching btc/btr/bts.
435 define i16 @btr_16_load(ptr %x, i16 %n) {
436 ; X64-LABEL: btr_16_load:
438 ; X64-NEXT: movzwl (%rdi), %eax
439 ; X64-NEXT: btrw %si, %ax
442 ; X86-LABEL: btr_16_load:
444 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
445 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
446 ; X86-NEXT: movzwl (%eax), %eax
447 ; X86-NEXT: btrw %cx, %ax
449 %1 = load i16, ptr %x
456 define i16 @bts_16_load(ptr %x, i16 %n) {
457 ; X64-LABEL: bts_16_load:
459 ; X64-NEXT: movl %esi, %ecx
460 ; X64-NEXT: movl $1, %eax
461 ; X64-NEXT: # kill: def $cl killed $cl killed $ecx
462 ; X64-NEXT: shll %cl, %eax
463 ; X64-NEXT: orw (%rdi), %ax
464 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
467 ; X86-LABEL: bts_16_load:
469 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
470 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
471 ; X86-NEXT: movl $1, %eax
472 ; X86-NEXT: shll %cl, %eax
473 ; X86-NEXT: orw (%edx), %ax
474 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
476 %1 = load i16, ptr %x
482 define i16 @btc_16_load(ptr %x, i16 %n) {
483 ; X64-LABEL: btc_16_load:
485 ; X64-NEXT: movl %esi, %ecx
486 ; X64-NEXT: movl $1, %eax
487 ; X64-NEXT: # kill: def $cl killed $cl killed $ecx
488 ; X64-NEXT: shll %cl, %eax
489 ; X64-NEXT: xorw (%rdi), %ax
490 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
493 ; X86-LABEL: btc_16_load:
495 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
496 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
497 ; X86-NEXT: movl $1, %eax
498 ; X86-NEXT: shll %cl, %eax
499 ; X86-NEXT: xorw (%edx), %ax
500 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
502 %1 = load i16, ptr %x
508 define i32 @btr_32_load(ptr %x, i32 %n) {
509 ; X64-LABEL: btr_32_load:
511 ; X64-NEXT: movl (%rdi), %eax
512 ; X64-NEXT: btrl %esi, %eax
515 ; X86-LABEL: btr_32_load:
517 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
518 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
519 ; X86-NEXT: movl (%eax), %eax
520 ; X86-NEXT: btrl %ecx, %eax
522 %1 = load i32, ptr %x
529 define i32 @bts_32_load(ptr %x, i32 %n) {
530 ; X64-LABEL: bts_32_load:
532 ; X64-NEXT: movl (%rdi), %eax
533 ; X64-NEXT: btsl %esi, %eax
536 ; X86-LABEL: bts_32_load:
538 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
539 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
540 ; X86-NEXT: movl (%eax), %eax
541 ; X86-NEXT: btsl %ecx, %eax
543 %1 = load i32, ptr %x
549 define i32 @btc_32_load(ptr %x, i32 %n) {
550 ; X64-LABEL: btc_32_load:
552 ; X64-NEXT: movl (%rdi), %eax
553 ; X64-NEXT: btcl %esi, %eax
556 ; X86-LABEL: btc_32_load:
558 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
559 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
560 ; X86-NEXT: movl (%eax), %eax
561 ; X86-NEXT: btcl %ecx, %eax
563 %1 = load i32, ptr %x
569 define i64 @btr_64_load(ptr %x, i64 %n) {
570 ; X64-LABEL: btr_64_load:
572 ; X64-NEXT: movq (%rdi), %rax
573 ; X64-NEXT: btrq %rsi, %rax
576 ; X86-LABEL: btr_64_load:
578 ; X86-NEXT: pushl %esi
579 ; X86-NEXT: .cfi_def_cfa_offset 8
580 ; X86-NEXT: .cfi_offset %esi, -8
581 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
582 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
583 ; X86-NEXT: movl $1, %eax
584 ; X86-NEXT: xorl %edx, %edx
585 ; X86-NEXT: shldl %cl, %eax, %edx
586 ; X86-NEXT: shll %cl, %eax
587 ; X86-NEXT: testb $32, %cl
588 ; X86-NEXT: je .LBB24_2
590 ; X86-NEXT: movl %eax, %edx
591 ; X86-NEXT: xorl %eax, %eax
592 ; X86-NEXT: .LBB24_2:
593 ; X86-NEXT: notl %edx
594 ; X86-NEXT: notl %eax
595 ; X86-NEXT: andl 4(%esi), %edx
596 ; X86-NEXT: andl (%esi), %eax
597 ; X86-NEXT: popl %esi
598 ; X86-NEXT: .cfi_def_cfa_offset 4
600 %1 = load i64, ptr %x
607 define i64 @bts_64_load(ptr %x, i64 %n) {
608 ; X64-LABEL: bts_64_load:
610 ; X64-NEXT: movq (%rdi), %rax
611 ; X64-NEXT: btsq %rsi, %rax
614 ; X86-LABEL: bts_64_load:
616 ; X86-NEXT: pushl %esi
617 ; X86-NEXT: .cfi_def_cfa_offset 8
618 ; X86-NEXT: .cfi_offset %esi, -8
619 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
620 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
621 ; X86-NEXT: movl $1, %eax
622 ; X86-NEXT: xorl %edx, %edx
623 ; X86-NEXT: shldl %cl, %eax, %edx
624 ; X86-NEXT: shll %cl, %eax
625 ; X86-NEXT: testb $32, %cl
626 ; X86-NEXT: je .LBB25_2
628 ; X86-NEXT: movl %eax, %edx
629 ; X86-NEXT: xorl %eax, %eax
630 ; X86-NEXT: .LBB25_2:
631 ; X86-NEXT: orl 4(%esi), %edx
632 ; X86-NEXT: orl (%esi), %eax
633 ; X86-NEXT: popl %esi
634 ; X86-NEXT: .cfi_def_cfa_offset 4
636 %1 = load i64, ptr %x
642 define i64 @btc_64_load(ptr %x, i64 %n) {
643 ; X64-LABEL: btc_64_load:
645 ; X64-NEXT: movq (%rdi), %rax
646 ; X64-NEXT: btcq %rsi, %rax
649 ; X86-LABEL: btc_64_load:
651 ; X86-NEXT: pushl %esi
652 ; X86-NEXT: .cfi_def_cfa_offset 8
653 ; X86-NEXT: .cfi_offset %esi, -8
654 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
655 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
656 ; X86-NEXT: movl $1, %eax
657 ; X86-NEXT: xorl %edx, %edx
658 ; X86-NEXT: shldl %cl, %eax, %edx
659 ; X86-NEXT: shll %cl, %eax
660 ; X86-NEXT: testb $32, %cl
661 ; X86-NEXT: je .LBB26_2
663 ; X86-NEXT: movl %eax, %edx
664 ; X86-NEXT: xorl %eax, %eax
665 ; X86-NEXT: .LBB26_2:
666 ; X86-NEXT: xorl 4(%esi), %edx
667 ; X86-NEXT: xorl (%esi), %eax
668 ; X86-NEXT: popl %esi
669 ; X86-NEXT: .cfi_def_cfa_offset 4
671 %1 = load i64, ptr %x
677 ; For the tests below, we definitely shouldn't fold them to the memory forms
678 ; of BTR/BTS/BTC as they have very different semantics from their register
681 define void @btr_16_dont_fold(ptr %x, i16 %n) {
682 ; X64-LABEL: btr_16_dont_fold:
684 ; X64-NEXT: movl %esi, %ecx
685 ; X64-NEXT: movw $-2, %ax
686 ; X64-NEXT: # kill: def $cl killed $cl killed $ecx
687 ; X64-NEXT: rolw %cl, %ax
688 ; X64-NEXT: andw %ax, (%rdi)
691 ; X86-LABEL: btr_16_dont_fold:
693 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
694 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
695 ; X86-NEXT: movw $-2, %dx
696 ; X86-NEXT: rolw %cl, %dx
697 ; X86-NEXT: andw %dx, (%eax)
699 %1 = load i16, ptr %x
707 define void @bts_16_dont_fold(ptr %x, i16 %n) {
708 ; X64-LABEL: bts_16_dont_fold:
710 ; X64-NEXT: movl %esi, %ecx
711 ; X64-NEXT: movl $1, %eax
712 ; X64-NEXT: # kill: def $cl killed $cl killed $ecx
713 ; X64-NEXT: shll %cl, %eax
714 ; X64-NEXT: orw %ax, (%rdi)
717 ; X86-LABEL: bts_16_dont_fold:
719 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
720 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
721 ; X86-NEXT: movl $1, %edx
722 ; X86-NEXT: shll %cl, %edx
723 ; X86-NEXT: orw %dx, (%eax)
725 %1 = load i16, ptr %x
732 define void @btc_16_dont_fold(ptr %x, i16 %n) {
733 ; X64-LABEL: btc_16_dont_fold:
735 ; X64-NEXT: movl %esi, %ecx
736 ; X64-NEXT: movl $1, %eax
737 ; X64-NEXT: # kill: def $cl killed $cl killed $ecx
738 ; X64-NEXT: shll %cl, %eax
739 ; X64-NEXT: xorw %ax, (%rdi)
742 ; X86-LABEL: btc_16_dont_fold:
744 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
745 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
746 ; X86-NEXT: movl $1, %edx
747 ; X86-NEXT: shll %cl, %edx
748 ; X86-NEXT: xorw %dx, (%eax)
750 %1 = load i16, ptr %x
757 define void @btr_32_dont_fold(ptr %x, i32 %n) {
758 ; X64-LABEL: btr_32_dont_fold:
760 ; X64-NEXT: movl %esi, %ecx
761 ; X64-NEXT: movl $-2, %eax
762 ; X64-NEXT: # kill: def $cl killed $cl killed $ecx
763 ; X64-NEXT: roll %cl, %eax
764 ; X64-NEXT: andl %eax, (%rdi)
767 ; X86-LABEL: btr_32_dont_fold:
769 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
770 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
771 ; X86-NEXT: movl $-2, %edx
772 ; X86-NEXT: roll %cl, %edx
773 ; X86-NEXT: andl %edx, (%eax)
775 %1 = load i32, ptr %x
783 define void @bts_32_dont_fold(ptr %x, i32 %n) {
784 ; X64-LABEL: bts_32_dont_fold:
786 ; X64-NEXT: movl %esi, %ecx
787 ; X64-NEXT: movl $1, %eax
788 ; X64-NEXT: # kill: def $cl killed $cl killed $ecx
789 ; X64-NEXT: shll %cl, %eax
790 ; X64-NEXT: orl %eax, (%rdi)
793 ; X86-LABEL: bts_32_dont_fold:
795 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
796 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
797 ; X86-NEXT: movl $1, %edx
798 ; X86-NEXT: shll %cl, %edx
799 ; X86-NEXT: orl %edx, (%eax)
801 %1 = load i32, ptr %x
808 define void @btc_32_dont_fold(ptr %x, i32 %n) {
809 ; X64-LABEL: btc_32_dont_fold:
811 ; X64-NEXT: movl %esi, %ecx
812 ; X64-NEXT: movl $1, %eax
813 ; X64-NEXT: # kill: def $cl killed $cl killed $ecx
814 ; X64-NEXT: shll %cl, %eax
815 ; X64-NEXT: xorl %eax, (%rdi)
818 ; X86-LABEL: btc_32_dont_fold:
820 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
821 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
822 ; X86-NEXT: movl $1, %edx
823 ; X86-NEXT: shll %cl, %edx
824 ; X86-NEXT: xorl %edx, (%eax)
826 %1 = load i32, ptr %x
833 define void @btr_64_dont_fold(ptr %x, i64 %n) {
834 ; X64-LABEL: btr_64_dont_fold:
836 ; X64-NEXT: movq %rsi, %rcx
837 ; X64-NEXT: movq $-2, %rax
838 ; X64-NEXT: # kill: def $cl killed $cl killed $rcx
839 ; X64-NEXT: rolq %cl, %rax
840 ; X64-NEXT: andq %rax, (%rdi)
843 ; X86-LABEL: btr_64_dont_fold:
845 ; X86-NEXT: pushl %esi
846 ; X86-NEXT: .cfi_def_cfa_offset 8
847 ; X86-NEXT: .cfi_offset %esi, -8
848 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
849 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
850 ; X86-NEXT: movl $1, %edx
851 ; X86-NEXT: xorl %esi, %esi
852 ; X86-NEXT: shldl %cl, %edx, %esi
853 ; X86-NEXT: shll %cl, %edx
854 ; X86-NEXT: testb $32, %cl
855 ; X86-NEXT: je .LBB33_2
857 ; X86-NEXT: movl %edx, %esi
858 ; X86-NEXT: xorl %edx, %edx
859 ; X86-NEXT: .LBB33_2:
860 ; X86-NEXT: notl %esi
861 ; X86-NEXT: notl %edx
862 ; X86-NEXT: andl %edx, (%eax)
863 ; X86-NEXT: andl %esi, 4(%eax)
864 ; X86-NEXT: popl %esi
865 ; X86-NEXT: .cfi_def_cfa_offset 4
867 %1 = load i64, ptr %x
875 define void @bts_64_dont_fold(ptr %x, i64 %n) {
876 ; X64-LABEL: bts_64_dont_fold:
878 ; X64-NEXT: movq %rsi, %rcx
879 ; X64-NEXT: movl $1, %eax
880 ; X64-NEXT: # kill: def $cl killed $cl killed $rcx
881 ; X64-NEXT: shlq %cl, %rax
882 ; X64-NEXT: orq %rax, (%rdi)
885 ; X86-LABEL: bts_64_dont_fold:
887 ; X86-NEXT: pushl %esi
888 ; X86-NEXT: .cfi_def_cfa_offset 8
889 ; X86-NEXT: .cfi_offset %esi, -8
890 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
891 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
892 ; X86-NEXT: movl $1, %edx
893 ; X86-NEXT: xorl %esi, %esi
894 ; X86-NEXT: shldl %cl, %edx, %esi
895 ; X86-NEXT: shll %cl, %edx
896 ; X86-NEXT: testb $32, %cl
897 ; X86-NEXT: je .LBB34_2
899 ; X86-NEXT: movl %edx, %esi
900 ; X86-NEXT: xorl %edx, %edx
901 ; X86-NEXT: .LBB34_2:
902 ; X86-NEXT: orl %edx, (%eax)
903 ; X86-NEXT: orl %esi, 4(%eax)
904 ; X86-NEXT: popl %esi
905 ; X86-NEXT: .cfi_def_cfa_offset 4
907 %1 = load i64, ptr %x
914 define void @btc_64_dont_fold(ptr %x, i64 %n) {
915 ; X64-LABEL: btc_64_dont_fold:
917 ; X64-NEXT: movq %rsi, %rcx
918 ; X64-NEXT: movl $1, %eax
919 ; X64-NEXT: # kill: def $cl killed $cl killed $rcx
920 ; X64-NEXT: shlq %cl, %rax
921 ; X64-NEXT: xorq %rax, (%rdi)
924 ; X86-LABEL: btc_64_dont_fold:
926 ; X86-NEXT: pushl %esi
927 ; X86-NEXT: .cfi_def_cfa_offset 8
928 ; X86-NEXT: .cfi_offset %esi, -8
929 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
930 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
931 ; X86-NEXT: movl $1, %edx
932 ; X86-NEXT: xorl %esi, %esi
933 ; X86-NEXT: shldl %cl, %edx, %esi
934 ; X86-NEXT: shll %cl, %edx
935 ; X86-NEXT: testb $32, %cl
936 ; X86-NEXT: je .LBB35_2
938 ; X86-NEXT: movl %edx, %esi
939 ; X86-NEXT: xorl %edx, %edx
940 ; X86-NEXT: .LBB35_2:
941 ; X86-NEXT: xorl %edx, (%eax)
942 ; X86-NEXT: xorl %esi, 4(%eax)
943 ; X86-NEXT: popl %esi
944 ; X86-NEXT: .cfi_def_cfa_offset 4
946 %1 = load i64, ptr %x
953 define i32 @btr_32_mask_zeros(i32 %x, i32 %n) {
954 ; X64-LABEL: btr_32_mask_zeros:
956 ; X64-NEXT: movl %edi, %eax
957 ; X64-NEXT: shll $2, %esi
958 ; X64-NEXT: btrl %esi, %eax
961 ; X86-LABEL: btr_32_mask_zeros:
963 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
964 ; X86-NEXT: shlb $2, %cl
965 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
966 ; X86-NEXT: btrl %ecx, %eax
976 define i32 @bts_32_mask_zeros(i32 %x, i32 %n) {
977 ; X64-LABEL: bts_32_mask_zeros:
979 ; X64-NEXT: movl %edi, %eax
980 ; X64-NEXT: shll $2, %esi
981 ; X64-NEXT: btsl %esi, %eax
984 ; X86-LABEL: bts_32_mask_zeros:
986 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
987 ; X86-NEXT: shlb $2, %cl
988 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
989 ; X86-NEXT: btsl %ecx, %eax
998 define i32 @btc_32_mask_zeros(i32 %x, i32 %n) {
999 ; X64-LABEL: btc_32_mask_zeros:
1001 ; X64-NEXT: movl %edi, %eax
1002 ; X64-NEXT: shll $2, %esi
1003 ; X64-NEXT: btcl %esi, %eax
1006 ; X86-LABEL: btc_32_mask_zeros:
1008 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
1009 ; X86-NEXT: shlb $2, %cl
1010 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1011 ; X86-NEXT: btcl %ecx, %eax
1020 define i64 @btr_64_mask_zeros(i64 %x, i64 %n) {
1021 ; X64-LABEL: btr_64_mask_zeros:
1023 ; X64-NEXT: movq %rdi, %rax
1024 ; X64-NEXT: shll $2, %esi
1025 ; X64-NEXT: btrq %rsi, %rax
1028 ; X86-LABEL: btr_64_mask_zeros:
1030 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
1031 ; X86-NEXT: shll $2, %ecx
1032 ; X86-NEXT: movl $1, %eax
1033 ; X86-NEXT: xorl %edx, %edx
1034 ; X86-NEXT: shldl %cl, %eax, %edx
1035 ; X86-NEXT: shll %cl, %eax
1036 ; X86-NEXT: testb $32, %cl
1037 ; X86-NEXT: je .LBB39_2
1038 ; X86-NEXT: # %bb.1:
1039 ; X86-NEXT: movl %eax, %edx
1040 ; X86-NEXT: xorl %eax, %eax
1041 ; X86-NEXT: .LBB39_2:
1042 ; X86-NEXT: notl %edx
1043 ; X86-NEXT: notl %eax
1044 ; X86-NEXT: andl {{[0-9]+}}(%esp), %edx
1045 ; X86-NEXT: andl {{[0-9]+}}(%esp), %eax
1055 define i64 @bts_64_mask_zeros(i64 %x, i64 %n) {
1056 ; X64-LABEL: bts_64_mask_zeros:
1058 ; X64-NEXT: movq %rdi, %rax
1059 ; X64-NEXT: shll $2, %esi
1060 ; X64-NEXT: btsq %rsi, %rax
1063 ; X86-LABEL: bts_64_mask_zeros:
1065 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
1066 ; X86-NEXT: shll $2, %ecx
1067 ; X86-NEXT: movl $1, %eax
1068 ; X86-NEXT: xorl %edx, %edx
1069 ; X86-NEXT: shldl %cl, %eax, %edx
1070 ; X86-NEXT: shll %cl, %eax
1071 ; X86-NEXT: testb $32, %cl
1072 ; X86-NEXT: je .LBB40_2
1073 ; X86-NEXT: # %bb.1:
1074 ; X86-NEXT: movl %eax, %edx
1075 ; X86-NEXT: xorl %eax, %eax
1076 ; X86-NEXT: .LBB40_2:
1077 ; X86-NEXT: orl {{[0-9]+}}(%esp), %edx
1078 ; X86-NEXT: orl {{[0-9]+}}(%esp), %eax
1087 define i64 @btc_64_mask_zeros(i64 %x, i64 %n) {
1088 ; X64-LABEL: btc_64_mask_zeros:
1090 ; X64-NEXT: movq %rdi, %rax
1091 ; X64-NEXT: shll $2, %esi
1092 ; X64-NEXT: btcq %rsi, %rax
1095 ; X86-LABEL: btc_64_mask_zeros:
1097 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
1098 ; X86-NEXT: shll $2, %ecx
1099 ; X86-NEXT: movl $1, %eax
1100 ; X86-NEXT: xorl %edx, %edx
1101 ; X86-NEXT: shldl %cl, %eax, %edx
1102 ; X86-NEXT: shll %cl, %eax
1103 ; X86-NEXT: testb $32, %cl
1104 ; X86-NEXT: je .LBB41_2
1105 ; X86-NEXT: # %bb.1:
1106 ; X86-NEXT: movl %eax, %edx
1107 ; X86-NEXT: xorl %eax, %eax
1108 ; X86-NEXT: .LBB41_2:
1109 ; X86-NEXT: xorl {{[0-9]+}}(%esp), %edx
1110 ; X86-NEXT: xorl {{[0-9]+}}(%esp), %eax