1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=x86_64-unknown-unknown -mattr=+tbm < %s | FileCheck %s
4 define i32 @test_x86_tbm_bextri_u32(i32 %a) nounwind {
5 ; CHECK-LABEL: test_x86_tbm_bextri_u32:
7 ; CHECK-NEXT: bextrl $3076, %edi, %eax # imm = 0xC04
10 %t1 = and i32 %t0, 4095
14 ; Make sure we still use AH subreg trick for extracting bits 15:8
15 define i32 @test_x86_tbm_bextri_u32_subreg(i32 %a) nounwind {
16 ; CHECK-LABEL: test_x86_tbm_bextri_u32_subreg:
18 ; CHECK-NEXT: movl %edi, %eax
19 ; CHECK-NEXT: movzbl %ah, %eax
22 %t1 = and i32 %t0, 255
26 define i32 @test_x86_tbm_bextri_u32_m(i32* nocapture %a) nounwind {
27 ; CHECK-LABEL: test_x86_tbm_bextri_u32_m:
29 ; CHECK-NEXT: bextrl $3076, (%rdi), %eax # imm = 0xC04
31 %t0 = load i32, i32* %a
33 %t2 = and i32 %t1, 4095
37 define i32 @test_x86_tbm_bextri_u32_z(i32 %a, i32 %b) nounwind {
38 ; CHECK-LABEL: test_x86_tbm_bextri_u32_z:
40 ; CHECK-NEXT: bextrl $3076, %edi, %eax # imm = 0xC04
41 ; CHECK-NEXT: cmovel %esi, %eax
44 %t1 = and i32 %t0, 4095
45 %t2 = icmp eq i32 %t1, 0
46 %t3 = select i1 %t2, i32 %b, i32 %t1
50 define i32 @test_x86_tbm_bextri_u32_z2(i32 %a, i32 %b, i32 %c) nounwind {
51 ; CHECK-LABEL: test_x86_tbm_bextri_u32_z2:
53 ; CHECK-NEXT: movl %esi, %eax
54 ; CHECK-NEXT: bextrl $3076, %edi, %ecx # imm = 0xC04
55 ; CHECK-NEXT: cmovnel %edx, %eax
58 %t1 = and i32 %t0, 4095
59 %t2 = icmp eq i32 %t1, 0
60 %t3 = select i1 %t2, i32 %b, i32 %c
64 define i64 @test_x86_tbm_bextri_u64(i64 %a) nounwind {
65 ; CHECK-LABEL: test_x86_tbm_bextri_u64:
67 ; CHECK-NEXT: bextrl $3076, %edi, %eax # imm = 0xC04
70 %t1 = and i64 %t0, 4095
74 ; Make sure we still use AH subreg trick for extracting bits 15:8
75 define i64 @test_x86_tbm_bextri_u64_subreg(i64 %a) nounwind {
76 ; CHECK-LABEL: test_x86_tbm_bextri_u64_subreg:
78 ; CHECK-NEXT: movq %rdi, %rax
79 ; CHECK-NEXT: movzbl %ah, %eax
82 %t1 = and i64 %t0, 255
86 define i64 @test_x86_tbm_bextri_u64_m(i64* nocapture %a) nounwind {
87 ; CHECK-LABEL: test_x86_tbm_bextri_u64_m:
89 ; CHECK-NEXT: bextrl $3076, (%rdi), %eax # imm = 0xC04
91 %t0 = load i64, i64* %a
93 %t2 = and i64 %t1, 4095
97 define i64 @test_x86_tbm_bextri_u64_z(i64 %a, i64 %b) nounwind {
98 ; CHECK-LABEL: test_x86_tbm_bextri_u64_z:
100 ; CHECK-NEXT: bextrl $3076, %edi, %eax # imm = 0xC04
101 ; CHECK-NEXT: cmoveq %rsi, %rax
104 %t1 = and i64 %t0, 4095
105 %t2 = icmp eq i64 %t1, 0
106 %t3 = select i1 %t2, i64 %b, i64 %t1
110 define i64 @test_x86_tbm_bextri_u64_z2(i64 %a, i64 %b, i64 %c) nounwind {
111 ; CHECK-LABEL: test_x86_tbm_bextri_u64_z2:
113 ; CHECK-NEXT: movq %rsi, %rax
114 ; CHECK-NEXT: bextrl $3076, %edi, %ecx # imm = 0xC04
115 ; CHECK-NEXT: cmovneq %rdx, %rax
118 %t1 = and i64 %t0, 4095
119 %t2 = icmp eq i64 %t1, 0
120 %t3 = select i1 %t2, i64 %b, i64 %c
124 define i32 @test_x86_tbm_blcfill_u32(i32 %a) nounwind {
125 ; CHECK-LABEL: test_x86_tbm_blcfill_u32:
127 ; CHECK-NEXT: blcfilll %edi, %eax
130 %t1 = and i32 %t0, %a
134 define i32 @test_x86_tbm_blcfill_u32_z(i32 %a, i32 %b) nounwind {
135 ; CHECK-LABEL: test_x86_tbm_blcfill_u32_z:
137 ; CHECK-NEXT: blcfilll %edi, %eax
138 ; CHECK-NEXT: cmovel %esi, %eax
141 %t1 = and i32 %t0, %a
142 %t2 = icmp eq i32 %t1, 0
143 %t3 = select i1 %t2, i32 %b, i32 %t1
147 define i32 @test_x86_tbm_blcfill_u32_z2(i32 %a, i32 %b, i32 %c) nounwind {
148 ; CHECK-LABEL: test_x86_tbm_blcfill_u32_z2:
150 ; CHECK-NEXT: movl %esi, %eax
151 ; CHECK-NEXT: blcfilll %edi, %ecx
152 ; CHECK-NEXT: cmovnel %edx, %eax
155 %t1 = and i32 %t0, %a
156 %t2 = icmp eq i32 %t1, 0
157 %t3 = select i1 %t2, i32 %b, i32 %c
161 define i64 @test_x86_tbm_blcfill_u64(i64 %a) nounwind {
162 ; CHECK-LABEL: test_x86_tbm_blcfill_u64:
164 ; CHECK-NEXT: blcfillq %rdi, %rax
167 %t1 = and i64 %t0, %a
171 define i64 @test_x86_tbm_blcfill_u64_z(i64 %a, i64 %b) nounwind {
172 ; CHECK-LABEL: test_x86_tbm_blcfill_u64_z:
174 ; CHECK-NEXT: blcfillq %rdi, %rax
175 ; CHECK-NEXT: cmoveq %rsi, %rax
178 %t1 = and i64 %t0, %a
179 %t2 = icmp eq i64 %t1, 0
180 %t3 = select i1 %t2, i64 %b, i64 %t1
184 define i64 @test_x86_tbm_blcfill_u64_z2(i64 %a, i64 %b, i64 %c) nounwind {
185 ; CHECK-LABEL: test_x86_tbm_blcfill_u64_z2:
187 ; CHECK-NEXT: movq %rsi, %rax
188 ; CHECK-NEXT: blcfillq %rdi, %rcx
189 ; CHECK-NEXT: cmovneq %rdx, %rax
192 %t1 = and i64 %t0, %a
193 %t2 = icmp eq i64 %t1, 0
194 %t3 = select i1 %t2, i64 %b, i64 %c
198 define i32 @test_x86_tbm_blci_u32(i32 %a) nounwind {
199 ; CHECK-LABEL: test_x86_tbm_blci_u32:
201 ; CHECK-NEXT: blcil %edi, %eax
204 %t1 = xor i32 %t0, -1
209 define i32 @test_x86_tbm_blci_u32_z(i32 %a, i32 %b) nounwind {
210 ; CHECK-LABEL: test_x86_tbm_blci_u32_z:
212 ; CHECK-NEXT: blcil %edi, %eax
213 ; CHECK-NEXT: cmovel %esi, %eax
216 %t1 = xor i32 %t0, -1
218 %t3 = icmp eq i32 %t2, 0
219 %t4 = select i1 %t3, i32 %b, i32 %t2
223 define i32 @test_x86_tbm_blci_u32_z2(i32 %a, i32 %b, i32 %c) nounwind {
224 ; CHECK-LABEL: test_x86_tbm_blci_u32_z2:
226 ; CHECK-NEXT: movl %esi, %eax
227 ; CHECK-NEXT: blcil %edi, %ecx
228 ; CHECK-NEXT: cmovnel %edx, %eax
231 %t1 = xor i32 %t0, -1
233 %t3 = icmp eq i32 %t2, 0
234 %t4 = select i1 %t3, i32 %b, i32 %c
238 define i64 @test_x86_tbm_blci_u64(i64 %a) nounwind {
239 ; CHECK-LABEL: test_x86_tbm_blci_u64:
241 ; CHECK-NEXT: blciq %rdi, %rax
244 %t1 = xor i64 %t0, -1
249 define i64 @test_x86_tbm_blci_u64_z(i64 %a, i64 %b) nounwind {
250 ; CHECK-LABEL: test_x86_tbm_blci_u64_z:
252 ; CHECK-NEXT: blciq %rdi, %rax
253 ; CHECK-NEXT: cmoveq %rsi, %rax
256 %t1 = xor i64 %t0, -1
258 %t3 = icmp eq i64 %t2, 0
259 %t4 = select i1 %t3, i64 %b, i64 %t2
263 define i64 @test_x86_tbm_blci_u64_z2(i64 %a, i64 %b, i64 %c) nounwind {
264 ; CHECK-LABEL: test_x86_tbm_blci_u64_z2:
266 ; CHECK-NEXT: movq %rsi, %rax
267 ; CHECK-NEXT: blciq %rdi, %rcx
268 ; CHECK-NEXT: cmovneq %rdx, %rax
271 %t1 = xor i64 %t0, -1
273 %t3 = icmp eq i64 %t2, 0
274 %t4 = select i1 %t3, i64 %b, i64 %c
278 define i32 @test_x86_tbm_blci_u32_b(i32 %a) nounwind {
279 ; CHECK-LABEL: test_x86_tbm_blci_u32_b:
281 ; CHECK-NEXT: blcil %edi, %eax
288 define i64 @test_x86_tbm_blci_u64_b(i64 %a) nounwind {
289 ; CHECK-LABEL: test_x86_tbm_blci_u64_b:
291 ; CHECK-NEXT: blciq %rdi, %rax
298 define i32 @test_x86_tbm_blcic_u32(i32 %a) nounwind {
299 ; CHECK-LABEL: test_x86_tbm_blcic_u32:
301 ; CHECK-NEXT: blcicl %edi, %eax
305 %t2 = and i32 %t1, %t0
309 define i32 @test_x86_tbm_blcic_u32_z(i32 %a, i32 %b) nounwind {
310 ; CHECK-LABEL: test_x86_tbm_blcic_u32_z:
312 ; CHECK-NEXT: blcicl %edi, %eax
313 ; CHECK-NEXT: cmovel %esi, %eax
317 %t2 = and i32 %t1, %t0
318 %t3 = icmp eq i32 %t2, 0
319 %t4 = select i1 %t3, i32 %b, i32 %t2
323 define i32 @test_x86_tbm_blcic_u32_z2(i32 %a, i32 %b, i32 %c) nounwind {
324 ; CHECK-LABEL: test_x86_tbm_blcic_u32_z2:
326 ; CHECK-NEXT: movl %esi, %eax
327 ; CHECK-NEXT: blcicl %edi, %ecx
328 ; CHECK-NEXT: cmovnel %edx, %eax
332 %t2 = and i32 %t1, %t0
333 %t3 = icmp eq i32 %t2, 0
334 %t4 = select i1 %t3, i32 %b, i32 %c
338 define i64 @test_x86_tbm_blcic_u64(i64 %a) nounwind {
339 ; CHECK-LABEL: test_x86_tbm_blcic_u64:
341 ; CHECK-NEXT: blcicq %rdi, %rax
345 %t2 = and i64 %t1, %t0
349 define i64 @test_x86_tbm_blcic_u64_z(i64 %a, i64 %b) nounwind {
350 ; CHECK-LABEL: test_x86_tbm_blcic_u64_z:
352 ; CHECK-NEXT: blcicq %rdi, %rax
353 ; CHECK-NEXT: cmoveq %rsi, %rax
357 %t2 = and i64 %t1, %t0
358 %t3 = icmp eq i64 %t2, 0
359 %t4 = select i1 %t3, i64 %b, i64 %t2
363 define i64 @test_x86_tbm_blcic_u64_z2(i64 %a, i64 %b, i64 %c) nounwind {
364 ; CHECK-LABEL: test_x86_tbm_blcic_u64_z2:
366 ; CHECK-NEXT: movq %rsi, %rax
367 ; CHECK-NEXT: blcicq %rdi, %rcx
368 ; CHECK-NEXT: cmovneq %rdx, %rax
372 %t2 = and i64 %t1, %t0
373 %t3 = icmp eq i64 %t2, 0
374 %t4 = select i1 %t3, i64 %b, i64 %c
378 define i32 @test_x86_tbm_blcmsk_u32(i32 %a) nounwind {
379 ; CHECK-LABEL: test_x86_tbm_blcmsk_u32:
381 ; CHECK-NEXT: blcmskl %edi, %eax
384 %t1 = xor i32 %t0, %a
388 define i32 @test_x86_tbm_blcmsk_u32_z(i32 %a, i32 %b) nounwind {
389 ; CHECK-LABEL: test_x86_tbm_blcmsk_u32_z:
391 ; CHECK-NEXT: blcmskl %edi, %eax
392 ; CHECK-NEXT: cmovel %esi, %eax
395 %t1 = xor i32 %t0, %a
396 %t2 = icmp eq i32 %t1, 0
397 %t3 = select i1 %t2, i32 %b, i32 %t1
401 define i32 @test_x86_tbm_blcmsk_u32_z2(i32 %a, i32 %b, i32 %c) nounwind {
402 ; CHECK-LABEL: test_x86_tbm_blcmsk_u32_z2:
404 ; CHECK-NEXT: movl %esi, %eax
405 ; CHECK-NEXT: blcmskl %edi, %ecx
406 ; CHECK-NEXT: cmovnel %edx, %eax
409 %t1 = xor i32 %t0, %a
410 %t2 = icmp eq i32 %t1, 0
411 %t3 = select i1 %t2, i32 %b, i32 %c
415 define i64 @test_x86_tbm_blcmsk_u64(i64 %a) nounwind {
416 ; CHECK-LABEL: test_x86_tbm_blcmsk_u64:
418 ; CHECK-NEXT: blcmskq %rdi, %rax
421 %t1 = xor i64 %t0, %a
425 define i64 @test_x86_tbm_blcmsk_u64_z(i64 %a, i64 %b) nounwind {
426 ; CHECK-LABEL: test_x86_tbm_blcmsk_u64_z:
428 ; CHECK-NEXT: blcmskq %rdi, %rax
429 ; CHECK-NEXT: cmoveq %rsi, %rax
432 %t1 = xor i64 %t0, %a
433 %t2 = icmp eq i64 %t1, 0
434 %t3 = select i1 %t2, i64 %b, i64 %t1
438 define i64 @test_x86_tbm_blcmsk_u64_z2(i64 %a, i64 %b, i64 %c) nounwind {
439 ; CHECK-LABEL: test_x86_tbm_blcmsk_u64_z2:
441 ; CHECK-NEXT: movq %rsi, %rax
442 ; CHECK-NEXT: blcmskq %rdi, %rcx
443 ; CHECK-NEXT: cmovneq %rdx, %rax
446 %t1 = xor i64 %t0, %a
447 %t2 = icmp eq i64 %t1, 0
448 %t3 = select i1 %t2, i64 %b, i64 %c
452 define i32 @test_x86_tbm_blcs_u32(i32 %a) nounwind {
453 ; CHECK-LABEL: test_x86_tbm_blcs_u32:
455 ; CHECK-NEXT: blcsl %edi, %eax
462 define i32 @test_x86_tbm_blcs_u32_z(i32 %a, i32 %b) nounwind {
463 ; CHECK-LABEL: test_x86_tbm_blcs_u32_z:
465 ; CHECK-NEXT: blcsl %edi, %eax
466 ; CHECK-NEXT: cmovel %esi, %eax
470 %t2 = icmp eq i32 %t1, 0
471 %t3 = select i1 %t2, i32 %b, i32 %t1
475 define i32 @test_x86_tbm_blcs_u32_z2(i32 %a, i32 %b, i32 %c) nounwind {
476 ; CHECK-LABEL: test_x86_tbm_blcs_u32_z2:
478 ; CHECK-NEXT: movl %esi, %eax
479 ; CHECK-NEXT: blcsl %edi, %ecx
480 ; CHECK-NEXT: cmovnel %edx, %eax
484 %t2 = icmp eq i32 %t1, 0
485 %t3 = select i1 %t2, i32 %b, i32 %c
489 define i64 @test_x86_tbm_blcs_u64(i64 %a) nounwind {
490 ; CHECK-LABEL: test_x86_tbm_blcs_u64:
492 ; CHECK-NEXT: blcsq %rdi, %rax
499 define i64 @test_x86_tbm_blcs_u64_z(i64 %a, i64 %b) nounwind {
500 ; CHECK-LABEL: test_x86_tbm_blcs_u64_z:
502 ; CHECK-NEXT: blcsq %rdi, %rax
503 ; CHECK-NEXT: cmoveq %rsi, %rax
507 %t2 = icmp eq i64 %t1, 0
508 %t3 = select i1 %t2, i64 %b, i64 %t1
512 define i64 @test_x86_tbm_blcs_u64_z2(i64 %a, i64 %b, i64 %c) nounwind {
513 ; CHECK-LABEL: test_x86_tbm_blcs_u64_z2:
515 ; CHECK-NEXT: movq %rsi, %rax
516 ; CHECK-NEXT: blcsq %rdi, %rcx
517 ; CHECK-NEXT: cmovneq %rdx, %rax
521 %t2 = icmp eq i64 %t1, 0
522 %t3 = select i1 %t2, i64 %b, i64 %c
526 define i32 @test_x86_tbm_blsfill_u32(i32 %a) nounwind {
527 ; CHECK-LABEL: test_x86_tbm_blsfill_u32:
529 ; CHECK-NEXT: blsfilll %edi, %eax
536 define i32 @test_x86_tbm_blsfill_u32_z(i32 %a, i32 %b) nounwind {
537 ; CHECK-LABEL: test_x86_tbm_blsfill_u32_z:
539 ; CHECK-NEXT: blsfilll %edi, %eax
540 ; CHECK-NEXT: cmovel %esi, %eax
544 %t2 = icmp eq i32 %t1, 0
545 %t3 = select i1 %t2, i32 %b, i32 %t1
549 define i32 @test_x86_tbm_blsfill_u32_z2(i32 %a, i32 %b, i32 %c) nounwind {
550 ; CHECK-LABEL: test_x86_tbm_blsfill_u32_z2:
552 ; CHECK-NEXT: movl %esi, %eax
553 ; CHECK-NEXT: blsfilll %edi, %ecx
554 ; CHECK-NEXT: cmovnel %edx, %eax
558 %t2 = icmp eq i32 %t1, 0
559 %t3 = select i1 %t2, i32 %b, i32 %c
563 define i64 @test_x86_tbm_blsfill_u64(i64 %a) nounwind {
564 ; CHECK-LABEL: test_x86_tbm_blsfill_u64:
566 ; CHECK-NEXT: blsfillq %rdi, %rax
573 define i64 @test_x86_tbm_blsfill_u64_z(i64 %a, i64 %b) nounwind {
574 ; CHECK-LABEL: test_x86_tbm_blsfill_u64_z:
576 ; CHECK-NEXT: blsfillq %rdi, %rax
577 ; CHECK-NEXT: cmoveq %rsi, %rax
581 %t2 = icmp eq i64 %t1, 0
582 %t3 = select i1 %t2, i64 %b, i64 %t1
586 define i64 @test_x86_tbm_blsfill_u64_z2(i64 %a, i64 %b, i64 %c) nounwind {
587 ; CHECK-LABEL: test_x86_tbm_blsfill_u64_z2:
589 ; CHECK-NEXT: movq %rsi, %rax
590 ; CHECK-NEXT: blsfillq %rdi, %rcx
591 ; CHECK-NEXT: cmovneq %rdx, %rax
595 %t2 = icmp eq i64 %t1, 0
596 %t3 = select i1 %t2, i64 %b, i64 %c
600 define i32 @test_x86_tbm_blsic_u32(i32 %a) nounwind {
601 ; CHECK-LABEL: test_x86_tbm_blsic_u32:
603 ; CHECK-NEXT: blsicl %edi, %eax
607 %t2 = or i32 %t0, %t1
611 define i32 @test_x86_tbm_blsic_u32_z(i32 %a, i32 %b) nounwind {
612 ; CHECK-LABEL: test_x86_tbm_blsic_u32_z:
614 ; CHECK-NEXT: blsicl %edi, %eax
615 ; CHECK-NEXT: cmovel %esi, %eax
619 %t2 = or i32 %t0, %t1
620 %t3 = icmp eq i32 %t2, 0
621 %t4 = select i1 %t3, i32 %b, i32 %t2
625 define i32 @test_x86_tbm_blsic_u32_z2(i32 %a, i32 %b, i32 %c) nounwind {
626 ; CHECK-LABEL: test_x86_tbm_blsic_u32_z2:
628 ; CHECK-NEXT: movl %esi, %eax
629 ; CHECK-NEXT: blsicl %edi, %ecx
630 ; CHECK-NEXT: cmovnel %edx, %eax
634 %t2 = or i32 %t0, %t1
635 %t3 = icmp eq i32 %t2, 0
636 %t4 = select i1 %t3, i32 %b, i32 %c
640 define i64 @test_x86_tbm_blsic_u64(i64 %a) nounwind {
641 ; CHECK-LABEL: test_x86_tbm_blsic_u64:
643 ; CHECK-NEXT: blsicq %rdi, %rax
647 %t2 = or i64 %t0, %t1
651 define i64 @test_x86_tbm_blsic_u64_z(i64 %a, i64 %b) nounwind {
652 ; CHECK-LABEL: test_x86_tbm_blsic_u64_z:
654 ; CHECK-NEXT: blsicq %rdi, %rax
655 ; CHECK-NEXT: cmoveq %rsi, %rax
659 %t2 = or i64 %t0, %t1
660 %t3 = icmp eq i64 %t2, 0
661 %t4 = select i1 %t3, i64 %b, i64 %t2
665 define i64 @test_x86_tbm_blsic_u64_z2(i64 %a, i64 %b, i64 %c) nounwind {
666 ; CHECK-LABEL: test_x86_tbm_blsic_u64_z2:
668 ; CHECK-NEXT: movq %rsi, %rax
669 ; CHECK-NEXT: blsicq %rdi, %rcx
670 ; CHECK-NEXT: cmovneq %rdx, %rax
674 %t2 = or i64 %t0, %t1
675 %t3 = icmp eq i64 %t2, 0
676 %t4 = select i1 %t3, i64 %b, i64 %c
680 define i32 @test_x86_tbm_t1mskc_u32(i32 %a) nounwind {
681 ; CHECK-LABEL: test_x86_tbm_t1mskc_u32:
683 ; CHECK-NEXT: t1mskcl %edi, %eax
687 %t2 = or i32 %t0, %t1
691 define i32 @test_x86_tbm_t1mskc_u32_z(i32 %a, i32 %b) nounwind {
692 ; CHECK-LABEL: test_x86_tbm_t1mskc_u32_z:
694 ; CHECK-NEXT: t1mskcl %edi, %eax
695 ; CHECK-NEXT: cmovel %esi, %eax
699 %t2 = or i32 %t0, %t1
700 %t3 = icmp eq i32 %t2, 0
701 %t4 = select i1 %t3, i32 %b, i32 %t2
705 define i32 @test_x86_tbm_t1mskc_u32_z2(i32 %a, i32 %b, i32 %c) nounwind {
706 ; CHECK-LABEL: test_x86_tbm_t1mskc_u32_z2:
708 ; CHECK-NEXT: movl %esi, %eax
709 ; CHECK-NEXT: t1mskcl %edi, %ecx
710 ; CHECK-NEXT: cmovnel %edx, %eax
714 %t2 = or i32 %t0, %t1
715 %t3 = icmp eq i32 %t2, 0
716 %t4 = select i1 %t3, i32 %b, i32 %c
720 define i64 @test_x86_tbm_t1mskc_u64(i64 %a) nounwind {
721 ; CHECK-LABEL: test_x86_tbm_t1mskc_u64:
723 ; CHECK-NEXT: t1mskcq %rdi, %rax
727 %t2 = or i64 %t0, %t1
731 define i64 @test_x86_tbm_t1mskc_u64_z(i64 %a, i64 %b) nounwind {
732 ; CHECK-LABEL: test_x86_tbm_t1mskc_u64_z:
734 ; CHECK-NEXT: t1mskcq %rdi, %rax
735 ; CHECK-NEXT: cmoveq %rsi, %rax
739 %t2 = or i64 %t0, %t1
740 %t3 = icmp eq i64 %t2, 0
741 %t4 = select i1 %t3, i64 %b, i64 %t2
745 define i64 @test_x86_tbm_t1mskc_u64_z2(i64 %a, i64 %b, i64 %c) nounwind {
746 ; CHECK-LABEL: test_x86_tbm_t1mskc_u64_z2:
748 ; CHECK-NEXT: movq %rsi, %rax
749 ; CHECK-NEXT: t1mskcq %rdi, %rcx
750 ; CHECK-NEXT: cmovneq %rdx, %rax
754 %t2 = or i64 %t0, %t1
755 %t3 = icmp eq i64 %t2, 0
756 %t4 = select i1 %t3, i64 %b, i64 %c
760 define i32 @test_x86_tbm_tzmsk_u32(i32 %a) nounwind {
761 ; CHECK-LABEL: test_x86_tbm_tzmsk_u32:
763 ; CHECK-NEXT: tzmskl %edi, %eax
767 %t2 = and i32 %t0, %t1
771 define i32 @test_x86_tbm_tzmsk_u32_z(i32 %a, i32 %b) nounwind {
772 ; CHECK-LABEL: test_x86_tbm_tzmsk_u32_z:
774 ; CHECK-NEXT: tzmskl %edi, %eax
775 ; CHECK-NEXT: cmovel %esi, %eax
779 %t2 = and i32 %t0, %t1
780 %t3 = icmp eq i32 %t2, 0
781 %t4 = select i1 %t3, i32 %b, i32 %t2
785 define i32 @test_x86_tbm_tzmsk_u32_z2(i32 %a, i32 %b, i32 %c) nounwind {
786 ; CHECK-LABEL: test_x86_tbm_tzmsk_u32_z2:
788 ; CHECK-NEXT: movl %esi, %eax
789 ; CHECK-NEXT: tzmskl %edi, %ecx
790 ; CHECK-NEXT: cmovnel %edx, %eax
794 %t2 = and i32 %t0, %t1
795 %t3 = icmp eq i32 %t2, 0
796 %t4 = select i1 %t3, i32 %b, i32 %c
800 define i64 @test_x86_tbm_tzmsk_u64(i64 %a) nounwind {
801 ; CHECK-LABEL: test_x86_tbm_tzmsk_u64:
803 ; CHECK-NEXT: tzmskq %rdi, %rax
807 %t2 = and i64 %t0, %t1
811 define i64 @test_x86_tbm_tzmsk_u64_z(i64 %a, i64 %b) nounwind {
812 ; CHECK-LABEL: test_x86_tbm_tzmsk_u64_z:
814 ; CHECK-NEXT: tzmskq %rdi, %rax
815 ; CHECK-NEXT: cmoveq %rsi, %rax
819 %t2 = and i64 %t0, %t1
820 %t3 = icmp eq i64 %t2, 0
821 %t4 = select i1 %t3, i64 %b, i64 %t2
825 define i64 @test_x86_tbm_tzmsk_u64_z2(i64 %a, i64 %b, i64 %c) nounwind {
826 ; CHECK-LABEL: test_x86_tbm_tzmsk_u64_z2:
828 ; CHECK-NEXT: movq %rsi, %rax
829 ; CHECK-NEXT: tzmskq %rdi, %rcx
830 ; CHECK-NEXT: cmovneq %rdx, %rax
834 %t2 = and i64 %t0, %t1
835 %t3 = icmp eq i64 %t2, 0
836 %t4 = select i1 %t3, i64 %b, i64 %c
840 define i64 @test_and_large_constant_mask(i64 %x) {
841 ; CHECK-LABEL: test_and_large_constant_mask:
842 ; CHECK: # %bb.0: # %entry
843 ; CHECK-NEXT: bextrq $15872, %rdi, %rax # imm = 0x3E00
846 %and = and i64 %x, 4611686018427387903
850 define i64 @test_and_large_constant_mask_load(i64* %x) {
851 ; CHECK-LABEL: test_and_large_constant_mask_load:
852 ; CHECK: # %bb.0: # %entry
853 ; CHECK-NEXT: bextrq $15872, (%rdi), %rax # imm = 0x3E00
856 %x1 = load i64, i64* %x
857 %and = and i64 %x1, 4611686018427387903
861 ; Make sure the mask doesn't break our matching of blcic
862 define i64 @masked_blcic(i64) {
863 ; CHECK-LABEL: masked_blcic:
865 ; CHECK-NEXT: movzwl %di, %eax
866 ; CHECK-NEXT: blcicl %eax, %eax
868 %2 = and i64 %0, 65535
870 %4 = add nuw nsw i64 %2, 1
875 define i32 @blcic32_branch(i32 %x) nounwind {
876 ; CHECK-LABEL: blcic32_branch:
878 ; CHECK-NEXT: pushq %rbx
879 ; CHECK-NEXT: blcicl %edi, %ebx
880 ; CHECK-NEXT: jne .LBB69_2
881 ; CHECK-NEXT: # %bb.1:
882 ; CHECK-NEXT: callq bar
883 ; CHECK-NEXT: .LBB69_2:
884 ; CHECK-NEXT: movl %ebx, %eax
885 ; CHECK-NEXT: popq %rbx
887 %tmp = xor i32 %x, -1
888 %tmp2 = add i32 %x, 1
889 %tmp3 = and i32 %tmp, %tmp2
890 %cmp = icmp eq i32 %tmp3, 0
891 br i1 %cmp, label %1, label %2
893 tail call void @bar()
898 define i64 @blcic64_branch(i64 %x) nounwind {
899 ; CHECK-LABEL: blcic64_branch:
901 ; CHECK-NEXT: pushq %rbx
902 ; CHECK-NEXT: blcicq %rdi, %rbx
903 ; CHECK-NEXT: jne .LBB70_2
904 ; CHECK-NEXT: # %bb.1:
905 ; CHECK-NEXT: callq bar
906 ; CHECK-NEXT: .LBB70_2:
907 ; CHECK-NEXT: movq %rbx, %rax
908 ; CHECK-NEXT: popq %rbx
910 %tmp = xor i64 %x, -1
911 %tmp2 = add i64 %x, 1
912 %tmp3 = and i64 %tmp, %tmp2
913 %cmp = icmp eq i64 %tmp3, 0
914 br i1 %cmp, label %1, label %2
916 tail call void @bar()
921 define i32 @tzmsk32_branch(i32 %x) nounwind {
922 ; CHECK-LABEL: tzmsk32_branch:
924 ; CHECK-NEXT: pushq %rbx
925 ; CHECK-NEXT: tzmskl %edi, %ebx
926 ; CHECK-NEXT: jne .LBB71_2
927 ; CHECK-NEXT: # %bb.1:
928 ; CHECK-NEXT: callq bar
929 ; CHECK-NEXT: .LBB71_2:
930 ; CHECK-NEXT: movl %ebx, %eax
931 ; CHECK-NEXT: popq %rbx
933 %tmp = xor i32 %x, -1
934 %tmp2 = add i32 %x, -1
935 %tmp3 = and i32 %tmp, %tmp2
936 %cmp = icmp eq i32 %tmp3, 0
937 br i1 %cmp, label %1, label %2
939 tail call void @bar()
944 define i64 @tzmsk64_branch(i64 %x) nounwind {
945 ; CHECK-LABEL: tzmsk64_branch:
947 ; CHECK-NEXT: pushq %rbx
948 ; CHECK-NEXT: tzmskq %rdi, %rbx
949 ; CHECK-NEXT: jne .LBB72_2
950 ; CHECK-NEXT: # %bb.1:
951 ; CHECK-NEXT: callq bar
952 ; CHECK-NEXT: .LBB72_2:
953 ; CHECK-NEXT: movq %rbx, %rax
954 ; CHECK-NEXT: popq %rbx
956 %tmp = xor i64 %x, -1
957 %tmp2 = add i64 %x, -1
958 %tmp3 = and i64 %tmp, %tmp2
959 %cmp = icmp eq i64 %tmp3, 0
960 br i1 %cmp, label %1, label %2
962 tail call void @bar()