1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+tbm,+cmov | FileCheck %s --check-prefix=X86
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+tbm | FileCheck %s --check-prefix=X64
5 define i32 @test_x86_tbm_bextri_u32(i32 %a) nounwind readnone {
6 ; X86-LABEL: test_x86_tbm_bextri_u32:
7 ; X86: # %bb.0: # %entry
8 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
9 ; X86-NEXT: addl %eax, %eax
10 ; X86-NEXT: bextrl $3841, %eax, %eax # imm = 0xF01
13 ; X64-LABEL: test_x86_tbm_bextri_u32:
14 ; X64: # %bb.0: # %entry
15 ; X64-NEXT: addl %edi, %edi
16 ; X64-NEXT: bextrl $3841, %edi, %eax # imm = 0xF01
20 %1 = tail call i32 @llvm.x86.tbm.bextri.u32(i32 %0, i32 3841)
24 declare i32 @llvm.x86.tbm.bextri.u32(i32, i32) nounwind readnone
26 define i32 @test_x86_tbm_bextri_u32_m(ptr nocapture %a) nounwind readonly {
27 ; X86-LABEL: test_x86_tbm_bextri_u32_m:
28 ; X86: # %bb.0: # %entry
29 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
30 ; X86-NEXT: bextrl $3841, (%eax), %eax # imm = 0xF01
33 ; X64-LABEL: test_x86_tbm_bextri_u32_m:
34 ; X64: # %bb.0: # %entry
35 ; X64-NEXT: bextrl $3841, (%rdi), %eax # imm = 0xF01
38 %tmp1 = load i32, ptr %a, align 4
39 %0 = tail call i32 @llvm.x86.tbm.bextri.u32(i32 %tmp1, i32 3841)
43 define i32 @test_x86_tbm_bextri_u32_z(i32 %a, i32 %b) nounwind readonly {
44 ; X86-LABEL: test_x86_tbm_bextri_u32_z:
45 ; X86: # %bb.0: # %entry
46 ; X86-NEXT: bextrl $3841, {{[0-9]+}}(%esp), %eax # imm = 0xF01
47 ; X86-NEXT: jne .LBB2_2
48 ; X86-NEXT: # %bb.1: # %entry
49 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
50 ; X86-NEXT: .LBB2_2: # %entry
53 ; X64-LABEL: test_x86_tbm_bextri_u32_z:
54 ; X64: # %bb.0: # %entry
55 ; X64-NEXT: bextrl $3841, %edi, %eax # imm = 0xF01
56 ; X64-NEXT: cmovel %esi, %eax
59 %0 = tail call i32 @llvm.x86.tbm.bextri.u32(i32 %a, i32 3841)
60 %1 = icmp eq i32 %0, 0
61 %2 = select i1 %1, i32 %b, i32 %0
65 define i32 @test_x86_tbm_bextri_demandedbits(i32 %x) nounwind readonly {
66 ; X86-LABEL: test_x86_tbm_bextri_demandedbits:
68 ; X86-NEXT: bextrl $3841, {{[0-9]+}}(%esp), %eax # imm = 0xF01
71 ; X64-LABEL: test_x86_tbm_bextri_demandedbits:
73 ; X64-NEXT: bextrl $3841, %edi, %eax # imm = 0xF01
75 %a = or i32 %x, 4294901761
76 %b = tail call i32 @llvm.x86.tbm.bextri.u32(i32 %a, i32 3841)