1 ; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve < %s | FileCheck %s
4 ; LD1H, LD1W, LD1D: base + 32-bit scaled offset, sign (sxtw) or zero (uxtw)
6 ; e.g. ld1h z0.d, p0/z, [x0, z0.d, uxtw #1]
10 define <vscale x 4 x i32> @gld1h_s_uxtw_index(<vscale x 4 x i1> %pg, i16* %base, <vscale x 4 x i32> %b) {
11 ; CHECK-LABEL: gld1h_s_uxtw_index:
12 ; CHECK: ld1h { z0.s }, p0/z, [x0, z0.s, uxtw #1]
14 %load = call <vscale x 4 x i16> @llvm.aarch64.sve.ld1.gather.uxtw.index.nxv4i16(<vscale x 4 x i1> %pg,
16 <vscale x 4 x i32> %b)
17 %res = zext <vscale x 4 x i16> %load to <vscale x 4 x i32>
18 ret <vscale x 4 x i32> %res
21 define <vscale x 4 x i32> @gld1h_s_sxtw_index(<vscale x 4 x i1> %pg, i16* %base, <vscale x 4 x i32> %b) {
22 ; CHECK-LABEL: gld1h_s_sxtw_index:
23 ; CHECK: ld1h { z0.s }, p0/z, [x0, z0.s, sxtw #1]
25 %load = call <vscale x 4 x i16> @llvm.aarch64.sve.ld1.gather.sxtw.index.nxv4i16(<vscale x 4 x i1> %pg,
27 <vscale x 4 x i32> %b)
28 %res = zext <vscale x 4 x i16> %load to <vscale x 4 x i32>
29 ret <vscale x 4 x i32> %res
32 define <vscale x 2 x i64> @gld1h_d_uxtw_index(<vscale x 2 x i1> %pg, i16* %base, <vscale x 2 x i32> %b) {
33 ; CHECK-LABEL: gld1h_d_uxtw_index:
34 ; CHECK: ld1h { z0.d }, p0/z, [x0, z0.d, uxtw #1]
36 %load = call <vscale x 2 x i16> @llvm.aarch64.sve.ld1.gather.uxtw.index.nxv2i16(<vscale x 2 x i1> %pg,
38 <vscale x 2 x i32> %b)
39 %res = zext <vscale x 2 x i16> %load to <vscale x 2 x i64>
40 ret <vscale x 2 x i64> %res
43 define <vscale x 2 x i64> @gld1h_d_sxtw_index(<vscale x 2 x i1> %pg, i16* %base, <vscale x 2 x i32> %b) {
44 ; CHECK-LABEL: gld1h_d_sxtw_index:
45 ; CHECK: ld1h { z0.d }, p0/z, [x0, z0.d, sxtw #1]
47 %load = call <vscale x 2 x i16> @llvm.aarch64.sve.ld1.gather.sxtw.index.nxv2i16(<vscale x 2 x i1> %pg,
49 <vscale x 2 x i32> %b)
50 %res = zext <vscale x 2 x i16> %load to <vscale x 2 x i64>
51 ret <vscale x 2 x i64> %res
55 define <vscale x 4 x i32> @gld1w_s_uxtw_index(<vscale x 4 x i1> %pg, i32* %base, <vscale x 4 x i32> %b) {
56 ; CHECK-LABEL: gld1w_s_uxtw_index:
57 ; CHECK: ld1w { z0.s }, p0/z, [x0, z0.s, uxtw #2]
59 %load = call <vscale x 4 x i32> @llvm.aarch64.sve.ld1.gather.uxtw.index.nxv4i32(<vscale x 4 x i1> %pg,
61 <vscale x 4 x i32> %b)
62 ret <vscale x 4 x i32> %load
65 define <vscale x 4 x i32> @gld1w_s_sxtw_index(<vscale x 4 x i1> %pg, i32* %base, <vscale x 4 x i32> %b) {
66 ; CHECK-LABEL: gld1w_s_sxtw_index:
67 ; CHECK: ld1w { z0.s }, p0/z, [x0, z0.s, sxtw #2]
69 %load = call <vscale x 4 x i32> @llvm.aarch64.sve.ld1.gather.sxtw.index.nxv4i32(<vscale x 4 x i1> %pg,
71 <vscale x 4 x i32> %b)
72 ret <vscale x 4 x i32> %load
75 define <vscale x 2 x i64> @gld1w_d_uxtw_index(<vscale x 2 x i1> %pg, i32* %base, <vscale x 2 x i32> %b) {
76 ; CHECK-LABEL: gld1w_d_uxtw_index:
77 ; CHECK: ld1w { z0.d }, p0/z, [x0, z0.d, uxtw #2]
79 %load = call <vscale x 2 x i32> @llvm.aarch64.sve.ld1.gather.uxtw.index.nxv2i32(<vscale x 2 x i1> %pg,
81 <vscale x 2 x i32> %b)
82 %res = zext <vscale x 2 x i32> %load to <vscale x 2 x i64>
83 ret <vscale x 2 x i64> %res
86 define <vscale x 2 x i64> @gld1w_d_sxtw_index(<vscale x 2 x i1> %pg, i32* %base, <vscale x 2 x i32> %b) {
87 ; CHECK-LABEL: gld1w_d_sxtw_index:
88 ; CHECK: ld1w { z0.d }, p0/z, [x0, z0.d, sxtw #2]
90 %load = call <vscale x 2 x i32> @llvm.aarch64.sve.ld1.gather.sxtw.index.nxv2i32(<vscale x 2 x i1> %pg,
92 <vscale x 2 x i32> %b)
93 %res = zext <vscale x 2 x i32> %load to <vscale x 2 x i64>
94 ret <vscale x 2 x i64> %res
97 define <vscale x 4 x float> @gld1w_s_uxtw_index_float(<vscale x 4 x i1> %pg, float* %base, <vscale x 4 x i32> %b) {
98 ; CHECK-LABEL: gld1w_s_uxtw_index_float:
99 ; CHECK: ld1w { z0.s }, p0/z, [x0, z0.s, uxtw #2]
101 %load = call <vscale x 4 x float> @llvm.aarch64.sve.ld1.gather.uxtw.index.nxv4f32(<vscale x 4 x i1> %pg,
103 <vscale x 4 x i32> %b)
104 ret <vscale x 4 x float> %load
107 define <vscale x 4 x float> @gld1w_s_sxtw_index_float(<vscale x 4 x i1> %pg, float* %base, <vscale x 4 x i32> %b) {
108 ; CHECK-LABEL: gld1w_s_sxtw_index_float:
109 ; CHECK: ld1w { z0.s }, p0/z, [x0, z0.s, sxtw #2]
111 %load = call <vscale x 4 x float> @llvm.aarch64.sve.ld1.gather.sxtw.index.nxv4f32(<vscale x 4 x i1> %pg,
113 <vscale x 4 x i32> %b)
114 ret <vscale x 4 x float> %load
118 define <vscale x 2 x i64> @gld1d_s_uxtw_index(<vscale x 2 x i1> %pg, i64* %base, <vscale x 2 x i32> %b) {
119 ; CHECK-LABEL: gld1d_s_uxtw_index:
120 ; CHECK: ld1d { z0.d }, p0/z, [x0, z0.d, uxtw #3]
122 %load = call <vscale x 2 x i64> @llvm.aarch64.sve.ld1.gather.uxtw.index.nxv2i64(<vscale x 2 x i1> %pg,
124 <vscale x 2 x i32> %b)
125 ret <vscale x 2 x i64> %load
128 define <vscale x 2 x i64> @gld1d_sxtw_index(<vscale x 2 x i1> %pg, i64* %base, <vscale x 2 x i32> %b) {
129 ; CHECK-LABEL: gld1d_sxtw_index:
130 ; CHECK: ld1d { z0.d }, p0/z, [x0, z0.d, sxtw #3]
132 %load = call <vscale x 2 x i64> @llvm.aarch64.sve.ld1.gather.sxtw.index.nxv2i64(<vscale x 2 x i1> %pg,
134 <vscale x 2 x i32> %b)
135 ret <vscale x 2 x i64> %load
138 define <vscale x 2 x double> @gld1d_uxtw_index_double(<vscale x 2 x i1> %pg, double* %base, <vscale x 2 x i32> %b) {
139 ; CHECK-LABEL: gld1d_uxtw_index_double:
140 ; CHECK: ld1d { z0.d }, p0/z, [x0, z0.d, uxtw #3]
142 %load = call <vscale x 2 x double> @llvm.aarch64.sve.ld1.gather.uxtw.index.nxv2f64(<vscale x 2 x i1> %pg,
144 <vscale x 2 x i32> %b)
145 ret <vscale x 2 x double> %load
148 define <vscale x 2 x double> @gld1d_sxtw_index_double(<vscale x 2 x i1> %pg, double* %base, <vscale x 2 x i32> %b) {
149 ; CHECK-LABEL: gld1d_sxtw_index_double:
150 ; CHECK: ld1d { z0.d }, p0/z, [x0, z0.d, sxtw #3]
152 %load = call <vscale x 2 x double> @llvm.aarch64.sve.ld1.gather.sxtw.index.nxv2f64(<vscale x 2 x i1> %pg,
154 <vscale x 2 x i32> %b)
155 ret <vscale x 2 x double> %load
159 ; LD1SH, LD1SW, LD1SD: base + 32-bit scaled offset, sign (sxtw) or zero (uxtw)
160 ; extended to 64 bits
161 ; e.g. ld1sh z0.d, p0/z, [x0, z0.d, uxtw #1]
165 define <vscale x 4 x i32> @gld1sh_s_uxtw_index(<vscale x 4 x i1> %pg, i16* %base, <vscale x 4 x i32> %b) {
166 ; CHECK-LABEL: gld1sh_s_uxtw_index:
167 ; CHECK: ld1sh { z0.s }, p0/z, [x0, z0.s, uxtw #1]
169 %load = call <vscale x 4 x i16> @llvm.aarch64.sve.ld1.gather.uxtw.index.nxv4i16(<vscale x 4 x i1> %pg,
171 <vscale x 4 x i32> %b)
172 %res = sext <vscale x 4 x i16> %load to <vscale x 4 x i32>
173 ret <vscale x 4 x i32> %res
176 define <vscale x 4 x i32> @gld1sh_s_sxtw_index(<vscale x 4 x i1> %pg, i16* %base, <vscale x 4 x i32> %b) {
177 ; CHECK-LABEL: gld1sh_s_sxtw_index:
178 ; CHECK: ld1sh { z0.s }, p0/z, [x0, z0.s, sxtw #1]
180 %load = call <vscale x 4 x i16> @llvm.aarch64.sve.ld1.gather.sxtw.index.nxv4i16(<vscale x 4 x i1> %pg,
182 <vscale x 4 x i32> %b)
183 %res = sext <vscale x 4 x i16> %load to <vscale x 4 x i32>
184 ret <vscale x 4 x i32> %res
187 define <vscale x 2 x i64> @gld1sh_d_uxtw_index(<vscale x 2 x i1> %pg, i16* %base, <vscale x 2 x i32> %b) {
188 ; CHECK-LABEL: gld1sh_d_uxtw_index:
189 ; CHECK: ld1sh { z0.d }, p0/z, [x0, z0.d, uxtw #1]
191 %load = call <vscale x 2 x i16> @llvm.aarch64.sve.ld1.gather.uxtw.index.nxv2i16(<vscale x 2 x i1> %pg,
193 <vscale x 2 x i32> %b)
194 %res = sext <vscale x 2 x i16> %load to <vscale x 2 x i64>
195 ret <vscale x 2 x i64> %res
198 define <vscale x 2 x i64> @gld1sh_d_sxtw_index(<vscale x 2 x i1> %pg, i16* %base, <vscale x 2 x i32> %b) {
199 ; CHECK-LABEL: gld1sh_d_sxtw_index:
200 ; CHECK: ld1sh { z0.d }, p0/z, [x0, z0.d, sxtw #1]
202 %load = call <vscale x 2 x i16> @llvm.aarch64.sve.ld1.gather.sxtw.index.nxv2i16(<vscale x 2 x i1> %pg,
204 <vscale x 2 x i32> %b)
205 %res = sext <vscale x 2 x i16> %load to <vscale x 2 x i64>
206 ret <vscale x 2 x i64> %res
210 define <vscale x 2 x i64> @gld1sw_d_uxtw_index(<vscale x 2 x i1> %pg, i32* %base, <vscale x 2 x i32> %b) {
211 ; CHECK-LABEL: gld1sw_d_uxtw_index:
212 ; CHECK: ld1sw { z0.d }, p0/z, [x0, z0.d, uxtw #2]
214 %load = call <vscale x 2 x i32> @llvm.aarch64.sve.ld1.gather.uxtw.index.nxv2i32(<vscale x 2 x i1> %pg,
216 <vscale x 2 x i32> %b)
217 %res = sext <vscale x 2 x i32> %load to <vscale x 2 x i64>
218 ret <vscale x 2 x i64> %res
221 define <vscale x 2 x i64> @gld1sw_d_sxtw_index(<vscale x 2 x i1> %pg, i32* %base, <vscale x 2 x i32> %b) {
222 ; CHECK-LABEL: gld1sw_d_sxtw_index:
223 ; CHECK: ld1sw { z0.d }, p0/z, [x0, z0.d, sxtw #2]
225 %load = call <vscale x 2 x i32> @llvm.aarch64.sve.ld1.gather.sxtw.index.nxv2i32(<vscale x 2 x i1> %pg,
227 <vscale x 2 x i32> %b)
228 %res = sext <vscale x 2 x i32> %load to <vscale x 2 x i64>
229 ret <vscale x 2 x i64> %res
234 declare <vscale x 4 x i16> @llvm.aarch64.sve.ld1.gather.uxtw.index.nxv4i16(<vscale x 4 x i1>, i16*, <vscale x 4 x i32>)
235 declare <vscale x 4 x i16> @llvm.aarch64.sve.ld1.gather.sxtw.index.nxv4i16(<vscale x 4 x i1>, i16*, <vscale x 4 x i32>)
237 declare <vscale x 2 x i16> @llvm.aarch64.sve.ld1.gather.uxtw.index.nxv2i16(<vscale x 2 x i1>, i16*, <vscale x 2 x i32>)
238 declare <vscale x 2 x i16> @llvm.aarch64.sve.ld1.gather.sxtw.index.nxv2i16(<vscale x 2 x i1>, i16*, <vscale x 2 x i32>)
241 declare <vscale x 4 x i32> @llvm.aarch64.sve.ld1.gather.uxtw.index.nxv4i32(<vscale x 4 x i1>, i32*, <vscale x 4 x i32>)
242 declare <vscale x 4 x i32> @llvm.aarch64.sve.ld1.gather.sxtw.index.nxv4i32(<vscale x 4 x i1>, i32*, <vscale x 4 x i32>)
244 declare <vscale x 2 x i32> @llvm.aarch64.sve.ld1.gather.uxtw.index.nxv2i32(<vscale x 2 x i1>, i32*, <vscale x 2 x i32>)
245 declare <vscale x 2 x i32> @llvm.aarch64.sve.ld1.gather.sxtw.index.nxv2i32(<vscale x 2 x i1>, i32*, <vscale x 2 x i32>)
247 declare <vscale x 4 x float> @llvm.aarch64.sve.ld1.gather.uxtw.index.nxv4f32(<vscale x 4 x i1>, float*, <vscale x 4 x i32>)
248 declare <vscale x 4 x float> @llvm.aarch64.sve.ld1.gather.sxtw.index.nxv4f32(<vscale x 4 x i1>, float*, <vscale x 4 x i32>)
251 declare <vscale x 2 x i64> @llvm.aarch64.sve.ld1.gather.uxtw.index.nxv2i64(<vscale x 2 x i1>, i64*, <vscale x 2 x i32>)
252 declare <vscale x 2 x i64> @llvm.aarch64.sve.ld1.gather.sxtw.index.nxv2i64(<vscale x 2 x i1>, i64*, <vscale x 2 x i32>)
254 declare <vscale x 2 x double> @llvm.aarch64.sve.ld1.gather.uxtw.index.nxv2f64(<vscale x 2 x i1>, double*, <vscale x 2 x i32>)
255 declare <vscale x 2 x double> @llvm.aarch64.sve.ld1.gather.sxtw.index.nxv2f64(<vscale x 2 x i1>, double*, <vscale x 2 x i32>)