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 ; TODO - Patterns fail to fold with ZF flags and prevents TBM instruction selection.
6 define i32 @test_x86_tbm_bextri_u32(i32 %a) nounwind {
7 ; CHECK-LABEL: test_x86_tbm_bextri_u32:
9 ; CHECK-NEXT: bextrl $3076, %edi, %eax # imm = 0xC04
12 %t1 = and i32 %t0, 4095
16 ; Make sure we still use AH subreg trick for extracting bits 15:8
17 define i32 @test_x86_tbm_bextri_u32_subreg(i32 %a) nounwind {
18 ; CHECK-LABEL: test_x86_tbm_bextri_u32_subreg:
20 ; CHECK-NEXT: movl %edi, %eax
21 ; CHECK-NEXT: movzbl %ah, %eax
24 %t1 = and i32 %t0, 255
28 define i32 @test_x86_tbm_bextri_u32_m(i32* nocapture %a) nounwind {
29 ; CHECK-LABEL: test_x86_tbm_bextri_u32_m:
31 ; CHECK-NEXT: bextrl $3076, (%rdi), %eax # imm = 0xC04
33 %t0 = load i32, i32* %a
35 %t2 = and i32 %t1, 4095
39 define i32 @test_x86_tbm_bextri_u32_z(i32 %a, i32 %b) nounwind {
40 ; CHECK-LABEL: test_x86_tbm_bextri_u32_z:
42 ; CHECK-NEXT: bextrl $3076, %edi, %eax # imm = 0xC04
43 ; CHECK-NEXT: cmovel %esi, %eax
46 %t1 = and i32 %t0, 4095
47 %t2 = icmp eq i32 %t1, 0
48 %t3 = select i1 %t2, i32 %b, i32 %t1
52 define i32 @test_x86_tbm_bextri_u32_z2(i32 %a, i32 %b, i32 %c) nounwind {
53 ; CHECK-LABEL: test_x86_tbm_bextri_u32_z2:
55 ; CHECK-NEXT: movl %esi, %eax
56 ; CHECK-NEXT: bextrl $3076, %edi, %ecx # imm = 0xC04
57 ; CHECK-NEXT: cmovnel %edx, %eax
60 %t1 = and i32 %t0, 4095
61 %t2 = icmp eq i32 %t1, 0
62 %t3 = select i1 %t2, i32 %b, i32 %c
66 define i64 @test_x86_tbm_bextri_u64(i64 %a) nounwind {
67 ; CHECK-LABEL: test_x86_tbm_bextri_u64:
69 ; CHECK-NEXT: bextrl $3076, %edi, %eax # imm = 0xC04
72 %t1 = and i64 %t0, 4095
76 ; Make sure we still use AH subreg trick for extracting bits 15:8
77 define i64 @test_x86_tbm_bextri_u64_subreg(i64 %a) nounwind {
78 ; CHECK-LABEL: test_x86_tbm_bextri_u64_subreg:
80 ; CHECK-NEXT: movq %rdi, %rax
81 ; CHECK-NEXT: movzbl %ah, %eax
84 %t1 = and i64 %t0, 255
88 define i64 @test_x86_tbm_bextri_u64_m(i64* nocapture %a) nounwind {
89 ; CHECK-LABEL: test_x86_tbm_bextri_u64_m:
91 ; CHECK-NEXT: bextrl $3076, (%rdi), %eax # imm = 0xC04
93 %t0 = load i64, i64* %a
95 %t2 = and i64 %t1, 4095
99 define i64 @test_x86_tbm_bextri_u64_z(i64 %a, i64 %b) nounwind {
100 ; CHECK-LABEL: test_x86_tbm_bextri_u64_z:
102 ; CHECK-NEXT: bextrl $3076, %edi, %eax # imm = 0xC04
103 ; CHECK-NEXT: cmoveq %rsi, %rax
106 %t1 = and i64 %t0, 4095
107 %t2 = icmp eq i64 %t1, 0
108 %t3 = select i1 %t2, i64 %b, i64 %t1
112 define i64 @test_x86_tbm_bextri_u64_z2(i64 %a, i64 %b, i64 %c) nounwind {
113 ; CHECK-LABEL: test_x86_tbm_bextri_u64_z2:
115 ; CHECK-NEXT: movq %rsi, %rax
116 ; CHECK-NEXT: bextrl $3076, %edi, %ecx # imm = 0xC04
117 ; CHECK-NEXT: cmovneq %rdx, %rax
120 %t1 = and i64 %t0, 4095
121 %t2 = icmp eq i64 %t1, 0
122 %t3 = select i1 %t2, i64 %b, i64 %c
126 define i32 @test_x86_tbm_blcfill_u32(i32 %a) nounwind {
127 ; CHECK-LABEL: test_x86_tbm_blcfill_u32:
129 ; CHECK-NEXT: blcfilll %edi, %eax
132 %t1 = and i32 %t0, %a
136 define i32 @test_x86_tbm_blcfill_u32_z(i32 %a, i32 %b) nounwind {
137 ; CHECK-LABEL: test_x86_tbm_blcfill_u32_z:
139 ; CHECK-NEXT: blcfilll %edi, %eax
140 ; CHECK-NEXT: cmovel %esi, %eax
143 %t1 = and i32 %t0, %a
144 %t2 = icmp eq i32 %t1, 0
145 %t3 = select i1 %t2, i32 %b, i32 %t1
149 define i32 @test_x86_tbm_blcfill_u32_z2(i32 %a, i32 %b, i32 %c) nounwind {
150 ; CHECK-LABEL: test_x86_tbm_blcfill_u32_z2:
152 ; CHECK-NEXT: movl %esi, %eax
153 ; CHECK-NEXT: blcfilll %edi, %ecx
154 ; CHECK-NEXT: cmovnel %edx, %eax
157 %t1 = and i32 %t0, %a
158 %t2 = icmp eq i32 %t1, 0
159 %t3 = select i1 %t2, i32 %b, i32 %c
163 define i64 @test_x86_tbm_blcfill_u64(i64 %a) nounwind {
164 ; CHECK-LABEL: test_x86_tbm_blcfill_u64:
166 ; CHECK-NEXT: blcfillq %rdi, %rax
169 %t1 = and i64 %t0, %a
173 define i64 @test_x86_tbm_blcfill_u64_z(i64 %a, i64 %b) nounwind {
174 ; CHECK-LABEL: test_x86_tbm_blcfill_u64_z:
176 ; CHECK-NEXT: blcfillq %rdi, %rax
177 ; CHECK-NEXT: cmoveq %rsi, %rax
180 %t1 = and i64 %t0, %a
181 %t2 = icmp eq i64 %t1, 0
182 %t3 = select i1 %t2, i64 %b, i64 %t1
186 define i64 @test_x86_tbm_blcfill_u64_z2(i64 %a, i64 %b, i64 %c) nounwind {
187 ; CHECK-LABEL: test_x86_tbm_blcfill_u64_z2:
189 ; CHECK-NEXT: movq %rsi, %rax
190 ; CHECK-NEXT: blcfillq %rdi, %rcx
191 ; CHECK-NEXT: cmovneq %rdx, %rax
194 %t1 = and i64 %t0, %a
195 %t2 = icmp eq i64 %t1, 0
196 %t3 = select i1 %t2, i64 %b, i64 %c
200 define i32 @test_x86_tbm_blci_u32(i32 %a) nounwind {
201 ; CHECK-LABEL: test_x86_tbm_blci_u32:
203 ; CHECK-NEXT: blcil %edi, %eax
206 %t1 = xor i32 %t0, -1
211 define i32 @test_x86_tbm_blci_u32_z(i32 %a, i32 %b) nounwind {
212 ; CHECK-LABEL: test_x86_tbm_blci_u32_z:
214 ; CHECK-NEXT: blcil %edi, %eax
215 ; CHECK-NEXT: cmovel %esi, %eax
218 %t1 = xor i32 %t0, -1
220 %t3 = icmp eq i32 %t2, 0
221 %t4 = select i1 %t3, i32 %b, i32 %t2
225 define i32 @test_x86_tbm_blci_u32_z2(i32 %a, i32 %b, i32 %c) nounwind {
226 ; CHECK-LABEL: test_x86_tbm_blci_u32_z2:
228 ; CHECK-NEXT: movl %esi, %eax
229 ; CHECK-NEXT: blcil %edi, %ecx
230 ; CHECK-NEXT: cmovnel %edx, %eax
233 %t1 = xor i32 %t0, -1
235 %t3 = icmp eq i32 %t2, 0
236 %t4 = select i1 %t3, i32 %b, i32 %c
240 define i64 @test_x86_tbm_blci_u64(i64 %a) nounwind {
241 ; CHECK-LABEL: test_x86_tbm_blci_u64:
243 ; CHECK-NEXT: blciq %rdi, %rax
246 %t1 = xor i64 %t0, -1
251 define i64 @test_x86_tbm_blci_u64_z(i64 %a, i64 %b) nounwind {
252 ; CHECK-LABEL: test_x86_tbm_blci_u64_z:
254 ; CHECK-NEXT: blciq %rdi, %rax
255 ; CHECK-NEXT: cmoveq %rsi, %rax
258 %t1 = xor i64 %t0, -1
260 %t3 = icmp eq i64 %t2, 0
261 %t4 = select i1 %t3, i64 %b, i64 %t2
265 define i64 @test_x86_tbm_blci_u64_z2(i64 %a, i64 %b, i64 %c) nounwind {
266 ; CHECK-LABEL: test_x86_tbm_blci_u64_z2:
268 ; CHECK-NEXT: movq %rsi, %rax
269 ; CHECK-NEXT: blciq %rdi, %rcx
270 ; CHECK-NEXT: cmovneq %rdx, %rax
273 %t1 = xor i64 %t0, -1
275 %t3 = icmp eq i64 %t2, 0
276 %t4 = select i1 %t3, i64 %b, i64 %c
280 define i32 @test_x86_tbm_blci_u32_b(i32 %a) nounwind {
281 ; CHECK-LABEL: test_x86_tbm_blci_u32_b:
283 ; CHECK-NEXT: blcil %edi, %eax
290 define i64 @test_x86_tbm_blci_u64_b(i64 %a) nounwind {
291 ; CHECK-LABEL: test_x86_tbm_blci_u64_b:
293 ; CHECK-NEXT: blciq %rdi, %rax
300 define i32 @test_x86_tbm_blcic_u32(i32 %a) nounwind {
301 ; CHECK-LABEL: test_x86_tbm_blcic_u32:
303 ; CHECK-NEXT: blcicl %edi, %eax
307 %t2 = and i32 %t1, %t0
311 define i32 @test_x86_tbm_blcic_u32_z(i32 %a, i32 %b) nounwind {
312 ; CHECK-LABEL: test_x86_tbm_blcic_u32_z:
314 ; CHECK-NEXT: blcicl %edi, %eax
315 ; CHECK-NEXT: cmovel %esi, %eax
319 %t2 = and i32 %t1, %t0
320 %t3 = icmp eq i32 %t2, 0
321 %t4 = select i1 %t3, i32 %b, i32 %t2
325 define i32 @test_x86_tbm_blcic_u32_z2(i32 %a, i32 %b, i32 %c) nounwind {
326 ; CHECK-LABEL: test_x86_tbm_blcic_u32_z2:
328 ; CHECK-NEXT: movl %esi, %eax
329 ; CHECK-NEXT: blcicl %edi, %ecx
330 ; CHECK-NEXT: cmovnel %edx, %eax
334 %t2 = and i32 %t1, %t0
335 %t3 = icmp eq i32 %t2, 0
336 %t4 = select i1 %t3, i32 %b, i32 %c
340 define i64 @test_x86_tbm_blcic_u64(i64 %a) nounwind {
341 ; CHECK-LABEL: test_x86_tbm_blcic_u64:
343 ; CHECK-NEXT: blcicq %rdi, %rax
347 %t2 = and i64 %t1, %t0
351 define i64 @test_x86_tbm_blcic_u64_z(i64 %a, i64 %b) nounwind {
352 ; CHECK-LABEL: test_x86_tbm_blcic_u64_z:
354 ; CHECK-NEXT: blcicq %rdi, %rax
355 ; CHECK-NEXT: cmoveq %rsi, %rax
359 %t2 = and i64 %t1, %t0
360 %t3 = icmp eq i64 %t2, 0
361 %t4 = select i1 %t3, i64 %b, i64 %t2
365 define i64 @test_x86_tbm_blcic_u64_z2(i64 %a, i64 %b, i64 %c) nounwind {
366 ; CHECK-LABEL: test_x86_tbm_blcic_u64_z2:
368 ; CHECK-NEXT: movq %rsi, %rax
369 ; CHECK-NEXT: blcicq %rdi, %rcx
370 ; CHECK-NEXT: cmovneq %rdx, %rax
374 %t2 = and i64 %t1, %t0
375 %t3 = icmp eq i64 %t2, 0
376 %t4 = select i1 %t3, i64 %b, i64 %c
380 define i32 @test_x86_tbm_blcmsk_u32(i32 %a) nounwind {
381 ; CHECK-LABEL: test_x86_tbm_blcmsk_u32:
383 ; CHECK-NEXT: blcmskl %edi, %eax
386 %t1 = xor i32 %t0, %a
390 define i32 @test_x86_tbm_blcmsk_u32_z(i32 %a, i32 %b) nounwind {
391 ; CHECK-LABEL: test_x86_tbm_blcmsk_u32_z:
393 ; CHECK-NEXT: blcmskl %edi, %eax
394 ; CHECK-NEXT: cmovel %esi, %eax
397 %t1 = xor i32 %t0, %a
398 %t2 = icmp eq i32 %t1, 0
399 %t3 = select i1 %t2, i32 %b, i32 %t1
403 define i32 @test_x86_tbm_blcmsk_u32_z2(i32 %a, i32 %b, i32 %c) nounwind {
404 ; CHECK-LABEL: test_x86_tbm_blcmsk_u32_z2:
406 ; CHECK-NEXT: movl %esi, %eax
407 ; CHECK-NEXT: blcmskl %edi, %ecx
408 ; CHECK-NEXT: cmovnel %edx, %eax
411 %t1 = xor i32 %t0, %a
412 %t2 = icmp eq i32 %t1, 0
413 %t3 = select i1 %t2, i32 %b, i32 %c
417 define i64 @test_x86_tbm_blcmsk_u64(i64 %a) nounwind {
418 ; CHECK-LABEL: test_x86_tbm_blcmsk_u64:
420 ; CHECK-NEXT: blcmskq %rdi, %rax
423 %t1 = xor i64 %t0, %a
427 define i64 @test_x86_tbm_blcmsk_u64_z(i64 %a, i64 %b) nounwind {
428 ; CHECK-LABEL: test_x86_tbm_blcmsk_u64_z:
430 ; CHECK-NEXT: blcmskq %rdi, %rax
431 ; CHECK-NEXT: cmoveq %rsi, %rax
434 %t1 = xor i64 %t0, %a
435 %t2 = icmp eq i64 %t1, 0
436 %t3 = select i1 %t2, i64 %b, i64 %t1
440 define i64 @test_x86_tbm_blcmsk_u64_z2(i64 %a, i64 %b, i64 %c) nounwind {
441 ; CHECK-LABEL: test_x86_tbm_blcmsk_u64_z2:
443 ; CHECK-NEXT: movq %rsi, %rax
444 ; CHECK-NEXT: blcmskq %rdi, %rcx
445 ; CHECK-NEXT: cmovneq %rdx, %rax
448 %t1 = xor i64 %t0, %a
449 %t2 = icmp eq i64 %t1, 0
450 %t3 = select i1 %t2, i64 %b, i64 %c
454 define i32 @test_x86_tbm_blcs_u32(i32 %a) nounwind {
455 ; CHECK-LABEL: test_x86_tbm_blcs_u32:
457 ; CHECK-NEXT: blcsl %edi, %eax
464 define i32 @test_x86_tbm_blcs_u32_z(i32 %a, i32 %b) nounwind {
465 ; CHECK-LABEL: test_x86_tbm_blcs_u32_z:
467 ; CHECK-NEXT: blcsl %edi, %eax
468 ; CHECK-NEXT: cmovel %esi, %eax
472 %t2 = icmp eq i32 %t1, 0
473 %t3 = select i1 %t2, i32 %b, i32 %t1
477 define i32 @test_x86_tbm_blcs_u32_z2(i32 %a, i32 %b, i32 %c) nounwind {
478 ; CHECK-LABEL: test_x86_tbm_blcs_u32_z2:
480 ; CHECK-NEXT: movl %esi, %eax
481 ; CHECK-NEXT: blcsl %edi, %ecx
482 ; CHECK-NEXT: cmovnel %edx, %eax
486 %t2 = icmp eq i32 %t1, 0
487 %t3 = select i1 %t2, i32 %b, i32 %c
491 define i64 @test_x86_tbm_blcs_u64(i64 %a) nounwind {
492 ; CHECK-LABEL: test_x86_tbm_blcs_u64:
494 ; CHECK-NEXT: blcsq %rdi, %rax
501 define i64 @test_x86_tbm_blcs_u64_z(i64 %a, i64 %b) nounwind {
502 ; CHECK-LABEL: test_x86_tbm_blcs_u64_z:
504 ; CHECK-NEXT: blcsq %rdi, %rax
505 ; CHECK-NEXT: cmoveq %rsi, %rax
509 %t2 = icmp eq i64 %t1, 0
510 %t3 = select i1 %t2, i64 %b, i64 %t1
514 define i64 @test_x86_tbm_blcs_u64_z2(i64 %a, i64 %b, i64 %c) nounwind {
515 ; CHECK-LABEL: test_x86_tbm_blcs_u64_z2:
517 ; CHECK-NEXT: movq %rsi, %rax
518 ; CHECK-NEXT: blcsq %rdi, %rcx
519 ; CHECK-NEXT: cmovneq %rdx, %rax
523 %t2 = icmp eq i64 %t1, 0
524 %t3 = select i1 %t2, i64 %b, i64 %c
528 define i32 @test_x86_tbm_blsfill_u32(i32 %a) nounwind {
529 ; CHECK-LABEL: test_x86_tbm_blsfill_u32:
531 ; CHECK-NEXT: blsfilll %edi, %eax
538 define i32 @test_x86_tbm_blsfill_u32_z(i32 %a, i32 %b) nounwind {
539 ; CHECK-LABEL: test_x86_tbm_blsfill_u32_z:
541 ; CHECK-NEXT: blsfilll %edi, %eax
542 ; CHECK-NEXT: cmovel %esi, %eax
546 %t2 = icmp eq i32 %t1, 0
547 %t3 = select i1 %t2, i32 %b, i32 %t1
551 define i32 @test_x86_tbm_blsfill_u32_z2(i32 %a, i32 %b, i32 %c) nounwind {
552 ; CHECK-LABEL: test_x86_tbm_blsfill_u32_z2:
554 ; CHECK-NEXT: movl %esi, %eax
555 ; CHECK-NEXT: blsfilll %edi, %ecx
556 ; CHECK-NEXT: cmovnel %edx, %eax
560 %t2 = icmp eq i32 %t1, 0
561 %t3 = select i1 %t2, i32 %b, i32 %c
565 define i64 @test_x86_tbm_blsfill_u64(i64 %a) nounwind {
566 ; CHECK-LABEL: test_x86_tbm_blsfill_u64:
568 ; CHECK-NEXT: blsfillq %rdi, %rax
575 define i64 @test_x86_tbm_blsfill_u64_z(i64 %a, i64 %b) nounwind {
576 ; CHECK-LABEL: test_x86_tbm_blsfill_u64_z:
578 ; CHECK-NEXT: blsfillq %rdi, %rax
579 ; CHECK-NEXT: cmoveq %rsi, %rax
583 %t2 = icmp eq i64 %t1, 0
584 %t3 = select i1 %t2, i64 %b, i64 %t1
588 define i64 @test_x86_tbm_blsfill_u64_z2(i64 %a, i64 %b, i64 %c) nounwind {
589 ; CHECK-LABEL: test_x86_tbm_blsfill_u64_z2:
591 ; CHECK-NEXT: movq %rsi, %rax
592 ; CHECK-NEXT: blsfillq %rdi, %rcx
593 ; CHECK-NEXT: cmovneq %rdx, %rax
597 %t2 = icmp eq i64 %t1, 0
598 %t3 = select i1 %t2, i64 %b, i64 %c
602 define i32 @test_x86_tbm_blsic_u32(i32 %a) nounwind {
603 ; CHECK-LABEL: test_x86_tbm_blsic_u32:
605 ; CHECK-NEXT: blsicl %edi, %eax
609 %t2 = or i32 %t0, %t1
613 define i32 @test_x86_tbm_blsic_u32_z(i32 %a, i32 %b) nounwind {
614 ; CHECK-LABEL: test_x86_tbm_blsic_u32_z:
616 ; CHECK-NEXT: blsicl %edi, %eax
617 ; CHECK-NEXT: cmovel %esi, %eax
621 %t2 = or i32 %t0, %t1
622 %t3 = icmp eq i32 %t2, 0
623 %t4 = select i1 %t3, i32 %b, i32 %t2
627 define i32 @test_x86_tbm_blsic_u32_z2(i32 %a, i32 %b, i32 %c) nounwind {
628 ; CHECK-LABEL: test_x86_tbm_blsic_u32_z2:
630 ; CHECK-NEXT: movl %esi, %eax
631 ; CHECK-NEXT: blsicl %edi, %ecx
632 ; CHECK-NEXT: cmovnel %edx, %eax
636 %t2 = or i32 %t0, %t1
637 %t3 = icmp eq i32 %t2, 0
638 %t4 = select i1 %t3, i32 %b, i32 %c
642 define i64 @test_x86_tbm_blsic_u64(i64 %a) nounwind {
643 ; CHECK-LABEL: test_x86_tbm_blsic_u64:
645 ; CHECK-NEXT: blsicq %rdi, %rax
649 %t2 = or i64 %t0, %t1
653 define i64 @test_x86_tbm_blsic_u64_z(i64 %a, i64 %b) nounwind {
654 ; CHECK-LABEL: test_x86_tbm_blsic_u64_z:
656 ; CHECK-NEXT: blsicq %rdi, %rax
657 ; CHECK-NEXT: cmoveq %rsi, %rax
661 %t2 = or i64 %t0, %t1
662 %t3 = icmp eq i64 %t2, 0
663 %t4 = select i1 %t3, i64 %b, i64 %t2
667 define i64 @test_x86_tbm_blsic_u64_z2(i64 %a, i64 %b, i64 %c) nounwind {
668 ; CHECK-LABEL: test_x86_tbm_blsic_u64_z2:
670 ; CHECK-NEXT: movq %rsi, %rax
671 ; CHECK-NEXT: blsicq %rdi, %rcx
672 ; CHECK-NEXT: cmovneq %rdx, %rax
676 %t2 = or i64 %t0, %t1
677 %t3 = icmp eq i64 %t2, 0
678 %t4 = select i1 %t3, i64 %b, i64 %c
682 define i32 @test_x86_tbm_t1mskc_u32(i32 %a) nounwind {
683 ; CHECK-LABEL: test_x86_tbm_t1mskc_u32:
685 ; CHECK-NEXT: t1mskcl %edi, %eax
689 %t2 = or i32 %t0, %t1
693 define i32 @test_x86_tbm_t1mskc_u32_z(i32 %a, i32 %b) nounwind {
694 ; CHECK-LABEL: test_x86_tbm_t1mskc_u32_z:
696 ; CHECK-NEXT: t1mskcl %edi, %eax
697 ; CHECK-NEXT: cmovel %esi, %eax
701 %t2 = or i32 %t0, %t1
702 %t3 = icmp eq i32 %t2, 0
703 %t4 = select i1 %t3, i32 %b, i32 %t2
707 define i32 @test_x86_tbm_t1mskc_u32_z2(i32 %a, i32 %b, i32 %c) nounwind {
708 ; CHECK-LABEL: test_x86_tbm_t1mskc_u32_z2:
710 ; CHECK-NEXT: movl %esi, %eax
711 ; CHECK-NEXT: t1mskcl %edi, %ecx
712 ; CHECK-NEXT: cmovnel %edx, %eax
716 %t2 = or i32 %t0, %t1
717 %t3 = icmp eq i32 %t2, 0
718 %t4 = select i1 %t3, i32 %b, i32 %c
722 define i64 @test_x86_tbm_t1mskc_u64(i64 %a) nounwind {
723 ; CHECK-LABEL: test_x86_tbm_t1mskc_u64:
725 ; CHECK-NEXT: t1mskcq %rdi, %rax
729 %t2 = or i64 %t0, %t1
733 define i64 @test_x86_tbm_t1mskc_u64_z(i64 %a, i64 %b) nounwind {
734 ; CHECK-LABEL: test_x86_tbm_t1mskc_u64_z:
736 ; CHECK-NEXT: t1mskcq %rdi, %rax
737 ; CHECK-NEXT: cmoveq %rsi, %rax
741 %t2 = or i64 %t0, %t1
742 %t3 = icmp eq i64 %t2, 0
743 %t4 = select i1 %t3, i64 %b, i64 %t2
747 define i64 @test_x86_tbm_t1mskc_u64_z2(i64 %a, i64 %b, i64 %c) nounwind {
748 ; CHECK-LABEL: test_x86_tbm_t1mskc_u64_z2:
750 ; CHECK-NEXT: movq %rsi, %rax
751 ; CHECK-NEXT: t1mskcq %rdi, %rcx
752 ; CHECK-NEXT: cmovneq %rdx, %rax
756 %t2 = or i64 %t0, %t1
757 %t3 = icmp eq i64 %t2, 0
758 %t4 = select i1 %t3, i64 %b, i64 %c
762 define i32 @test_x86_tbm_tzmsk_u32(i32 %a) nounwind {
763 ; CHECK-LABEL: test_x86_tbm_tzmsk_u32:
765 ; CHECK-NEXT: tzmskl %edi, %eax
769 %t2 = and i32 %t0, %t1
773 define i32 @test_x86_tbm_tzmsk_u32_z(i32 %a, i32 %b) nounwind {
774 ; CHECK-LABEL: test_x86_tbm_tzmsk_u32_z:
776 ; CHECK-NEXT: tzmskl %edi, %eax
777 ; CHECK-NEXT: cmovel %esi, %eax
781 %t2 = and i32 %t0, %t1
782 %t3 = icmp eq i32 %t2, 0
783 %t4 = select i1 %t3, i32 %b, i32 %t2
787 define i32 @test_x86_tbm_tzmsk_u32_z2(i32 %a, i32 %b, i32 %c) nounwind {
788 ; CHECK-LABEL: test_x86_tbm_tzmsk_u32_z2:
790 ; CHECK-NEXT: movl %esi, %eax
791 ; CHECK-NEXT: tzmskl %edi, %ecx
792 ; CHECK-NEXT: cmovnel %edx, %eax
796 %t2 = and i32 %t0, %t1
797 %t3 = icmp eq i32 %t2, 0
798 %t4 = select i1 %t3, i32 %b, i32 %c
802 define i64 @test_x86_tbm_tzmsk_u64(i64 %a) nounwind {
803 ; CHECK-LABEL: test_x86_tbm_tzmsk_u64:
805 ; CHECK-NEXT: tzmskq %rdi, %rax
809 %t2 = and i64 %t0, %t1
813 define i64 @test_x86_tbm_tzmsk_u64_z(i64 %a, i64 %b) nounwind {
814 ; CHECK-LABEL: test_x86_tbm_tzmsk_u64_z:
816 ; CHECK-NEXT: tzmskq %rdi, %rax
817 ; CHECK-NEXT: cmoveq %rsi, %rax
821 %t2 = and i64 %t0, %t1
822 %t3 = icmp eq i64 %t2, 0
823 %t4 = select i1 %t3, i64 %b, i64 %t2
827 define i64 @test_x86_tbm_tzmsk_u64_z2(i64 %a, i64 %b, i64 %c) nounwind {
828 ; CHECK-LABEL: test_x86_tbm_tzmsk_u64_z2:
830 ; CHECK-NEXT: movq %rsi, %rax
831 ; CHECK-NEXT: tzmskq %rdi, %rcx
832 ; CHECK-NEXT: cmovneq %rdx, %rax
836 %t2 = and i64 %t0, %t1
837 %t3 = icmp eq i64 %t2, 0
838 %t4 = select i1 %t3, i64 %b, i64 %c
842 define i64 @test_and_large_constant_mask(i64 %x) {
843 ; CHECK-LABEL: test_and_large_constant_mask:
844 ; CHECK: # %bb.0: # %entry
845 ; CHECK-NEXT: bextrq $15872, %rdi, %rax # imm = 0x3E00
848 %and = and i64 %x, 4611686018427387903
852 define i64 @test_and_large_constant_mask_load(i64* %x) {
853 ; CHECK-LABEL: test_and_large_constant_mask_load:
854 ; CHECK: # %bb.0: # %entry
855 ; CHECK-NEXT: bextrq $15872, (%rdi), %rax # imm = 0x3E00
858 %x1 = load i64, i64* %x
859 %and = and i64 %x1, 4611686018427387903
863 ; Make sure the mask doesn't break our matching of blcic
864 define i64 @masked_blcic(i64) {
865 ; CHECK-LABEL: masked_blcic:
867 ; CHECK-NEXT: movzwl %di, %eax
868 ; CHECK-NEXT: blcicl %eax, %eax
870 %2 = and i64 %0, 65535
872 %4 = add nuw nsw i64 %2, 1