1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
2 ; RUN: llc -O0 -fast-isel -verify-machineinstrs -mtriple=arm64-eabi < %s | FileCheck --enable-var-scope %s
5 define i32 @fptosi_wh(half %a) nounwind ssp {
6 ; CHECK-LABEL: fptosi_wh:
7 ; CHECK: // %bb.0: // %entry
8 ; CHECK-NEXT: fcvt s0, h0
9 ; CHECK-NEXT: fcvtzs w0, s0
12 %conv = fptosi half %a to i32
17 define i32 @fptoui_swh(half %a) nounwind ssp {
18 ; CHECK-LABEL: fptoui_swh:
19 ; CHECK: // %bb.0: // %entry
20 ; CHECK-NEXT: fcvt s0, h0
21 ; CHECK-NEXT: fcvtzu w0, s0
24 %conv = fptoui half %a to i32
29 define half @sitofp_hw_i1(i1 %a) nounwind ssp {
30 ; CHECK-LABEL: sitofp_hw_i1:
31 ; CHECK: // %bb.0: // %entry
32 ; CHECK-NEXT: sbfx w8, w0, #0, #1
33 ; CHECK-NEXT: scvtf s0, w8
34 ; CHECK-NEXT: fcvt h0, s0
37 %conv = sitofp i1 %a to half
42 define half @sitofp_hw_i8(i8 %a) nounwind ssp {
43 ; CHECK-LABEL: sitofp_hw_i8:
44 ; CHECK: // %bb.0: // %entry
45 ; CHECK-NEXT: sxtb w8, w0
46 ; CHECK-NEXT: scvtf s0, w8
47 ; CHECK-NEXT: fcvt h0, s0
50 %conv = sitofp i8 %a to half
55 define half @sitofp_hw_i16(i16 %a) nounwind ssp {
56 ; CHECK-LABEL: sitofp_hw_i16:
57 ; CHECK: // %bb.0: // %entry
58 ; CHECK-NEXT: sxth w8, w0
59 ; CHECK-NEXT: scvtf s0, w8
60 ; CHECK-NEXT: fcvt h0, s0
63 %conv = sitofp i16 %a to half
68 define half @sitofp_hw_i32(i32 %a) nounwind ssp {
69 ; CHECK-LABEL: sitofp_hw_i32:
70 ; CHECK: // %bb.0: // %entry
71 ; CHECK-NEXT: scvtf s0, w0
72 ; CHECK-NEXT: fcvt h0, s0
75 %conv = sitofp i32 %a to half
80 define half @sitofp_hx(i64 %a) nounwind ssp {
81 ; CHECK-LABEL: sitofp_hx:
82 ; CHECK: // %bb.0: // %entry
83 ; CHECK-NEXT: scvtf s0, x0
84 ; CHECK-NEXT: fcvt h0, s0
87 %conv = sitofp i64 %a to half
92 define half @uitofp_hw_i1(i1 %a) nounwind ssp {
93 ; CHECK-LABEL: uitofp_hw_i1:
94 ; CHECK: // %bb.0: // %entry
95 ; CHECK-NEXT: and w8, w0, #0x1
96 ; CHECK-NEXT: ucvtf s0, w8
97 ; CHECK-NEXT: fcvt h0, s0
100 %conv = uitofp i1 %a to half
105 define half @uitofp_hw_i8(i8 %a) nounwind ssp {
106 ; CHECK-LABEL: uitofp_hw_i8:
107 ; CHECK: // %bb.0: // %entry
108 ; CHECK-NEXT: and w8, w0, #0xff
109 ; CHECK-NEXT: ucvtf s0, w8
110 ; CHECK-NEXT: fcvt h0, s0
113 %conv = uitofp i8 %a to half
118 define half @uitofp_hw_i16(i16 %a) nounwind ssp {
119 ; CHECK-LABEL: uitofp_hw_i16:
120 ; CHECK: // %bb.0: // %entry
121 ; CHECK-NEXT: and w8, w0, #0xffff
122 ; CHECK-NEXT: ucvtf s0, w8
123 ; CHECK-NEXT: fcvt h0, s0
126 %conv = uitofp i16 %a to half
131 define half @uitofp_hw_i32(i32 %a) nounwind ssp {
132 ; CHECK-LABEL: uitofp_hw_i32:
133 ; CHECK: // %bb.0: // %entry
134 ; CHECK-NEXT: ucvtf s0, w0
135 ; CHECK-NEXT: fcvt h0, s0
138 %conv = uitofp i32 %a to half
143 define half @uitofp_hx(i64 %a) nounwind ssp {
144 ; CHECK-LABEL: uitofp_hx:
145 ; CHECK: // %bb.0: // %entry
146 ; CHECK-NEXT: ucvtf s0, x0
147 ; CHECK-NEXT: fcvt h0, s0
150 %conv = uitofp i64 %a to half
155 define i32 @fptosi_bf(bfloat %a) nounwind ssp {
156 ; CHECK-LABEL: fptosi_bf:
157 ; CHECK: // %bb.0: // %entry
158 ; CHECK-NEXT: fmov s1, s0
159 ; CHECK-NEXT: // implicit-def: $s0
160 ; CHECK-NEXT: fmov s0, s1
161 ; CHECK-NEXT: fmov w8, s0
162 ; CHECK-NEXT: lsl w8, w8, #16
163 ; CHECK-NEXT: fmov s0, w8
164 ; CHECK-NEXT: fcvtzs w0, s0
167 %conv = fptosi bfloat %a to i32
172 define i32 @fptoui_sbf(bfloat %a) nounwind ssp {
173 ; CHECK-LABEL: fptoui_sbf:
174 ; CHECK: // %bb.0: // %entry
175 ; CHECK-NEXT: fmov s1, s0
176 ; CHECK-NEXT: // implicit-def: $s0
177 ; CHECK-NEXT: fmov s0, s1
178 ; CHECK-NEXT: fmov w8, s0
179 ; CHECK-NEXT: lsl w8, w8, #16
180 ; CHECK-NEXT: fmov s0, w8
181 ; CHECK-NEXT: fcvtzu w0, s0
184 %conv = fptoui bfloat %a to i32
189 define bfloat @sitofp_bf_i1(i1 %a) nounwind ssp {
190 ; CHECK-LABEL: sitofp_bf_i1:
191 ; CHECK: // %bb.0: // %entry
192 ; CHECK-NEXT: sbfx w8, w0, #0, #1
193 ; CHECK-NEXT: scvtf s0, w8
194 ; CHECK-NEXT: fmov w9, s0
195 ; CHECK-NEXT: ubfx w8, w9, #16, #1
196 ; CHECK-NEXT: add w8, w8, w9
197 ; CHECK-NEXT: mov w9, #32767 // =0x7fff
198 ; CHECK-NEXT: add w8, w8, w9
199 ; CHECK-NEXT: lsr w8, w8, #16
200 ; CHECK-NEXT: fmov s0, w8
201 ; CHECK-NEXT: // kill: def $h0 killed $h0 killed $s0
204 %conv = sitofp i1 %a to bfloat
209 define bfloat @sitofp_bf_i8(i8 %a) nounwind ssp {
210 ; CHECK-LABEL: sitofp_bf_i8:
211 ; CHECK: // %bb.0: // %entry
212 ; CHECK-NEXT: sxtb w8, w0
213 ; CHECK-NEXT: scvtf s0, w8
214 ; CHECK-NEXT: fmov w9, s0
215 ; CHECK-NEXT: ubfx w8, w9, #16, #1
216 ; CHECK-NEXT: add w8, w8, w9
217 ; CHECK-NEXT: mov w9, #32767 // =0x7fff
218 ; CHECK-NEXT: add w8, w8, w9
219 ; CHECK-NEXT: lsr w8, w8, #16
220 ; CHECK-NEXT: fmov s0, w8
221 ; CHECK-NEXT: // kill: def $h0 killed $h0 killed $s0
224 %conv = sitofp i8 %a to bfloat
229 define bfloat @sitofp_bf_i16(i16 %a) nounwind ssp {
230 ; CHECK-LABEL: sitofp_bf_i16:
231 ; CHECK: // %bb.0: // %entry
232 ; CHECK-NEXT: sxth w8, w0
233 ; CHECK-NEXT: scvtf s0, w8
234 ; CHECK-NEXT: fmov w9, s0
235 ; CHECK-NEXT: ubfx w8, w9, #16, #1
236 ; CHECK-NEXT: add w8, w8, w9
237 ; CHECK-NEXT: mov w9, #32767 // =0x7fff
238 ; CHECK-NEXT: add w8, w8, w9
239 ; CHECK-NEXT: lsr w8, w8, #16
240 ; CHECK-NEXT: fmov s0, w8
241 ; CHECK-NEXT: // kill: def $h0 killed $h0 killed $s0
244 %conv = sitofp i16 %a to bfloat
249 define bfloat @sitofp_bf_i32(i32 %a) nounwind ssp {
250 ; CHECK-LABEL: sitofp_bf_i32:
251 ; CHECK: // %bb.0: // %entry
252 ; CHECK-NEXT: scvtf d0, w0
253 ; CHECK-NEXT: fcvtxn s0, d0
254 ; CHECK-NEXT: fmov w9, s0
255 ; CHECK-NEXT: ubfx w8, w9, #16, #1
256 ; CHECK-NEXT: add w8, w8, w9
257 ; CHECK-NEXT: mov w9, #32767 // =0x7fff
258 ; CHECK-NEXT: add w8, w8, w9
259 ; CHECK-NEXT: lsr w8, w8, #16
260 ; CHECK-NEXT: fmov s0, w8
261 ; CHECK-NEXT: // kill: def $h0 killed $h0 killed $s0
264 %conv = sitofp i32 %a to bfloat
269 define bfloat @sitofp_bf_i164(i64 %a) nounwind ssp {
270 ; CHECK-LABEL: sitofp_bf_i164:
271 ; CHECK: // %bb.0: // %entry
272 ; CHECK-NEXT: subs x8, x0, #0
273 ; CHECK-NEXT: cneg x10, x0, mi
274 ; CHECK-NEXT: and x8, x10, #0xfffffffffffff000
275 ; CHECK-NEXT: lsr x9, x10, #53
276 ; CHECK-NEXT: subs x9, x9, #0
277 ; CHECK-NEXT: csel x8, x8, x10, ne
278 ; CHECK-NEXT: scvtf d0, x8
279 ; CHECK-NEXT: fmov x8, d0
280 ; CHECK-NEXT: and x9, x0, #0x8000000000000000
281 ; CHECK-NEXT: orr x8, x8, x9
282 ; CHECK-NEXT: cset w9, ne
283 ; CHECK-NEXT: ands x10, x10, #0xfff
284 ; CHECK-NEXT: csel w9, wzr, w9, eq
285 ; CHECK-NEXT: mov w9, w9
286 ; CHECK-NEXT: // kill: def $x9 killed $w9
287 ; CHECK-NEXT: orr x8, x8, x9
288 ; CHECK-NEXT: fmov d0, x8
289 ; CHECK-NEXT: fcvtxn s0, d0
290 ; CHECK-NEXT: fmov w9, s0
291 ; CHECK-NEXT: ubfx w8, w9, #16, #1
292 ; CHECK-NEXT: add w8, w8, w9
293 ; CHECK-NEXT: mov w9, #32767 // =0x7fff
294 ; CHECK-NEXT: add w8, w8, w9
295 ; CHECK-NEXT: lsr w8, w8, #16
296 ; CHECK-NEXT: fmov s0, w8
297 ; CHECK-NEXT: // kill: def $h0 killed $h0 killed $s0
300 %conv = sitofp i64 %a to bfloat
305 define bfloat @uitofp_bf_i1(i1 %a) nounwind ssp {
306 ; CHECK-LABEL: uitofp_bf_i1:
307 ; CHECK: // %bb.0: // %entry
308 ; CHECK-NEXT: and w8, w0, #0x1
309 ; CHECK-NEXT: ucvtf s0, w8
310 ; CHECK-NEXT: fmov w9, s0
311 ; CHECK-NEXT: ubfx w8, w9, #16, #1
312 ; CHECK-NEXT: add w8, w8, w9
313 ; CHECK-NEXT: mov w9, #32767 // =0x7fff
314 ; CHECK-NEXT: add w8, w8, w9
315 ; CHECK-NEXT: lsr w8, w8, #16
316 ; CHECK-NEXT: fmov s0, w8
317 ; CHECK-NEXT: // kill: def $h0 killed $h0 killed $s0
320 %conv = uitofp i1 %a to bfloat
325 define bfloat @uitofp_bf_i8(i8 %a) nounwind ssp {
326 ; CHECK-LABEL: uitofp_bf_i8:
327 ; CHECK: // %bb.0: // %entry
328 ; CHECK-NEXT: and w8, w0, #0xff
329 ; CHECK-NEXT: ucvtf s0, w8
330 ; CHECK-NEXT: fmov w9, s0
331 ; CHECK-NEXT: ubfx w8, w9, #16, #1
332 ; CHECK-NEXT: add w8, w8, w9
333 ; CHECK-NEXT: mov w9, #32767 // =0x7fff
334 ; CHECK-NEXT: add w8, w8, w9
335 ; CHECK-NEXT: lsr w8, w8, #16
336 ; CHECK-NEXT: fmov s0, w8
337 ; CHECK-NEXT: // kill: def $h0 killed $h0 killed $s0
340 %conv = uitofp i8 %a to bfloat
345 define bfloat @uitofp_bf_i16(i16 %a) nounwind ssp {
346 ; CHECK-LABEL: uitofp_bf_i16:
347 ; CHECK: // %bb.0: // %entry
348 ; CHECK-NEXT: and w8, w0, #0xffff
349 ; CHECK-NEXT: ucvtf s0, w8
350 ; CHECK-NEXT: fmov w9, s0
351 ; CHECK-NEXT: ubfx w8, w9, #16, #1
352 ; CHECK-NEXT: add w8, w8, w9
353 ; CHECK-NEXT: mov w9, #32767 // =0x7fff
354 ; CHECK-NEXT: add w8, w8, w9
355 ; CHECK-NEXT: lsr w8, w8, #16
356 ; CHECK-NEXT: fmov s0, w8
357 ; CHECK-NEXT: // kill: def $h0 killed $h0 killed $s0
360 %conv = uitofp i16 %a to bfloat
365 define bfloat @uitofp_bf_i32(i32 %a) nounwind ssp {
366 ; CHECK-LABEL: uitofp_bf_i32:
367 ; CHECK: // %bb.0: // %entry
368 ; CHECK-NEXT: ucvtf d0, w0
369 ; CHECK-NEXT: fcvtxn s0, d0
370 ; CHECK-NEXT: fmov w9, s0
371 ; CHECK-NEXT: ubfx w8, w9, #16, #1
372 ; CHECK-NEXT: add w8, w8, w9
373 ; CHECK-NEXT: mov w9, #32767 // =0x7fff
374 ; CHECK-NEXT: add w8, w8, w9
375 ; CHECK-NEXT: lsr w8, w8, #16
376 ; CHECK-NEXT: fmov s0, w8
377 ; CHECK-NEXT: // kill: def $h0 killed $h0 killed $s0
380 %conv = uitofp i32 %a to bfloat
385 define bfloat @uitofp_bf_i64(i64 %a) nounwind ssp {
386 ; CHECK-LABEL: uitofp_bf_i64:
387 ; CHECK: // %bb.0: // %entry
388 ; CHECK-NEXT: and x8, x0, #0xfffffffffffff000
389 ; CHECK-NEXT: lsr x9, x0, #53
390 ; CHECK-NEXT: subs x9, x9, #0
391 ; CHECK-NEXT: csel x8, x8, x0, ne
392 ; CHECK-NEXT: ucvtf d0, x8
393 ; CHECK-NEXT: fmov x8, d0
394 ; CHECK-NEXT: cset w9, ne
395 ; CHECK-NEXT: ands x10, x0, #0xfff
396 ; CHECK-NEXT: csel w9, wzr, w9, eq
397 ; CHECK-NEXT: mov w9, w9
398 ; CHECK-NEXT: // kill: def $x9 killed $w9
399 ; CHECK-NEXT: orr x8, x8, x9
400 ; CHECK-NEXT: fmov d0, x8
401 ; CHECK-NEXT: fcvtxn s0, d0
402 ; CHECK-NEXT: fmov w9, s0
403 ; CHECK-NEXT: ubfx w8, w9, #16, #1
404 ; CHECK-NEXT: add w8, w8, w9
405 ; CHECK-NEXT: mov w9, #32767 // =0x7fff
406 ; CHECK-NEXT: add w8, w8, w9
407 ; CHECK-NEXT: lsr w8, w8, #16
408 ; CHECK-NEXT: fmov s0, w8
409 ; CHECK-NEXT: // kill: def $h0 killed $h0 killed $s0
412 %conv = uitofp i64 %a to bfloat