1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mattr=+sve -force-streaming-compatible-sve < %s | FileCheck %s
3 ; RUN: llc -mattr=+sme -force-streaming-compatible-sve < %s | FileCheck %s
5 target triple = "aarch64-unknown-linux-gnu"
8 ; FCVT H -> S; Without load instr
11 define void @fcvt_v2f16_to_v2f32(<2 x half> %a, ptr %b) {
12 ; CHECK-LABEL: fcvt_v2f16_to_v2f32:
14 ; CHECK-NEXT: ptrue p0.s, vl4
15 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
16 ; CHECK-NEXT: uunpklo z0.s, z0.h
17 ; CHECK-NEXT: fcvt z0.s, p0/m, z0.h
18 ; CHECK-NEXT: str d0, [x0]
20 %res = fpext <2 x half> %a to <2 x float>
21 store <2 x float> %res, ptr %b
25 define void @fcvt_v4f16_to_v4f32(<4 x half> %a, ptr %b) {
26 ; CHECK-LABEL: fcvt_v4f16_to_v4f32:
28 ; CHECK-NEXT: ptrue p0.s, vl4
29 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
30 ; CHECK-NEXT: uunpklo z0.s, z0.h
31 ; CHECK-NEXT: fcvt z0.s, p0/m, z0.h
32 ; CHECK-NEXT: str q0, [x0]
34 %res = fpext <4 x half> %a to <4 x float>
35 store <4 x float> %res, ptr %b
39 define void @fcvt_v8f16_to_v8f32(<8 x half> %a, ptr %b) {
40 ; CHECK-LABEL: fcvt_v8f16_to_v8f32:
42 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
43 ; CHECK-NEXT: uunpklo z1.s, z0.h
44 ; CHECK-NEXT: ptrue p0.s, vl4
45 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #8
46 ; CHECK-NEXT: uunpklo z0.s, z0.h
47 ; CHECK-NEXT: fcvt z1.s, p0/m, z1.h
48 ; CHECK-NEXT: fcvt z0.s, p0/m, z0.h
49 ; CHECK-NEXT: stp q1, q0, [x0]
51 %res = fpext <8 x half> %a to <8 x float>
52 store <8 x float> %res, ptr %b
56 define void @fcvt_v16f16_to_v16f32(<16 x half> %a, ptr %b) {
57 ; CHECK-LABEL: fcvt_v16f16_to_v16f32:
59 ; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1
60 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
61 ; CHECK-NEXT: uunpklo z2.s, z1.h
62 ; CHECK-NEXT: uunpklo z3.s, z0.h
63 ; CHECK-NEXT: ptrue p0.s, vl4
64 ; CHECK-NEXT: ext z1.b, z1.b, z1.b, #8
65 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #8
66 ; CHECK-NEXT: uunpklo z1.s, z1.h
67 ; CHECK-NEXT: uunpklo z0.s, z0.h
68 ; CHECK-NEXT: fcvt z2.s, p0/m, z2.h
69 ; CHECK-NEXT: fcvt z3.s, p0/m, z3.h
70 ; CHECK-NEXT: fcvt z1.s, p0/m, z1.h
71 ; CHECK-NEXT: fcvt z0.s, p0/m, z0.h
72 ; CHECK-NEXT: stp q3, q0, [x0]
73 ; CHECK-NEXT: stp q2, q1, [x0, #32]
75 %res = fpext <16 x half> %a to <16 x float>
76 store <16 x float> %res, ptr %b
85 define void @fcvt_v2f16_v2f32(ptr %a, ptr %b) {
86 ; CHECK-LABEL: fcvt_v2f16_v2f32:
88 ; CHECK-NEXT: ptrue p0.s, vl2
89 ; CHECK-NEXT: ld1h { z0.s }, p0/z, [x0]
90 ; CHECK-NEXT: fcvt z0.s, p0/m, z0.h
91 ; CHECK-NEXT: str d0, [x1]
93 %op1 = load <2 x half>, ptr %a
94 %res = fpext <2 x half> %op1 to <2 x float>
95 store <2 x float> %res, ptr %b
99 define void @fcvt_v4f16_v4f32(ptr %a, ptr %b) {
100 ; CHECK-LABEL: fcvt_v4f16_v4f32:
102 ; CHECK-NEXT: ptrue p0.s, vl4
103 ; CHECK-NEXT: ld1h { z0.s }, p0/z, [x0]
104 ; CHECK-NEXT: fcvt z0.s, p0/m, z0.h
105 ; CHECK-NEXT: str q0, [x1]
107 %op1 = load <4 x half>, ptr %a
108 %res = fpext <4 x half> %op1 to <4 x float>
109 store <4 x float> %res, ptr %b
113 define void @fcvt_v8f16_v8f32(ptr %a, ptr %b) {
114 ; CHECK-LABEL: fcvt_v8f16_v8f32:
116 ; CHECK-NEXT: ptrue p0.s, vl4
117 ; CHECK-NEXT: mov x8, #4 // =0x4
118 ; CHECK-NEXT: ld1h { z0.s }, p0/z, [x0, x8, lsl #1]
119 ; CHECK-NEXT: ld1h { z1.s }, p0/z, [x0]
120 ; CHECK-NEXT: fcvt z0.s, p0/m, z0.h
121 ; CHECK-NEXT: fcvt z1.s, p0/m, z1.h
122 ; CHECK-NEXT: stp q1, q0, [x1]
124 %op1 = load <8 x half>, ptr %a
125 %res = fpext <8 x half> %op1 to <8 x float>
126 store <8 x float> %res, ptr %b
130 define void @fcvt_v16f16_v16f32(ptr %a, ptr %b) {
131 ; CHECK-LABEL: fcvt_v16f16_v16f32:
133 ; CHECK-NEXT: ptrue p0.s, vl4
134 ; CHECK-NEXT: mov x8, #8 // =0x8
135 ; CHECK-NEXT: ld1h { z0.s }, p0/z, [x0, x8, lsl #1]
136 ; CHECK-NEXT: mov x8, #12 // =0xc
137 ; CHECK-NEXT: ld1h { z1.s }, p0/z, [x0, x8, lsl #1]
138 ; CHECK-NEXT: mov x8, #4 // =0x4
139 ; CHECK-NEXT: ld1h { z2.s }, p0/z, [x0, x8, lsl #1]
140 ; CHECK-NEXT: ld1h { z3.s }, p0/z, [x0]
141 ; CHECK-NEXT: fcvt z0.s, p0/m, z0.h
142 ; CHECK-NEXT: fcvt z1.s, p0/m, z1.h
143 ; CHECK-NEXT: fcvt z3.s, p0/m, z3.h
144 ; CHECK-NEXT: fcvt z2.s, p0/m, z2.h
145 ; CHECK-NEXT: stp q0, q1, [x1, #32]
146 ; CHECK-NEXT: stp q3, q2, [x1]
148 %op1 = load <16 x half>, ptr %a
149 %res = fpext <16 x half> %op1 to <16 x float>
150 store <16 x float> %res, ptr %b
158 define void @fcvt_v1f16_v1f64(ptr %a, ptr %b) {
159 ; CHECK-LABEL: fcvt_v1f16_v1f64:
161 ; CHECK-NEXT: ldr h0, [x0]
162 ; CHECK-NEXT: fcvt d0, h0
163 ; CHECK-NEXT: str d0, [x1]
165 %op1 = load <1 x half>, ptr %a
166 %res = fpext <1 x half> %op1 to <1 x double>
167 store <1 x double> %res, ptr %b
171 define void @fcvt_v2f16_v2f64(ptr %a, ptr %b) {
172 ; CHECK-LABEL: fcvt_v2f16_v2f64:
174 ; CHECK-NEXT: ptrue p0.d, vl2
175 ; CHECK-NEXT: ld1h { z0.d }, p0/z, [x0]
176 ; CHECK-NEXT: fcvt z0.d, p0/m, z0.h
177 ; CHECK-NEXT: str q0, [x1]
179 %op1 = load <2 x half>, ptr %a
180 %res = fpext <2 x half> %op1 to <2 x double>
181 store <2 x double> %res, ptr %b
185 define void @fcvt_v4f16_v4f64(ptr %a, ptr %b) {
186 ; CHECK-LABEL: fcvt_v4f16_v4f64:
188 ; CHECK-NEXT: ptrue p0.d, vl2
189 ; CHECK-NEXT: mov x8, #2 // =0x2
190 ; CHECK-NEXT: ld1h { z0.d }, p0/z, [x0, x8, lsl #1]
191 ; CHECK-NEXT: ld1h { z1.d }, p0/z, [x0]
192 ; CHECK-NEXT: fcvt z0.d, p0/m, z0.h
193 ; CHECK-NEXT: fcvt z1.d, p0/m, z1.h
194 ; CHECK-NEXT: stp q1, q0, [x1]
196 %op1 = load <4 x half>, ptr %a
197 %res = fpext <4 x half> %op1 to <4 x double>
198 store <4 x double> %res, ptr %b
202 define void @fcvt_v8f16_v8f64(ptr %a, ptr %b) {
203 ; CHECK-LABEL: fcvt_v8f16_v8f64:
205 ; CHECK-NEXT: ptrue p0.d, vl2
206 ; CHECK-NEXT: mov x8, #4 // =0x4
207 ; CHECK-NEXT: ld1h { z0.d }, p0/z, [x0, x8, lsl #1]
208 ; CHECK-NEXT: mov x8, #6 // =0x6
209 ; CHECK-NEXT: ld1h { z1.d }, p0/z, [x0, x8, lsl #1]
210 ; CHECK-NEXT: mov x8, #2 // =0x2
211 ; CHECK-NEXT: ld1h { z2.d }, p0/z, [x0, x8, lsl #1]
212 ; CHECK-NEXT: ld1h { z3.d }, p0/z, [x0]
213 ; CHECK-NEXT: fcvt z0.d, p0/m, z0.h
214 ; CHECK-NEXT: fcvt z1.d, p0/m, z1.h
215 ; CHECK-NEXT: fcvt z3.d, p0/m, z3.h
216 ; CHECK-NEXT: fcvt z2.d, p0/m, z2.h
217 ; CHECK-NEXT: stp q0, q1, [x1, #32]
218 ; CHECK-NEXT: stp q3, q2, [x1]
220 %op1 = load <8 x half>, ptr %a
221 %res = fpext <8 x half> %op1 to <8 x double>
222 store <8 x double> %res, ptr %b
226 define void @fcvt_v16f16_v16f64(ptr %a, ptr %b) {
227 ; CHECK-LABEL: fcvt_v16f16_v16f64:
229 ; CHECK-NEXT: ptrue p0.d, vl2
230 ; CHECK-NEXT: mov x8, #12 // =0xc
231 ; CHECK-NEXT: ld1h { z0.d }, p0/z, [x0, x8, lsl #1]
232 ; CHECK-NEXT: mov x8, #14 // =0xe
233 ; CHECK-NEXT: ld1h { z1.d }, p0/z, [x0, x8, lsl #1]
234 ; CHECK-NEXT: mov x8, #8 // =0x8
235 ; CHECK-NEXT: ld1h { z2.d }, p0/z, [x0, x8, lsl #1]
236 ; CHECK-NEXT: mov x8, #10 // =0xa
237 ; CHECK-NEXT: ld1h { z3.d }, p0/z, [x0, x8, lsl #1]
238 ; CHECK-NEXT: mov x8, #4 // =0x4
239 ; CHECK-NEXT: fcvt z0.d, p0/m, z0.h
240 ; CHECK-NEXT: ld1h { z4.d }, p0/z, [x0, x8, lsl #1]
241 ; CHECK-NEXT: mov x8, #6 // =0x6
242 ; CHECK-NEXT: fcvt z1.d, p0/m, z1.h
243 ; CHECK-NEXT: ld1h { z5.d }, p0/z, [x0, x8, lsl #1]
244 ; CHECK-NEXT: mov x8, #2 // =0x2
245 ; CHECK-NEXT: fcvt z2.d, p0/m, z2.h
246 ; CHECK-NEXT: ld1h { z6.d }, p0/z, [x0, x8, lsl #1]
247 ; CHECK-NEXT: ld1h { z7.d }, p0/z, [x0]
248 ; CHECK-NEXT: fcvt z3.d, p0/m, z3.h
249 ; CHECK-NEXT: fcvt z4.d, p0/m, z4.h
250 ; CHECK-NEXT: stp q0, q1, [x1, #96]
251 ; CHECK-NEXT: movprfx z0, z5
252 ; CHECK-NEXT: fcvt z0.d, p0/m, z5.h
253 ; CHECK-NEXT: movprfx z1, z7
254 ; CHECK-NEXT: fcvt z1.d, p0/m, z7.h
255 ; CHECK-NEXT: stp q2, q3, [x1, #64]
256 ; CHECK-NEXT: movprfx z2, z6
257 ; CHECK-NEXT: fcvt z2.d, p0/m, z6.h
258 ; CHECK-NEXT: stp q1, q2, [x1]
259 ; CHECK-NEXT: stp q4, q0, [x1, #32]
261 %op1 = load <16 x half>, ptr %a
262 %res = fpext <16 x half> %op1 to <16 x double>
263 store <16 x double> %res, ptr %b
271 define void @fcvt_v1f32_v1f64(ptr %a, ptr %b) {
272 ; CHECK-LABEL: fcvt_v1f32_v1f64:
274 ; CHECK-NEXT: ldr s0, [x0]
275 ; CHECK-NEXT: fcvt d0, s0
276 ; CHECK-NEXT: str d0, [x1]
278 %op1 = load <1 x float>, ptr %a
279 %res = fpext <1 x float> %op1 to <1 x double>
280 store <1 x double> %res, ptr %b
284 define void @fcvt_v2f32_v2f64(ptr %a, ptr %b) {
285 ; CHECK-LABEL: fcvt_v2f32_v2f64:
287 ; CHECK-NEXT: ptrue p0.d, vl2
288 ; CHECK-NEXT: ld1w { z0.d }, p0/z, [x0]
289 ; CHECK-NEXT: fcvt z0.d, p0/m, z0.s
290 ; CHECK-NEXT: str q0, [x1]
292 %op1 = load <2 x float>, ptr %a
293 %res = fpext <2 x float> %op1 to <2 x double>
294 store <2 x double> %res, ptr %b
298 define void @fcvt_v4f32_v4f64(ptr %a, ptr %b) {
299 ; CHECK-LABEL: fcvt_v4f32_v4f64:
301 ; CHECK-NEXT: ptrue p0.d, vl2
302 ; CHECK-NEXT: mov x8, #2 // =0x2
303 ; CHECK-NEXT: ld1w { z0.d }, p0/z, [x0, x8, lsl #2]
304 ; CHECK-NEXT: ld1w { z1.d }, p0/z, [x0]
305 ; CHECK-NEXT: fcvt z0.d, p0/m, z0.s
306 ; CHECK-NEXT: fcvt z1.d, p0/m, z1.s
307 ; CHECK-NEXT: stp q1, q0, [x1]
309 %op1 = load <4 x float>, ptr %a
310 %res = fpext <4 x float> %op1 to <4 x double>
311 store <4 x double> %res, ptr %b
315 define void @fcvt_v8f32_v8f64(ptr %a, ptr %b) {
316 ; CHECK-LABEL: fcvt_v8f32_v8f64:
318 ; CHECK-NEXT: ptrue p0.d, vl2
319 ; CHECK-NEXT: mov x8, #4 // =0x4
320 ; CHECK-NEXT: ld1w { z0.d }, p0/z, [x0, x8, lsl #2]
321 ; CHECK-NEXT: mov x8, #6 // =0x6
322 ; CHECK-NEXT: ld1w { z1.d }, p0/z, [x0, x8, lsl #2]
323 ; CHECK-NEXT: mov x8, #2 // =0x2
324 ; CHECK-NEXT: ld1w { z2.d }, p0/z, [x0, x8, lsl #2]
325 ; CHECK-NEXT: ld1w { z3.d }, p0/z, [x0]
326 ; CHECK-NEXT: fcvt z0.d, p0/m, z0.s
327 ; CHECK-NEXT: fcvt z1.d, p0/m, z1.s
328 ; CHECK-NEXT: fcvt z3.d, p0/m, z3.s
329 ; CHECK-NEXT: fcvt z2.d, p0/m, z2.s
330 ; CHECK-NEXT: stp q0, q1, [x1, #32]
331 ; CHECK-NEXT: stp q3, q2, [x1]
333 %op1 = load <8 x float>, ptr %a
334 %res = fpext <8 x float> %op1 to <8 x double>
335 store <8 x double> %res, ptr %b
343 define void @fcvt_v2f32_v2f16(ptr %a, ptr %b) {
344 ; CHECK-LABEL: fcvt_v2f32_v2f16:
346 ; CHECK-NEXT: ptrue p0.s, vl2
347 ; CHECK-NEXT: ldr d0, [x0]
348 ; CHECK-NEXT: fcvt z0.h, p0/m, z0.s
349 ; CHECK-NEXT: st1h { z0.s }, p0, [x1]
351 %op1 = load <2 x float>, ptr %a
352 %res = fptrunc <2 x float> %op1 to <2 x half>
353 store <2 x half> %res, ptr %b
357 define void @fcvt_v4f32_v4f16(ptr %a, ptr %b) {
358 ; CHECK-LABEL: fcvt_v4f32_v4f16:
360 ; CHECK-NEXT: ptrue p0.s, vl4
361 ; CHECK-NEXT: ldr q0, [x0]
362 ; CHECK-NEXT: fcvt z0.h, p0/m, z0.s
363 ; CHECK-NEXT: st1h { z0.s }, p0, [x1]
365 %op1 = load <4 x float>, ptr %a
366 %res = fptrunc <4 x float> %op1 to <4 x half>
367 store <4 x half> %res, ptr %b
371 define void @fcvt_v8f32_v8f16(ptr %a, ptr %b) {
372 ; CHECK-LABEL: fcvt_v8f32_v8f16:
374 ; CHECK-NEXT: ptrue p0.s, vl4
375 ; CHECK-NEXT: ldp q1, q0, [x0]
376 ; CHECK-NEXT: mov x8, #4 // =0x4
377 ; CHECK-NEXT: fcvt z0.h, p0/m, z0.s
378 ; CHECK-NEXT: fcvt z1.h, p0/m, z1.s
379 ; CHECK-NEXT: st1h { z0.s }, p0, [x1, x8, lsl #1]
380 ; CHECK-NEXT: st1h { z1.s }, p0, [x1]
382 %op1 = load <8 x float>, ptr %a
383 %res = fptrunc <8 x float> %op1 to <8 x half>
384 store <8 x half> %res, ptr %b
392 define void @fcvt_v1f64_v1f16(ptr %a, ptr %b) {
393 ; CHECK-LABEL: fcvt_v1f64_v1f16:
395 ; CHECK-NEXT: ptrue p0.d, vl1
396 ; CHECK-NEXT: ldr d0, [x0]
397 ; CHECK-NEXT: fcvt z0.h, p0/m, z0.d
398 ; CHECK-NEXT: st1h { z0.d }, p0, [x1]
400 %op1 = load <1 x double>, ptr %a
401 %res = fptrunc <1 x double> %op1 to <1 x half>
402 store <1 x half> %res, ptr %b
406 define void @fcvt_v2f64_v2f16(ptr %a, ptr %b) {
407 ; CHECK-LABEL: fcvt_v2f64_v2f16:
409 ; CHECK-NEXT: ptrue p0.d, vl2
410 ; CHECK-NEXT: ldr q0, [x0]
411 ; CHECK-NEXT: fcvt z0.h, p0/m, z0.d
412 ; CHECK-NEXT: st1h { z0.d }, p0, [x1]
414 %op1 = load <2 x double>, ptr %a
415 %res = fptrunc <2 x double> %op1 to <2 x half>
416 store <2 x half> %res, ptr %b
420 define void @fcvt_v4f64_v4f16(ptr %a, ptr %b) {
421 ; CHECK-LABEL: fcvt_v4f64_v4f16:
423 ; CHECK-NEXT: ptrue p0.d, vl2
424 ; CHECK-NEXT: ldp q1, q0, [x0]
425 ; CHECK-NEXT: mov x8, #2 // =0x2
426 ; CHECK-NEXT: fcvt z0.h, p0/m, z0.d
427 ; CHECK-NEXT: fcvt z1.h, p0/m, z1.d
428 ; CHECK-NEXT: st1h { z0.d }, p0, [x1, x8, lsl #1]
429 ; CHECK-NEXT: st1h { z1.d }, p0, [x1]
431 %op1 = load <4 x double>, ptr %a
432 %res = fptrunc <4 x double> %op1 to <4 x half>
433 store <4 x half> %res, ptr %b
441 define void @fcvt_v1f64_v1f32(<1 x double> %op1, ptr %b) {
442 ; CHECK-LABEL: fcvt_v1f64_v1f32:
444 ; CHECK-NEXT: ptrue p0.d, vl1
445 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
446 ; CHECK-NEXT: fcvt z0.s, p0/m, z0.d
447 ; CHECK-NEXT: st1w { z0.d }, p0, [x0]
449 %res = fptrunc <1 x double> %op1 to <1 x float>
450 store <1 x float> %res, ptr %b
454 define void @fcvt_v2f64_v2f32(<2 x double> %op1, ptr %b) {
455 ; CHECK-LABEL: fcvt_v2f64_v2f32:
457 ; CHECK-NEXT: ptrue p0.d, vl2
458 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
459 ; CHECK-NEXT: fcvt z0.s, p0/m, z0.d
460 ; CHECK-NEXT: st1w { z0.d }, p0, [x0]
462 %res = fptrunc <2 x double> %op1 to <2 x float>
463 store <2 x float> %res, ptr %b
467 define void @fcvt_v4f64_v4f32(ptr %a, ptr %b) {
468 ; CHECK-LABEL: fcvt_v4f64_v4f32:
470 ; CHECK-NEXT: ptrue p0.d, vl2
471 ; CHECK-NEXT: ldp q1, q0, [x0]
472 ; CHECK-NEXT: mov x8, #2 // =0x2
473 ; CHECK-NEXT: fcvt z0.s, p0/m, z0.d
474 ; CHECK-NEXT: fcvt z1.s, p0/m, z1.d
475 ; CHECK-NEXT: st1w { z0.d }, p0, [x1, x8, lsl #2]
476 ; CHECK-NEXT: st1w { z1.d }, p0, [x1]
478 %op1 = load <4 x double>, ptr %a
479 %res = fptrunc <4 x double> %op1 to <4 x float>
480 store <4 x float> %res, ptr %b