1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+sse2,+bmi | FileCheck %s --check-prefixes=CHECK,X32 3; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse2,+bmi | FileCheck %s --check-prefixes=CHECK,X64 4 5declare i32 @llvm.x86.bmi.bextr.32(i32, i32) 6 7define i32 @bextr_zero_length(i32 %x, i32 %y) { 8; CHECK-LABEL: bextr_zero_length: 9; CHECK: # %bb.0: 10; CHECK-NEXT: xorl %eax, %eax 11; CHECK-NEXT: ret{{[l|q]}} 12 %1 = and i32 %y, 255 13 %2 = tail call i32 @llvm.x86.bmi.bextr.32(i32 %x, i32 %1) 14 ret i32 %2 15} 16 17define i32 @bextr_big_shift(i32 %x, i32 %y) { 18; X32-LABEL: bextr_big_shift: 19; X32: # %bb.0: 20; X32-NEXT: movl $255, %eax 21; X32-NEXT: orl {{[0-9]+}}(%esp), %eax 22; X32-NEXT: bextrl %eax, {{[0-9]+}}(%esp), %eax 23; X32-NEXT: retl 24; 25; X64-LABEL: bextr_big_shift: 26; X64: # %bb.0: 27; X64-NEXT: orl $255, %esi 28; X64-NEXT: bextrl %esi, %edi, %eax 29; X64-NEXT: retq 30 %1 = or i32 %y, 255 31 %2 = tail call i32 @llvm.x86.bmi.bextr.32(i32 %x, i32 %1) 32 ret i32 %2 33} 34 35define float @bextr_uitofp(i32 %x, i32 %y) { 36; X32-LABEL: bextr_uitofp: 37; X32: # %bb.0: 38; X32-NEXT: pushl %eax 39; X32-NEXT: .cfi_def_cfa_offset 8 40; X32-NEXT: movl $3855, %eax # imm = 0xF0F 41; X32-NEXT: bextrl %eax, {{[0-9]+}}(%esp), %eax 42; X32-NEXT: movd %eax, %xmm0 43; X32-NEXT: por {{\.LCPI.*}}, %xmm0 44; X32-NEXT: subsd {{\.LCPI.*}}, %xmm0 45; X32-NEXT: cvtsd2ss %xmm0, %xmm0 46; X32-NEXT: movss %xmm0, (%esp) 47; X32-NEXT: flds (%esp) 48; X32-NEXT: popl %eax 49; X32-NEXT: .cfi_def_cfa_offset 4 50; X32-NEXT: retl 51; 52; X64-LABEL: bextr_uitofp: 53; X64: # %bb.0: 54; X64-NEXT: movl $3855, %eax # imm = 0xF0F 55; X64-NEXT: bextrl %eax, %edi, %eax 56; X64-NEXT: cvtsi2ss %eax, %xmm0 57; X64-NEXT: retq 58 %1 = tail call i32 @llvm.x86.bmi.bextr.32(i32 %x, i32 3855) 59 %2 = uitofp i32 %1 to float 60 ret float %2 61} 62