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-prefixes=CHECK,X86 3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+tbm | FileCheck %s --check-prefixes=CHECK,X64 4 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 11 ; X86-NEXT: retl 12 ; 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 17 ; X64-NEXT: retq 18 entry: 19 %0 = add i32 %a, %a 20 %1 = tail call i32 @llvm.x86.tbm.bextri.u32(i32 %0, i32 3841) 21 ret i32 %1 22 } 23 24 declare i32 @llvm.x86.tbm.bextri.u32(i32, i32) nounwind readnone 25 26 define i32 @test_x86_tbm_bextri_u32_m(i32* 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 31 ; X86-NEXT: retl 32 ; 33 ; X64-LABEL: test_x86_tbm_bextri_u32_m: 34 ; X64: # %bb.0: # %entry 35 ; X64-NEXT: bextrl $3841, (%rdi), %eax # imm = 0xF01 36 ; X64-NEXT: retq 37 entry: 38 %tmp1 = load i32, i32* %a, align 4 39 %0 = tail call i32 @llvm.x86.tbm.bextri.u32(i32 %tmp1, i32 3841) 40 ret i32 %0 41 } 42 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 51 ; X86-NEXT: retl 52 ; 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 57 ; X64-NEXT: retq 58 entry: 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 62 ret i32 %2 63 } 64