1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mattr=+sve -force-streaming-compatible < %s | FileCheck %s
3 ; RUN: llc -mattr=+sme -force-streaming < %s | FileCheck %s
4 ; RUN: llc -force-streaming-compatible < %s | FileCheck %s --check-prefix=NONEON-NOSVE
6 target triple = "aarch64-unknown-linux-gnu"
8 define void @bitcast_v4i8(ptr %a, ptr %b) {
9 ; CHECK-LABEL: bitcast_v4i8:
11 ; CHECK-NEXT: ptrue p0.h, vl4
12 ; CHECK-NEXT: ld1b { z0.h }, p0/z, [x0]
13 ; CHECK-NEXT: st1b { z0.h }, p0, [x1]
16 ; NONEON-NOSVE-LABEL: bitcast_v4i8:
17 ; NONEON-NOSVE: // %bb.0:
18 ; NONEON-NOSVE-NEXT: ldrb w8, [x0]
19 ; NONEON-NOSVE-NEXT: ldrb w9, [x0, #1]
20 ; NONEON-NOSVE-NEXT: ldrb w10, [x0, #2]
21 ; NONEON-NOSVE-NEXT: ldrb w11, [x0, #3]
22 ; NONEON-NOSVE-NEXT: strb w11, [x1, #3]
23 ; NONEON-NOSVE-NEXT: strb w10, [x1, #2]
24 ; NONEON-NOSVE-NEXT: strb w9, [x1, #1]
25 ; NONEON-NOSVE-NEXT: strb w8, [x1]
26 ; NONEON-NOSVE-NEXT: ret
27 %load = load volatile <4 x i8>, ptr %a
28 %cast = bitcast <4 x i8> %load to <4 x i8>
29 store volatile <4 x i8> %cast, ptr %b
33 define void @bitcast_v8i8(ptr %a, ptr %b) {
34 ; CHECK-LABEL: bitcast_v8i8:
36 ; CHECK-NEXT: ldr d0, [x0]
37 ; CHECK-NEXT: str d0, [x1]
40 ; NONEON-NOSVE-LABEL: bitcast_v8i8:
41 ; NONEON-NOSVE: // %bb.0:
42 ; NONEON-NOSVE-NEXT: ldr d0, [x0]
43 ; NONEON-NOSVE-NEXT: str d0, [x1]
44 ; NONEON-NOSVE-NEXT: ret
45 %load = load volatile <8 x i8>, ptr %a
46 %cast = bitcast <8 x i8> %load to <8 x i8>
47 store volatile <8 x i8> %cast, ptr %b
51 define void @bitcast_v16i8(ptr %a, ptr %b) {
52 ; CHECK-LABEL: bitcast_v16i8:
54 ; CHECK-NEXT: ldr q0, [x0]
55 ; CHECK-NEXT: str q0, [x1]
58 ; NONEON-NOSVE-LABEL: bitcast_v16i8:
59 ; NONEON-NOSVE: // %bb.0:
60 ; NONEON-NOSVE-NEXT: ldr q0, [x0]
61 ; NONEON-NOSVE-NEXT: str q0, [x1]
62 ; NONEON-NOSVE-NEXT: ret
63 %load = load volatile <16 x i8>, ptr %a
64 %cast = bitcast <16 x i8> %load to <16 x i8>
65 store volatile <16 x i8> %cast, ptr %b
69 define void @bitcast_v32i8(ptr %a, ptr %b) {
70 ; CHECK-LABEL: bitcast_v32i8:
72 ; CHECK-NEXT: ldr q0, [x0]
73 ; CHECK-NEXT: ldr q1, [x0, #16]
74 ; CHECK-NEXT: str q1, [x1, #16]
75 ; CHECK-NEXT: str q0, [x1]
78 ; NONEON-NOSVE-LABEL: bitcast_v32i8:
79 ; NONEON-NOSVE: // %bb.0:
80 ; NONEON-NOSVE-NEXT: ldr q0, [x0]
81 ; NONEON-NOSVE-NEXT: ldr q1, [x0, #16]
82 ; NONEON-NOSVE-NEXT: str q1, [x1, #16]
83 ; NONEON-NOSVE-NEXT: str q0, [x1]
84 ; NONEON-NOSVE-NEXT: ret
85 %load = load volatile <32 x i8>, ptr %a
86 %cast = bitcast <32 x i8> %load to <32 x i8>
87 store volatile <32 x i8> %cast, ptr %b
91 define void @bitcast_v2i16(ptr %a, ptr %b) {
92 ; CHECK-LABEL: bitcast_v2i16:
94 ; CHECK-NEXT: sub sp, sp, #16
95 ; CHECK-NEXT: .cfi_def_cfa_offset 16
96 ; CHECK-NEXT: ptrue p0.s, vl2
97 ; CHECK-NEXT: ld1h { z0.s }, p0/z, [x0]
98 ; CHECK-NEXT: mov z1.s, z0.s[1]
99 ; CHECK-NEXT: fmov w8, s0
100 ; CHECK-NEXT: strh w8, [sp, #8]
101 ; CHECK-NEXT: fmov w8, s1
102 ; CHECK-NEXT: strh w8, [sp, #10]
103 ; CHECK-NEXT: ldr d0, [sp, #8]
104 ; CHECK-NEXT: fmov w8, s0
105 ; CHECK-NEXT: str w8, [x1]
106 ; CHECK-NEXT: add sp, sp, #16
109 ; NONEON-NOSVE-LABEL: bitcast_v2i16:
110 ; NONEON-NOSVE: // %bb.0:
111 ; NONEON-NOSVE-NEXT: sub sp, sp, #32
112 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 32
113 ; NONEON-NOSVE-NEXT: ldrh w8, [x0, #2]
114 ; NONEON-NOSVE-NEXT: str w8, [sp, #4]
115 ; NONEON-NOSVE-NEXT: ldrh w8, [x0]
116 ; NONEON-NOSVE-NEXT: str w8, [sp]
117 ; NONEON-NOSVE-NEXT: ldr d0, [sp]
118 ; NONEON-NOSVE-NEXT: str d0, [sp, #8]
119 ; NONEON-NOSVE-NEXT: ldp w8, w9, [sp, #8]
120 ; NONEON-NOSVE-NEXT: strh w9, [sp, #18]
121 ; NONEON-NOSVE-NEXT: strh w8, [sp, #16]
122 ; NONEON-NOSVE-NEXT: ldr d0, [sp, #16]
123 ; NONEON-NOSVE-NEXT: str d0, [sp, #24]
124 ; NONEON-NOSVE-NEXT: ldr w8, [sp, #24]
125 ; NONEON-NOSVE-NEXT: str w8, [x1]
126 ; NONEON-NOSVE-NEXT: add sp, sp, #32
127 ; NONEON-NOSVE-NEXT: ret
128 %load = load volatile <2 x i16>, ptr %a
129 %cast = bitcast <2 x i16> %load to <2 x half>
130 store volatile <2 x half> %cast, ptr %b
134 define void @bitcast_v4i16(ptr %a, ptr %b) {
135 ; CHECK-LABEL: bitcast_v4i16:
137 ; CHECK-NEXT: ldr d0, [x0]
138 ; CHECK-NEXT: str d0, [x1]
141 ; NONEON-NOSVE-LABEL: bitcast_v4i16:
142 ; NONEON-NOSVE: // %bb.0:
143 ; NONEON-NOSVE-NEXT: ldr d0, [x0]
144 ; NONEON-NOSVE-NEXT: str d0, [x1]
145 ; NONEON-NOSVE-NEXT: ret
146 %load = load volatile <4 x i16>, ptr %a
147 %cast = bitcast <4 x i16> %load to <4 x half>
148 store volatile <4 x half> %cast, ptr %b
152 define void @bitcast_v8i16(ptr %a, ptr %b) {
153 ; CHECK-LABEL: bitcast_v8i16:
155 ; CHECK-NEXT: ldr q0, [x0]
156 ; CHECK-NEXT: str q0, [x1]
159 ; NONEON-NOSVE-LABEL: bitcast_v8i16:
160 ; NONEON-NOSVE: // %bb.0:
161 ; NONEON-NOSVE-NEXT: ldr q0, [x0]
162 ; NONEON-NOSVE-NEXT: str q0, [x1]
163 ; NONEON-NOSVE-NEXT: ret
164 %load = load volatile <8 x i16>, ptr %a
165 %cast = bitcast <8 x i16> %load to <8 x half>
166 store volatile <8 x half> %cast, ptr %b
170 define void @bitcast_v16i16(ptr %a, ptr %b) {
171 ; CHECK-LABEL: bitcast_v16i16:
173 ; CHECK-NEXT: ldr q0, [x0]
174 ; CHECK-NEXT: ldr q1, [x0, #16]
175 ; CHECK-NEXT: str q1, [x1, #16]
176 ; CHECK-NEXT: str q0, [x1]
179 ; NONEON-NOSVE-LABEL: bitcast_v16i16:
180 ; NONEON-NOSVE: // %bb.0:
181 ; NONEON-NOSVE-NEXT: ldr q0, [x0]
182 ; NONEON-NOSVE-NEXT: ldr q1, [x0, #16]
183 ; NONEON-NOSVE-NEXT: str q1, [x1, #16]
184 ; NONEON-NOSVE-NEXT: str q0, [x1]
185 ; NONEON-NOSVE-NEXT: ret
186 %load = load volatile <16 x i16>, ptr %a
187 %cast = bitcast <16 x i16> %load to <16 x half>
188 store volatile <16 x half> %cast, ptr %b
192 define void @bitcast_v2i32(ptr %a, ptr %b) {
193 ; CHECK-LABEL: bitcast_v2i32:
195 ; CHECK-NEXT: ldr d0, [x0]
196 ; CHECK-NEXT: str d0, [x1]
199 ; NONEON-NOSVE-LABEL: bitcast_v2i32:
200 ; NONEON-NOSVE: // %bb.0:
201 ; NONEON-NOSVE-NEXT: ldr d0, [x0]
202 ; NONEON-NOSVE-NEXT: str d0, [x1]
203 ; NONEON-NOSVE-NEXT: ret
204 %load = load volatile <2 x i32>, ptr %a
205 %cast = bitcast <2 x i32> %load to <2 x float>
206 store volatile <2 x float> %cast, ptr %b
210 define void @bitcast_v4i32(ptr %a, ptr %b) {
211 ; CHECK-LABEL: bitcast_v4i32:
213 ; CHECK-NEXT: ldr q0, [x0]
214 ; CHECK-NEXT: str q0, [x1]
217 ; NONEON-NOSVE-LABEL: bitcast_v4i32:
218 ; NONEON-NOSVE: // %bb.0:
219 ; NONEON-NOSVE-NEXT: ldr q0, [x0]
220 ; NONEON-NOSVE-NEXT: str q0, [x1]
221 ; NONEON-NOSVE-NEXT: ret
222 %load = load volatile <4 x i32>, ptr %a
223 %cast = bitcast <4 x i32> %load to <4 x float>
224 store volatile <4 x float> %cast, ptr %b
228 define void @bitcast_v8i32(ptr %a, ptr %b) {
229 ; CHECK-LABEL: bitcast_v8i32:
231 ; CHECK-NEXT: ldr q0, [x0]
232 ; CHECK-NEXT: ldr q1, [x0, #16]
233 ; CHECK-NEXT: str q1, [x1, #16]
234 ; CHECK-NEXT: str q0, [x1]
237 ; NONEON-NOSVE-LABEL: bitcast_v8i32:
238 ; NONEON-NOSVE: // %bb.0:
239 ; NONEON-NOSVE-NEXT: ldr q0, [x0]
240 ; NONEON-NOSVE-NEXT: ldr q1, [x0, #16]
241 ; NONEON-NOSVE-NEXT: str q1, [x1, #16]
242 ; NONEON-NOSVE-NEXT: str q0, [x1]
243 ; NONEON-NOSVE-NEXT: ret
244 %load = load volatile <8 x i32>, ptr %a
245 %cast = bitcast <8 x i32> %load to <8 x float>
246 store volatile <8 x float> %cast, ptr %b
250 define void @bitcast_v1i64(ptr %a, ptr %b) {
251 ; CHECK-LABEL: bitcast_v1i64:
253 ; CHECK-NEXT: ldr d0, [x0]
254 ; CHECK-NEXT: str d0, [x1]
257 ; NONEON-NOSVE-LABEL: bitcast_v1i64:
258 ; NONEON-NOSVE: // %bb.0:
259 ; NONEON-NOSVE-NEXT: ldr d0, [x0]
260 ; NONEON-NOSVE-NEXT: str d0, [x1]
261 ; NONEON-NOSVE-NEXT: ret
262 %load = load volatile <1 x i64>, ptr %a
263 %cast = bitcast <1 x i64> %load to <1 x double>
264 store volatile <1 x double> %cast, ptr %b
268 define void @bitcast_v2i64(ptr %a, ptr %b) {
269 ; CHECK-LABEL: bitcast_v2i64:
271 ; CHECK-NEXT: ldr q0, [x0]
272 ; CHECK-NEXT: str q0, [x1]
275 ; NONEON-NOSVE-LABEL: bitcast_v2i64:
276 ; NONEON-NOSVE: // %bb.0:
277 ; NONEON-NOSVE-NEXT: ldr q0, [x0]
278 ; NONEON-NOSVE-NEXT: str q0, [x1]
279 ; NONEON-NOSVE-NEXT: ret
280 %load = load volatile <2 x i64>, ptr %a
281 %cast = bitcast <2 x i64> %load to <2 x double>
282 store volatile <2 x double> %cast, ptr %b
286 define void @bitcast_v4i64(ptr %a, ptr %b) {
287 ; CHECK-LABEL: bitcast_v4i64:
289 ; CHECK-NEXT: ldr q0, [x0]
290 ; CHECK-NEXT: ldr q1, [x0, #16]
291 ; CHECK-NEXT: str q1, [x1, #16]
292 ; CHECK-NEXT: str q0, [x1]
295 ; NONEON-NOSVE-LABEL: bitcast_v4i64:
296 ; NONEON-NOSVE: // %bb.0:
297 ; NONEON-NOSVE-NEXT: ldr q0, [x0]
298 ; NONEON-NOSVE-NEXT: ldr q1, [x0, #16]
299 ; NONEON-NOSVE-NEXT: str q1, [x1, #16]
300 ; NONEON-NOSVE-NEXT: str q0, [x1]
301 ; NONEON-NOSVE-NEXT: ret
302 %load = load volatile <4 x i64>, ptr %a
303 %cast = bitcast <4 x i64> %load to <4 x double>
304 store volatile <4 x double> %cast, ptr %b