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,X86
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse2,+bmi | FileCheck %s --check-prefixes=CHECK,X64
5 declare i32 @llvm.x86.bmi.bextr.32(i32, i32)
7 define i32 @bextr_zero_length(i32 %x, i32 %y) nounwind {
8 ; CHECK-LABEL: bextr_zero_length:
10 ; CHECK-NEXT: xorl %eax, %eax
11 ; CHECK-NEXT: ret{{[l|q]}}
13 %2 = tail call i32 @llvm.x86.bmi.bextr.32(i32 %x, i32 %1)
17 define i32 @bextr_big_shift(i32 %x, i32 %y) nounwind {
18 ; X86-LABEL: bextr_big_shift:
20 ; X86-NEXT: movl $255, %eax
21 ; X86-NEXT: orl {{[0-9]+}}(%esp), %eax
22 ; X86-NEXT: bextrl %eax, {{[0-9]+}}(%esp), %eax
25 ; X64-LABEL: bextr_big_shift:
27 ; X64-NEXT: orl $255, %esi
28 ; X64-NEXT: bextrl %esi, %edi, %eax
31 %2 = tail call i32 @llvm.x86.bmi.bextr.32(i32 %x, i32 %1)
35 define float @bextr_uitofp(i32 %x, i32 %y) nounwind {
36 ; X86-LABEL: bextr_uitofp:
38 ; X86-NEXT: pushl %eax
39 ; X86-NEXT: movl $3855, %eax # imm = 0xF0F
40 ; X86-NEXT: bextrl %eax, {{[0-9]+}}(%esp), %eax
41 ; X86-NEXT: movd %eax, %xmm0
42 ; X86-NEXT: por {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
43 ; X86-NEXT: subsd {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
44 ; X86-NEXT: cvtsd2ss %xmm0, %xmm0
45 ; X86-NEXT: movss %xmm0, (%esp)
46 ; X86-NEXT: flds (%esp)
50 ; X64-LABEL: bextr_uitofp:
52 ; X64-NEXT: movl $3855, %eax # imm = 0xF0F
53 ; X64-NEXT: bextrl %eax, %edi, %eax
54 ; X64-NEXT: cvtsi2ss %eax, %xmm0
56 %1 = tail call i32 @llvm.x86.bmi.bextr.32(i32 %x, i32 3855)
57 %2 = uitofp i32 %1 to float