1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -fast-isel -mtriple=i686-unknown-unknown -mattr=+tbm | FileCheck %s --check-prefix=X86
3 ; RUN: llc < %s -fast-isel -mtriple=x86_64-unknown-unknown -mattr=+tbm | FileCheck %s --check-prefix=X64
5 ; NOTE: This should use IR equivalent to what is generated by clang/test/CodeGen/tbm-builtins.c
7 define i32 @test__bextri_u32(i32 %a0) {
8 ; X86-LABEL: test__bextri_u32:
10 ; X86-NEXT: bextrl $3841, {{[0-9]+}}(%esp), %eax # imm = 0xF01
13 ; X64-LABEL: test__bextri_u32:
15 ; X64-NEXT: bextrl $3841, %edi, %eax # imm = 0xF01
17 %1 = call i32 @llvm.x86.tbm.bextri.u32(i32 %a0, i32 3841)
21 define i32 @test__blcfill_u32(i32 %a0) {
22 ; X86-LABEL: test__blcfill_u32:
24 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
25 ; X86-NEXT: leal 1(%ecx), %eax
26 ; X86-NEXT: andl %ecx, %eax
29 ; X64-LABEL: test__blcfill_u32:
31 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
32 ; X64-NEXT: leal 1(%rdi), %eax
33 ; X64-NEXT: andl %edi, %eax
40 define i32 @test__blci_u32(i32 %a0) {
41 ; X86-LABEL: test__blci_u32:
43 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
44 ; X86-NEXT: leal 1(%ecx), %eax
45 ; X86-NEXT: xorl $-1, %eax
46 ; X86-NEXT: orl %ecx, %eax
49 ; X64-LABEL: test__blci_u32:
51 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
52 ; X64-NEXT: leal 1(%rdi), %eax
53 ; X64-NEXT: xorl $-1, %eax
54 ; X64-NEXT: orl %edi, %eax
62 define i32 @test__blcic_u32(i32 %a0) {
63 ; X86-LABEL: test__blcic_u32:
65 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
66 ; X86-NEXT: movl %eax, %ecx
67 ; X86-NEXT: xorl $-1, %ecx
68 ; X86-NEXT: addl $1, %eax
69 ; X86-NEXT: andl %ecx, %eax
72 ; X64-LABEL: test__blcic_u32:
74 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
75 ; X64-NEXT: leal 1(%rdi), %eax
76 ; X64-NEXT: movl %edi, %ecx
77 ; X64-NEXT: xorl $-1, %ecx
78 ; X64-NEXT: andl %ecx, %eax
86 define i32 @test__blcmsk_u32(i32 %a0) {
87 ; X86-LABEL: test__blcmsk_u32:
89 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
90 ; X86-NEXT: leal 1(%ecx), %eax
91 ; X86-NEXT: xorl %ecx, %eax
94 ; X64-LABEL: test__blcmsk_u32:
96 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
97 ; X64-NEXT: leal 1(%rdi), %eax
98 ; X64-NEXT: xorl %edi, %eax
105 define i32 @test__blcs_u32(i32 %a0) {
106 ; X86-LABEL: test__blcs_u32:
108 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
109 ; X86-NEXT: leal 1(%ecx), %eax
110 ; X86-NEXT: orl %ecx, %eax
113 ; X64-LABEL: test__blcs_u32:
115 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
116 ; X64-NEXT: leal 1(%rdi), %eax
117 ; X64-NEXT: orl %edi, %eax
124 define i32 @test__blsfill_u32(i32 %a0) {
125 ; X86-LABEL: test__blsfill_u32:
127 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
128 ; X86-NEXT: leal -1(%ecx), %eax
129 ; X86-NEXT: orl %ecx, %eax
132 ; X64-LABEL: test__blsfill_u32:
134 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
135 ; X64-NEXT: leal -1(%rdi), %eax
136 ; X64-NEXT: orl %edi, %eax
143 define i32 @test__blsic_u32(i32 %a0) {
144 ; X86-LABEL: test__blsic_u32:
146 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
147 ; X86-NEXT: movl %eax, %ecx
148 ; X86-NEXT: xorl $-1, %ecx
149 ; X86-NEXT: subl $1, %eax
150 ; X86-NEXT: orl %ecx, %eax
153 ; X64-LABEL: test__blsic_u32:
155 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
156 ; X64-NEXT: leal -1(%rdi), %eax
157 ; X64-NEXT: movl %edi, %ecx
158 ; X64-NEXT: xorl $-1, %ecx
159 ; X64-NEXT: orl %ecx, %eax
167 define i32 @test__t1mskc_u32(i32 %a0) {
168 ; X86-LABEL: test__t1mskc_u32:
170 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
171 ; X86-NEXT: movl %eax, %ecx
172 ; X86-NEXT: xorl $-1, %ecx
173 ; X86-NEXT: addl $1, %eax
174 ; X86-NEXT: orl %ecx, %eax
177 ; X64-LABEL: test__t1mskc_u32:
179 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
180 ; X64-NEXT: leal 1(%rdi), %eax
181 ; X64-NEXT: movl %edi, %ecx
182 ; X64-NEXT: xorl $-1, %ecx
183 ; X64-NEXT: orl %ecx, %eax
191 define i32 @test__tzmsk_u32(i32 %a0) {
192 ; X86-LABEL: test__tzmsk_u32:
194 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
195 ; X86-NEXT: movl %eax, %ecx
196 ; X86-NEXT: xorl $-1, %ecx
197 ; X86-NEXT: subl $1, %eax
198 ; X86-NEXT: andl %ecx, %eax
201 ; X64-LABEL: test__tzmsk_u32:
203 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
204 ; X64-NEXT: leal -1(%rdi), %eax
205 ; X64-NEXT: movl %edi, %ecx
206 ; X64-NEXT: xorl $-1, %ecx
207 ; X64-NEXT: andl %ecx, %eax
215 declare i32 @llvm.x86.tbm.bextri.u32(i32, i32)