llvm.org GIT mirror llvm / 15443bd
[X86] Add some initial scheduling tests for generic x86 instructions These will be using inline asm to ensure we have coverage that we're unlikely to get from lowering of basic ir. Currently waiting for D39728 to land to add support for scheduler comments for inline asm. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317698 91177308-0d34-0410-b5e6-96231b3b80d8 Simon Pilgrim 3 years ago
2 changed file(s) with 1085 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
1 ; RUN: llc < %s -mtriple=i686-unknown-unknown -print-schedule -mcpu=i686 | FileCheck %s --check-prefix=CHECK --check-prefix=GENERIC
2 ; RUN: llc < %s -mtriple=i686-unknown-unknown -print-schedule -mcpu=atom | FileCheck %s --check-prefix=CHECK --check-prefix=ATOM
3 ; RUN: llc < %s -mtriple=i686-unknown-unknown -print-schedule -mcpu=slm | FileCheck %s --check-prefix=CHECK --check-prefix=SLM
4 ; RUN: llc < %s -mtriple=i686-unknown-unknown -print-schedule -mcpu=sandybridge | FileCheck %s --check-prefix=CHECK --check-prefix=SANDY
5 ; RUN: llc < %s -mtriple=i686-unknown-unknown -print-schedule -mcpu=ivybridge | FileCheck %s --check-prefix=CHECK --check-prefix=SANDY
6 ; RUN: llc < %s -mtriple=i686-unknown-unknown -print-schedule -mcpu=haswell | FileCheck %s --check-prefix=CHECK --check-prefix=HASWELL
7 ; RUN: llc < %s -mtriple=i686-unknown-unknown -print-schedule -mcpu=broadwell | FileCheck %s --check-prefix=CHECK --check-prefix=BROADWELL
8 ; RUN: llc < %s -mtriple=i686-unknown-unknown -print-schedule -mcpu=skylake | FileCheck %s --check-prefix=CHECK --check-prefix=SKYLAKE
9 ; RUN: llc < %s -mtriple=i686-unknown-unknown -print-schedule -mcpu=skx | FileCheck %s --check-prefix=CHECK --check-prefix=SKX
10 ; RUN: llc < %s -mtriple=i686-unknown-unknown -print-schedule -mcpu=btver2 | FileCheck %s --check-prefix=CHECK --check-prefix=BTVER2
11 ; RUN: llc < %s -mtriple=i686-unknown-unknown -print-schedule -mcpu=znver1 | FileCheck %s --check-prefix=CHECK --check-prefix=ZNVER1
12
13 define i8 @test_aaa(i8 %a0) optsize {
14 ; GENERIC-LABEL: test_aaa:
15 ; GENERIC: # BB#0:
16 ; GENERIC-NEXT: movb {{[0-9]+}}(%esp), %al
17 ; GENERIC-NEXT: #APP
18 ; GENERIC-NEXT: aaa
19 ; GENERIC-NEXT: #NO_APP
20 ; GENERIC-NEXT: retl
21 ;
22 ; ATOM-LABEL: test_aaa:
23 ; ATOM: # BB#0:
24 ; ATOM-NEXT: movb {{[0-9]+}}(%esp), %al # sched: [1:1.00]
25 ; ATOM-NEXT: #APP
26 ; ATOM-NEXT: aaa
27 ; ATOM-NEXT: #NO_APP
28 ; ATOM-NEXT: retl # sched: [79:39.50]
29 ;
30 ; SLM-LABEL: test_aaa:
31 ; SLM: # BB#0:
32 ; SLM-NEXT: movb {{[0-9]+}}(%esp), %al # sched: [3:1.00]
33 ; SLM-NEXT: #APP
34 ; SLM-NEXT: aaa
35 ; SLM-NEXT: #NO_APP
36 ; SLM-NEXT: retl # sched: [4:1.00]
37 ;
38 ; SANDY-LABEL: test_aaa:
39 ; SANDY: # BB#0:
40 ; SANDY-NEXT: movb {{[0-9]+}}(%esp), %al # sched: [5:0.50]
41 ; SANDY-NEXT: #APP
42 ; SANDY-NEXT: aaa
43 ; SANDY-NEXT: #NO_APP
44 ; SANDY-NEXT: retl # sched: [5:1.00]
45 ;
46 ; HASWELL-LABEL: test_aaa:
47 ; HASWELL: # BB#0:
48 ; HASWELL-NEXT: movb {{[0-9]+}}(%esp), %al # sched: [1:0.50]
49 ; HASWELL-NEXT: #APP
50 ; HASWELL-NEXT: aaa
51 ; HASWELL-NEXT: #NO_APP
52 ; HASWELL-NEXT: retl # sched: [5:0.50]
53 ;
54 ; BROADWELL-LABEL: test_aaa:
55 ; BROADWELL: # BB#0:
56 ; BROADWELL-NEXT: movb {{[0-9]+}}(%esp), %al # sched: [5:0.50]
57 ; BROADWELL-NEXT: #APP
58 ; BROADWELL-NEXT: aaa
59 ; BROADWELL-NEXT: #NO_APP
60 ; BROADWELL-NEXT: retl # sched: [6:0.50]
61 ;
62 ; SKYLAKE-LABEL: test_aaa:
63 ; SKYLAKE: # BB#0:
64 ; SKYLAKE-NEXT: movb {{[0-9]+}}(%esp), %al # sched: [5:0.50]
65 ; SKYLAKE-NEXT: #APP
66 ; SKYLAKE-NEXT: aaa
67 ; SKYLAKE-NEXT: #NO_APP
68 ; SKYLAKE-NEXT: retl # sched: [6:0.50]
69 ;
70 ; SKX-LABEL: test_aaa:
71 ; SKX: # BB#0:
72 ; SKX-NEXT: movb {{[0-9]+}}(%esp), %al # sched: [5:0.50]
73 ; SKX-NEXT: #APP
74 ; SKX-NEXT: aaa
75 ; SKX-NEXT: #NO_APP
76 ; SKX-NEXT: retl # sched: [6:0.50]
77 ;
78 ; BTVER2-LABEL: test_aaa:
79 ; BTVER2: # BB#0:
80 ; BTVER2-NEXT: movb {{[0-9]+}}(%esp), %al # sched: [5:1.00]
81 ; BTVER2-NEXT: #APP
82 ; BTVER2-NEXT: aaa
83 ; BTVER2-NEXT: #NO_APP
84 ; BTVER2-NEXT: retl # sched: [4:1.00]
85 ;
86 ; ZNVER1-LABEL: test_aaa:
87 ; ZNVER1: # BB#0:
88 ; ZNVER1-NEXT: movb {{[0-9]+}}(%esp), %al # sched: [8:0.50]
89 ; ZNVER1-NEXT: #APP
90 ; ZNVER1-NEXT: aaa
91 ; ZNVER1-NEXT: #NO_APP
92 ; ZNVER1-NEXT: retl # sched: [1:0.50]
93 %1 = tail call i8 asm "aaa", "=r,r"(i8 %a0) nounwind
94 ret i8 %1
95 }
96
97 define i8 @test_aad(i16 %a0) optsize {
98 ; GENERIC-LABEL: test_aad:
99 ; GENERIC: # BB#0:
100 ; GENERIC-NEXT: movzwl {{[0-9]+}}(%esp), %eax
101 ; GENERIC-NEXT: #APP
102 ; GENERIC-NEXT: aad
103 ; GENERIC-NEXT: #NO_APP
104 ; GENERIC-NEXT: retl
105 ;
106 ; ATOM-LABEL: test_aad:
107 ; ATOM: # BB#0:
108 ; ATOM-NEXT: movzwl {{[0-9]+}}(%esp), %eax # sched: [1:1.00]
109 ; ATOM-NEXT: #APP
110 ; ATOM-NEXT: aad
111 ; ATOM-NEXT: #NO_APP
112 ; ATOM-NEXT: retl # sched: [79:39.50]
113 ;
114 ; SLM-LABEL: test_aad:
115 ; SLM: # BB#0:
116 ; SLM-NEXT: movzwl {{[0-9]+}}(%esp), %eax # sched: [4:1.00]
117 ; SLM-NEXT: #APP
118 ; SLM-NEXT: aad
119 ; SLM-NEXT: #NO_APP
120 ; SLM-NEXT: retl # sched: [4:1.00]
121 ;
122 ; SANDY-LABEL: test_aad:
123 ; SANDY: # BB#0:
124 ; SANDY-NEXT: movzwl {{[0-9]+}}(%esp), %eax # sched: [5:0.50]
125 ; SANDY-NEXT: #APP
126 ; SANDY-NEXT: aad
127 ; SANDY-NEXT: #NO_APP
128 ; SANDY-NEXT: retl # sched: [5:1.00]
129 ;
130 ; HASWELL-LABEL: test_aad:
131 ; HASWELL: # BB#0:
132 ; HASWELL-NEXT: movzwl {{[0-9]+}}(%esp), %eax # sched: [4:0.50]
133 ; HASWELL-NEXT: #APP
134 ; HASWELL-NEXT: aad
135 ; HASWELL-NEXT: #NO_APP
136 ; HASWELL-NEXT: retl # sched: [5:0.50]
137 ;
138 ; BROADWELL-LABEL: test_aad:
139 ; BROADWELL: # BB#0:
140 ; BROADWELL-NEXT: movzwl {{[0-9]+}}(%esp), %eax # sched: [5:0.50]
141 ; BROADWELL-NEXT: #APP
142 ; BROADWELL-NEXT: aad
143 ; BROADWELL-NEXT: #NO_APP
144 ; BROADWELL-NEXT: retl # sched: [6:0.50]
145 ;
146 ; SKYLAKE-LABEL: test_aad:
147 ; SKYLAKE: # BB#0:
148 ; SKYLAKE-NEXT: movzwl {{[0-9]+}}(%esp), %eax # sched: [5:0.50]
149 ; SKYLAKE-NEXT: #APP
150 ; SKYLAKE-NEXT: aad
151 ; SKYLAKE-NEXT: #NO_APP
152 ; SKYLAKE-NEXT: retl # sched: [6:0.50]
153 ;
154 ; SKX-LABEL: test_aad:
155 ; SKX: # BB#0:
156 ; SKX-NEXT: movzwl {{[0-9]+}}(%esp), %eax # sched: [5:0.50]
157 ; SKX-NEXT: #APP
158 ; SKX-NEXT: aad
159 ; SKX-NEXT: #NO_APP
160 ; SKX-NEXT: retl # sched: [6:0.50]
161 ;
162 ; BTVER2-LABEL: test_aad:
163 ; BTVER2: # BB#0:
164 ; BTVER2-NEXT: movzwl {{[0-9]+}}(%esp), %eax # sched: [4:1.00]
165 ; BTVER2-NEXT: #APP
166 ; BTVER2-NEXT: aad
167 ; BTVER2-NEXT: #NO_APP
168 ; BTVER2-NEXT: retl # sched: [4:1.00]
169 ;
170 ; ZNVER1-LABEL: test_aad:
171 ; ZNVER1: # BB#0:
172 ; ZNVER1-NEXT: movzwl {{[0-9]+}}(%esp), %eax # sched: [8:0.50]
173 ; ZNVER1-NEXT: #APP
174 ; ZNVER1-NEXT: aad
175 ; ZNVER1-NEXT: #NO_APP
176 ; ZNVER1-NEXT: retl # sched: [1:0.50]
177 %1 = tail call i8 asm "aad", "=r,r"(i16 %a0) nounwind
178 ret i8 %1
179 }
180
181 define i16 @test_aam(i8 %a0) optsize {
182 ; GENERIC-LABEL: test_aam:
183 ; GENERIC: # BB#0:
184 ; GENERIC-NEXT: movb {{[0-9]+}}(%esp), %al
185 ; GENERIC-NEXT: #APP
186 ; GENERIC-NEXT: aam
187 ; GENERIC-NEXT: #NO_APP
188 ; GENERIC-NEXT: retl
189 ;
190 ; ATOM-LABEL: test_aam:
191 ; ATOM: # BB#0:
192 ; ATOM-NEXT: movb {{[0-9]+}}(%esp), %al # sched: [1:1.00]
193 ; ATOM-NEXT: #APP
194 ; ATOM-NEXT: aam
195 ; ATOM-NEXT: #NO_APP
196 ; ATOM-NEXT: retl # sched: [79:39.50]
197 ;
198 ; SLM-LABEL: test_aam:
199 ; SLM: # BB#0:
200 ; SLM-NEXT: movb {{[0-9]+}}(%esp), %al # sched: [3:1.00]
201 ; SLM-NEXT: #APP
202 ; SLM-NEXT: aam
203 ; SLM-NEXT: #NO_APP
204 ; SLM-NEXT: retl # sched: [4:1.00]
205 ;
206 ; SANDY-LABEL: test_aam:
207 ; SANDY: # BB#0:
208 ; SANDY-NEXT: movb {{[0-9]+}}(%esp), %al # sched: [5:0.50]
209 ; SANDY-NEXT: #APP
210 ; SANDY-NEXT: aam
211 ; SANDY-NEXT: #NO_APP
212 ; SANDY-NEXT: retl # sched: [5:1.00]
213 ;
214 ; HASWELL-LABEL: test_aam:
215 ; HASWELL: # BB#0:
216 ; HASWELL-NEXT: movb {{[0-9]+}}(%esp), %al # sched: [1:0.50]
217 ; HASWELL-NEXT: #APP
218 ; HASWELL-NEXT: aam
219 ; HASWELL-NEXT: #NO_APP
220 ; HASWELL-NEXT: retl # sched: [5:0.50]
221 ;
222 ; BROADWELL-LABEL: test_aam:
223 ; BROADWELL: # BB#0:
224 ; BROADWELL-NEXT: movb {{[0-9]+}}(%esp), %al # sched: [5:0.50]
225 ; BROADWELL-NEXT: #APP
226 ; BROADWELL-NEXT: aam
227 ; BROADWELL-NEXT: #NO_APP
228 ; BROADWELL-NEXT: retl # sched: [6:0.50]
229 ;
230 ; SKYLAKE-LABEL: test_aam:
231 ; SKYLAKE: # BB#0:
232 ; SKYLAKE-NEXT: movb {{[0-9]+}}(%esp), %al # sched: [5:0.50]
233 ; SKYLAKE-NEXT: #APP
234 ; SKYLAKE-NEXT: aam
235 ; SKYLAKE-NEXT: #NO_APP
236 ; SKYLAKE-NEXT: retl # sched: [6:0.50]
237 ;
238 ; SKX-LABEL: test_aam:
239 ; SKX: # BB#0:
240 ; SKX-NEXT: movb {{[0-9]+}}(%esp), %al # sched: [5:0.50]
241 ; SKX-NEXT: #APP
242 ; SKX-NEXT: aam
243 ; SKX-NEXT: #NO_APP
244 ; SKX-NEXT: retl # sched: [6:0.50]
245 ;
246 ; BTVER2-LABEL: test_aam:
247 ; BTVER2: # BB#0:
248 ; BTVER2-NEXT: movb {{[0-9]+}}(%esp), %al # sched: [5:1.00]
249 ; BTVER2-NEXT: #APP
250 ; BTVER2-NEXT: aam
251 ; BTVER2-NEXT: #NO_APP
252 ; BTVER2-NEXT: retl # sched: [4:1.00]
253 ;
254 ; ZNVER1-LABEL: test_aam:
255 ; ZNVER1: # BB#0:
256 ; ZNVER1-NEXT: movb {{[0-9]+}}(%esp), %al # sched: [8:0.50]
257 ; ZNVER1-NEXT: #APP
258 ; ZNVER1-NEXT: aam
259 ; ZNVER1-NEXT: #NO_APP
260 ; ZNVER1-NEXT: retl # sched: [1:0.50]
261 %1 = tail call i16 asm "aam", "=r,r"(i8 %a0) nounwind
262 ret i16 %1
263 }
264
265 define i8 @test_aas(i8 %a0) optsize {
266 ; GENERIC-LABEL: test_aas:
267 ; GENERIC: # BB#0:
268 ; GENERIC-NEXT: movb {{[0-9]+}}(%esp), %al
269 ; GENERIC-NEXT: #APP
270 ; GENERIC-NEXT: aas
271 ; GENERIC-NEXT: #NO_APP
272 ; GENERIC-NEXT: retl
273 ;
274 ; ATOM-LABEL: test_aas:
275 ; ATOM: # BB#0:
276 ; ATOM-NEXT: movb {{[0-9]+}}(%esp), %al # sched: [1:1.00]
277 ; ATOM-NEXT: #APP
278 ; ATOM-NEXT: aas
279 ; ATOM-NEXT: #NO_APP
280 ; ATOM-NEXT: retl # sched: [79:39.50]
281 ;
282 ; SLM-LABEL: test_aas:
283 ; SLM: # BB#0:
284 ; SLM-NEXT: movb {{[0-9]+}}(%esp), %al # sched: [3:1.00]
285 ; SLM-NEXT: #APP
286 ; SLM-NEXT: aas
287 ; SLM-NEXT: #NO_APP
288 ; SLM-NEXT: retl # sched: [4:1.00]
289 ;
290 ; SANDY-LABEL: test_aas:
291 ; SANDY: # BB#0:
292 ; SANDY-NEXT: movb {{[0-9]+}}(%esp), %al # sched: [5:0.50]
293 ; SANDY-NEXT: #APP
294 ; SANDY-NEXT: aas
295 ; SANDY-NEXT: #NO_APP
296 ; SANDY-NEXT: retl # sched: [5:1.00]
297 ;
298 ; HASWELL-LABEL: test_aas:
299 ; HASWELL: # BB#0:
300 ; HASWELL-NEXT: movb {{[0-9]+}}(%esp), %al # sched: [1:0.50]
301 ; HASWELL-NEXT: #APP
302 ; HASWELL-NEXT: aas
303 ; HASWELL-NEXT: #NO_APP
304 ; HASWELL-NEXT: retl # sched: [5:0.50]
305 ;
306 ; BROADWELL-LABEL: test_aas:
307 ; BROADWELL: # BB#0:
308 ; BROADWELL-NEXT: movb {{[0-9]+}}(%esp), %al # sched: [5:0.50]
309 ; BROADWELL-NEXT: #APP
310 ; BROADWELL-NEXT: aas
311 ; BROADWELL-NEXT: #NO_APP
312 ; BROADWELL-NEXT: retl # sched: [6:0.50]
313 ;
314 ; SKYLAKE-LABEL: test_aas:
315 ; SKYLAKE: # BB#0:
316 ; SKYLAKE-NEXT: movb {{[0-9]+}}(%esp), %al # sched: [5:0.50]
317 ; SKYLAKE-NEXT: #APP
318 ; SKYLAKE-NEXT: aas
319 ; SKYLAKE-NEXT: #NO_APP
320 ; SKYLAKE-NEXT: retl # sched: [6:0.50]
321 ;
322 ; SKX-LABEL: test_aas:
323 ; SKX: # BB#0:
324 ; SKX-NEXT: movb {{[0-9]+}}(%esp), %al # sched: [5:0.50]
325 ; SKX-NEXT: #APP
326 ; SKX-NEXT: aas
327 ; SKX-NEXT: #NO_APP
328 ; SKX-NEXT: retl # sched: [6:0.50]
329 ;
330 ; BTVER2-LABEL: test_aas:
331 ; BTVER2: # BB#0:
332 ; BTVER2-NEXT: movb {{[0-9]+}}(%esp), %al # sched: [5:1.00]
333 ; BTVER2-NEXT: #APP
334 ; BTVER2-NEXT: aas
335 ; BTVER2-NEXT: #NO_APP
336 ; BTVER2-NEXT: retl # sched: [4:1.00]
337 ;
338 ; ZNVER1-LABEL: test_aas:
339 ; ZNVER1: # BB#0:
340 ; ZNVER1-NEXT: movb {{[0-9]+}}(%esp), %al # sched: [8:0.50]
341 ; ZNVER1-NEXT: #APP
342 ; ZNVER1-NEXT: aas
343 ; ZNVER1-NEXT: #NO_APP
344 ; ZNVER1-NEXT: retl # sched: [1:0.50]
345 %1 = tail call i8 asm "aas", "=r,r"(i8 %a0) nounwind
346 ret i8 %1
347 }
0 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
1 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -print-schedule -mcpu=x86-64 | FileCheck %s --check-prefix=CHECK --check-prefix=GENERIC
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -print-schedule -mcpu=atom | FileCheck %s --check-prefix=CHECK --check-prefix=ATOM
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -print-schedule -mcpu=slm | FileCheck %s --check-prefix=CHECK --check-prefix=SLM
4 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -print-schedule -mcpu=sandybridge | FileCheck %s --check-prefix=CHECK --check-prefix=SANDY
5 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -print-schedule -mcpu=ivybridge | FileCheck %s --check-prefix=CHECK --check-prefix=SANDY
6 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -print-schedule -mcpu=haswell | FileCheck %s --check-prefix=CHECK --check-prefix=HASWELL
7 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -print-schedule -mcpu=broadwell | FileCheck %s --check-prefix=CHECK --check-prefix=BROADWELL
8 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -print-schedule -mcpu=skylake | FileCheck %s --check-prefix=CHECK --check-prefix=SKYLAKE
9 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -print-schedule -mcpu=skx | FileCheck %s --check-prefix=CHECK --check-prefix=SKX
10 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -print-schedule -mcpu=btver2 | FileCheck %s --check-prefix=CHECK --check-prefix=BTVER2
11 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -print-schedule -mcpu=znver1 | FileCheck %s --check-prefix=CHECK --check-prefix=ZNVER1
12
13 define i16 @test_bsf16(i16 %a0, i16* %a1) optsize {
14 ; GENERIC-LABEL: test_bsf16:
15 ; GENERIC: # BB#0:
16 ; GENERIC-NEXT: #APP
17 ; GENERIC-NEXT: bsfw %di, %ax
18 ; GENERIC-NEXT: bsfw (%rsi), %cx
19 ; GENERIC-NEXT: #NO_APP
20 ; GENERIC-NEXT: orl %ecx, %eax # sched: [1:0.33]
21 ; GENERIC-NEXT: # kill: %AX %AX %EAX
22 ; GENERIC-NEXT: retq # sched: [1:1.00]
23 ;
24 ; ATOM-LABEL: test_bsf16:
25 ; ATOM: # BB#0:
26 ; ATOM-NEXT: #APP
27 ; ATOM-NEXT: bsfw %di, %ax
28 ; ATOM-NEXT: bsfw (%rsi), %cx
29 ; ATOM-NEXT: #NO_APP
30 ; ATOM-NEXT: orl %ecx, %eax # sched: [1:0.50]
31 ; ATOM-NEXT: # kill: %AX %AX %EAX
32 ; ATOM-NEXT: retq # sched: [79:39.50]
33 ;
34 ; SLM-LABEL: test_bsf16:
35 ; SLM: # BB#0:
36 ; SLM-NEXT: #APP
37 ; SLM-NEXT: bsfw %di, %ax
38 ; SLM-NEXT: bsfw (%rsi), %cx
39 ; SLM-NEXT: #NO_APP
40 ; SLM-NEXT: orl %ecx, %eax # sched: [1:0.50]
41 ; SLM-NEXT: # kill: %AX %AX %EAX
42 ; SLM-NEXT: retq # sched: [4:1.00]
43 ;
44 ; SANDY-LABEL: test_bsf16:
45 ; SANDY: # BB#0:
46 ; SANDY-NEXT: #APP
47 ; SANDY-NEXT: bsfw %di, %ax
48 ; SANDY-NEXT: bsfw (%rsi), %cx
49 ; SANDY-NEXT: #NO_APP
50 ; SANDY-NEXT: orl %ecx, %eax # sched: [1:0.33]
51 ; SANDY-NEXT: # kill: %AX %AX %EAX
52 ; SANDY-NEXT: retq # sched: [1:1.00]
53 ;
54 ; HASWELL-LABEL: test_bsf16:
55 ; HASWELL: # BB#0:
56 ; HASWELL-NEXT: #APP
57 ; HASWELL-NEXT: bsfw %di, %ax
58 ; HASWELL-NEXT: bsfw (%rsi), %cx
59 ; HASWELL-NEXT: #NO_APP
60 ; HASWELL-NEXT: orl %ecx, %eax # sched: [1:0.25]
61 ; HASWELL-NEXT: # kill: %AX %AX %EAX
62 ; HASWELL-NEXT: retq # sched: [2:1.00]
63 ;
64 ; BROADWELL-LABEL: test_bsf16:
65 ; BROADWELL: # BB#0:
66 ; BROADWELL-NEXT: #APP
67 ; BROADWELL-NEXT: bsfw %di, %ax
68 ; BROADWELL-NEXT: bsfw (%rsi), %cx
69 ; BROADWELL-NEXT: #NO_APP
70 ; BROADWELL-NEXT: orl %ecx, %eax # sched: [1:0.25]
71 ; BROADWELL-NEXT: # kill: %AX %AX %EAX
72 ; BROADWELL-NEXT: retq # sched: [7:1.00]
73 ;
74 ; SKYLAKE-LABEL: test_bsf16:
75 ; SKYLAKE: # BB#0:
76 ; SKYLAKE-NEXT: #APP
77 ; SKYLAKE-NEXT: bsfw %di, %ax
78 ; SKYLAKE-NEXT: bsfw (%rsi), %cx
79 ; SKYLAKE-NEXT: #NO_APP
80 ; SKYLAKE-NEXT: orl %ecx, %eax # sched: [1:0.25]
81 ; SKYLAKE-NEXT: # kill: %AX %AX %EAX
82 ; SKYLAKE-NEXT: retq # sched: [7:1.00]
83 ;
84 ; SKX-LABEL: test_bsf16:
85 ; SKX: # BB#0:
86 ; SKX-NEXT: #APP
87 ; SKX-NEXT: bsfw %di, %ax
88 ; SKX-NEXT: bsfw (%rsi), %cx
89 ; SKX-NEXT: #NO_APP
90 ; SKX-NEXT: orl %ecx, %eax # sched: [1:0.25]
91 ; SKX-NEXT: # kill: %AX %AX %EAX
92 ; SKX-NEXT: retq # sched: [7:1.00]
93 ;
94 ; BTVER2-LABEL: test_bsf16:
95 ; BTVER2: # BB#0:
96 ; BTVER2-NEXT: #APP
97 ; BTVER2-NEXT: bsfw %di, %ax
98 ; BTVER2-NEXT: bsfw (%rsi), %cx
99 ; BTVER2-NEXT: #NO_APP
100 ; BTVER2-NEXT: orl %ecx, %eax # sched: [1:0.50]
101 ; BTVER2-NEXT: # kill: %AX %AX %EAX
102 ; BTVER2-NEXT: retq # sched: [4:1.00]
103 ;
104 ; ZNVER1-LABEL: test_bsf16:
105 ; ZNVER1: # BB#0:
106 ; ZNVER1-NEXT: #APP
107 ; ZNVER1-NEXT: bsfw %di, %ax
108 ; ZNVER1-NEXT: bsfw (%rsi), %cx
109 ; ZNVER1-NEXT: #NO_APP
110 ; ZNVER1-NEXT: orl %ecx, %eax # sched: [1:0.25]
111 ; ZNVER1-NEXT: # kill: %AX %AX %EAX
112 ; ZNVER1-NEXT: retq # sched: [1:0.50]
113 %1 = call { i16, i16 } asm sideeffect "bsf $2, $0 \0A\09 bsf $3, $1", "=r,=r,r,*m,~{dirflag},~{fpsr},~{flags}"(i16 %a0, i16* %a1)
114 %2 = extractvalue { i16, i16 } %1, 0
115 %3 = extractvalue { i16, i16 } %1, 1
116 %4 = or i16 %2, %3
117 ret i16 %4
118 }
119 define i32 @test_bsf32(i32 %a0, i32* %a1) optsize {
120 ; GENERIC-LABEL: test_bsf32:
121 ; GENERIC: # BB#0:
122 ; GENERIC-NEXT: #APP
123 ; GENERIC-NEXT: bsfl %edi, %eax
124 ; GENERIC-NEXT: bsfl (%rsi), %ecx
125 ; GENERIC-NEXT: #NO_APP
126 ; GENERIC-NEXT: orl %ecx, %eax # sched: [1:0.33]
127 ; GENERIC-NEXT: retq # sched: [1:1.00]
128 ;
129 ; ATOM-LABEL: test_bsf32:
130 ; ATOM: # BB#0:
131 ; ATOM-NEXT: #APP
132 ; ATOM-NEXT: bsfl %edi, %eax
133 ; ATOM-NEXT: bsfl (%rsi), %ecx
134 ; ATOM-NEXT: #NO_APP
135 ; ATOM-NEXT: orl %ecx, %eax # sched: [1:0.50]
136 ; ATOM-NEXT: retq # sched: [79:39.50]
137 ;
138 ; SLM-LABEL: test_bsf32:
139 ; SLM: # BB#0:
140 ; SLM-NEXT: #APP
141 ; SLM-NEXT: bsfl %edi, %eax
142 ; SLM-NEXT: bsfl (%rsi), %ecx
143 ; SLM-NEXT: #NO_APP
144 ; SLM-NEXT: orl %ecx, %eax # sched: [1:0.50]
145 ; SLM-NEXT: retq # sched: [4:1.00]
146 ;
147 ; SANDY-LABEL: test_bsf32:
148 ; SANDY: # BB#0:
149 ; SANDY-NEXT: #APP
150 ; SANDY-NEXT: bsfl %edi, %eax
151 ; SANDY-NEXT: bsfl (%rsi), %ecx
152 ; SANDY-NEXT: #NO_APP
153 ; SANDY-NEXT: orl %ecx, %eax # sched: [1:0.33]
154 ; SANDY-NEXT: retq # sched: [1:1.00]
155 ;
156 ; HASWELL-LABEL: test_bsf32:
157 ; HASWELL: # BB#0:
158 ; HASWELL-NEXT: #APP
159 ; HASWELL-NEXT: bsfl %edi, %eax
160 ; HASWELL-NEXT: bsfl (%rsi), %ecx
161 ; HASWELL-NEXT: #NO_APP
162 ; HASWELL-NEXT: orl %ecx, %eax # sched: [1:0.25]
163 ; HASWELL-NEXT: retq # sched: [2:1.00]
164 ;
165 ; BROADWELL-LABEL: test_bsf32:
166 ; BROADWELL: # BB#0:
167 ; BROADWELL-NEXT: #APP
168 ; BROADWELL-NEXT: bsfl %edi, %eax
169 ; BROADWELL-NEXT: bsfl (%rsi), %ecx
170 ; BROADWELL-NEXT: #NO_APP
171 ; BROADWELL-NEXT: orl %ecx, %eax # sched: [1:0.25]
172 ; BROADWELL-NEXT: retq # sched: [7:1.00]
173 ;
174 ; SKYLAKE-LABEL: test_bsf32:
175 ; SKYLAKE: # BB#0:
176 ; SKYLAKE-NEXT: #APP
177 ; SKYLAKE-NEXT: bsfl %edi, %eax
178 ; SKYLAKE-NEXT: bsfl (%rsi), %ecx
179 ; SKYLAKE-NEXT: #NO_APP
180 ; SKYLAKE-NEXT: orl %ecx, %eax # sched: [1:0.25]
181 ; SKYLAKE-NEXT: retq # sched: [7:1.00]
182 ;
183 ; SKX-LABEL: test_bsf32:
184 ; SKX: # BB#0:
185 ; SKX-NEXT: #APP
186 ; SKX-NEXT: bsfl %edi, %eax
187 ; SKX-NEXT: bsfl (%rsi), %ecx
188 ; SKX-NEXT: #NO_APP
189 ; SKX-NEXT: orl %ecx, %eax # sched: [1:0.25]
190 ; SKX-NEXT: retq # sched: [7:1.00]
191 ;
192 ; BTVER2-LABEL: test_bsf32:
193 ; BTVER2: # BB#0:
194 ; BTVER2-NEXT: #APP
195 ; BTVER2-NEXT: bsfl %edi, %eax
196 ; BTVER2-NEXT: bsfl (%rsi), %ecx
197 ; BTVER2-NEXT: #NO_APP
198 ; BTVER2-NEXT: orl %ecx, %eax # sched: [1:0.50]
199 ; BTVER2-NEXT: retq # sched: [4:1.00]
200 ;
201 ; ZNVER1-LABEL: test_bsf32:
202 ; ZNVER1: # BB#0:
203 ; ZNVER1-NEXT: #APP
204 ; ZNVER1-NEXT: bsfl %edi, %eax
205 ; ZNVER1-NEXT: bsfl (%rsi), %ecx
206 ; ZNVER1-NEXT: #NO_APP
207 ; ZNVER1-NEXT: orl %ecx, %eax # sched: [1:0.25]
208 ; ZNVER1-NEXT: retq # sched: [1:0.50]
209 %1 = call { i32, i32 } asm sideeffect "bsf $2, $0 \0A\09 bsf $3, $1", "=r,=r,r,*m,~{dirflag},~{fpsr},~{flags}"(i32 %a0, i32* %a1)
210 %2 = extractvalue { i32, i32 } %1, 0
211 %3 = extractvalue { i32, i32 } %1, 1
212 %4 = or i32 %2, %3
213 ret i32 %4
214 }
215 define i64 @test_bsf64(i64 %a0, i64* %a1) optsize {
216 ; GENERIC-LABEL: test_bsf64:
217 ; GENERIC: # BB#0:
218 ; GENERIC-NEXT: #APP
219 ; GENERIC-NEXT: bsfq %rdi, %rax
220 ; GENERIC-NEXT: bsfq (%rsi), %rcx
221 ; GENERIC-NEXT: #NO_APP
222 ; GENERIC-NEXT: orq %rcx, %rax # sched: [1:0.33]
223 ; GENERIC-NEXT: retq # sched: [1:1.00]
224 ;
225 ; ATOM-LABEL: test_bsf64:
226 ; ATOM: # BB#0:
227 ; ATOM-NEXT: #APP
228 ; ATOM-NEXT: bsfq %rdi, %rax
229 ; ATOM-NEXT: bsfq (%rsi), %rcx
230 ; ATOM-NEXT: #NO_APP
231 ; ATOM-NEXT: orq %rcx, %rax # sched: [1:0.50]
232 ; ATOM-NEXT: retq # sched: [79:39.50]
233 ;
234 ; SLM-LABEL: test_bsf64:
235 ; SLM: # BB#0:
236 ; SLM-NEXT: #APP
237 ; SLM-NEXT: bsfq %rdi, %rax
238 ; SLM-NEXT: bsfq (%rsi), %rcx
239 ; SLM-NEXT: #NO_APP
240 ; SLM-NEXT: orq %rcx, %rax # sched: [1:0.50]
241 ; SLM-NEXT: retq # sched: [4:1.00]
242 ;
243 ; SANDY-LABEL: test_bsf64:
244 ; SANDY: # BB#0:
245 ; SANDY-NEXT: #APP
246 ; SANDY-NEXT: bsfq %rdi, %rax
247 ; SANDY-NEXT: bsfq (%rsi), %rcx
248 ; SANDY-NEXT: #NO_APP
249 ; SANDY-NEXT: orq %rcx, %rax # sched: [1:0.33]
250 ; SANDY-NEXT: retq # sched: [1:1.00]
251 ;
252 ; HASWELL-LABEL: test_bsf64:
253 ; HASWELL: # BB#0:
254 ; HASWELL-NEXT: #APP
255 ; HASWELL-NEXT: bsfq %rdi, %rax
256 ; HASWELL-NEXT: bsfq (%rsi), %rcx
257 ; HASWELL-NEXT: #NO_APP
258 ; HASWELL-NEXT: orq %rcx, %rax # sched: [1:0.25]
259 ; HASWELL-NEXT: retq # sched: [2:1.00]
260 ;
261 ; BROADWELL-LABEL: test_bsf64:
262 ; BROADWELL: # BB#0:
263 ; BROADWELL-NEXT: #APP
264 ; BROADWELL-NEXT: bsfq %rdi, %rax
265 ; BROADWELL-NEXT: bsfq (%rsi), %rcx
266 ; BROADWELL-NEXT: #NO_APP
267 ; BROADWELL-NEXT: orq %rcx, %rax # sched: [1:0.25]
268 ; BROADWELL-NEXT: retq # sched: [7:1.00]
269 ;
270 ; SKYLAKE-LABEL: test_bsf64:
271 ; SKYLAKE: # BB#0:
272 ; SKYLAKE-NEXT: #APP
273 ; SKYLAKE-NEXT: bsfq %rdi, %rax
274 ; SKYLAKE-NEXT: bsfq (%rsi), %rcx
275 ; SKYLAKE-NEXT: #NO_APP
276 ; SKYLAKE-NEXT: orq %rcx, %rax # sched: [1:0.25]
277 ; SKYLAKE-NEXT: retq # sched: [7:1.00]
278 ;
279 ; SKX-LABEL: test_bsf64:
280 ; SKX: # BB#0:
281 ; SKX-NEXT: #APP
282 ; SKX-NEXT: bsfq %rdi, %rax
283 ; SKX-NEXT: bsfq (%rsi), %rcx
284 ; SKX-NEXT: #NO_APP
285 ; SKX-NEXT: orq %rcx, %rax # sched: [1:0.25]
286 ; SKX-NEXT: retq # sched: [7:1.00]
287 ;
288 ; BTVER2-LABEL: test_bsf64:
289 ; BTVER2: # BB#0:
290 ; BTVER2-NEXT: #APP
291 ; BTVER2-NEXT: bsfq %rdi, %rax
292 ; BTVER2-NEXT: bsfq (%rsi), %rcx
293 ; BTVER2-NEXT: #NO_APP
294 ; BTVER2-NEXT: orq %rcx, %rax # sched: [1:0.50]
295 ; BTVER2-NEXT: retq # sched: [4:1.00]
296 ;
297 ; ZNVER1-LABEL: test_bsf64:
298 ; ZNVER1: # BB#0:
299 ; ZNVER1-NEXT: #APP
300 ; ZNVER1-NEXT: bsfq %rdi, %rax
301 ; ZNVER1-NEXT: bsfq (%rsi), %rcx
302 ; ZNVER1-NEXT: #NO_APP
303 ; ZNVER1-NEXT: orq %rcx, %rax # sched: [1:0.25]
304 ; ZNVER1-NEXT: retq # sched: [1:0.50]
305 %1 = call { i64, i64 } asm sideeffect "bsf $2, $0 \0A\09 bsf $3, $1", "=r,=r,r,*m,~{dirflag},~{fpsr},~{flags}"(i64 %a0, i64* %a1)
306 %2 = extractvalue { i64, i64 } %1, 0
307 %3 = extractvalue { i64, i64 } %1, 1
308 %4 = or i64 %2, %3
309 ret i64 %4
310 }
311
312 define i16 @test_bsr16(i16 %a0, i16* %a1) optsize {
313 ; GENERIC-LABEL: test_bsr16:
314 ; GENERIC: # BB#0:
315 ; GENERIC-NEXT: #APP
316 ; GENERIC-NEXT: bsrw %di, %ax
317 ; GENERIC-NEXT: bsrw (%rsi), %cx
318 ; GENERIC-NEXT: #NO_APP
319 ; GENERIC-NEXT: orl %ecx, %eax # sched: [1:0.33]
320 ; GENERIC-NEXT: # kill: %AX %AX %EAX
321 ; GENERIC-NEXT: retq # sched: [1:1.00]
322 ;
323 ; ATOM-LABEL: test_bsr16:
324 ; ATOM: # BB#0:
325 ; ATOM-NEXT: #APP
326 ; ATOM-NEXT: bsrw %di, %ax
327 ; ATOM-NEXT: bsrw (%rsi), %cx
328 ; ATOM-NEXT: #NO_APP
329 ; ATOM-NEXT: orl %ecx, %eax # sched: [1:0.50]
330 ; ATOM-NEXT: # kill: %AX %AX %EAX
331 ; ATOM-NEXT: retq # sched: [79:39.50]
332 ;
333 ; SLM-LABEL: test_bsr16:
334 ; SLM: # BB#0:
335 ; SLM-NEXT: #APP
336 ; SLM-NEXT: bsrw %di, %ax
337 ; SLM-NEXT: bsrw (%rsi), %cx
338 ; SLM-NEXT: #NO_APP
339 ; SLM-NEXT: orl %ecx, %eax # sched: [1:0.50]
340 ; SLM-NEXT: # kill: %AX %AX %EAX
341 ; SLM-NEXT: retq # sched: [4:1.00]
342 ;
343 ; SANDY-LABEL: test_bsr16:
344 ; SANDY: # BB#0:
345 ; SANDY-NEXT: #APP
346 ; SANDY-NEXT: bsrw %di, %ax
347 ; SANDY-NEXT: bsrw (%rsi), %cx
348 ; SANDY-NEXT: #NO_APP
349 ; SANDY-NEXT: orl %ecx, %eax # sched: [1:0.33]
350 ; SANDY-NEXT: # kill: %AX %AX %EAX
351 ; SANDY-NEXT: retq # sched: [1:1.00]
352 ;
353 ; HASWELL-LABEL: test_bsr16:
354 ; HASWELL: # BB#0:
355 ; HASWELL-NEXT: #APP
356 ; HASWELL-NEXT: bsrw %di, %ax
357 ; HASWELL-NEXT: bsrw (%rsi), %cx
358 ; HASWELL-NEXT: #NO_APP
359 ; HASWELL-NEXT: orl %ecx, %eax # sched: [1:0.25]
360 ; HASWELL-NEXT: # kill: %AX %AX %EAX
361 ; HASWELL-NEXT: retq # sched: [2:1.00]
362 ;
363 ; BROADWELL-LABEL: test_bsr16:
364 ; BROADWELL: # BB#0:
365 ; BROADWELL-NEXT: #APP
366 ; BROADWELL-NEXT: bsrw %di, %ax
367 ; BROADWELL-NEXT: bsrw (%rsi), %cx
368 ; BROADWELL-NEXT: #NO_APP
369 ; BROADWELL-NEXT: orl %ecx, %eax # sched: [1:0.25]
370 ; BROADWELL-NEXT: # kill: %AX %AX %EAX
371 ; BROADWELL-NEXT: retq # sched: [7:1.00]
372 ;
373 ; SKYLAKE-LABEL: test_bsr16:
374 ; SKYLAKE: # BB#0:
375 ; SKYLAKE-NEXT: #APP
376 ; SKYLAKE-NEXT: bsrw %di, %ax
377 ; SKYLAKE-NEXT: bsrw (%rsi), %cx
378 ; SKYLAKE-NEXT: #NO_APP
379 ; SKYLAKE-NEXT: orl %ecx, %eax # sched: [1:0.25]
380 ; SKYLAKE-NEXT: # kill: %AX %AX %EAX
381 ; SKYLAKE-NEXT: retq # sched: [7:1.00]
382 ;
383 ; SKX-LABEL: test_bsr16:
384 ; SKX: # BB#0:
385 ; SKX-NEXT: #APP
386 ; SKX-NEXT: bsrw %di, %ax
387 ; SKX-NEXT: bsrw (%rsi), %cx
388 ; SKX-NEXT: #NO_APP
389 ; SKX-NEXT: orl %ecx, %eax # sched: [1:0.25]
390 ; SKX-NEXT: # kill: %AX %AX %EAX
391 ; SKX-NEXT: retq # sched: [7:1.00]
392 ;
393 ; BTVER2-LABEL: test_bsr16:
394 ; BTVER2: # BB#0:
395 ; BTVER2-NEXT: #APP
396 ; BTVER2-NEXT: bsrw %di, %ax
397 ; BTVER2-NEXT: bsrw (%rsi), %cx
398 ; BTVER2-NEXT: #NO_APP
399 ; BTVER2-NEXT: orl %ecx, %eax # sched: [1:0.50]
400 ; BTVER2-NEXT: # kill: %AX %AX %EAX
401 ; BTVER2-NEXT: retq # sched: [4:1.00]
402 ;
403 ; ZNVER1-LABEL: test_bsr16:
404 ; ZNVER1: # BB#0:
405 ; ZNVER1-NEXT: #APP
406 ; ZNVER1-NEXT: bsrw %di, %ax
407 ; ZNVER1-NEXT: bsrw (%rsi), %cx
408 ; ZNVER1-NEXT: #NO_APP
409 ; ZNVER1-NEXT: orl %ecx, %eax # sched: [1:0.25]
410 ; ZNVER1-NEXT: # kill: %AX %AX %EAX
411 ; ZNVER1-NEXT: retq # sched: [1:0.50]
412 %1 = call { i16, i16 } asm sideeffect "bsr $2, $0 \0A\09 bsr $3, $1", "=r,=r,r,*m,~{dirflag},~{fpsr},~{flags}"(i16 %a0, i16* %a1)
413 %2 = extractvalue { i16, i16 } %1, 0
414 %3 = extractvalue { i16, i16 } %1, 1
415 %4 = or i16 %2, %3
416 ret i16 %4
417 }
418 define i32 @test_bsr32(i32 %a0, i32* %a1) optsize {
419 ; GENERIC-LABEL: test_bsr32:
420 ; GENERIC: # BB#0:
421 ; GENERIC-NEXT: #APP
422 ; GENERIC-NEXT: bsrl %edi, %eax
423 ; GENERIC-NEXT: bsrl (%rsi), %ecx
424 ; GENERIC-NEXT: #NO_APP
425 ; GENERIC-NEXT: orl %ecx, %eax # sched: [1:0.33]
426 ; GENERIC-NEXT: retq # sched: [1:1.00]
427 ;
428 ; ATOM-LABEL: test_bsr32:
429 ; ATOM: # BB#0:
430 ; ATOM-NEXT: #APP
431 ; ATOM-NEXT: bsrl %edi, %eax
432 ; ATOM-NEXT: bsrl (%rsi), %ecx
433 ; ATOM-NEXT: #NO_APP
434 ; ATOM-NEXT: orl %ecx, %eax # sched: [1:0.50]
435 ; ATOM-NEXT: retq # sched: [79:39.50]
436 ;
437 ; SLM-LABEL: test_bsr32:
438 ; SLM: # BB#0:
439 ; SLM-NEXT: #APP
440 ; SLM-NEXT: bsrl %edi, %eax
441 ; SLM-NEXT: bsrl (%rsi), %ecx
442 ; SLM-NEXT: #NO_APP
443 ; SLM-NEXT: orl %ecx, %eax # sched: [1:0.50]
444 ; SLM-NEXT: retq # sched: [4:1.00]
445 ;
446 ; SANDY-LABEL: test_bsr32:
447 ; SANDY: # BB#0:
448 ; SANDY-NEXT: #APP
449 ; SANDY-NEXT: bsrl %edi, %eax
450 ; SANDY-NEXT: bsrl (%rsi), %ecx
451 ; SANDY-NEXT: #NO_APP
452 ; SANDY-NEXT: orl %ecx, %eax # sched: [1:0.33]
453 ; SANDY-NEXT: retq # sched: [1:1.00]
454 ;
455 ; HASWELL-LABEL: test_bsr32:
456 ; HASWELL: # BB#0:
457 ; HASWELL-NEXT: #APP
458 ; HASWELL-NEXT: bsrl %edi, %eax
459 ; HASWELL-NEXT: bsrl (%rsi), %ecx
460 ; HASWELL-NEXT: #NO_APP
461 ; HASWELL-NEXT: orl %ecx, %eax # sched: [1:0.25]
462 ; HASWELL-NEXT: retq # sched: [2:1.00]
463 ;
464 ; BROADWELL-LABEL: test_bsr32:
465 ; BROADWELL: # BB#0:
466 ; BROADWELL-NEXT: #APP
467 ; BROADWELL-NEXT: bsrl %edi, %eax
468 ; BROADWELL-NEXT: bsrl (%rsi), %ecx
469 ; BROADWELL-NEXT: #NO_APP
470 ; BROADWELL-NEXT: orl %ecx, %eax # sched: [1:0.25]
471 ; BROADWELL-NEXT: retq # sched: [7:1.00]
472 ;
473 ; SKYLAKE-LABEL: test_bsr32:
474 ; SKYLAKE: # BB#0:
475 ; SKYLAKE-NEXT: #APP
476 ; SKYLAKE-NEXT: bsrl %edi, %eax
477 ; SKYLAKE-NEXT: bsrl (%rsi), %ecx
478 ; SKYLAKE-NEXT: #NO_APP
479 ; SKYLAKE-NEXT: orl %ecx, %eax # sched: [1:0.25]
480 ; SKYLAKE-NEXT: retq # sched: [7:1.00]
481 ;
482 ; SKX-LABEL: test_bsr32:
483 ; SKX: # BB#0:
484 ; SKX-NEXT: #APP
485 ; SKX-NEXT: bsrl %edi, %eax
486 ; SKX-NEXT: bsrl (%rsi), %ecx
487 ; SKX-NEXT: #NO_APP
488 ; SKX-NEXT: orl %ecx, %eax # sched: [1:0.25]
489 ; SKX-NEXT: retq # sched: [7:1.00]
490 ;
491 ; BTVER2-LABEL: test_bsr32:
492 ; BTVER2: # BB#0:
493 ; BTVER2-NEXT: #APP
494 ; BTVER2-NEXT: bsrl %edi, %eax
495 ; BTVER2-NEXT: bsrl (%rsi), %ecx
496 ; BTVER2-NEXT: #NO_APP
497 ; BTVER2-NEXT: orl %ecx, %eax # sched: [1:0.50]
498 ; BTVER2-NEXT: retq # sched: [4:1.00]
499 ;
500 ; ZNVER1-LABEL: test_bsr32:
501 ; ZNVER1: # BB#0:
502 ; ZNVER1-NEXT: #APP
503 ; ZNVER1-NEXT: bsrl %edi, %eax
504 ; ZNVER1-NEXT: bsrl (%rsi), %ecx
505 ; ZNVER1-NEXT: #NO_APP
506 ; ZNVER1-NEXT: orl %ecx, %eax # sched: [1:0.25]
507 ; ZNVER1-NEXT: retq # sched: [1:0.50]
508 %1 = call { i32, i32 } asm sideeffect "bsr $2, $0 \0A\09 bsr $3, $1", "=r,=r,r,*m,~{dirflag},~{fpsr},~{flags}"(i32 %a0, i32* %a1)
509 %2 = extractvalue { i32, i32 } %1, 0
510 %3 = extractvalue { i32, i32 } %1, 1
511 %4 = or i32 %2, %3
512 ret i32 %4
513 }
514 define i64 @test_bsr64(i64 %a0, i64* %a1) optsize {
515 ; GENERIC-LABEL: test_bsr64:
516 ; GENERIC: # BB#0:
517 ; GENERIC-NEXT: #APP
518 ; GENERIC-NEXT: bsrq %rdi, %rax
519 ; GENERIC-NEXT: bsrq (%rsi), %rcx
520 ; GENERIC-NEXT: #NO_APP
521 ; GENERIC-NEXT: orq %rcx, %rax # sched: [1:0.33]
522 ; GENERIC-NEXT: retq # sched: [1:1.00]
523 ;
524 ; ATOM-LABEL: test_bsr64:
525 ; ATOM: # BB#0:
526 ; ATOM-NEXT: #APP
527 ; ATOM-NEXT: bsrq %rdi, %rax
528 ; ATOM-NEXT: bsrq (%rsi), %rcx
529 ; ATOM-NEXT: #NO_APP
530 ; ATOM-NEXT: orq %rcx, %rax # sched: [1:0.50]
531 ; ATOM-NEXT: retq # sched: [79:39.50]
532 ;
533 ; SLM-LABEL: test_bsr64:
534 ; SLM: # BB#0:
535 ; SLM-NEXT: #APP
536 ; SLM-NEXT: bsrq %rdi, %rax
537 ; SLM-NEXT: bsrq (%rsi), %rcx
538 ; SLM-NEXT: #NO_APP
539 ; SLM-NEXT: orq %rcx, %rax # sched: [1:0.50]
540 ; SLM-NEXT: retq # sched: [4:1.00]
541 ;
542 ; SANDY-LABEL: test_bsr64:
543 ; SANDY: # BB#0:
544 ; SANDY-NEXT: #APP
545 ; SANDY-NEXT: bsrq %rdi, %rax
546 ; SANDY-NEXT: bsrq (%rsi), %rcx
547 ; SANDY-NEXT: #NO_APP
548 ; SANDY-NEXT: orq %rcx, %rax # sched: [1:0.33]
549 ; SANDY-NEXT: retq # sched: [1:1.00]
550 ;
551 ; HASWELL-LABEL: test_bsr64:
552 ; HASWELL: # BB#0:
553 ; HASWELL-NEXT: #APP
554 ; HASWELL-NEXT: bsrq %rdi, %rax
555 ; HASWELL-NEXT: bsrq (%rsi), %rcx
556 ; HASWELL-NEXT: #NO_APP
557 ; HASWELL-NEXT: orq %rcx, %rax # sched: [1:0.25]
558 ; HASWELL-NEXT: retq # sched: [2:1.00]
559 ;
560 ; BROADWELL-LABEL: test_bsr64:
561 ; BROADWELL: # BB#0:
562 ; BROADWELL-NEXT: #APP
563 ; BROADWELL-NEXT: bsrq %rdi, %rax
564 ; BROADWELL-NEXT: bsrq (%rsi), %rcx
565 ; BROADWELL-NEXT: #NO_APP
566 ; BROADWELL-NEXT: orq %rcx, %rax # sched: [1:0.25]
567 ; BROADWELL-NEXT: retq # sched: [7:1.00]
568 ;
569 ; SKYLAKE-LABEL: test_bsr64:
570 ; SKYLAKE: # BB#0:
571 ; SKYLAKE-NEXT: #APP
572 ; SKYLAKE-NEXT: bsrq %rdi, %rax
573 ; SKYLAKE-NEXT: bsrq (%rsi), %rcx
574 ; SKYLAKE-NEXT: #NO_APP
575 ; SKYLAKE-NEXT: orq %rcx, %rax # sched: [1:0.25]
576 ; SKYLAKE-NEXT: retq # sched: [7:1.00]
577 ;
578 ; SKX-LABEL: test_bsr64:
579 ; SKX: # BB#0:
580 ; SKX-NEXT: #APP
581 ; SKX-NEXT: bsrq %rdi, %rax
582 ; SKX-NEXT: bsrq (%rsi), %rcx
583 ; SKX-NEXT: #NO_APP
584 ; SKX-NEXT: orq %rcx, %rax # sched: [1:0.25]
585 ; SKX-NEXT: retq # sched: [7:1.00]
586 ;
587 ; BTVER2-LABEL: test_bsr64:
588 ; BTVER2: # BB#0:
589 ; BTVER2-NEXT: #APP
590 ; BTVER2-NEXT: bsrq %rdi, %rax
591 ; BTVER2-NEXT: bsrq (%rsi), %rcx
592 ; BTVER2-NEXT: #NO_APP
593 ; BTVER2-NEXT: orq %rcx, %rax # sched: [1:0.50]
594 ; BTVER2-NEXT: retq # sched: [4:1.00]
595 ;
596 ; ZNVER1-LABEL: test_bsr64:
597 ; ZNVER1: # BB#0:
598 ; ZNVER1-NEXT: #APP
599 ; ZNVER1-NEXT: bsrq %rdi, %rax
600 ; ZNVER1-NEXT: bsrq (%rsi), %rcx
601 ; ZNVER1-NEXT: #NO_APP
602 ; ZNVER1-NEXT: orq %rcx, %rax # sched: [1:0.25]
603 ; ZNVER1-NEXT: retq # sched: [1:0.50]
604 %1 = call { i64, i64 } asm sideeffect "bsr $2, $0 \0A\09 bsr $3, $1", "=r,=r,r,*m,~{dirflag},~{fpsr},~{flags}"(i64 %a0, i64* %a1)
605 %2 = extractvalue { i64, i64 } %1, 0
606 %3 = extractvalue { i64, i64 } %1, 1
607 %4 = or i64 %2, %3
608 ret i64 %4
609 }
610
611 define i32 @test_bswap32(i32 %a0) optsize {
612 ; GENERIC-LABEL: test_bswap32:
613 ; GENERIC: # BB#0:
614 ; GENERIC-NEXT: bswapl %edi # sched: [2:1.00]
615 ; GENERIC-NEXT: movl %edi, %eax # sched: [1:0.33]
616 ; GENERIC-NEXT: retq # sched: [1:1.00]
617 ;
618 ; ATOM-LABEL: test_bswap32:
619 ; ATOM: # BB#0:
620 ; ATOM-NEXT: bswapl %edi # sched: [1:1.00]
621 ; ATOM-NEXT: movl %edi, %eax # sched: [1:0.50]
622 ; ATOM-NEXT: retq # sched: [79:39.50]
623 ;
624 ; SLM-LABEL: test_bswap32:
625 ; SLM: # BB#0:
626 ; SLM-NEXT: bswapl %edi # sched: [1:0.50]
627 ; SLM-NEXT: movl %edi, %eax # sched: [1:0.50]
628 ; SLM-NEXT: retq # sched: [4:1.00]
629 ;
630 ; SANDY-LABEL: test_bswap32:
631 ; SANDY: # BB#0:
632 ; SANDY-NEXT: bswapl %edi # sched: [2:1.00]
633 ; SANDY-NEXT: movl %edi, %eax # sched: [1:0.33]
634 ; SANDY-NEXT: retq # sched: [1:1.00]
635 ;
636 ; HASWELL-LABEL: test_bswap32:
637 ; HASWELL: # BB#0:
638 ; HASWELL-NEXT: bswapl %edi # sched: [2:0.50]
639 ; HASWELL-NEXT: movl %edi, %eax # sched: [1:0.25]
640 ; HASWELL-NEXT: retq # sched: [2:1.00]
641 ;
642 ; BROADWELL-LABEL: test_bswap32:
643 ; BROADWELL: # BB#0:
644 ; BROADWELL-NEXT: bswapl %edi # sched: [2:0.50]
645 ; BROADWELL-NEXT: movl %edi, %eax # sched: [1:0.25]
646 ; BROADWELL-NEXT: retq # sched: [7:1.00]
647 ;
648 ; SKYLAKE-LABEL: test_bswap32:
649 ; SKYLAKE: # BB#0:
650 ; SKYLAKE-NEXT: bswapl %edi # sched: [2:0.50]
651 ; SKYLAKE-NEXT: movl %edi, %eax # sched: [1:0.25]
652 ; SKYLAKE-NEXT: retq # sched: [7:1.00]
653 ;
654 ; SKX-LABEL: test_bswap32:
655 ; SKX: # BB#0:
656 ; SKX-NEXT: bswapl %edi # sched: [2:0.50]
657 ; SKX-NEXT: movl %edi, %eax # sched: [1:0.25]
658 ; SKX-NEXT: retq # sched: [7:1.00]
659 ;
660 ; BTVER2-LABEL: test_bswap32:
661 ; BTVER2: # BB#0:
662 ; BTVER2-NEXT: bswapl %edi # sched: [1:0.50]
663 ; BTVER2-NEXT: movl %edi, %eax # sched: [1:0.17]
664 ; BTVER2-NEXT: retq # sched: [4:1.00]
665 ;
666 ; ZNVER1-LABEL: test_bswap32:
667 ; ZNVER1: # BB#0:
668 ; ZNVER1-NEXT: bswapl %edi # sched: [1:1.00]
669 ; ZNVER1-NEXT: movl %edi, %eax # sched: [1:0.25]
670 ; ZNVER1-NEXT: retq # sched: [1:0.50]
671 %1 = tail call i32 asm "bswap $0", "=r,0"(i32 %a0) nounwind
672 ret i32 %1
673 }
674 define i64 @test_bswap64(i64 %a0) optsize {
675 ; GENERIC-LABEL: test_bswap64:
676 ; GENERIC: # BB#0:
677 ; GENERIC-NEXT: bswapq %rdi # sched: [2:1.00]
678 ; GENERIC-NEXT: movq %rdi, %rax # sched: [1:0.33]
679 ; GENERIC-NEXT: retq # sched: [1:1.00]
680 ;
681 ; ATOM-LABEL: test_bswap64:
682 ; ATOM: # BB#0:
683 ; ATOM-NEXT: bswapq %rdi # sched: [1:1.00]
684 ; ATOM-NEXT: movq %rdi, %rax # sched: [1:0.50]
685 ; ATOM-NEXT: retq # sched: [79:39.50]
686 ;
687 ; SLM-LABEL: test_bswap64:
688 ; SLM: # BB#0:
689 ; SLM-NEXT: bswapq %rdi # sched: [1:0.50]
690 ; SLM-NEXT: movq %rdi, %rax # sched: [1:0.50]
691 ; SLM-NEXT: retq # sched: [4:1.00]
692 ;
693 ; SANDY-LABEL: test_bswap64:
694 ; SANDY: # BB#0:
695 ; SANDY-NEXT: bswapq %rdi # sched: [2:1.00]
696 ; SANDY-NEXT: movq %rdi, %rax # sched: [1:0.33]
697 ; SANDY-NEXT: retq # sched: [1:1.00]
698 ;
699 ; HASWELL-LABEL: test_bswap64:
700 ; HASWELL: # BB#0:
701 ; HASWELL-NEXT: bswapq %rdi # sched: [2:0.50]
702 ; HASWELL-NEXT: movq %rdi, %rax # sched: [1:0.25]
703 ; HASWELL-NEXT: retq # sched: [2:1.00]
704 ;
705 ; BROADWELL-LABEL: test_bswap64:
706 ; BROADWELL: # BB#0:
707 ; BROADWELL-NEXT: bswapq %rdi # sched: [2:0.50]
708 ; BROADWELL-NEXT: movq %rdi, %rax # sched: [1:0.25]
709 ; BROADWELL-NEXT: retq # sched: [7:1.00]
710 ;
711 ; SKYLAKE-LABEL: test_bswap64:
712 ; SKYLAKE: # BB#0:
713 ; SKYLAKE-NEXT: bswapq %rdi # sched: [2:0.50]
714 ; SKYLAKE-NEXT: movq %rdi, %rax # sched: [1:0.25]
715 ; SKYLAKE-NEXT: retq # sched: [7:1.00]
716 ;
717 ; SKX-LABEL: test_bswap64:
718 ; SKX: # BB#0:
719 ; SKX-NEXT: bswapq %rdi # sched: [2:0.50]
720 ; SKX-NEXT: movq %rdi, %rax # sched: [1:0.25]
721 ; SKX-NEXT: retq # sched: [7:1.00]
722 ;
723 ; BTVER2-LABEL: test_bswap64:
724 ; BTVER2: # BB#0:
725 ; BTVER2-NEXT: bswapq %rdi # sched: [1:0.50]
726 ; BTVER2-NEXT: movq %rdi, %rax # sched: [1:0.17]
727 ; BTVER2-NEXT: retq # sched: [4:1.00]
728 ;
729 ; ZNVER1-LABEL: test_bswap64:
730 ; ZNVER1: # BB#0:
731 ; ZNVER1-NEXT: bswapq %rdi # sched: [1:1.00]
732 ; ZNVER1-NEXT: movq %rdi, %rax # sched: [1:0.25]
733 ; ZNVER1-NEXT: retq # sched: [1:0.50]
734 %1 = tail call i64 asm "bswap $0", "=r,0"(i64 %a0) nounwind
735 ret i64 %1
736 }