1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve < %s | FileCheck %s
3 ; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sme < %s | FileCheck %s
9 define void @st1b_upper_bound(<vscale x 16 x i8> %data, <vscale x 16 x i1> %pg, ptr %a) {
10 ; CHECK-LABEL: st1b_upper_bound:
12 ; CHECK-NEXT: st1b { z0.b }, p0, [x0, #7, mul vl]
14 %base = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i64 7
15 %base_scalar = bitcast <vscale x 16 x i8>* %base to ptr
16 call void @llvm.aarch64.sve.st1.nxv16i8(<vscale x 16 x i8> %data, <vscale x 16 x i1> %pg, ptr %base_scalar)
20 define void @st1b_inbound(<vscale x 16 x i8> %data, <vscale x 16 x i1> %pg, ptr %a) {
21 ; CHECK-LABEL: st1b_inbound:
23 ; CHECK-NEXT: st1b { z0.b }, p0, [x0, #1, mul vl]
25 %base = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i64 1
26 %base_scalar = bitcast <vscale x 16 x i8>* %base to ptr
27 call void @llvm.aarch64.sve.st1.nxv16i8(<vscale x 16 x i8> %data, <vscale x 16 x i1> %pg, ptr %base_scalar)
31 define void @st1b_lower_bound(<vscale x 16 x i8> %data, <vscale x 16 x i1> %pg, ptr %a) {
32 ; CHECK-LABEL: st1b_lower_bound:
34 ; CHECK-NEXT: st1b { z0.b }, p0, [x0, #-8, mul vl]
36 %base = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i64 -8
37 %base_scalar = bitcast <vscale x 16 x i8>* %base to ptr
38 call void @llvm.aarch64.sve.st1.nxv16i8(<vscale x 16 x i8> %data, <vscale x 16 x i1> %pg, ptr %base_scalar)
42 define void @st1b_out_of_upper_bound(<vscale x 16 x i8> %data, <vscale x 16 x i1> %pg, ptr %a) {
43 ; CHECK-LABEL: st1b_out_of_upper_bound:
45 ; CHECK-NEXT: rdvl x8, #8
46 ; CHECK-NEXT: st1b { z0.b }, p0, [x0, x8]
48 %base = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i64 8
49 %base_scalar = bitcast <vscale x 16 x i8>* %base to ptr
50 call void @llvm.aarch64.sve.st1.nxv16i8(<vscale x 16 x i8> %data, <vscale x 16 x i1> %pg, ptr %base_scalar)
54 define void @st1b_out_of_lower_bound(<vscale x 16 x i8> %data, <vscale x 16 x i1> %pg, ptr %a) {
55 ; CHECK-LABEL: st1b_out_of_lower_bound:
57 ; CHECK-NEXT: rdvl x8, #-9
58 ; CHECK-NEXT: st1b { z0.b }, p0, [x0, x8]
60 %base = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i64 -9
61 %base_scalar = bitcast <vscale x 16 x i8>* %base to ptr
62 call void @llvm.aarch64.sve.st1.nxv16i8(<vscale x 16 x i8> %data, <vscale x 16 x i1> %pg, ptr %base_scalar)
66 define void @st1b_s_inbound(<vscale x 4 x i32> %data, <vscale x 4 x i1> %pg, ptr %a) {
67 ; CHECK-LABEL: st1b_s_inbound:
69 ; CHECK-NEXT: st1b { z0.s }, p0, [x0, #7, mul vl]
71 %base = getelementptr <vscale x 4 x i8>, <vscale x 4 x i8>* %a, i64 7
72 %base_scalar = bitcast <vscale x 4 x i8>* %base to ptr
73 %trunc = trunc <vscale x 4 x i32> %data to <vscale x 4 x i8>
74 call void @llvm.aarch64.sve.st1.nxv4i8(<vscale x 4 x i8> %trunc, <vscale x 4 x i1> %pg, ptr %base_scalar)
78 define void @st1b_h_inbound(<vscale x 8 x i16> %data, <vscale x 8 x i1> %pg, ptr %a) {
79 ; CHECK-LABEL: st1b_h_inbound:
81 ; CHECK-NEXT: st1b { z0.h }, p0, [x0, #1, mul vl]
83 %base = getelementptr <vscale x 8 x i8>, <vscale x 8 x i8>* %a, i64 1
84 %base_scalar = bitcast <vscale x 8 x i8>* %base to ptr
85 %trunc = trunc <vscale x 8 x i16> %data to <vscale x 8 x i8>
86 call void @llvm.aarch64.sve.st1.nxv8i8(<vscale x 8 x i8> %trunc, <vscale x 8 x i1> %pg, ptr %base_scalar)
90 define void @st1b_d_inbound(<vscale x 2 x i64> %data, <vscale x 2 x i1> %pg, ptr %a) {
91 ; CHECK-LABEL: st1b_d_inbound:
93 ; CHECK-NEXT: st1b { z0.d }, p0, [x0, #-7, mul vl]
95 %base = getelementptr <vscale x 2 x i8>, <vscale x 2 x i8>* %a, i64 -7
96 %base_scalar = bitcast <vscale x 2 x i8>* %base to ptr
97 %trunc = trunc <vscale x 2 x i64> %data to <vscale x 2 x i8>
98 call void @llvm.aarch64.sve.st1.nxv2i8(<vscale x 2 x i8> %trunc, <vscale x 2 x i1> %pg, ptr %base_scalar)
106 define void @st1h_inbound(<vscale x 8 x i16> %data, <vscale x 8 x i1> %pg, ptr %a) {
107 ; CHECK-LABEL: st1h_inbound:
109 ; CHECK-NEXT: st1h { z0.h }, p0, [x0, #-1, mul vl]
111 %base = getelementptr <vscale x 8 x i16>, <vscale x 8 x i16>* %a, i64 -1
112 %base_scalar = bitcast <vscale x 8 x i16>* %base to ptr
113 call void @llvm.aarch64.sve.st1.nxv8i16(<vscale x 8 x i16> %data, <vscale x 8 x i1> %pg, ptr %base_scalar)
117 define void @st1h_f16_inbound(<vscale x 8 x half> %data, <vscale x 8 x i1> %pg, ptr %a) {
118 ; CHECK-LABEL: st1h_f16_inbound:
120 ; CHECK-NEXT: st1h { z0.h }, p0, [x0, #-5, mul vl]
122 %base = getelementptr <vscale x 8 x half>, <vscale x 8 x half>* %a, i64 -5
123 %base_scalar = bitcast <vscale x 8 x half>* %base to ptr
124 call void @llvm.aarch64.sve.st1.nxv8f16(<vscale x 8 x half> %data, <vscale x 8 x i1> %pg, ptr %base_scalar)
128 define void @st1h_bf16_inbound(<vscale x 8 x bfloat> %data, <vscale x 8 x i1> %pg, ptr %a) #0 {
129 ; CHECK-LABEL: st1h_bf16_inbound:
131 ; CHECK-NEXT: st1h { z0.h }, p0, [x0, #-5, mul vl]
133 %base = getelementptr <vscale x 8 x bfloat>, <vscale x 8 x bfloat>* %a, i64 -5
134 %base_scalar = bitcast <vscale x 8 x bfloat>* %base to ptr
135 call void @llvm.aarch64.sve.st1.nxv8bf16(<vscale x 8 x bfloat> %data, <vscale x 8 x i1> %pg, ptr %base_scalar)
139 define void @st1h_s_inbound(<vscale x 4 x i32> %data, <vscale x 4 x i1> %pg, ptr %a) {
140 ; CHECK-LABEL: st1h_s_inbound:
142 ; CHECK-NEXT: st1h { z0.s }, p0, [x0, #2, mul vl]
144 %base = getelementptr <vscale x 4 x i16>, <vscale x 4 x i16>* %a, i64 2
145 %base_scalar = bitcast <vscale x 4 x i16>* %base to ptr
146 %trunc = trunc <vscale x 4 x i32> %data to <vscale x 4 x i16>
147 call void @llvm.aarch64.sve.st1.nxv4i16(<vscale x 4 x i16> %trunc, <vscale x 4 x i1> %pg, ptr %base_scalar)
151 define void @st1h_d_inbound(<vscale x 2 x i64> %data, <vscale x 2 x i1> %pg, ptr %a) {
152 ; CHECK-LABEL: st1h_d_inbound:
154 ; CHECK-NEXT: st1h { z0.d }, p0, [x0, #-4, mul vl]
156 %base = getelementptr <vscale x 2 x i16>, <vscale x 2 x i16>* %a, i64 -4
157 %base_scalar = bitcast <vscale x 2 x i16>* %base to ptr
158 %trunc = trunc <vscale x 2 x i64> %data to <vscale x 2 x i16>
159 call void @llvm.aarch64.sve.st1.nxv2i16(<vscale x 2 x i16> %trunc, <vscale x 2 x i1> %pg, ptr %base_scalar)
167 define void @st1w_inbound(<vscale x 4 x i32> %data, <vscale x 4 x i1> %pg, ptr %a) {
168 ; CHECK-LABEL: st1w_inbound:
170 ; CHECK-NEXT: st1w { z0.s }, p0, [x0, #6, mul vl]
172 %base = getelementptr <vscale x 4 x i32>, <vscale x 4 x i32>* %a, i64 6
173 %base_scalar = bitcast <vscale x 4 x i32>* %base to ptr
174 call void @llvm.aarch64.sve.st1.nxv4i32(<vscale x 4 x i32> %data, <vscale x 4 x i1> %pg, ptr %base_scalar)
178 define void @st1w_f32_inbound(<vscale x 4 x float> %data, <vscale x 4 x i1> %pg, ptr %a) {
179 ; CHECK-LABEL: st1w_f32_inbound:
181 ; CHECK-NEXT: st1w { z0.s }, p0, [x0, #-1, mul vl]
183 %base = getelementptr <vscale x 4 x float>, <vscale x 4 x float>* %a, i64 -1
184 %base_scalar = bitcast <vscale x 4 x float>* %base to ptr
185 call void @llvm.aarch64.sve.st1.nxv4f32(<vscale x 4 x float> %data, <vscale x 4 x i1> %pg, ptr %base_scalar)
189 define void @st1w_d_inbound(<vscale x 2 x i64> %data, <vscale x 2 x i1> %pg, ptr %a) {
190 ; CHECK-LABEL: st1w_d_inbound:
192 ; CHECK-NEXT: st1w { z0.d }, p0, [x0, #1, mul vl]
194 %base = getelementptr <vscale x 2 x i32>, <vscale x 2 x i32>* %a, i64 1
195 %base_scalar = bitcast <vscale x 2 x i32>* %base to ptr
196 %trunc = trunc <vscale x 2 x i64> %data to <vscale x 2 x i32>
197 call void @llvm.aarch64.sve.st1.nxv2i32(<vscale x 2 x i32> %trunc, <vscale x 2 x i1> %pg, ptr %base_scalar)
205 define void @st1d_inbound(<vscale x 2 x i64> %data, <vscale x 2 x i1> %pg, ptr %a) {
206 ; CHECK-LABEL: st1d_inbound:
208 ; CHECK-NEXT: st1d { z0.d }, p0, [x0, #5, mul vl]
210 %base = getelementptr <vscale x 2 x i64>, <vscale x 2 x i64>* %a, i64 5
211 %base_scalar = bitcast <vscale x 2 x i64>* %base to ptr
212 call void @llvm.aarch64.sve.st1.nxv2i64(<vscale x 2 x i64> %data, <vscale x 2 x i1> %pg, ptr %base_scalar)
216 define void @st1d_f64_inbound(<vscale x 2 x double> %data, <vscale x 2 x i1> %pg, ptr %a) {
217 ; CHECK-LABEL: st1d_f64_inbound:
219 ; CHECK-NEXT: st1d { z0.d }, p0, [x0, #-8, mul vl]
221 %base = getelementptr <vscale x 2 x double>, <vscale x 2 x double>* %a, i64 -8
222 %base_scalar = bitcast <vscale x 2 x double>* %base to ptr
223 call void @llvm.aarch64.sve.st1.nxv2f64(<vscale x 2 x double> %data, <vscale x 2 x i1> %pg, ptr %base_scalar)
227 declare void @llvm.aarch64.sve.st1.nxv16i8(<vscale x 16 x i8>, <vscale x 16 x i1>, ptr)
229 declare void @llvm.aarch64.sve.st1.nxv8i8(<vscale x 8 x i8>, <vscale x 8 x i1>, ptr)
230 declare void @llvm.aarch64.sve.st1.nxv8i16(<vscale x 8 x i16>, <vscale x 8 x i1>, ptr)
231 declare void @llvm.aarch64.sve.st1.nxv8f16(<vscale x 8 x half>, <vscale x 8 x i1>, ptr)
232 declare void @llvm.aarch64.sve.st1.nxv8bf16(<vscale x 8 x bfloat>, <vscale x 8 x i1>, ptr)
234 declare void @llvm.aarch64.sve.st1.nxv4i8(<vscale x 4 x i8>, <vscale x 4 x i1>, ptr)
235 declare void @llvm.aarch64.sve.st1.nxv4i16(<vscale x 4 x i16>, <vscale x 4 x i1>, ptr)
236 declare void @llvm.aarch64.sve.st1.nxv4i32(<vscale x 4 x i32>, <vscale x 4 x i1>, ptr)
237 declare void @llvm.aarch64.sve.st1.nxv4f32(<vscale x 4 x float>, <vscale x 4 x i1>, ptr)
239 declare void @llvm.aarch64.sve.st1.nxv2i8(<vscale x 2 x i8>, <vscale x 2 x i1>, ptr)
240 declare void @llvm.aarch64.sve.st1.nxv2i16(<vscale x 2 x i16>, <vscale x 2 x i1>, ptr)
241 declare void @llvm.aarch64.sve.st1.nxv2i32(<vscale x 2 x i32>, <vscale x 2 x i1>, ptr)
242 declare void @llvm.aarch64.sve.st1.nxv2i64(<vscale x 2 x i64>, <vscale x 2 x i1>, ptr)
243 declare void @llvm.aarch64.sve.st1.nxv2f64(<vscale x 2 x double>, <vscale x 2 x i1>, ptr)
245 ; +bf16 is required for the bfloat version.
246 attributes #0 = { "target-features"="+bf16" }