1 ; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve < %s | FileCheck %s
7 define void @st1b_upper_bound(<vscale x 16 x i8> %data, <vscale x 16 x i1> %pg, i8* %a) {
8 ; CHECK-LABEL: st1b_upper_bound:
9 ; CHECK: st1b { z0.b }, p0, [x0, #7, mul vl]
11 %base_scalable = bitcast i8* %a to <vscale x 16 x i8>*
12 %base = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %base_scalable, i64 7
13 %base_scalar = bitcast <vscale x 16 x i8>* %base to i8*
14 call void @llvm.aarch64.sve.st1.nxv16i8(<vscale x 16 x i8> %data, <vscale x 16 x i1> %pg, i8* %base_scalar)
18 define void @st1b_inbound(<vscale x 16 x i8> %data, <vscale x 16 x i1> %pg, i8* %a) {
19 ; CHECK-LABEL: st1b_inbound:
20 ; CHECK: st1b { z0.b }, p0, [x0, #1, mul vl]
22 %base_scalable = bitcast i8* %a to <vscale x 16 x i8>*
23 %base = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %base_scalable, i64 1
24 %base_scalar = bitcast <vscale x 16 x i8>* %base to i8*
25 call void @llvm.aarch64.sve.st1.nxv16i8(<vscale x 16 x i8> %data, <vscale x 16 x i1> %pg, i8* %base_scalar)
29 define void @st1b_lower_bound(<vscale x 16 x i8> %data, <vscale x 16 x i1> %pg, i8* %a) {
30 ; CHECK-LABEL: st1b_lower_bound:
31 ; CHECK: st1b { z0.b }, p0, [x0, #-8, mul vl]
33 %base_scalable = bitcast i8* %a to <vscale x 16 x i8>*
34 %base = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %base_scalable, i64 -8
35 %base_scalar = bitcast <vscale x 16 x i8>* %base to i8*
36 call void @llvm.aarch64.sve.st1.nxv16i8(<vscale x 16 x i8> %data, <vscale x 16 x i1> %pg, i8* %base_scalar)
40 define void @st1b_out_of_upper_bound(<vscale x 16 x i8> %data, <vscale x 16 x i1> %pg, i8* %a) {
41 ; CHECK-LABEL: st1b_out_of_upper_bound:
42 ; CHECK: rdvl x[[OFFSET:[0-9]+]], #8
43 ; CHECK: st1b { z0.b }, p0, [x0, x[[OFFSET]]]
45 %base_scalable = bitcast i8* %a to <vscale x 16 x i8>*
46 %base = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %base_scalable, i64 8
47 %base_scalar = bitcast <vscale x 16 x i8>* %base to i8*
48 call void @llvm.aarch64.sve.st1.nxv16i8(<vscale x 16 x i8> %data, <vscale x 16 x i1> %pg, i8* %base_scalar)
52 define void @st1b_out_of_lower_bound(<vscale x 16 x i8> %data, <vscale x 16 x i1> %pg, i8* %a) {
53 ; CHECK-LABEL: st1b_out_of_lower_bound:
54 ; CHECK: rdvl x[[OFFSET:[0-9]+]], #-9
55 ; CHECK: st1b { z0.b }, p0, [x0, x[[OFFSET]]]
57 %base_scalable = bitcast i8* %a to <vscale x 16 x i8>*
58 %base = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %base_scalable, i64 -9
59 %base_scalar = bitcast <vscale x 16 x i8>* %base to i8*
60 call void @llvm.aarch64.sve.st1.nxv16i8(<vscale x 16 x i8> %data, <vscale x 16 x i1> %pg, i8* %base_scalar)
64 define void @st1b_s_inbound(<vscale x 4 x i32> %data, <vscale x 4 x i1> %pg, i8* %a) {
65 ; CHECK-LABEL: st1b_s_inbound:
66 ; CHECK: st1b { z0.s }, p0, [x0, #7, mul vl]
68 %base_scalable = bitcast i8* %a to <vscale x 4 x i8>*
69 %base = getelementptr <vscale x 4 x i8>, <vscale x 4 x i8>* %base_scalable, i64 7
70 %base_scalar = bitcast <vscale x 4 x i8>* %base to i8*
71 %trunc = trunc <vscale x 4 x i32> %data to <vscale x 4 x i8>
72 call void @llvm.aarch64.sve.st1.nxv4i8(<vscale x 4 x i8> %trunc, <vscale x 4 x i1> %pg, i8* %base_scalar)
76 define void @st1b_h_inbound(<vscale x 8 x i16> %data, <vscale x 8 x i1> %pg, i8* %a) {
77 ; CHECK-LABEL: st1b_h_inbound:
78 ; CHECK: st1b { z0.h }, p0, [x0, #1, mul vl]
80 %base_scalable = bitcast i8* %a to <vscale x 8 x i8>*
81 %base = getelementptr <vscale x 8 x i8>, <vscale x 8 x i8>* %base_scalable, i64 1
82 %base_scalar = bitcast <vscale x 8 x i8>* %base to i8*
83 %trunc = trunc <vscale x 8 x i16> %data to <vscale x 8 x i8>
84 call void @llvm.aarch64.sve.st1.nxv8i8(<vscale x 8 x i8> %trunc, <vscale x 8 x i1> %pg, i8* %base_scalar)
88 define void @st1b_d_inbound(<vscale x 2 x i64> %data, <vscale x 2 x i1> %pg, i8* %a) {
89 ; CHECK-LABEL: st1b_d_inbound:
90 ; CHECK: st1b { z0.d }, p0, [x0, #-7, mul vl]
92 %base_scalable = bitcast i8* %a to <vscale x 2 x i8>*
93 %base = getelementptr <vscale x 2 x i8>, <vscale x 2 x i8>* %base_scalable, i64 -7
94 %base_scalar = bitcast <vscale x 2 x i8>* %base to i8*
95 %trunc = trunc <vscale x 2 x i64> %data to <vscale x 2 x i8>
96 call void @llvm.aarch64.sve.st1.nxv2i8(<vscale x 2 x i8> %trunc, <vscale x 2 x i1> %pg, i8* %base_scalar)
104 define void @st1h_inbound(<vscale x 8 x i16> %data, <vscale x 8 x i1> %pg, i16* %a) {
105 ; CHECK-LABEL: st1h_inbound:
106 ; CHECK: st1h { z0.h }, p0, [x0, #-1, mul vl]
108 %base_scalable = bitcast i16* %a to <vscale x 8 x i16>*
109 %base = getelementptr <vscale x 8 x i16>, <vscale x 8 x i16>* %base_scalable, i64 -1
110 %base_scalar = bitcast <vscale x 8 x i16>* %base to i16*
111 call void @llvm.aarch64.sve.st1.nxv8i16(<vscale x 8 x i16> %data, <vscale x 8 x i1> %pg, i16* %base_scalar)
115 define void @st1h_f16_inbound(<vscale x 8 x half> %data, <vscale x 8 x i1> %pg, half* %a) {
116 ; CHECK-LABEL: st1h_f16_inbound:
117 ; CHECK: st1h { z0.h }, p0, [x0, #-5, mul vl]
119 %base_scalable = bitcast half* %a to <vscale x 8 x half>*
120 %base = getelementptr <vscale x 8 x half>, <vscale x 8 x half>* %base_scalable, i64 -5
121 %base_scalar = bitcast <vscale x 8 x half>* %base to half*
122 call void @llvm.aarch64.sve.st1.nxv8f16(<vscale x 8 x half> %data, <vscale x 8 x i1> %pg, half* %base_scalar)
126 define void @st1h_bf16_inbound(<vscale x 8 x bfloat> %data, <vscale x 8 x i1> %pg, bfloat* %a) #0 {
127 ; CHECK-LABEL: st1h_bf16_inbound:
128 ; CHECK: st1h { z0.h }, p0, [x0, #-5, mul vl]
130 %base_scalable = bitcast bfloat* %a to <vscale x 8 x bfloat>*
131 %base = getelementptr <vscale x 8 x bfloat>, <vscale x 8 x bfloat>* %base_scalable, i64 -5
132 %base_scalar = bitcast <vscale x 8 x bfloat>* %base to bfloat*
133 call void @llvm.aarch64.sve.st1.nxv8bf16(<vscale x 8 x bfloat> %data, <vscale x 8 x i1> %pg, bfloat* %base_scalar)
137 define void @st1h_s_inbound(<vscale x 4 x i32> %data, <vscale x 4 x i1> %pg, i16* %a) {
138 ; CHECK-LABEL: st1h_s_inbound:
139 ; CHECK: st1h { z0.s }, p0, [x0, #2, mul vl]
141 %base_scalable = bitcast i16* %a to <vscale x 4 x i16>*
142 %base = getelementptr <vscale x 4 x i16>, <vscale x 4 x i16>* %base_scalable, i64 2
143 %base_scalar = bitcast <vscale x 4 x i16>* %base to i16*
144 %trunc = trunc <vscale x 4 x i32> %data to <vscale x 4 x i16>
145 call void @llvm.aarch64.sve.st1.nxv4i16(<vscale x 4 x i16> %trunc, <vscale x 4 x i1> %pg, i16* %base_scalar)
149 define void @st1h_d_inbound(<vscale x 2 x i64> %data, <vscale x 2 x i1> %pg, i16* %a) {
150 ; CHECK-LABEL: st1h_d_inbound:
151 ; CHECK: st1h { z0.d }, p0, [x0, #-4, mul vl]
153 %base_scalable = bitcast i16* %a to <vscale x 2 x i16>*
154 %base = getelementptr <vscale x 2 x i16>, <vscale x 2 x i16>* %base_scalable, i64 -4
155 %base_scalar = bitcast <vscale x 2 x i16>* %base to i16*
156 %trunc = trunc <vscale x 2 x i64> %data to <vscale x 2 x i16>
157 call void @llvm.aarch64.sve.st1.nxv2i16(<vscale x 2 x i16> %trunc, <vscale x 2 x i1> %pg, i16* %base_scalar)
165 define void @st1w_inbound(<vscale x 4 x i32> %data, <vscale x 4 x i1> %pg, i32* %a) {
166 ; CHECK-LABEL: st1w_inbound:
167 ; CHECK: st1w { z0.s }, p0, [x0, #6, mul vl]
169 %base_scalable = bitcast i32* %a to <vscale x 4 x i32>*
170 %base = getelementptr <vscale x 4 x i32>, <vscale x 4 x i32>* %base_scalable, i64 6
171 %base_scalar = bitcast <vscale x 4 x i32>* %base to i32*
172 call void @llvm.aarch64.sve.st1.nxv4i32(<vscale x 4 x i32> %data, <vscale x 4 x i1> %pg, i32* %base_scalar)
176 define void @st1w_f32_inbound(<vscale x 4 x float> %data, <vscale x 4 x i1> %pg, float* %a) {
177 ; CHECK-LABEL: st1w_f32_inbound:
178 ; CHECK: st1w { z0.s }, p0, [x0, #-1, mul vl]
180 %base_scalable = bitcast float* %a to <vscale x 4 x float>*
181 %base = getelementptr <vscale x 4 x float>, <vscale x 4 x float>* %base_scalable, i64 -1
182 %base_scalar = bitcast <vscale x 4 x float>* %base to float*
183 call void @llvm.aarch64.sve.st1.nxv4f32(<vscale x 4 x float> %data, <vscale x 4 x i1> %pg, float* %base_scalar)
187 define void @st1w_d_inbound(<vscale x 2 x i64> %data, <vscale x 2 x i1> %pg, i32* %a) {
188 ; CHECK-LABEL: st1w_d_inbound:
189 ; CHECK: st1w { z0.d }, p0, [x0, #1, mul vl]
191 %base_scalable = bitcast i32* %a to <vscale x 2 x i32>*
192 %base = getelementptr <vscale x 2 x i32>, <vscale x 2 x i32>* %base_scalable, i64 1
193 %base_scalar = bitcast <vscale x 2 x i32>* %base to i32*
194 %trunc = trunc <vscale x 2 x i64> %data to <vscale x 2 x i32>
195 call void @llvm.aarch64.sve.st1.nxv2i32(<vscale x 2 x i32> %trunc, <vscale x 2 x i1> %pg, i32* %base_scalar)
203 define void @st1d_inbound(<vscale x 2 x i64> %data, <vscale x 2 x i1> %pg, i64* %a) {
204 ; CHECK-LABEL: st1d_inbound:
205 ; CHECK: st1d { z0.d }, p0, [x0, #5, mul vl]
207 %base_scalable = bitcast i64* %a to <vscale x 2 x i64>*
208 %base = getelementptr <vscale x 2 x i64>, <vscale x 2 x i64>* %base_scalable, i64 5
209 %base_scalar = bitcast <vscale x 2 x i64>* %base to i64*
210 call void @llvm.aarch64.sve.st1.nxv2i64(<vscale x 2 x i64> %data, <vscale x 2 x i1> %pg, i64* %base_scalar)
214 define void @st1d_f64_inbound(<vscale x 2 x double> %data, <vscale x 2 x i1> %pg, double* %a) {
215 ; CHECK-LABEL: st1d_f64_inbound:
216 ; CHECK: st1d { z0.d }, p0, [x0, #-8, mul vl]
218 %base_scalable = bitcast double* %a to <vscale x 2 x double>*
219 %base = getelementptr <vscale x 2 x double>, <vscale x 2 x double>* %base_scalable, i64 -8
220 %base_scalar = bitcast <vscale x 2 x double>* %base to double*
221 call void @llvm.aarch64.sve.st1.nxv2f64(<vscale x 2 x double> %data, <vscale x 2 x i1> %pg, double* %base_scalar)
225 declare void @llvm.aarch64.sve.st1.nxv16i8(<vscale x 16 x i8>, <vscale x 16 x i1>, i8*)
227 declare void @llvm.aarch64.sve.st1.nxv8i8(<vscale x 8 x i8>, <vscale x 8 x i1>, i8*)
228 declare void @llvm.aarch64.sve.st1.nxv8i16(<vscale x 8 x i16>, <vscale x 8 x i1>, i16*)
229 declare void @llvm.aarch64.sve.st1.nxv8f16(<vscale x 8 x half>, <vscale x 8 x i1>, half*)
230 declare void @llvm.aarch64.sve.st1.nxv8bf16(<vscale x 8 x bfloat>, <vscale x 8 x i1>, bfloat*)
232 declare void @llvm.aarch64.sve.st1.nxv4i8(<vscale x 4 x i8>, <vscale x 4 x i1>, i8*)
233 declare void @llvm.aarch64.sve.st1.nxv4i16(<vscale x 4 x i16>, <vscale x 4 x i1>, i16*)
234 declare void @llvm.aarch64.sve.st1.nxv4i32(<vscale x 4 x i32>, <vscale x 4 x i1>, i32*)
235 declare void @llvm.aarch64.sve.st1.nxv4f32(<vscale x 4 x float>, <vscale x 4 x i1>, float*)
237 declare void @llvm.aarch64.sve.st1.nxv2i8(<vscale x 2 x i8>, <vscale x 2 x i1>, i8*)
238 declare void @llvm.aarch64.sve.st1.nxv2i16(<vscale x 2 x i16>, <vscale x 2 x i1>, i16*)
239 declare void @llvm.aarch64.sve.st1.nxv2i32(<vscale x 2 x i32>, <vscale x 2 x i1>, i32*)
240 declare void @llvm.aarch64.sve.st1.nxv2i64(<vscale x 2 x i64>, <vscale x 2 x i1>, i64*)
241 declare void @llvm.aarch64.sve.st1.nxv2f64(<vscale x 2 x double>, <vscale x 2 x i1>, double*)
243 ; +bf16 is required for the bfloat version.
244 attributes #0 = { "target-features"="+sve,+bf16" }