1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+m,+d,+zfh,+zvfh,+v -target-abi=ilp32d \
3 ; RUN: -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,RV32
4 ; RUN: llc -mtriple=riscv64 -mattr=+m,+d,+zfh,+zvfh,+v -target-abi=lp64d \
5 ; RUN: -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,RV64
7 declare <vscale x 1 x i8> @llvm.masked.gather.nxv1i8.nxv1p0(<vscale x 1 x ptr>, i32, <vscale x 1 x i1>, <vscale x 1 x i8>)
9 define <vscale x 1 x i8> @mgather_nxv1i8(<vscale x 1 x ptr> %ptrs, <vscale x 1 x i1> %m, <vscale x 1 x i8> %passthru) {
10 ; RV32-LABEL: mgather_nxv1i8:
12 ; RV32-NEXT: vsetvli a0, zero, e8, mf8, ta, mu
13 ; RV32-NEXT: vluxei32.v v9, (zero), v8, v0.t
14 ; RV32-NEXT: vmv1r.v v8, v9
17 ; RV64-LABEL: mgather_nxv1i8:
19 ; RV64-NEXT: vsetvli a0, zero, e8, mf8, ta, mu
20 ; RV64-NEXT: vluxei64.v v9, (zero), v8, v0.t
21 ; RV64-NEXT: vmv1r.v v8, v9
23 %v = call <vscale x 1 x i8> @llvm.masked.gather.nxv1i8.nxv1p0(<vscale x 1 x ptr> %ptrs, i32 1, <vscale x 1 x i1> %m, <vscale x 1 x i8> %passthru)
24 ret <vscale x 1 x i8> %v
27 declare <vscale x 2 x i8> @llvm.masked.gather.nxv2i8.nxv2p0(<vscale x 2 x ptr>, i32, <vscale x 2 x i1>, <vscale x 2 x i8>)
29 define <vscale x 2 x i8> @mgather_nxv2i8(<vscale x 2 x ptr> %ptrs, <vscale x 2 x i1> %m, <vscale x 2 x i8> %passthru) {
30 ; RV32-LABEL: mgather_nxv2i8:
32 ; RV32-NEXT: vsetvli a0, zero, e8, mf4, ta, mu
33 ; RV32-NEXT: vluxei32.v v9, (zero), v8, v0.t
34 ; RV32-NEXT: vmv1r.v v8, v9
37 ; RV64-LABEL: mgather_nxv2i8:
39 ; RV64-NEXT: vsetvli a0, zero, e8, mf4, ta, mu
40 ; RV64-NEXT: vluxei64.v v10, (zero), v8, v0.t
41 ; RV64-NEXT: vmv1r.v v8, v10
43 %v = call <vscale x 2 x i8> @llvm.masked.gather.nxv2i8.nxv2p0(<vscale x 2 x ptr> %ptrs, i32 1, <vscale x 2 x i1> %m, <vscale x 2 x i8> %passthru)
44 ret <vscale x 2 x i8> %v
47 define <vscale x 2 x i16> @mgather_nxv2i8_sextload_nxv2i16(<vscale x 2 x ptr> %ptrs, <vscale x 2 x i1> %m, <vscale x 2 x i8> %passthru) {
48 ; RV32-LABEL: mgather_nxv2i8_sextload_nxv2i16:
50 ; RV32-NEXT: vsetvli a0, zero, e8, mf4, ta, mu
51 ; RV32-NEXT: vluxei32.v v9, (zero), v8, v0.t
52 ; RV32-NEXT: vsetvli zero, zero, e16, mf2, ta, ma
53 ; RV32-NEXT: vsext.vf2 v8, v9
56 ; RV64-LABEL: mgather_nxv2i8_sextload_nxv2i16:
58 ; RV64-NEXT: vsetvli a0, zero, e8, mf4, ta, mu
59 ; RV64-NEXT: vluxei64.v v10, (zero), v8, v0.t
60 ; RV64-NEXT: vsetvli zero, zero, e16, mf2, ta, ma
61 ; RV64-NEXT: vsext.vf2 v8, v10
63 %v = call <vscale x 2 x i8> @llvm.masked.gather.nxv2i8.nxv2p0(<vscale x 2 x ptr> %ptrs, i32 1, <vscale x 2 x i1> %m, <vscale x 2 x i8> %passthru)
64 %ev = sext <vscale x 2 x i8> %v to <vscale x 2 x i16>
65 ret <vscale x 2 x i16> %ev
68 define <vscale x 2 x i16> @mgather_nxv2i8_zextload_nxv2i16(<vscale x 2 x ptr> %ptrs, <vscale x 2 x i1> %m, <vscale x 2 x i8> %passthru) {
69 ; RV32-LABEL: mgather_nxv2i8_zextload_nxv2i16:
71 ; RV32-NEXT: vsetvli a0, zero, e8, mf4, ta, mu
72 ; RV32-NEXT: vluxei32.v v9, (zero), v8, v0.t
73 ; RV32-NEXT: vsetvli zero, zero, e16, mf2, ta, ma
74 ; RV32-NEXT: vzext.vf2 v8, v9
77 ; RV64-LABEL: mgather_nxv2i8_zextload_nxv2i16:
79 ; RV64-NEXT: vsetvli a0, zero, e8, mf4, ta, mu
80 ; RV64-NEXT: vluxei64.v v10, (zero), v8, v0.t
81 ; RV64-NEXT: vsetvli zero, zero, e16, mf2, ta, ma
82 ; RV64-NEXT: vzext.vf2 v8, v10
84 %v = call <vscale x 2 x i8> @llvm.masked.gather.nxv2i8.nxv2p0(<vscale x 2 x ptr> %ptrs, i32 1, <vscale x 2 x i1> %m, <vscale x 2 x i8> %passthru)
85 %ev = zext <vscale x 2 x i8> %v to <vscale x 2 x i16>
86 ret <vscale x 2 x i16> %ev
89 define <vscale x 2 x i32> @mgather_nxv2i8_sextload_nxv2i32(<vscale x 2 x ptr> %ptrs, <vscale x 2 x i1> %m, <vscale x 2 x i8> %passthru) {
90 ; RV32-LABEL: mgather_nxv2i8_sextload_nxv2i32:
92 ; RV32-NEXT: vsetvli a0, zero, e8, mf4, ta, mu
93 ; RV32-NEXT: vluxei32.v v9, (zero), v8, v0.t
94 ; RV32-NEXT: vsetvli zero, zero, e32, m1, ta, ma
95 ; RV32-NEXT: vsext.vf4 v8, v9
98 ; RV64-LABEL: mgather_nxv2i8_sextload_nxv2i32:
100 ; RV64-NEXT: vsetvli a0, zero, e8, mf4, ta, mu
101 ; RV64-NEXT: vluxei64.v v10, (zero), v8, v0.t
102 ; RV64-NEXT: vsetvli zero, zero, e32, m1, ta, ma
103 ; RV64-NEXT: vsext.vf4 v8, v10
105 %v = call <vscale x 2 x i8> @llvm.masked.gather.nxv2i8.nxv2p0(<vscale x 2 x ptr> %ptrs, i32 1, <vscale x 2 x i1> %m, <vscale x 2 x i8> %passthru)
106 %ev = sext <vscale x 2 x i8> %v to <vscale x 2 x i32>
107 ret <vscale x 2 x i32> %ev
110 define <vscale x 2 x i32> @mgather_nxv2i8_zextload_nxv2i32(<vscale x 2 x ptr> %ptrs, <vscale x 2 x i1> %m, <vscale x 2 x i8> %passthru) {
111 ; RV32-LABEL: mgather_nxv2i8_zextload_nxv2i32:
113 ; RV32-NEXT: vsetvli a0, zero, e8, mf4, ta, mu
114 ; RV32-NEXT: vluxei32.v v9, (zero), v8, v0.t
115 ; RV32-NEXT: vsetvli zero, zero, e32, m1, ta, ma
116 ; RV32-NEXT: vzext.vf4 v8, v9
119 ; RV64-LABEL: mgather_nxv2i8_zextload_nxv2i32:
121 ; RV64-NEXT: vsetvli a0, zero, e8, mf4, ta, mu
122 ; RV64-NEXT: vluxei64.v v10, (zero), v8, v0.t
123 ; RV64-NEXT: vsetvli zero, zero, e32, m1, ta, ma
124 ; RV64-NEXT: vzext.vf4 v8, v10
126 %v = call <vscale x 2 x i8> @llvm.masked.gather.nxv2i8.nxv2p0(<vscale x 2 x ptr> %ptrs, i32 1, <vscale x 2 x i1> %m, <vscale x 2 x i8> %passthru)
127 %ev = zext <vscale x 2 x i8> %v to <vscale x 2 x i32>
128 ret <vscale x 2 x i32> %ev
131 define <vscale x 2 x i64> @mgather_nxv2i8_sextload_nxv2i64(<vscale x 2 x ptr> %ptrs, <vscale x 2 x i1> %m, <vscale x 2 x i8> %passthru) {
132 ; RV32-LABEL: mgather_nxv2i8_sextload_nxv2i64:
134 ; RV32-NEXT: vsetvli a0, zero, e8, mf4, ta, mu
135 ; RV32-NEXT: vluxei32.v v9, (zero), v8, v0.t
136 ; RV32-NEXT: vsetvli zero, zero, e64, m2, ta, ma
137 ; RV32-NEXT: vsext.vf8 v10, v9
138 ; RV32-NEXT: vmv.v.v v8, v10
141 ; RV64-LABEL: mgather_nxv2i8_sextload_nxv2i64:
143 ; RV64-NEXT: vsetvli a0, zero, e8, mf4, ta, mu
144 ; RV64-NEXT: vluxei64.v v10, (zero), v8, v0.t
145 ; RV64-NEXT: vsetvli zero, zero, e64, m2, ta, ma
146 ; RV64-NEXT: vsext.vf8 v8, v10
148 %v = call <vscale x 2 x i8> @llvm.masked.gather.nxv2i8.nxv2p0(<vscale x 2 x ptr> %ptrs, i32 1, <vscale x 2 x i1> %m, <vscale x 2 x i8> %passthru)
149 %ev = sext <vscale x 2 x i8> %v to <vscale x 2 x i64>
150 ret <vscale x 2 x i64> %ev
153 define <vscale x 2 x i64> @mgather_nxv2i8_zextload_nxv2i64(<vscale x 2 x ptr> %ptrs, <vscale x 2 x i1> %m, <vscale x 2 x i8> %passthru) {
154 ; RV32-LABEL: mgather_nxv2i8_zextload_nxv2i64:
156 ; RV32-NEXT: vsetvli a0, zero, e8, mf4, ta, mu
157 ; RV32-NEXT: vluxei32.v v9, (zero), v8, v0.t
158 ; RV32-NEXT: vsetvli zero, zero, e64, m2, ta, ma
159 ; RV32-NEXT: vzext.vf8 v10, v9
160 ; RV32-NEXT: vmv.v.v v8, v10
163 ; RV64-LABEL: mgather_nxv2i8_zextload_nxv2i64:
165 ; RV64-NEXT: vsetvli a0, zero, e8, mf4, ta, mu
166 ; RV64-NEXT: vluxei64.v v10, (zero), v8, v0.t
167 ; RV64-NEXT: vsetvli zero, zero, e64, m2, ta, ma
168 ; RV64-NEXT: vzext.vf8 v8, v10
170 %v = call <vscale x 2 x i8> @llvm.masked.gather.nxv2i8.nxv2p0(<vscale x 2 x ptr> %ptrs, i32 1, <vscale x 2 x i1> %m, <vscale x 2 x i8> %passthru)
171 %ev = zext <vscale x 2 x i8> %v to <vscale x 2 x i64>
172 ret <vscale x 2 x i64> %ev
175 declare <vscale x 4 x i8> @llvm.masked.gather.nxv4i8.nxv4p0(<vscale x 4 x ptr>, i32, <vscale x 4 x i1>, <vscale x 4 x i8>)
177 define <vscale x 4 x i8> @mgather_nxv4i8(<vscale x 4 x ptr> %ptrs, <vscale x 4 x i1> %m, <vscale x 4 x i8> %passthru) {
178 ; RV32-LABEL: mgather_nxv4i8:
180 ; RV32-NEXT: vsetvli a0, zero, e8, mf2, ta, mu
181 ; RV32-NEXT: vluxei32.v v10, (zero), v8, v0.t
182 ; RV32-NEXT: vmv1r.v v8, v10
185 ; RV64-LABEL: mgather_nxv4i8:
187 ; RV64-NEXT: vsetvli a0, zero, e8, mf2, ta, mu
188 ; RV64-NEXT: vluxei64.v v12, (zero), v8, v0.t
189 ; RV64-NEXT: vmv1r.v v8, v12
191 %v = call <vscale x 4 x i8> @llvm.masked.gather.nxv4i8.nxv4p0(<vscale x 4 x ptr> %ptrs, i32 1, <vscale x 4 x i1> %m, <vscale x 4 x i8> %passthru)
192 ret <vscale x 4 x i8> %v
195 define <vscale x 4 x i8> @mgather_truemask_nxv4i8(<vscale x 4 x ptr> %ptrs, <vscale x 4 x i8> %passthru) {
196 ; RV32-LABEL: mgather_truemask_nxv4i8:
198 ; RV32-NEXT: vsetvli a0, zero, e8, mf2, ta, ma
199 ; RV32-NEXT: vluxei32.v v10, (zero), v8
200 ; RV32-NEXT: vmv1r.v v8, v10
203 ; RV64-LABEL: mgather_truemask_nxv4i8:
205 ; RV64-NEXT: vsetvli a0, zero, e8, mf2, ta, ma
206 ; RV64-NEXT: vluxei64.v v12, (zero), v8
207 ; RV64-NEXT: vmv1r.v v8, v12
209 %v = call <vscale x 4 x i8> @llvm.masked.gather.nxv4i8.nxv4p0(<vscale x 4 x ptr> %ptrs, i32 1, <vscale x 4 x i1> splat (i1 1), <vscale x 4 x i8> %passthru)
210 ret <vscale x 4 x i8> %v
213 define <vscale x 4 x i8> @mgather_falsemask_nxv4i8(<vscale x 4 x ptr> %ptrs, <vscale x 4 x i8> %passthru) {
214 ; RV32-LABEL: mgather_falsemask_nxv4i8:
216 ; RV32-NEXT: vmv1r.v v8, v10
219 ; RV64-LABEL: mgather_falsemask_nxv4i8:
221 ; RV64-NEXT: vmv1r.v v8, v12
223 %v = call <vscale x 4 x i8> @llvm.masked.gather.nxv4i8.nxv4p0(<vscale x 4 x ptr> %ptrs, i32 1, <vscale x 4 x i1> zeroinitializer, <vscale x 4 x i8> %passthru)
224 ret <vscale x 4 x i8> %v
227 declare <vscale x 8 x i8> @llvm.masked.gather.nxv8i8.nxv8p0(<vscale x 8 x ptr>, i32, <vscale x 8 x i1>, <vscale x 8 x i8>)
229 define <vscale x 8 x i8> @mgather_nxv8i8(<vscale x 8 x ptr> %ptrs, <vscale x 8 x i1> %m, <vscale x 8 x i8> %passthru) {
230 ; RV32-LABEL: mgather_nxv8i8:
232 ; RV32-NEXT: vsetvli a0, zero, e8, m1, ta, mu
233 ; RV32-NEXT: vluxei32.v v12, (zero), v8, v0.t
234 ; RV32-NEXT: vmv.v.v v8, v12
237 ; RV64-LABEL: mgather_nxv8i8:
239 ; RV64-NEXT: vsetvli a0, zero, e8, m1, ta, mu
240 ; RV64-NEXT: vluxei64.v v16, (zero), v8, v0.t
241 ; RV64-NEXT: vmv.v.v v8, v16
243 %v = call <vscale x 8 x i8> @llvm.masked.gather.nxv8i8.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 1, <vscale x 8 x i1> %m, <vscale x 8 x i8> %passthru)
244 ret <vscale x 8 x i8> %v
247 define <vscale x 8 x i8> @mgather_baseidx_nxv8i8(ptr %base, <vscale x 8 x i8> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x i8> %passthru) {
248 ; RV32-LABEL: mgather_baseidx_nxv8i8:
250 ; RV32-NEXT: vsetvli a1, zero, e32, m4, ta, ma
251 ; RV32-NEXT: vsext.vf4 v12, v8
252 ; RV32-NEXT: vsetvli zero, zero, e8, m1, ta, mu
253 ; RV32-NEXT: vluxei32.v v9, (a0), v12, v0.t
254 ; RV32-NEXT: vmv.v.v v8, v9
257 ; RV64-LABEL: mgather_baseidx_nxv8i8:
259 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, ma
260 ; RV64-NEXT: vsext.vf8 v16, v8
261 ; RV64-NEXT: vsetvli zero, zero, e8, m1, ta, mu
262 ; RV64-NEXT: vluxei64.v v9, (a0), v16, v0.t
263 ; RV64-NEXT: vmv.v.v v8, v9
265 %ptrs = getelementptr inbounds i8, ptr %base, <vscale x 8 x i8> %idxs
266 %v = call <vscale x 8 x i8> @llvm.masked.gather.nxv8i8.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 1, <vscale x 8 x i1> %m, <vscale x 8 x i8> %passthru)
267 ret <vscale x 8 x i8> %v
270 declare <vscale x 1 x i16> @llvm.masked.gather.nxv1i16.nxv1p0(<vscale x 1 x ptr>, i32, <vscale x 1 x i1>, <vscale x 1 x i16>)
272 define <vscale x 1 x i16> @mgather_nxv1i16(<vscale x 1 x ptr> %ptrs, <vscale x 1 x i1> %m, <vscale x 1 x i16> %passthru) {
273 ; RV32-LABEL: mgather_nxv1i16:
275 ; RV32-NEXT: vsetvli a0, zero, e16, mf4, ta, mu
276 ; RV32-NEXT: vluxei32.v v9, (zero), v8, v0.t
277 ; RV32-NEXT: vmv1r.v v8, v9
280 ; RV64-LABEL: mgather_nxv1i16:
282 ; RV64-NEXT: vsetvli a0, zero, e16, mf4, ta, mu
283 ; RV64-NEXT: vluxei64.v v9, (zero), v8, v0.t
284 ; RV64-NEXT: vmv1r.v v8, v9
286 %v = call <vscale x 1 x i16> @llvm.masked.gather.nxv1i16.nxv1p0(<vscale x 1 x ptr> %ptrs, i32 2, <vscale x 1 x i1> %m, <vscale x 1 x i16> %passthru)
287 ret <vscale x 1 x i16> %v
290 declare <vscale x 2 x i16> @llvm.masked.gather.nxv2i16.nxv2p0(<vscale x 2 x ptr>, i32, <vscale x 2 x i1>, <vscale x 2 x i16>)
292 define <vscale x 2 x i16> @mgather_nxv2i16(<vscale x 2 x ptr> %ptrs, <vscale x 2 x i1> %m, <vscale x 2 x i16> %passthru) {
293 ; RV32-LABEL: mgather_nxv2i16:
295 ; RV32-NEXT: vsetvli a0, zero, e16, mf2, ta, mu
296 ; RV32-NEXT: vluxei32.v v9, (zero), v8, v0.t
297 ; RV32-NEXT: vmv1r.v v8, v9
300 ; RV64-LABEL: mgather_nxv2i16:
302 ; RV64-NEXT: vsetvli a0, zero, e16, mf2, ta, mu
303 ; RV64-NEXT: vluxei64.v v10, (zero), v8, v0.t
304 ; RV64-NEXT: vmv1r.v v8, v10
306 %v = call <vscale x 2 x i16> @llvm.masked.gather.nxv2i16.nxv2p0(<vscale x 2 x ptr> %ptrs, i32 2, <vscale x 2 x i1> %m, <vscale x 2 x i16> %passthru)
307 ret <vscale x 2 x i16> %v
310 define <vscale x 2 x i32> @mgather_nxv2i16_sextload_nxv2i32(<vscale x 2 x ptr> %ptrs, <vscale x 2 x i1> %m, <vscale x 2 x i16> %passthru) {
311 ; RV32-LABEL: mgather_nxv2i16_sextload_nxv2i32:
313 ; RV32-NEXT: vsetvli a0, zero, e16, mf2, ta, mu
314 ; RV32-NEXT: vluxei32.v v9, (zero), v8, v0.t
315 ; RV32-NEXT: vsetvli zero, zero, e32, m1, ta, ma
316 ; RV32-NEXT: vsext.vf2 v8, v9
319 ; RV64-LABEL: mgather_nxv2i16_sextload_nxv2i32:
321 ; RV64-NEXT: vsetvli a0, zero, e16, mf2, ta, mu
322 ; RV64-NEXT: vluxei64.v v10, (zero), v8, v0.t
323 ; RV64-NEXT: vsetvli zero, zero, e32, m1, ta, ma
324 ; RV64-NEXT: vsext.vf2 v8, v10
326 %v = call <vscale x 2 x i16> @llvm.masked.gather.nxv2i16.nxv2p0(<vscale x 2 x ptr> %ptrs, i32 2, <vscale x 2 x i1> %m, <vscale x 2 x i16> %passthru)
327 %ev = sext <vscale x 2 x i16> %v to <vscale x 2 x i32>
328 ret <vscale x 2 x i32> %ev
331 define <vscale x 2 x i32> @mgather_nxv2i16_zextload_nxv2i32(<vscale x 2 x ptr> %ptrs, <vscale x 2 x i1> %m, <vscale x 2 x i16> %passthru) {
332 ; RV32-LABEL: mgather_nxv2i16_zextload_nxv2i32:
334 ; RV32-NEXT: vsetvli a0, zero, e16, mf2, ta, mu
335 ; RV32-NEXT: vluxei32.v v9, (zero), v8, v0.t
336 ; RV32-NEXT: vsetvli zero, zero, e32, m1, ta, ma
337 ; RV32-NEXT: vzext.vf2 v8, v9
340 ; RV64-LABEL: mgather_nxv2i16_zextload_nxv2i32:
342 ; RV64-NEXT: vsetvli a0, zero, e16, mf2, ta, mu
343 ; RV64-NEXT: vluxei64.v v10, (zero), v8, v0.t
344 ; RV64-NEXT: vsetvli zero, zero, e32, m1, ta, ma
345 ; RV64-NEXT: vzext.vf2 v8, v10
347 %v = call <vscale x 2 x i16> @llvm.masked.gather.nxv2i16.nxv2p0(<vscale x 2 x ptr> %ptrs, i32 2, <vscale x 2 x i1> %m, <vscale x 2 x i16> %passthru)
348 %ev = zext <vscale x 2 x i16> %v to <vscale x 2 x i32>
349 ret <vscale x 2 x i32> %ev
352 define <vscale x 2 x i64> @mgather_nxv2i16_sextload_nxv2i64(<vscale x 2 x ptr> %ptrs, <vscale x 2 x i1> %m, <vscale x 2 x i16> %passthru) {
353 ; RV32-LABEL: mgather_nxv2i16_sextload_nxv2i64:
355 ; RV32-NEXT: vsetvli a0, zero, e16, mf2, ta, mu
356 ; RV32-NEXT: vluxei32.v v9, (zero), v8, v0.t
357 ; RV32-NEXT: vsetvli zero, zero, e64, m2, ta, ma
358 ; RV32-NEXT: vsext.vf4 v10, v9
359 ; RV32-NEXT: vmv.v.v v8, v10
362 ; RV64-LABEL: mgather_nxv2i16_sextload_nxv2i64:
364 ; RV64-NEXT: vsetvli a0, zero, e16, mf2, ta, mu
365 ; RV64-NEXT: vluxei64.v v10, (zero), v8, v0.t
366 ; RV64-NEXT: vsetvli zero, zero, e64, m2, ta, ma
367 ; RV64-NEXT: vsext.vf4 v8, v10
369 %v = call <vscale x 2 x i16> @llvm.masked.gather.nxv2i16.nxv2p0(<vscale x 2 x ptr> %ptrs, i32 2, <vscale x 2 x i1> %m, <vscale x 2 x i16> %passthru)
370 %ev = sext <vscale x 2 x i16> %v to <vscale x 2 x i64>
371 ret <vscale x 2 x i64> %ev
374 define <vscale x 2 x i64> @mgather_nxv2i16_zextload_nxv2i64(<vscale x 2 x ptr> %ptrs, <vscale x 2 x i1> %m, <vscale x 2 x i16> %passthru) {
375 ; RV32-LABEL: mgather_nxv2i16_zextload_nxv2i64:
377 ; RV32-NEXT: vsetvli a0, zero, e16, mf2, ta, mu
378 ; RV32-NEXT: vluxei32.v v9, (zero), v8, v0.t
379 ; RV32-NEXT: vsetvli zero, zero, e64, m2, ta, ma
380 ; RV32-NEXT: vzext.vf4 v10, v9
381 ; RV32-NEXT: vmv.v.v v8, v10
384 ; RV64-LABEL: mgather_nxv2i16_zextload_nxv2i64:
386 ; RV64-NEXT: vsetvli a0, zero, e16, mf2, ta, mu
387 ; RV64-NEXT: vluxei64.v v10, (zero), v8, v0.t
388 ; RV64-NEXT: vsetvli zero, zero, e64, m2, ta, ma
389 ; RV64-NEXT: vzext.vf4 v8, v10
391 %v = call <vscale x 2 x i16> @llvm.masked.gather.nxv2i16.nxv2p0(<vscale x 2 x ptr> %ptrs, i32 2, <vscale x 2 x i1> %m, <vscale x 2 x i16> %passthru)
392 %ev = zext <vscale x 2 x i16> %v to <vscale x 2 x i64>
393 ret <vscale x 2 x i64> %ev
396 declare <vscale x 4 x i16> @llvm.masked.gather.nxv4i16.nxv4p0(<vscale x 4 x ptr>, i32, <vscale x 4 x i1>, <vscale x 4 x i16>)
398 define <vscale x 4 x i16> @mgather_nxv4i16(<vscale x 4 x ptr> %ptrs, <vscale x 4 x i1> %m, <vscale x 4 x i16> %passthru) {
399 ; RV32-LABEL: mgather_nxv4i16:
401 ; RV32-NEXT: vsetvli a0, zero, e16, m1, ta, mu
402 ; RV32-NEXT: vluxei32.v v10, (zero), v8, v0.t
403 ; RV32-NEXT: vmv.v.v v8, v10
406 ; RV64-LABEL: mgather_nxv4i16:
408 ; RV64-NEXT: vsetvli a0, zero, e16, m1, ta, mu
409 ; RV64-NEXT: vluxei64.v v12, (zero), v8, v0.t
410 ; RV64-NEXT: vmv.v.v v8, v12
412 %v = call <vscale x 4 x i16> @llvm.masked.gather.nxv4i16.nxv4p0(<vscale x 4 x ptr> %ptrs, i32 2, <vscale x 4 x i1> %m, <vscale x 4 x i16> %passthru)
413 ret <vscale x 4 x i16> %v
416 define <vscale x 4 x i16> @mgather_truemask_nxv4i16(<vscale x 4 x ptr> %ptrs, <vscale x 4 x i16> %passthru) {
417 ; RV32-LABEL: mgather_truemask_nxv4i16:
419 ; RV32-NEXT: vsetvli a0, zero, e16, m1, ta, ma
420 ; RV32-NEXT: vluxei32.v v10, (zero), v8
421 ; RV32-NEXT: vmv.v.v v8, v10
424 ; RV64-LABEL: mgather_truemask_nxv4i16:
426 ; RV64-NEXT: vsetvli a0, zero, e16, m1, ta, ma
427 ; RV64-NEXT: vluxei64.v v12, (zero), v8
428 ; RV64-NEXT: vmv.v.v v8, v12
430 %v = call <vscale x 4 x i16> @llvm.masked.gather.nxv4i16.nxv4p0(<vscale x 4 x ptr> %ptrs, i32 2, <vscale x 4 x i1> splat (i1 1), <vscale x 4 x i16> %passthru)
431 ret <vscale x 4 x i16> %v
434 define <vscale x 4 x i16> @mgather_falsemask_nxv4i16(<vscale x 4 x ptr> %ptrs, <vscale x 4 x i16> %passthru) {
435 ; RV32-LABEL: mgather_falsemask_nxv4i16:
437 ; RV32-NEXT: vmv1r.v v8, v10
440 ; RV64-LABEL: mgather_falsemask_nxv4i16:
442 ; RV64-NEXT: vmv1r.v v8, v12
444 %v = call <vscale x 4 x i16> @llvm.masked.gather.nxv4i16.nxv4p0(<vscale x 4 x ptr> %ptrs, i32 2, <vscale x 4 x i1> zeroinitializer, <vscale x 4 x i16> %passthru)
445 ret <vscale x 4 x i16> %v
448 declare <vscale x 8 x i16> @llvm.masked.gather.nxv8i16.nxv8p0(<vscale x 8 x ptr>, i32, <vscale x 8 x i1>, <vscale x 8 x i16>)
450 define <vscale x 8 x i16> @mgather_nxv8i16(<vscale x 8 x ptr> %ptrs, <vscale x 8 x i1> %m, <vscale x 8 x i16> %passthru) {
451 ; RV32-LABEL: mgather_nxv8i16:
453 ; RV32-NEXT: vsetvli a0, zero, e16, m2, ta, mu
454 ; RV32-NEXT: vluxei32.v v12, (zero), v8, v0.t
455 ; RV32-NEXT: vmv.v.v v8, v12
458 ; RV64-LABEL: mgather_nxv8i16:
460 ; RV64-NEXT: vsetvli a0, zero, e16, m2, ta, mu
461 ; RV64-NEXT: vluxei64.v v16, (zero), v8, v0.t
462 ; RV64-NEXT: vmv.v.v v8, v16
464 %v = call <vscale x 8 x i16> @llvm.masked.gather.nxv8i16.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 2, <vscale x 8 x i1> %m, <vscale x 8 x i16> %passthru)
465 ret <vscale x 8 x i16> %v
468 define <vscale x 8 x i16> @mgather_baseidx_nxv8i8_nxv8i16(ptr %base, <vscale x 8 x i8> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x i16> %passthru) {
469 ; RV32-LABEL: mgather_baseidx_nxv8i8_nxv8i16:
471 ; RV32-NEXT: vsetvli a1, zero, e32, m4, ta, ma
472 ; RV32-NEXT: vsext.vf4 v12, v8
473 ; RV32-NEXT: vadd.vv v12, v12, v12
474 ; RV32-NEXT: vsetvli zero, zero, e16, m2, ta, mu
475 ; RV32-NEXT: vluxei32.v v10, (a0), v12, v0.t
476 ; RV32-NEXT: vmv.v.v v8, v10
479 ; RV64-LABEL: mgather_baseidx_nxv8i8_nxv8i16:
481 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, ma
482 ; RV64-NEXT: vsext.vf8 v16, v8
483 ; RV64-NEXT: vadd.vv v16, v16, v16
484 ; RV64-NEXT: vsetvli zero, zero, e16, m2, ta, mu
485 ; RV64-NEXT: vluxei64.v v10, (a0), v16, v0.t
486 ; RV64-NEXT: vmv.v.v v8, v10
488 %ptrs = getelementptr inbounds i16, ptr %base, <vscale x 8 x i8> %idxs
489 %v = call <vscale x 8 x i16> @llvm.masked.gather.nxv8i16.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 2, <vscale x 8 x i1> %m, <vscale x 8 x i16> %passthru)
490 ret <vscale x 8 x i16> %v
493 define <vscale x 8 x i16> @mgather_baseidx_sext_nxv8i8_nxv8i16(ptr %base, <vscale x 8 x i8> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x i16> %passthru) {
494 ; RV32-LABEL: mgather_baseidx_sext_nxv8i8_nxv8i16:
496 ; RV32-NEXT: vsetvli a1, zero, e32, m4, ta, ma
497 ; RV32-NEXT: vsext.vf4 v12, v8
498 ; RV32-NEXT: vadd.vv v12, v12, v12
499 ; RV32-NEXT: vsetvli zero, zero, e16, m2, ta, mu
500 ; RV32-NEXT: vluxei32.v v10, (a0), v12, v0.t
501 ; RV32-NEXT: vmv.v.v v8, v10
504 ; RV64-LABEL: mgather_baseidx_sext_nxv8i8_nxv8i16:
506 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, ma
507 ; RV64-NEXT: vsext.vf8 v16, v8
508 ; RV64-NEXT: vadd.vv v16, v16, v16
509 ; RV64-NEXT: vsetvli zero, zero, e16, m2, ta, mu
510 ; RV64-NEXT: vluxei64.v v10, (a0), v16, v0.t
511 ; RV64-NEXT: vmv.v.v v8, v10
513 %eidxs = sext <vscale x 8 x i8> %idxs to <vscale x 8 x i16>
514 %ptrs = getelementptr inbounds i16, ptr %base, <vscale x 8 x i16> %eidxs
515 %v = call <vscale x 8 x i16> @llvm.masked.gather.nxv8i16.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 2, <vscale x 8 x i1> %m, <vscale x 8 x i16> %passthru)
516 ret <vscale x 8 x i16> %v
519 define <vscale x 8 x i16> @mgather_baseidx_zext_nxv8i8_nxv8i16(ptr %base, <vscale x 8 x i8> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x i16> %passthru) {
520 ; CHECK-LABEL: mgather_baseidx_zext_nxv8i8_nxv8i16:
522 ; CHECK-NEXT: vsetvli a1, zero, e8, m1, ta, ma
523 ; CHECK-NEXT: vwaddu.vv v12, v8, v8
524 ; CHECK-NEXT: vsetvli zero, zero, e16, m2, ta, mu
525 ; CHECK-NEXT: vluxei16.v v10, (a0), v12, v0.t
526 ; CHECK-NEXT: vmv.v.v v8, v10
528 %eidxs = zext <vscale x 8 x i8> %idxs to <vscale x 8 x i16>
529 %ptrs = getelementptr inbounds i16, ptr %base, <vscale x 8 x i16> %eidxs
530 %v = call <vscale x 8 x i16> @llvm.masked.gather.nxv8i16.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 2, <vscale x 8 x i1> %m, <vscale x 8 x i16> %passthru)
531 ret <vscale x 8 x i16> %v
534 define <vscale x 8 x i16> @mgather_baseidx_nxv8i16(ptr %base, <vscale x 8 x i16> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x i16> %passthru) {
535 ; RV32-LABEL: mgather_baseidx_nxv8i16:
537 ; RV32-NEXT: vsetvli a1, zero, e16, m2, ta, mu
538 ; RV32-NEXT: vwadd.vv v12, v8, v8
539 ; RV32-NEXT: vluxei32.v v10, (a0), v12, v0.t
540 ; RV32-NEXT: vmv.v.v v8, v10
543 ; RV64-LABEL: mgather_baseidx_nxv8i16:
545 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, ma
546 ; RV64-NEXT: vsext.vf4 v16, v8
547 ; RV64-NEXT: vadd.vv v16, v16, v16
548 ; RV64-NEXT: vsetvli zero, zero, e16, m2, ta, mu
549 ; RV64-NEXT: vluxei64.v v10, (a0), v16, v0.t
550 ; RV64-NEXT: vmv.v.v v8, v10
552 %ptrs = getelementptr inbounds i16, ptr %base, <vscale x 8 x i16> %idxs
553 %v = call <vscale x 8 x i16> @llvm.masked.gather.nxv8i16.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 2, <vscale x 8 x i1> %m, <vscale x 8 x i16> %passthru)
554 ret <vscale x 8 x i16> %v
557 declare <vscale x 1 x i32> @llvm.masked.gather.nxv1i32.nxv1p0(<vscale x 1 x ptr>, i32, <vscale x 1 x i1>, <vscale x 1 x i32>)
559 define <vscale x 1 x i32> @mgather_nxv1i32(<vscale x 1 x ptr> %ptrs, <vscale x 1 x i1> %m, <vscale x 1 x i32> %passthru) {
560 ; RV32-LABEL: mgather_nxv1i32:
562 ; RV32-NEXT: vsetvli a0, zero, e32, mf2, ta, mu
563 ; RV32-NEXT: vluxei32.v v9, (zero), v8, v0.t
564 ; RV32-NEXT: vmv1r.v v8, v9
567 ; RV64-LABEL: mgather_nxv1i32:
569 ; RV64-NEXT: vsetvli a0, zero, e32, mf2, ta, mu
570 ; RV64-NEXT: vluxei64.v v9, (zero), v8, v0.t
571 ; RV64-NEXT: vmv1r.v v8, v9
573 %v = call <vscale x 1 x i32> @llvm.masked.gather.nxv1i32.nxv1p0(<vscale x 1 x ptr> %ptrs, i32 4, <vscale x 1 x i1> %m, <vscale x 1 x i32> %passthru)
574 ret <vscale x 1 x i32> %v
577 declare <vscale x 2 x i32> @llvm.masked.gather.nxv2i32.nxv2p0(<vscale x 2 x ptr>, i32, <vscale x 2 x i1>, <vscale x 2 x i32>)
579 define <vscale x 2 x i32> @mgather_nxv2i32(<vscale x 2 x ptr> %ptrs, <vscale x 2 x i1> %m, <vscale x 2 x i32> %passthru) {
580 ; RV32-LABEL: mgather_nxv2i32:
582 ; RV32-NEXT: vsetvli a0, zero, e32, m1, ta, mu
583 ; RV32-NEXT: vluxei32.v v9, (zero), v8, v0.t
584 ; RV32-NEXT: vmv.v.v v8, v9
587 ; RV64-LABEL: mgather_nxv2i32:
589 ; RV64-NEXT: vsetvli a0, zero, e32, m1, ta, mu
590 ; RV64-NEXT: vluxei64.v v10, (zero), v8, v0.t
591 ; RV64-NEXT: vmv.v.v v8, v10
593 %v = call <vscale x 2 x i32> @llvm.masked.gather.nxv2i32.nxv2p0(<vscale x 2 x ptr> %ptrs, i32 4, <vscale x 2 x i1> %m, <vscale x 2 x i32> %passthru)
594 ret <vscale x 2 x i32> %v
597 define <vscale x 2 x i64> @mgather_nxv2i32_sextload_nxv2i64(<vscale x 2 x ptr> %ptrs, <vscale x 2 x i1> %m, <vscale x 2 x i32> %passthru) {
598 ; RV32-LABEL: mgather_nxv2i32_sextload_nxv2i64:
600 ; RV32-NEXT: vsetvli a0, zero, e32, m1, ta, mu
601 ; RV32-NEXT: vluxei32.v v9, (zero), v8, v0.t
602 ; RV32-NEXT: vsetvli zero, zero, e64, m2, ta, ma
603 ; RV32-NEXT: vsext.vf2 v10, v9
604 ; RV32-NEXT: vmv.v.v v8, v10
607 ; RV64-LABEL: mgather_nxv2i32_sextload_nxv2i64:
609 ; RV64-NEXT: vsetvli a0, zero, e32, m1, ta, mu
610 ; RV64-NEXT: vluxei64.v v10, (zero), v8, v0.t
611 ; RV64-NEXT: vsetvli zero, zero, e64, m2, ta, ma
612 ; RV64-NEXT: vsext.vf2 v8, v10
614 %v = call <vscale x 2 x i32> @llvm.masked.gather.nxv2i32.nxv2p0(<vscale x 2 x ptr> %ptrs, i32 4, <vscale x 2 x i1> %m, <vscale x 2 x i32> %passthru)
615 %ev = sext <vscale x 2 x i32> %v to <vscale x 2 x i64>
616 ret <vscale x 2 x i64> %ev
619 define <vscale x 2 x i64> @mgather_nxv2i32_zextload_nxv2i64(<vscale x 2 x ptr> %ptrs, <vscale x 2 x i1> %m, <vscale x 2 x i32> %passthru) {
620 ; RV32-LABEL: mgather_nxv2i32_zextload_nxv2i64:
622 ; RV32-NEXT: vsetvli a0, zero, e32, m1, ta, mu
623 ; RV32-NEXT: vluxei32.v v9, (zero), v8, v0.t
624 ; RV32-NEXT: vsetvli zero, zero, e64, m2, ta, ma
625 ; RV32-NEXT: vzext.vf2 v10, v9
626 ; RV32-NEXT: vmv.v.v v8, v10
629 ; RV64-LABEL: mgather_nxv2i32_zextload_nxv2i64:
631 ; RV64-NEXT: vsetvli a0, zero, e32, m1, ta, mu
632 ; RV64-NEXT: vluxei64.v v10, (zero), v8, v0.t
633 ; RV64-NEXT: vsetvli zero, zero, e64, m2, ta, ma
634 ; RV64-NEXT: vzext.vf2 v8, v10
636 %v = call <vscale x 2 x i32> @llvm.masked.gather.nxv2i32.nxv2p0(<vscale x 2 x ptr> %ptrs, i32 4, <vscale x 2 x i1> %m, <vscale x 2 x i32> %passthru)
637 %ev = zext <vscale x 2 x i32> %v to <vscale x 2 x i64>
638 ret <vscale x 2 x i64> %ev
641 declare <vscale x 4 x i32> @llvm.masked.gather.nxv4i32.nxv4p0(<vscale x 4 x ptr>, i32, <vscale x 4 x i1>, <vscale x 4 x i32>)
643 define <vscale x 4 x i32> @mgather_nxv4i32(<vscale x 4 x ptr> %ptrs, <vscale x 4 x i1> %m, <vscale x 4 x i32> %passthru) {
644 ; RV32-LABEL: mgather_nxv4i32:
646 ; RV32-NEXT: vsetvli a0, zero, e32, m2, ta, mu
647 ; RV32-NEXT: vluxei32.v v10, (zero), v8, v0.t
648 ; RV32-NEXT: vmv.v.v v8, v10
651 ; RV64-LABEL: mgather_nxv4i32:
653 ; RV64-NEXT: vsetvli a0, zero, e32, m2, ta, mu
654 ; RV64-NEXT: vluxei64.v v12, (zero), v8, v0.t
655 ; RV64-NEXT: vmv.v.v v8, v12
657 %v = call <vscale x 4 x i32> @llvm.masked.gather.nxv4i32.nxv4p0(<vscale x 4 x ptr> %ptrs, i32 4, <vscale x 4 x i1> %m, <vscale x 4 x i32> %passthru)
658 ret <vscale x 4 x i32> %v
661 define <vscale x 4 x i32> @mgather_truemask_nxv4i32(<vscale x 4 x ptr> %ptrs, <vscale x 4 x i32> %passthru) {
662 ; RV32-LABEL: mgather_truemask_nxv4i32:
664 ; RV32-NEXT: vsetvli a0, zero, e32, m2, ta, ma
665 ; RV32-NEXT: vluxei32.v v8, (zero), v8
668 ; RV64-LABEL: mgather_truemask_nxv4i32:
670 ; RV64-NEXT: vsetvli a0, zero, e32, m2, ta, ma
671 ; RV64-NEXT: vluxei64.v v12, (zero), v8
672 ; RV64-NEXT: vmv.v.v v8, v12
674 %v = call <vscale x 4 x i32> @llvm.masked.gather.nxv4i32.nxv4p0(<vscale x 4 x ptr> %ptrs, i32 4, <vscale x 4 x i1> splat (i1 1), <vscale x 4 x i32> %passthru)
675 ret <vscale x 4 x i32> %v
678 define <vscale x 4 x i32> @mgather_falsemask_nxv4i32(<vscale x 4 x ptr> %ptrs, <vscale x 4 x i32> %passthru) {
679 ; RV32-LABEL: mgather_falsemask_nxv4i32:
681 ; RV32-NEXT: vmv2r.v v8, v10
684 ; RV64-LABEL: mgather_falsemask_nxv4i32:
686 ; RV64-NEXT: vmv2r.v v8, v12
688 %v = call <vscale x 4 x i32> @llvm.masked.gather.nxv4i32.nxv4p0(<vscale x 4 x ptr> %ptrs, i32 4, <vscale x 4 x i1> zeroinitializer, <vscale x 4 x i32> %passthru)
689 ret <vscale x 4 x i32> %v
692 declare <vscale x 8 x i32> @llvm.masked.gather.nxv8i32.nxv8p0(<vscale x 8 x ptr>, i32, <vscale x 8 x i1>, <vscale x 8 x i32>)
694 define <vscale x 8 x i32> @mgather_nxv8i32(<vscale x 8 x ptr> %ptrs, <vscale x 8 x i1> %m, <vscale x 8 x i32> %passthru) {
695 ; RV32-LABEL: mgather_nxv8i32:
697 ; RV32-NEXT: vsetvli a0, zero, e32, m4, ta, mu
698 ; RV32-NEXT: vluxei32.v v12, (zero), v8, v0.t
699 ; RV32-NEXT: vmv.v.v v8, v12
702 ; RV64-LABEL: mgather_nxv8i32:
704 ; RV64-NEXT: vsetvli a0, zero, e32, m4, ta, mu
705 ; RV64-NEXT: vluxei64.v v16, (zero), v8, v0.t
706 ; RV64-NEXT: vmv.v.v v8, v16
708 %v = call <vscale x 8 x i32> @llvm.masked.gather.nxv8i32.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 4, <vscale x 8 x i1> %m, <vscale x 8 x i32> %passthru)
709 ret <vscale x 8 x i32> %v
712 define <vscale x 8 x i32> @mgather_baseidx_nxv8i8_nxv8i32(ptr %base, <vscale x 8 x i8> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x i32> %passthru) {
713 ; RV32-LABEL: mgather_baseidx_nxv8i8_nxv8i32:
715 ; RV32-NEXT: vsetvli a1, zero, e32, m4, ta, mu
716 ; RV32-NEXT: vsext.vf4 v16, v8
717 ; RV32-NEXT: vsll.vi v8, v16, 2
718 ; RV32-NEXT: vluxei32.v v12, (a0), v8, v0.t
719 ; RV32-NEXT: vmv.v.v v8, v12
722 ; RV64-LABEL: mgather_baseidx_nxv8i8_nxv8i32:
724 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, ma
725 ; RV64-NEXT: vsext.vf8 v16, v8
726 ; RV64-NEXT: vsll.vi v16, v16, 2
727 ; RV64-NEXT: vsetvli zero, zero, e32, m4, ta, mu
728 ; RV64-NEXT: vluxei64.v v12, (a0), v16, v0.t
729 ; RV64-NEXT: vmv.v.v v8, v12
731 %ptrs = getelementptr inbounds i32, ptr %base, <vscale x 8 x i8> %idxs
732 %v = call <vscale x 8 x i32> @llvm.masked.gather.nxv8i32.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 4, <vscale x 8 x i1> %m, <vscale x 8 x i32> %passthru)
733 ret <vscale x 8 x i32> %v
736 define <vscale x 8 x i32> @mgather_baseidx_sext_nxv8i8_nxv8i32(ptr %base, <vscale x 8 x i8> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x i32> %passthru) {
737 ; RV32-LABEL: mgather_baseidx_sext_nxv8i8_nxv8i32:
739 ; RV32-NEXT: vsetvli a1, zero, e32, m4, ta, mu
740 ; RV32-NEXT: vsext.vf4 v16, v8
741 ; RV32-NEXT: vsll.vi v8, v16, 2
742 ; RV32-NEXT: vluxei32.v v12, (a0), v8, v0.t
743 ; RV32-NEXT: vmv.v.v v8, v12
746 ; RV64-LABEL: mgather_baseidx_sext_nxv8i8_nxv8i32:
748 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, ma
749 ; RV64-NEXT: vsext.vf8 v16, v8
750 ; RV64-NEXT: vsll.vi v16, v16, 2
751 ; RV64-NEXT: vsetvli zero, zero, e32, m4, ta, mu
752 ; RV64-NEXT: vluxei64.v v12, (a0), v16, v0.t
753 ; RV64-NEXT: vmv.v.v v8, v12
755 %eidxs = sext <vscale x 8 x i8> %idxs to <vscale x 8 x i32>
756 %ptrs = getelementptr inbounds i32, ptr %base, <vscale x 8 x i32> %eidxs
757 %v = call <vscale x 8 x i32> @llvm.masked.gather.nxv8i32.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 4, <vscale x 8 x i1> %m, <vscale x 8 x i32> %passthru)
758 ret <vscale x 8 x i32> %v
761 define <vscale x 8 x i32> @mgather_baseidx_zext_nxv8i8_nxv8i32(ptr %base, <vscale x 8 x i8> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x i32> %passthru) {
762 ; CHECK-LABEL: mgather_baseidx_zext_nxv8i8_nxv8i32:
764 ; CHECK-NEXT: vsetvli a1, zero, e16, m2, ta, ma
765 ; CHECK-NEXT: vzext.vf2 v10, v8
766 ; CHECK-NEXT: vsll.vi v8, v10, 2
767 ; CHECK-NEXT: vsetvli zero, zero, e32, m4, ta, mu
768 ; CHECK-NEXT: vluxei16.v v12, (a0), v8, v0.t
769 ; CHECK-NEXT: vmv.v.v v8, v12
771 %eidxs = zext <vscale x 8 x i8> %idxs to <vscale x 8 x i32>
772 %ptrs = getelementptr inbounds i32, ptr %base, <vscale x 8 x i32> %eidxs
773 %v = call <vscale x 8 x i32> @llvm.masked.gather.nxv8i32.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 4, <vscale x 8 x i1> %m, <vscale x 8 x i32> %passthru)
774 ret <vscale x 8 x i32> %v
777 define <vscale x 8 x i32> @mgather_baseidx_nxv8i16_nxv8i32(ptr %base, <vscale x 8 x i16> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x i32> %passthru) {
778 ; RV32-LABEL: mgather_baseidx_nxv8i16_nxv8i32:
780 ; RV32-NEXT: vsetvli a1, zero, e32, m4, ta, mu
781 ; RV32-NEXT: vsext.vf2 v16, v8
782 ; RV32-NEXT: vsll.vi v8, v16, 2
783 ; RV32-NEXT: vluxei32.v v12, (a0), v8, v0.t
784 ; RV32-NEXT: vmv.v.v v8, v12
787 ; RV64-LABEL: mgather_baseidx_nxv8i16_nxv8i32:
789 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, ma
790 ; RV64-NEXT: vsext.vf4 v16, v8
791 ; RV64-NEXT: vsll.vi v16, v16, 2
792 ; RV64-NEXT: vsetvli zero, zero, e32, m4, ta, mu
793 ; RV64-NEXT: vluxei64.v v12, (a0), v16, v0.t
794 ; RV64-NEXT: vmv.v.v v8, v12
796 %ptrs = getelementptr inbounds i32, ptr %base, <vscale x 8 x i16> %idxs
797 %v = call <vscale x 8 x i32> @llvm.masked.gather.nxv8i32.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 4, <vscale x 8 x i1> %m, <vscale x 8 x i32> %passthru)
798 ret <vscale x 8 x i32> %v
801 define <vscale x 8 x i32> @mgather_baseidx_sext_nxv8i16_nxv8i32(ptr %base, <vscale x 8 x i16> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x i32> %passthru) {
802 ; RV32-LABEL: mgather_baseidx_sext_nxv8i16_nxv8i32:
804 ; RV32-NEXT: vsetvli a1, zero, e32, m4, ta, mu
805 ; RV32-NEXT: vsext.vf2 v16, v8
806 ; RV32-NEXT: vsll.vi v8, v16, 2
807 ; RV32-NEXT: vluxei32.v v12, (a0), v8, v0.t
808 ; RV32-NEXT: vmv.v.v v8, v12
811 ; RV64-LABEL: mgather_baseidx_sext_nxv8i16_nxv8i32:
813 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, ma
814 ; RV64-NEXT: vsext.vf4 v16, v8
815 ; RV64-NEXT: vsll.vi v16, v16, 2
816 ; RV64-NEXT: vsetvli zero, zero, e32, m4, ta, mu
817 ; RV64-NEXT: vluxei64.v v12, (a0), v16, v0.t
818 ; RV64-NEXT: vmv.v.v v8, v12
820 %eidxs = sext <vscale x 8 x i16> %idxs to <vscale x 8 x i32>
821 %ptrs = getelementptr inbounds i32, ptr %base, <vscale x 8 x i32> %eidxs
822 %v = call <vscale x 8 x i32> @llvm.masked.gather.nxv8i32.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 4, <vscale x 8 x i1> %m, <vscale x 8 x i32> %passthru)
823 ret <vscale x 8 x i32> %v
826 define <vscale x 8 x i32> @mgather_baseidx_zext_nxv8i16_nxv8i32(ptr %base, <vscale x 8 x i16> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x i32> %passthru) {
827 ; CHECK-LABEL: mgather_baseidx_zext_nxv8i16_nxv8i32:
829 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, mu
830 ; CHECK-NEXT: vzext.vf2 v16, v8
831 ; CHECK-NEXT: vsll.vi v8, v16, 2
832 ; CHECK-NEXT: vluxei32.v v12, (a0), v8, v0.t
833 ; CHECK-NEXT: vmv.v.v v8, v12
835 %eidxs = zext <vscale x 8 x i16> %idxs to <vscale x 8 x i32>
836 %ptrs = getelementptr inbounds i32, ptr %base, <vscale x 8 x i32> %eidxs
837 %v = call <vscale x 8 x i32> @llvm.masked.gather.nxv8i32.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 4, <vscale x 8 x i1> %m, <vscale x 8 x i32> %passthru)
838 ret <vscale x 8 x i32> %v
841 define <vscale x 8 x i32> @mgather_baseidx_nxv8i32(ptr %base, <vscale x 8 x i32> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x i32> %passthru) {
842 ; RV32-LABEL: mgather_baseidx_nxv8i32:
844 ; RV32-NEXT: vsetvli a1, zero, e32, m4, ta, mu
845 ; RV32-NEXT: vsll.vi v8, v8, 2
846 ; RV32-NEXT: vluxei32.v v12, (a0), v8, v0.t
847 ; RV32-NEXT: vmv.v.v v8, v12
850 ; RV64-LABEL: mgather_baseidx_nxv8i32:
852 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, ma
853 ; RV64-NEXT: vsext.vf2 v16, v8
854 ; RV64-NEXT: vsll.vi v16, v16, 2
855 ; RV64-NEXT: vsetvli zero, zero, e32, m4, ta, mu
856 ; RV64-NEXT: vluxei64.v v12, (a0), v16, v0.t
857 ; RV64-NEXT: vmv.v.v v8, v12
859 %ptrs = getelementptr inbounds i32, ptr %base, <vscale x 8 x i32> %idxs
860 %v = call <vscale x 8 x i32> @llvm.masked.gather.nxv8i32.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 4, <vscale x 8 x i1> %m, <vscale x 8 x i32> %passthru)
861 ret <vscale x 8 x i32> %v
864 declare <vscale x 1 x i64> @llvm.masked.gather.nxv1i64.nxv1p0(<vscale x 1 x ptr>, i32, <vscale x 1 x i1>, <vscale x 1 x i64>)
866 define <vscale x 1 x i64> @mgather_nxv1i64(<vscale x 1 x ptr> %ptrs, <vscale x 1 x i1> %m, <vscale x 1 x i64> %passthru) {
867 ; RV32-LABEL: mgather_nxv1i64:
869 ; RV32-NEXT: vsetvli a0, zero, e64, m1, ta, mu
870 ; RV32-NEXT: vluxei32.v v9, (zero), v8, v0.t
871 ; RV32-NEXT: vmv.v.v v8, v9
874 ; RV64-LABEL: mgather_nxv1i64:
876 ; RV64-NEXT: vsetvli a0, zero, e64, m1, ta, mu
877 ; RV64-NEXT: vluxei64.v v9, (zero), v8, v0.t
878 ; RV64-NEXT: vmv.v.v v8, v9
880 %v = call <vscale x 1 x i64> @llvm.masked.gather.nxv1i64.nxv1p0(<vscale x 1 x ptr> %ptrs, i32 8, <vscale x 1 x i1> %m, <vscale x 1 x i64> %passthru)
881 ret <vscale x 1 x i64> %v
884 declare <vscale x 2 x i64> @llvm.masked.gather.nxv2i64.nxv2p0(<vscale x 2 x ptr>, i32, <vscale x 2 x i1>, <vscale x 2 x i64>)
886 define <vscale x 2 x i64> @mgather_nxv2i64(<vscale x 2 x ptr> %ptrs, <vscale x 2 x i1> %m, <vscale x 2 x i64> %passthru) {
887 ; RV32-LABEL: mgather_nxv2i64:
889 ; RV32-NEXT: vsetvli a0, zero, e64, m2, ta, mu
890 ; RV32-NEXT: vluxei32.v v10, (zero), v8, v0.t
891 ; RV32-NEXT: vmv.v.v v8, v10
894 ; RV64-LABEL: mgather_nxv2i64:
896 ; RV64-NEXT: vsetvli a0, zero, e64, m2, ta, mu
897 ; RV64-NEXT: vluxei64.v v10, (zero), v8, v0.t
898 ; RV64-NEXT: vmv.v.v v8, v10
900 %v = call <vscale x 2 x i64> @llvm.masked.gather.nxv2i64.nxv2p0(<vscale x 2 x ptr> %ptrs, i32 8, <vscale x 2 x i1> %m, <vscale x 2 x i64> %passthru)
901 ret <vscale x 2 x i64> %v
904 declare <vscale x 4 x i64> @llvm.masked.gather.nxv4i64.nxv4p0(<vscale x 4 x ptr>, i32, <vscale x 4 x i1>, <vscale x 4 x i64>)
906 define <vscale x 4 x i64> @mgather_nxv4i64(<vscale x 4 x ptr> %ptrs, <vscale x 4 x i1> %m, <vscale x 4 x i64> %passthru) {
907 ; RV32-LABEL: mgather_nxv4i64:
909 ; RV32-NEXT: vsetvli a0, zero, e64, m4, ta, mu
910 ; RV32-NEXT: vluxei32.v v12, (zero), v8, v0.t
911 ; RV32-NEXT: vmv.v.v v8, v12
914 ; RV64-LABEL: mgather_nxv4i64:
916 ; RV64-NEXT: vsetvli a0, zero, e64, m4, ta, mu
917 ; RV64-NEXT: vluxei64.v v12, (zero), v8, v0.t
918 ; RV64-NEXT: vmv.v.v v8, v12
920 %v = call <vscale x 4 x i64> @llvm.masked.gather.nxv4i64.nxv4p0(<vscale x 4 x ptr> %ptrs, i32 8, <vscale x 4 x i1> %m, <vscale x 4 x i64> %passthru)
921 ret <vscale x 4 x i64> %v
924 define <vscale x 4 x i64> @mgather_truemask_nxv4i64(<vscale x 4 x ptr> %ptrs, <vscale x 4 x i64> %passthru) {
925 ; RV32-LABEL: mgather_truemask_nxv4i64:
927 ; RV32-NEXT: vsetvli a0, zero, e64, m4, ta, ma
928 ; RV32-NEXT: vluxei32.v v12, (zero), v8
929 ; RV32-NEXT: vmv.v.v v8, v12
932 ; RV64-LABEL: mgather_truemask_nxv4i64:
934 ; RV64-NEXT: vsetvli a0, zero, e64, m4, ta, ma
935 ; RV64-NEXT: vluxei64.v v8, (zero), v8
937 %v = call <vscale x 4 x i64> @llvm.masked.gather.nxv4i64.nxv4p0(<vscale x 4 x ptr> %ptrs, i32 8, <vscale x 4 x i1> splat (i1 1), <vscale x 4 x i64> %passthru)
938 ret <vscale x 4 x i64> %v
941 define <vscale x 4 x i64> @mgather_falsemask_nxv4i64(<vscale x 4 x ptr> %ptrs, <vscale x 4 x i64> %passthru) {
942 ; CHECK-LABEL: mgather_falsemask_nxv4i64:
944 ; CHECK-NEXT: vmv4r.v v8, v12
946 %v = call <vscale x 4 x i64> @llvm.masked.gather.nxv4i64.nxv4p0(<vscale x 4 x ptr> %ptrs, i32 8, <vscale x 4 x i1> zeroinitializer, <vscale x 4 x i64> %passthru)
947 ret <vscale x 4 x i64> %v
950 declare <vscale x 8 x i64> @llvm.masked.gather.nxv8i64.nxv8p0(<vscale x 8 x ptr>, i32, <vscale x 8 x i1>, <vscale x 8 x i64>)
952 define <vscale x 8 x i64> @mgather_nxv8i64(<vscale x 8 x ptr> %ptrs, <vscale x 8 x i1> %m, <vscale x 8 x i64> %passthru) {
953 ; RV32-LABEL: mgather_nxv8i64:
955 ; RV32-NEXT: vsetvli a0, zero, e64, m8, ta, mu
956 ; RV32-NEXT: vluxei32.v v16, (zero), v8, v0.t
957 ; RV32-NEXT: vmv.v.v v8, v16
960 ; RV64-LABEL: mgather_nxv8i64:
962 ; RV64-NEXT: vsetvli a0, zero, e64, m8, ta, mu
963 ; RV64-NEXT: vluxei64.v v16, (zero), v8, v0.t
964 ; RV64-NEXT: vmv.v.v v8, v16
966 %v = call <vscale x 8 x i64> @llvm.masked.gather.nxv8i64.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 8, <vscale x 8 x i1> %m, <vscale x 8 x i64> %passthru)
967 ret <vscale x 8 x i64> %v
970 define <vscale x 8 x i64> @mgather_baseidx_nxv8i8_nxv8i64(ptr %base, <vscale x 8 x i8> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x i64> %passthru) {
971 ; RV32-LABEL: mgather_baseidx_nxv8i8_nxv8i64:
973 ; RV32-NEXT: vsetvli a1, zero, e32, m4, ta, ma
974 ; RV32-NEXT: vsext.vf4 v12, v8
975 ; RV32-NEXT: vsll.vi v8, v12, 3
976 ; RV32-NEXT: vsetvli zero, zero, e64, m8, ta, mu
977 ; RV32-NEXT: vluxei32.v v16, (a0), v8, v0.t
978 ; RV32-NEXT: vmv.v.v v8, v16
981 ; RV64-LABEL: mgather_baseidx_nxv8i8_nxv8i64:
983 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, mu
984 ; RV64-NEXT: vsext.vf8 v24, v8
985 ; RV64-NEXT: vsll.vi v8, v24, 3
986 ; RV64-NEXT: vluxei64.v v16, (a0), v8, v0.t
987 ; RV64-NEXT: vmv.v.v v8, v16
989 %ptrs = getelementptr inbounds i64, ptr %base, <vscale x 8 x i8> %idxs
990 %v = call <vscale x 8 x i64> @llvm.masked.gather.nxv8i64.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 8, <vscale x 8 x i1> %m, <vscale x 8 x i64> %passthru)
991 ret <vscale x 8 x i64> %v
994 define <vscale x 8 x i64> @mgather_baseidx_sext_nxv8i8_nxv8i64(ptr %base, <vscale x 8 x i8> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x i64> %passthru) {
995 ; RV32-LABEL: mgather_baseidx_sext_nxv8i8_nxv8i64:
997 ; RV32-NEXT: vsetvli a1, zero, e32, m4, ta, ma
998 ; RV32-NEXT: vsext.vf4 v12, v8
999 ; RV32-NEXT: vsll.vi v8, v12, 3
1000 ; RV32-NEXT: vsetvli zero, zero, e64, m8, ta, mu
1001 ; RV32-NEXT: vluxei32.v v16, (a0), v8, v0.t
1002 ; RV32-NEXT: vmv.v.v v8, v16
1005 ; RV64-LABEL: mgather_baseidx_sext_nxv8i8_nxv8i64:
1007 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, mu
1008 ; RV64-NEXT: vsext.vf8 v24, v8
1009 ; RV64-NEXT: vsll.vi v8, v24, 3
1010 ; RV64-NEXT: vluxei64.v v16, (a0), v8, v0.t
1011 ; RV64-NEXT: vmv.v.v v8, v16
1013 %eidxs = sext <vscale x 8 x i8> %idxs to <vscale x 8 x i64>
1014 %ptrs = getelementptr inbounds i64, ptr %base, <vscale x 8 x i64> %eidxs
1015 %v = call <vscale x 8 x i64> @llvm.masked.gather.nxv8i64.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 8, <vscale x 8 x i1> %m, <vscale x 8 x i64> %passthru)
1016 ret <vscale x 8 x i64> %v
1019 define <vscale x 8 x i64> @mgather_baseidx_zext_nxv8i8_nxv8i64(ptr %base, <vscale x 8 x i8> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x i64> %passthru) {
1020 ; CHECK-LABEL: mgather_baseidx_zext_nxv8i8_nxv8i64:
1022 ; CHECK-NEXT: vsetvli a1, zero, e16, m2, ta, ma
1023 ; CHECK-NEXT: vzext.vf2 v10, v8
1024 ; CHECK-NEXT: vsll.vi v8, v10, 3
1025 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, mu
1026 ; CHECK-NEXT: vluxei16.v v16, (a0), v8, v0.t
1027 ; CHECK-NEXT: vmv.v.v v8, v16
1029 %eidxs = zext <vscale x 8 x i8> %idxs to <vscale x 8 x i64>
1030 %ptrs = getelementptr inbounds i64, ptr %base, <vscale x 8 x i64> %eidxs
1031 %v = call <vscale x 8 x i64> @llvm.masked.gather.nxv8i64.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 8, <vscale x 8 x i1> %m, <vscale x 8 x i64> %passthru)
1032 ret <vscale x 8 x i64> %v
1035 define <vscale x 8 x i64> @mgather_baseidx_nxv8i16_nxv8i64(ptr %base, <vscale x 8 x i16> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x i64> %passthru) {
1036 ; RV32-LABEL: mgather_baseidx_nxv8i16_nxv8i64:
1038 ; RV32-NEXT: vsetvli a1, zero, e32, m4, ta, ma
1039 ; RV32-NEXT: vsext.vf2 v12, v8
1040 ; RV32-NEXT: vsll.vi v8, v12, 3
1041 ; RV32-NEXT: vsetvli zero, zero, e64, m8, ta, mu
1042 ; RV32-NEXT: vluxei32.v v16, (a0), v8, v0.t
1043 ; RV32-NEXT: vmv.v.v v8, v16
1046 ; RV64-LABEL: mgather_baseidx_nxv8i16_nxv8i64:
1048 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, mu
1049 ; RV64-NEXT: vsext.vf4 v24, v8
1050 ; RV64-NEXT: vsll.vi v8, v24, 3
1051 ; RV64-NEXT: vluxei64.v v16, (a0), v8, v0.t
1052 ; RV64-NEXT: vmv.v.v v8, v16
1054 %ptrs = getelementptr inbounds i64, ptr %base, <vscale x 8 x i16> %idxs
1055 %v = call <vscale x 8 x i64> @llvm.masked.gather.nxv8i64.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 8, <vscale x 8 x i1> %m, <vscale x 8 x i64> %passthru)
1056 ret <vscale x 8 x i64> %v
1059 define <vscale x 8 x i64> @mgather_baseidx_sext_nxv8i16_nxv8i64(ptr %base, <vscale x 8 x i16> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x i64> %passthru) {
1060 ; RV32-LABEL: mgather_baseidx_sext_nxv8i16_nxv8i64:
1062 ; RV32-NEXT: vsetvli a1, zero, e32, m4, ta, ma
1063 ; RV32-NEXT: vsext.vf2 v12, v8
1064 ; RV32-NEXT: vsll.vi v8, v12, 3
1065 ; RV32-NEXT: vsetvli zero, zero, e64, m8, ta, mu
1066 ; RV32-NEXT: vluxei32.v v16, (a0), v8, v0.t
1067 ; RV32-NEXT: vmv.v.v v8, v16
1070 ; RV64-LABEL: mgather_baseidx_sext_nxv8i16_nxv8i64:
1072 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, mu
1073 ; RV64-NEXT: vsext.vf4 v24, v8
1074 ; RV64-NEXT: vsll.vi v8, v24, 3
1075 ; RV64-NEXT: vluxei64.v v16, (a0), v8, v0.t
1076 ; RV64-NEXT: vmv.v.v v8, v16
1078 %eidxs = sext <vscale x 8 x i16> %idxs to <vscale x 8 x i64>
1079 %ptrs = getelementptr inbounds i64, ptr %base, <vscale x 8 x i64> %eidxs
1080 %v = call <vscale x 8 x i64> @llvm.masked.gather.nxv8i64.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 8, <vscale x 8 x i1> %m, <vscale x 8 x i64> %passthru)
1081 ret <vscale x 8 x i64> %v
1084 define <vscale x 8 x i64> @mgather_baseidx_zext_nxv8i16_nxv8i64(ptr %base, <vscale x 8 x i16> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x i64> %passthru) {
1085 ; CHECK-LABEL: mgather_baseidx_zext_nxv8i16_nxv8i64:
1087 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma
1088 ; CHECK-NEXT: vzext.vf2 v12, v8
1089 ; CHECK-NEXT: vsll.vi v8, v12, 3
1090 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, mu
1091 ; CHECK-NEXT: vluxei32.v v16, (a0), v8, v0.t
1092 ; CHECK-NEXT: vmv.v.v v8, v16
1094 %eidxs = zext <vscale x 8 x i16> %idxs to <vscale x 8 x i64>
1095 %ptrs = getelementptr inbounds i64, ptr %base, <vscale x 8 x i64> %eidxs
1096 %v = call <vscale x 8 x i64> @llvm.masked.gather.nxv8i64.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 8, <vscale x 8 x i1> %m, <vscale x 8 x i64> %passthru)
1097 ret <vscale x 8 x i64> %v
1100 define <vscale x 8 x i64> @mgather_baseidx_nxv8i32_nxv8i64(ptr %base, <vscale x 8 x i32> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x i64> %passthru) {
1101 ; RV32-LABEL: mgather_baseidx_nxv8i32_nxv8i64:
1103 ; RV32-NEXT: vsetvli a1, zero, e32, m4, ta, ma
1104 ; RV32-NEXT: vsll.vi v8, v8, 3
1105 ; RV32-NEXT: vsetvli zero, zero, e64, m8, ta, mu
1106 ; RV32-NEXT: vluxei32.v v16, (a0), v8, v0.t
1107 ; RV32-NEXT: vmv.v.v v8, v16
1110 ; RV64-LABEL: mgather_baseidx_nxv8i32_nxv8i64:
1112 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, mu
1113 ; RV64-NEXT: vsext.vf2 v24, v8
1114 ; RV64-NEXT: vsll.vi v8, v24, 3
1115 ; RV64-NEXT: vluxei64.v v16, (a0), v8, v0.t
1116 ; RV64-NEXT: vmv.v.v v8, v16
1118 %ptrs = getelementptr inbounds i64, ptr %base, <vscale x 8 x i32> %idxs
1119 %v = call <vscale x 8 x i64> @llvm.masked.gather.nxv8i64.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 8, <vscale x 8 x i1> %m, <vscale x 8 x i64> %passthru)
1120 ret <vscale x 8 x i64> %v
1123 define <vscale x 8 x i64> @mgather_baseidx_sext_nxv8i32_nxv8i64(ptr %base, <vscale x 8 x i32> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x i64> %passthru) {
1124 ; RV32-LABEL: mgather_baseidx_sext_nxv8i32_nxv8i64:
1126 ; RV32-NEXT: vsetvli a1, zero, e32, m4, ta, ma
1127 ; RV32-NEXT: vsll.vi v8, v8, 3
1128 ; RV32-NEXT: vsetvli zero, zero, e64, m8, ta, mu
1129 ; RV32-NEXT: vluxei32.v v16, (a0), v8, v0.t
1130 ; RV32-NEXT: vmv.v.v v8, v16
1133 ; RV64-LABEL: mgather_baseidx_sext_nxv8i32_nxv8i64:
1135 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, mu
1136 ; RV64-NEXT: vsext.vf2 v24, v8
1137 ; RV64-NEXT: vsll.vi v8, v24, 3
1138 ; RV64-NEXT: vluxei64.v v16, (a0), v8, v0.t
1139 ; RV64-NEXT: vmv.v.v v8, v16
1141 %eidxs = sext <vscale x 8 x i32> %idxs to <vscale x 8 x i64>
1142 %ptrs = getelementptr inbounds i64, ptr %base, <vscale x 8 x i64> %eidxs
1143 %v = call <vscale x 8 x i64> @llvm.masked.gather.nxv8i64.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 8, <vscale x 8 x i1> %m, <vscale x 8 x i64> %passthru)
1144 ret <vscale x 8 x i64> %v
1147 define <vscale x 8 x i64> @mgather_baseidx_zext_nxv8i32_nxv8i64(ptr %base, <vscale x 8 x i32> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x i64> %passthru) {
1148 ; RV32-LABEL: mgather_baseidx_zext_nxv8i32_nxv8i64:
1150 ; RV32-NEXT: vsetvli a1, zero, e32, m4, ta, ma
1151 ; RV32-NEXT: vsll.vi v8, v8, 3
1152 ; RV32-NEXT: vsetvli zero, zero, e64, m8, ta, mu
1153 ; RV32-NEXT: vluxei32.v v16, (a0), v8, v0.t
1154 ; RV32-NEXT: vmv.v.v v8, v16
1157 ; RV64-LABEL: mgather_baseidx_zext_nxv8i32_nxv8i64:
1159 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, mu
1160 ; RV64-NEXT: vzext.vf2 v24, v8
1161 ; RV64-NEXT: vsll.vi v8, v24, 3
1162 ; RV64-NEXT: vluxei64.v v16, (a0), v8, v0.t
1163 ; RV64-NEXT: vmv.v.v v8, v16
1165 %eidxs = zext <vscale x 8 x i32> %idxs to <vscale x 8 x i64>
1166 %ptrs = getelementptr inbounds i64, ptr %base, <vscale x 8 x i64> %eidxs
1167 %v = call <vscale x 8 x i64> @llvm.masked.gather.nxv8i64.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 8, <vscale x 8 x i1> %m, <vscale x 8 x i64> %passthru)
1168 ret <vscale x 8 x i64> %v
1171 define <vscale x 8 x i64> @mgather_baseidx_nxv8i64(ptr %base, <vscale x 8 x i64> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x i64> %passthru) {
1172 ; RV32-LABEL: mgather_baseidx_nxv8i64:
1174 ; RV32-NEXT: vsetvli a1, zero, e32, m4, ta, ma
1175 ; RV32-NEXT: vnsrl.wi v24, v8, 0
1176 ; RV32-NEXT: vsll.vi v8, v24, 3
1177 ; RV32-NEXT: vsetvli zero, zero, e64, m8, ta, mu
1178 ; RV32-NEXT: vluxei32.v v16, (a0), v8, v0.t
1179 ; RV32-NEXT: vmv.v.v v8, v16
1182 ; RV64-LABEL: mgather_baseidx_nxv8i64:
1184 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, mu
1185 ; RV64-NEXT: vsll.vi v8, v8, 3
1186 ; RV64-NEXT: vluxei64.v v16, (a0), v8, v0.t
1187 ; RV64-NEXT: vmv.v.v v8, v16
1189 %ptrs = getelementptr inbounds i64, ptr %base, <vscale x 8 x i64> %idxs
1190 %v = call <vscale x 8 x i64> @llvm.masked.gather.nxv8i64.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 8, <vscale x 8 x i1> %m, <vscale x 8 x i64> %passthru)
1191 ret <vscale x 8 x i64> %v
1194 declare <vscale x 16 x i64> @llvm.masked.gather.nxv16i64.nxv16p0(<vscale x 16 x ptr>, i32, <vscale x 16 x i1>, <vscale x 16 x i64>)
1196 declare <vscale x 16 x i64> @llvm.vector.insert.nxv8i64.nxv16i64(<vscale x 16 x i64>, <vscale x 8 x i64>, i64 %idx)
1197 declare <vscale x 16 x ptr> @llvm.vector.insert.nxv8p0.nxv16p0(<vscale x 16 x ptr>, <vscale x 8 x ptr>, i64 %idx)
1199 define void @mgather_nxv16i64(<vscale x 8 x ptr> %ptrs0, <vscale x 8 x ptr> %ptrs1, <vscale x 16 x i1> %m, <vscale x 8 x i64> %passthru0, <vscale x 8 x i64> %passthru1, ptr %out) {
1200 ; RV32-LABEL: mgather_nxv16i64:
1202 ; RV32-NEXT: vl8re64.v v24, (a0)
1203 ; RV32-NEXT: csrr a0, vlenb
1204 ; RV32-NEXT: srli a2, a0, 3
1205 ; RV32-NEXT: vsetvli a3, zero, e8, mf4, ta, ma
1206 ; RV32-NEXT: vslidedown.vx v7, v0, a2
1207 ; RV32-NEXT: vsetvli a2, zero, e64, m8, ta, mu
1208 ; RV32-NEXT: vluxei32.v v16, (zero), v8, v0.t
1209 ; RV32-NEXT: vmv1r.v v0, v7
1210 ; RV32-NEXT: vluxei32.v v24, (zero), v12, v0.t
1211 ; RV32-NEXT: slli a0, a0, 3
1212 ; RV32-NEXT: add a0, a1, a0
1213 ; RV32-NEXT: vs8r.v v24, (a0)
1214 ; RV32-NEXT: vs8r.v v16, (a1)
1217 ; RV64-LABEL: mgather_nxv16i64:
1219 ; RV64-NEXT: addi sp, sp, -16
1220 ; RV64-NEXT: .cfi_def_cfa_offset 16
1221 ; RV64-NEXT: csrr a3, vlenb
1222 ; RV64-NEXT: slli a3, a3, 3
1223 ; RV64-NEXT: sub sp, sp, a3
1224 ; RV64-NEXT: .cfi_escape 0x0f, 0x0d, 0x72, 0x00, 0x11, 0x10, 0x22, 0x11, 0x08, 0x92, 0xa2, 0x38, 0x00, 0x1e, 0x22 # sp + 16 + 8 * vlenb
1225 ; RV64-NEXT: addi a3, sp, 16
1226 ; RV64-NEXT: vs8r.v v16, (a3) # Unknown-size Folded Spill
1227 ; RV64-NEXT: vmv8r.v v16, v8
1228 ; RV64-NEXT: vl8re64.v v24, (a0)
1229 ; RV64-NEXT: csrr a0, vlenb
1230 ; RV64-NEXT: vl8re64.v v8, (a1)
1231 ; RV64-NEXT: srli a1, a0, 3
1232 ; RV64-NEXT: vsetvli a3, zero, e8, mf4, ta, ma
1233 ; RV64-NEXT: vslidedown.vx v7, v0, a1
1234 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, mu
1235 ; RV64-NEXT: vluxei64.v v24, (zero), v16, v0.t
1236 ; RV64-NEXT: vmv1r.v v0, v7
1237 ; RV64-NEXT: addi a1, sp, 16
1238 ; RV64-NEXT: vl8r.v v16, (a1) # Unknown-size Folded Reload
1239 ; RV64-NEXT: vluxei64.v v8, (zero), v16, v0.t
1240 ; RV64-NEXT: slli a0, a0, 3
1241 ; RV64-NEXT: add a0, a2, a0
1242 ; RV64-NEXT: vs8r.v v8, (a0)
1243 ; RV64-NEXT: vs8r.v v24, (a2)
1244 ; RV64-NEXT: csrr a0, vlenb
1245 ; RV64-NEXT: slli a0, a0, 3
1246 ; RV64-NEXT: add sp, sp, a0
1247 ; RV64-NEXT: addi sp, sp, 16
1249 %p0 = call <vscale x 16 x ptr> @llvm.vector.insert.nxv8p0.nxv16p0(<vscale x 16 x ptr> undef, <vscale x 8 x ptr> %ptrs0, i64 0)
1250 %p1 = call <vscale x 16 x ptr> @llvm.vector.insert.nxv8p0.nxv16p0(<vscale x 16 x ptr> %p0, <vscale x 8 x ptr> %ptrs1, i64 8)
1252 %pt0 = call <vscale x 16 x i64> @llvm.vector.insert.nxv8i64.nxv16i64(<vscale x 16 x i64> undef, <vscale x 8 x i64> %passthru0, i64 0)
1253 %pt1 = call <vscale x 16 x i64> @llvm.vector.insert.nxv8i64.nxv16i64(<vscale x 16 x i64> %pt0, <vscale x 8 x i64> %passthru1, i64 8)
1255 %v = call <vscale x 16 x i64> @llvm.masked.gather.nxv16i64.nxv16p0(<vscale x 16 x ptr> %p1, i32 8, <vscale x 16 x i1> %m, <vscale x 16 x i64> %pt1)
1256 store <vscale x 16 x i64> %v, ptr %out
1261 declare <vscale x 1 x half> @llvm.masked.gather.nxv1f16.nxv1p0(<vscale x 1 x ptr>, i32, <vscale x 1 x i1>, <vscale x 1 x half>)
1263 define <vscale x 1 x half> @mgather_nxv1f16(<vscale x 1 x ptr> %ptrs, <vscale x 1 x i1> %m, <vscale x 1 x half> %passthru) {
1264 ; RV32-LABEL: mgather_nxv1f16:
1266 ; RV32-NEXT: vsetvli a0, zero, e16, mf4, ta, mu
1267 ; RV32-NEXT: vluxei32.v v9, (zero), v8, v0.t
1268 ; RV32-NEXT: vmv1r.v v8, v9
1271 ; RV64-LABEL: mgather_nxv1f16:
1273 ; RV64-NEXT: vsetvli a0, zero, e16, mf4, ta, mu
1274 ; RV64-NEXT: vluxei64.v v9, (zero), v8, v0.t
1275 ; RV64-NEXT: vmv1r.v v8, v9
1277 %v = call <vscale x 1 x half> @llvm.masked.gather.nxv1f16.nxv1p0(<vscale x 1 x ptr> %ptrs, i32 2, <vscale x 1 x i1> %m, <vscale x 1 x half> %passthru)
1278 ret <vscale x 1 x half> %v
1281 declare <vscale x 2 x half> @llvm.masked.gather.nxv2f16.nxv2p0(<vscale x 2 x ptr>, i32, <vscale x 2 x i1>, <vscale x 2 x half>)
1283 define <vscale x 2 x half> @mgather_nxv2f16(<vscale x 2 x ptr> %ptrs, <vscale x 2 x i1> %m, <vscale x 2 x half> %passthru) {
1284 ; RV32-LABEL: mgather_nxv2f16:
1286 ; RV32-NEXT: vsetvli a0, zero, e16, mf2, ta, mu
1287 ; RV32-NEXT: vluxei32.v v9, (zero), v8, v0.t
1288 ; RV32-NEXT: vmv1r.v v8, v9
1291 ; RV64-LABEL: mgather_nxv2f16:
1293 ; RV64-NEXT: vsetvli a0, zero, e16, mf2, ta, mu
1294 ; RV64-NEXT: vluxei64.v v10, (zero), v8, v0.t
1295 ; RV64-NEXT: vmv1r.v v8, v10
1297 %v = call <vscale x 2 x half> @llvm.masked.gather.nxv2f16.nxv2p0(<vscale x 2 x ptr> %ptrs, i32 2, <vscale x 2 x i1> %m, <vscale x 2 x half> %passthru)
1298 ret <vscale x 2 x half> %v
1301 declare <vscale x 4 x half> @llvm.masked.gather.nxv4f16.nxv4p0(<vscale x 4 x ptr>, i32, <vscale x 4 x i1>, <vscale x 4 x half>)
1303 define <vscale x 4 x half> @mgather_nxv4f16(<vscale x 4 x ptr> %ptrs, <vscale x 4 x i1> %m, <vscale x 4 x half> %passthru) {
1304 ; RV32-LABEL: mgather_nxv4f16:
1306 ; RV32-NEXT: vsetvli a0, zero, e16, m1, ta, mu
1307 ; RV32-NEXT: vluxei32.v v10, (zero), v8, v0.t
1308 ; RV32-NEXT: vmv.v.v v8, v10
1311 ; RV64-LABEL: mgather_nxv4f16:
1313 ; RV64-NEXT: vsetvli a0, zero, e16, m1, ta, mu
1314 ; RV64-NEXT: vluxei64.v v12, (zero), v8, v0.t
1315 ; RV64-NEXT: vmv.v.v v8, v12
1317 %v = call <vscale x 4 x half> @llvm.masked.gather.nxv4f16.nxv4p0(<vscale x 4 x ptr> %ptrs, i32 2, <vscale x 4 x i1> %m, <vscale x 4 x half> %passthru)
1318 ret <vscale x 4 x half> %v
1321 define <vscale x 4 x half> @mgather_truemask_nxv4f16(<vscale x 4 x ptr> %ptrs, <vscale x 4 x half> %passthru) {
1322 ; RV32-LABEL: mgather_truemask_nxv4f16:
1324 ; RV32-NEXT: vsetvli a0, zero, e16, m1, ta, ma
1325 ; RV32-NEXT: vluxei32.v v10, (zero), v8
1326 ; RV32-NEXT: vmv.v.v v8, v10
1329 ; RV64-LABEL: mgather_truemask_nxv4f16:
1331 ; RV64-NEXT: vsetvli a0, zero, e16, m1, ta, ma
1332 ; RV64-NEXT: vluxei64.v v12, (zero), v8
1333 ; RV64-NEXT: vmv.v.v v8, v12
1335 %v = call <vscale x 4 x half> @llvm.masked.gather.nxv4f16.nxv4p0(<vscale x 4 x ptr> %ptrs, i32 2, <vscale x 4 x i1> splat (i1 1), <vscale x 4 x half> %passthru)
1336 ret <vscale x 4 x half> %v
1339 define <vscale x 4 x half> @mgather_falsemask_nxv4f16(<vscale x 4 x ptr> %ptrs, <vscale x 4 x half> %passthru) {
1340 ; RV32-LABEL: mgather_falsemask_nxv4f16:
1342 ; RV32-NEXT: vmv1r.v v8, v10
1345 ; RV64-LABEL: mgather_falsemask_nxv4f16:
1347 ; RV64-NEXT: vmv1r.v v8, v12
1349 %v = call <vscale x 4 x half> @llvm.masked.gather.nxv4f16.nxv4p0(<vscale x 4 x ptr> %ptrs, i32 2, <vscale x 4 x i1> zeroinitializer, <vscale x 4 x half> %passthru)
1350 ret <vscale x 4 x half> %v
1353 declare <vscale x 8 x half> @llvm.masked.gather.nxv8f16.nxv8p0(<vscale x 8 x ptr>, i32, <vscale x 8 x i1>, <vscale x 8 x half>)
1355 define <vscale x 8 x half> @mgather_nxv8f16(<vscale x 8 x ptr> %ptrs, <vscale x 8 x i1> %m, <vscale x 8 x half> %passthru) {
1356 ; RV32-LABEL: mgather_nxv8f16:
1358 ; RV32-NEXT: vsetvli a0, zero, e16, m2, ta, mu
1359 ; RV32-NEXT: vluxei32.v v12, (zero), v8, v0.t
1360 ; RV32-NEXT: vmv.v.v v8, v12
1363 ; RV64-LABEL: mgather_nxv8f16:
1365 ; RV64-NEXT: vsetvli a0, zero, e16, m2, ta, mu
1366 ; RV64-NEXT: vluxei64.v v16, (zero), v8, v0.t
1367 ; RV64-NEXT: vmv.v.v v8, v16
1369 %v = call <vscale x 8 x half> @llvm.masked.gather.nxv8f16.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 2, <vscale x 8 x i1> %m, <vscale x 8 x half> %passthru)
1370 ret <vscale x 8 x half> %v
1373 define <vscale x 8 x half> @mgather_baseidx_nxv8i8_nxv8f16(ptr %base, <vscale x 8 x i8> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x half> %passthru) {
1374 ; RV32-LABEL: mgather_baseidx_nxv8i8_nxv8f16:
1376 ; RV32-NEXT: vsetvli a1, zero, e32, m4, ta, ma
1377 ; RV32-NEXT: vsext.vf4 v12, v8
1378 ; RV32-NEXT: vadd.vv v12, v12, v12
1379 ; RV32-NEXT: vsetvli zero, zero, e16, m2, ta, mu
1380 ; RV32-NEXT: vluxei32.v v10, (a0), v12, v0.t
1381 ; RV32-NEXT: vmv.v.v v8, v10
1384 ; RV64-LABEL: mgather_baseidx_nxv8i8_nxv8f16:
1386 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, ma
1387 ; RV64-NEXT: vsext.vf8 v16, v8
1388 ; RV64-NEXT: vadd.vv v16, v16, v16
1389 ; RV64-NEXT: vsetvli zero, zero, e16, m2, ta, mu
1390 ; RV64-NEXT: vluxei64.v v10, (a0), v16, v0.t
1391 ; RV64-NEXT: vmv.v.v v8, v10
1393 %ptrs = getelementptr inbounds half, ptr %base, <vscale x 8 x i8> %idxs
1394 %v = call <vscale x 8 x half> @llvm.masked.gather.nxv8f16.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 2, <vscale x 8 x i1> %m, <vscale x 8 x half> %passthru)
1395 ret <vscale x 8 x half> %v
1398 define <vscale x 8 x half> @mgather_baseidx_sext_nxv8i8_nxv8f16(ptr %base, <vscale x 8 x i8> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x half> %passthru) {
1399 ; RV32-LABEL: mgather_baseidx_sext_nxv8i8_nxv8f16:
1401 ; RV32-NEXT: vsetvli a1, zero, e32, m4, ta, ma
1402 ; RV32-NEXT: vsext.vf4 v12, v8
1403 ; RV32-NEXT: vadd.vv v12, v12, v12
1404 ; RV32-NEXT: vsetvli zero, zero, e16, m2, ta, mu
1405 ; RV32-NEXT: vluxei32.v v10, (a0), v12, v0.t
1406 ; RV32-NEXT: vmv.v.v v8, v10
1409 ; RV64-LABEL: mgather_baseidx_sext_nxv8i8_nxv8f16:
1411 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, ma
1412 ; RV64-NEXT: vsext.vf8 v16, v8
1413 ; RV64-NEXT: vadd.vv v16, v16, v16
1414 ; RV64-NEXT: vsetvli zero, zero, e16, m2, ta, mu
1415 ; RV64-NEXT: vluxei64.v v10, (a0), v16, v0.t
1416 ; RV64-NEXT: vmv.v.v v8, v10
1418 %eidxs = sext <vscale x 8 x i8> %idxs to <vscale x 8 x i16>
1419 %ptrs = getelementptr inbounds half, ptr %base, <vscale x 8 x i16> %eidxs
1420 %v = call <vscale x 8 x half> @llvm.masked.gather.nxv8f16.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 2, <vscale x 8 x i1> %m, <vscale x 8 x half> %passthru)
1421 ret <vscale x 8 x half> %v
1424 define <vscale x 8 x half> @mgather_baseidx_zext_nxv8i8_nxv8f16(ptr %base, <vscale x 8 x i8> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x half> %passthru) {
1425 ; CHECK-LABEL: mgather_baseidx_zext_nxv8i8_nxv8f16:
1427 ; CHECK-NEXT: vsetvli a1, zero, e8, m1, ta, ma
1428 ; CHECK-NEXT: vwaddu.vv v12, v8, v8
1429 ; CHECK-NEXT: vsetvli zero, zero, e16, m2, ta, mu
1430 ; CHECK-NEXT: vluxei16.v v10, (a0), v12, v0.t
1431 ; CHECK-NEXT: vmv.v.v v8, v10
1433 %eidxs = zext <vscale x 8 x i8> %idxs to <vscale x 8 x i16>
1434 %ptrs = getelementptr inbounds half, ptr %base, <vscale x 8 x i16> %eidxs
1435 %v = call <vscale x 8 x half> @llvm.masked.gather.nxv8f16.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 2, <vscale x 8 x i1> %m, <vscale x 8 x half> %passthru)
1436 ret <vscale x 8 x half> %v
1439 define <vscale x 8 x half> @mgather_baseidx_nxv8f16(ptr %base, <vscale x 8 x i16> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x half> %passthru) {
1440 ; RV32-LABEL: mgather_baseidx_nxv8f16:
1442 ; RV32-NEXT: vsetvli a1, zero, e16, m2, ta, mu
1443 ; RV32-NEXT: vwadd.vv v12, v8, v8
1444 ; RV32-NEXT: vluxei32.v v10, (a0), v12, v0.t
1445 ; RV32-NEXT: vmv.v.v v8, v10
1448 ; RV64-LABEL: mgather_baseidx_nxv8f16:
1450 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, ma
1451 ; RV64-NEXT: vsext.vf4 v16, v8
1452 ; RV64-NEXT: vadd.vv v16, v16, v16
1453 ; RV64-NEXT: vsetvli zero, zero, e16, m2, ta, mu
1454 ; RV64-NEXT: vluxei64.v v10, (a0), v16, v0.t
1455 ; RV64-NEXT: vmv.v.v v8, v10
1457 %ptrs = getelementptr inbounds half, ptr %base, <vscale x 8 x i16> %idxs
1458 %v = call <vscale x 8 x half> @llvm.masked.gather.nxv8f16.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 2, <vscale x 8 x i1> %m, <vscale x 8 x half> %passthru)
1459 ret <vscale x 8 x half> %v
1462 declare <vscale x 1 x float> @llvm.masked.gather.nxv1f32.nxv1p0(<vscale x 1 x ptr>, i32, <vscale x 1 x i1>, <vscale x 1 x float>)
1464 define <vscale x 1 x float> @mgather_nxv1f32(<vscale x 1 x ptr> %ptrs, <vscale x 1 x i1> %m, <vscale x 1 x float> %passthru) {
1465 ; RV32-LABEL: mgather_nxv1f32:
1467 ; RV32-NEXT: vsetvli a0, zero, e32, mf2, ta, mu
1468 ; RV32-NEXT: vluxei32.v v9, (zero), v8, v0.t
1469 ; RV32-NEXT: vmv1r.v v8, v9
1472 ; RV64-LABEL: mgather_nxv1f32:
1474 ; RV64-NEXT: vsetvli a0, zero, e32, mf2, ta, mu
1475 ; RV64-NEXT: vluxei64.v v9, (zero), v8, v0.t
1476 ; RV64-NEXT: vmv1r.v v8, v9
1478 %v = call <vscale x 1 x float> @llvm.masked.gather.nxv1f32.nxv1p0(<vscale x 1 x ptr> %ptrs, i32 4, <vscale x 1 x i1> %m, <vscale x 1 x float> %passthru)
1479 ret <vscale x 1 x float> %v
1482 declare <vscale x 2 x float> @llvm.masked.gather.nxv2f32.nxv2p0(<vscale x 2 x ptr>, i32, <vscale x 2 x i1>, <vscale x 2 x float>)
1484 define <vscale x 2 x float> @mgather_nxv2f32(<vscale x 2 x ptr> %ptrs, <vscale x 2 x i1> %m, <vscale x 2 x float> %passthru) {
1485 ; RV32-LABEL: mgather_nxv2f32:
1487 ; RV32-NEXT: vsetvli a0, zero, e32, m1, ta, mu
1488 ; RV32-NEXT: vluxei32.v v9, (zero), v8, v0.t
1489 ; RV32-NEXT: vmv.v.v v8, v9
1492 ; RV64-LABEL: mgather_nxv2f32:
1494 ; RV64-NEXT: vsetvli a0, zero, e32, m1, ta, mu
1495 ; RV64-NEXT: vluxei64.v v10, (zero), v8, v0.t
1496 ; RV64-NEXT: vmv.v.v v8, v10
1498 %v = call <vscale x 2 x float> @llvm.masked.gather.nxv2f32.nxv2p0(<vscale x 2 x ptr> %ptrs, i32 4, <vscale x 2 x i1> %m, <vscale x 2 x float> %passthru)
1499 ret <vscale x 2 x float> %v
1502 declare <vscale x 4 x float> @llvm.masked.gather.nxv4f32.nxv4p0(<vscale x 4 x ptr>, i32, <vscale x 4 x i1>, <vscale x 4 x float>)
1504 define <vscale x 4 x float> @mgather_nxv4f32(<vscale x 4 x ptr> %ptrs, <vscale x 4 x i1> %m, <vscale x 4 x float> %passthru) {
1505 ; RV32-LABEL: mgather_nxv4f32:
1507 ; RV32-NEXT: vsetvli a0, zero, e32, m2, ta, mu
1508 ; RV32-NEXT: vluxei32.v v10, (zero), v8, v0.t
1509 ; RV32-NEXT: vmv.v.v v8, v10
1512 ; RV64-LABEL: mgather_nxv4f32:
1514 ; RV64-NEXT: vsetvli a0, zero, e32, m2, ta, mu
1515 ; RV64-NEXT: vluxei64.v v12, (zero), v8, v0.t
1516 ; RV64-NEXT: vmv.v.v v8, v12
1518 %v = call <vscale x 4 x float> @llvm.masked.gather.nxv4f32.nxv4p0(<vscale x 4 x ptr> %ptrs, i32 4, <vscale x 4 x i1> %m, <vscale x 4 x float> %passthru)
1519 ret <vscale x 4 x float> %v
1522 define <vscale x 4 x float> @mgather_truemask_nxv4f32(<vscale x 4 x ptr> %ptrs, <vscale x 4 x float> %passthru) {
1523 ; RV32-LABEL: mgather_truemask_nxv4f32:
1525 ; RV32-NEXT: vsetvli a0, zero, e32, m2, ta, ma
1526 ; RV32-NEXT: vluxei32.v v8, (zero), v8
1529 ; RV64-LABEL: mgather_truemask_nxv4f32:
1531 ; RV64-NEXT: vsetvli a0, zero, e32, m2, ta, ma
1532 ; RV64-NEXT: vluxei64.v v12, (zero), v8
1533 ; RV64-NEXT: vmv.v.v v8, v12
1535 %v = call <vscale x 4 x float> @llvm.masked.gather.nxv4f32.nxv4p0(<vscale x 4 x ptr> %ptrs, i32 4, <vscale x 4 x i1> splat (i1 1), <vscale x 4 x float> %passthru)
1536 ret <vscale x 4 x float> %v
1539 define <vscale x 4 x float> @mgather_falsemask_nxv4f32(<vscale x 4 x ptr> %ptrs, <vscale x 4 x float> %passthru) {
1540 ; RV32-LABEL: mgather_falsemask_nxv4f32:
1542 ; RV32-NEXT: vmv2r.v v8, v10
1545 ; RV64-LABEL: mgather_falsemask_nxv4f32:
1547 ; RV64-NEXT: vmv2r.v v8, v12
1549 %v = call <vscale x 4 x float> @llvm.masked.gather.nxv4f32.nxv4p0(<vscale x 4 x ptr> %ptrs, i32 4, <vscale x 4 x i1> zeroinitializer, <vscale x 4 x float> %passthru)
1550 ret <vscale x 4 x float> %v
1553 declare <vscale x 8 x float> @llvm.masked.gather.nxv8f32.nxv8p0(<vscale x 8 x ptr>, i32, <vscale x 8 x i1>, <vscale x 8 x float>)
1555 define <vscale x 8 x float> @mgather_nxv8f32(<vscale x 8 x ptr> %ptrs, <vscale x 8 x i1> %m, <vscale x 8 x float> %passthru) {
1556 ; RV32-LABEL: mgather_nxv8f32:
1558 ; RV32-NEXT: vsetvli a0, zero, e32, m4, ta, mu
1559 ; RV32-NEXT: vluxei32.v v12, (zero), v8, v0.t
1560 ; RV32-NEXT: vmv.v.v v8, v12
1563 ; RV64-LABEL: mgather_nxv8f32:
1565 ; RV64-NEXT: vsetvli a0, zero, e32, m4, ta, mu
1566 ; RV64-NEXT: vluxei64.v v16, (zero), v8, v0.t
1567 ; RV64-NEXT: vmv.v.v v8, v16
1569 %v = call <vscale x 8 x float> @llvm.masked.gather.nxv8f32.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 4, <vscale x 8 x i1> %m, <vscale x 8 x float> %passthru)
1570 ret <vscale x 8 x float> %v
1573 define <vscale x 8 x float> @mgather_baseidx_nxv8i8_nxv8f32(ptr %base, <vscale x 8 x i8> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x float> %passthru) {
1574 ; RV32-LABEL: mgather_baseidx_nxv8i8_nxv8f32:
1576 ; RV32-NEXT: vsetvli a1, zero, e32, m4, ta, mu
1577 ; RV32-NEXT: vsext.vf4 v16, v8
1578 ; RV32-NEXT: vsll.vi v8, v16, 2
1579 ; RV32-NEXT: vluxei32.v v12, (a0), v8, v0.t
1580 ; RV32-NEXT: vmv.v.v v8, v12
1583 ; RV64-LABEL: mgather_baseidx_nxv8i8_nxv8f32:
1585 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, ma
1586 ; RV64-NEXT: vsext.vf8 v16, v8
1587 ; RV64-NEXT: vsll.vi v16, v16, 2
1588 ; RV64-NEXT: vsetvli zero, zero, e32, m4, ta, mu
1589 ; RV64-NEXT: vluxei64.v v12, (a0), v16, v0.t
1590 ; RV64-NEXT: vmv.v.v v8, v12
1592 %ptrs = getelementptr inbounds float, ptr %base, <vscale x 8 x i8> %idxs
1593 %v = call <vscale x 8 x float> @llvm.masked.gather.nxv8f32.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 4, <vscale x 8 x i1> %m, <vscale x 8 x float> %passthru)
1594 ret <vscale x 8 x float> %v
1597 define <vscale x 8 x float> @mgather_baseidx_sext_nxv8i8_nxv8f32(ptr %base, <vscale x 8 x i8> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x float> %passthru) {
1598 ; RV32-LABEL: mgather_baseidx_sext_nxv8i8_nxv8f32:
1600 ; RV32-NEXT: vsetvli a1, zero, e32, m4, ta, mu
1601 ; RV32-NEXT: vsext.vf4 v16, v8
1602 ; RV32-NEXT: vsll.vi v8, v16, 2
1603 ; RV32-NEXT: vluxei32.v v12, (a0), v8, v0.t
1604 ; RV32-NEXT: vmv.v.v v8, v12
1607 ; RV64-LABEL: mgather_baseidx_sext_nxv8i8_nxv8f32:
1609 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, ma
1610 ; RV64-NEXT: vsext.vf8 v16, v8
1611 ; RV64-NEXT: vsll.vi v16, v16, 2
1612 ; RV64-NEXT: vsetvli zero, zero, e32, m4, ta, mu
1613 ; RV64-NEXT: vluxei64.v v12, (a0), v16, v0.t
1614 ; RV64-NEXT: vmv.v.v v8, v12
1616 %eidxs = sext <vscale x 8 x i8> %idxs to <vscale x 8 x i32>
1617 %ptrs = getelementptr inbounds float, ptr %base, <vscale x 8 x i32> %eidxs
1618 %v = call <vscale x 8 x float> @llvm.masked.gather.nxv8f32.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 4, <vscale x 8 x i1> %m, <vscale x 8 x float> %passthru)
1619 ret <vscale x 8 x float> %v
1622 define <vscale x 8 x float> @mgather_baseidx_zext_nxv8i8_nxv8f32(ptr %base, <vscale x 8 x i8> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x float> %passthru) {
1623 ; CHECK-LABEL: mgather_baseidx_zext_nxv8i8_nxv8f32:
1625 ; CHECK-NEXT: vsetvli a1, zero, e16, m2, ta, ma
1626 ; CHECK-NEXT: vzext.vf2 v10, v8
1627 ; CHECK-NEXT: vsll.vi v8, v10, 2
1628 ; CHECK-NEXT: vsetvli zero, zero, e32, m4, ta, mu
1629 ; CHECK-NEXT: vluxei16.v v12, (a0), v8, v0.t
1630 ; CHECK-NEXT: vmv.v.v v8, v12
1632 %eidxs = zext <vscale x 8 x i8> %idxs to <vscale x 8 x i32>
1633 %ptrs = getelementptr inbounds float, ptr %base, <vscale x 8 x i32> %eidxs
1634 %v = call <vscale x 8 x float> @llvm.masked.gather.nxv8f32.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 4, <vscale x 8 x i1> %m, <vscale x 8 x float> %passthru)
1635 ret <vscale x 8 x float> %v
1638 define <vscale x 8 x float> @mgather_baseidx_nxv8i16_nxv8f32(ptr %base, <vscale x 8 x i16> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x float> %passthru) {
1639 ; RV32-LABEL: mgather_baseidx_nxv8i16_nxv8f32:
1641 ; RV32-NEXT: vsetvli a1, zero, e32, m4, ta, mu
1642 ; RV32-NEXT: vsext.vf2 v16, v8
1643 ; RV32-NEXT: vsll.vi v8, v16, 2
1644 ; RV32-NEXT: vluxei32.v v12, (a0), v8, v0.t
1645 ; RV32-NEXT: vmv.v.v v8, v12
1648 ; RV64-LABEL: mgather_baseidx_nxv8i16_nxv8f32:
1650 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, ma
1651 ; RV64-NEXT: vsext.vf4 v16, v8
1652 ; RV64-NEXT: vsll.vi v16, v16, 2
1653 ; RV64-NEXT: vsetvli zero, zero, e32, m4, ta, mu
1654 ; RV64-NEXT: vluxei64.v v12, (a0), v16, v0.t
1655 ; RV64-NEXT: vmv.v.v v8, v12
1657 %ptrs = getelementptr inbounds float, ptr %base, <vscale x 8 x i16> %idxs
1658 %v = call <vscale x 8 x float> @llvm.masked.gather.nxv8f32.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 4, <vscale x 8 x i1> %m, <vscale x 8 x float> %passthru)
1659 ret <vscale x 8 x float> %v
1662 define <vscale x 8 x float> @mgather_baseidx_sext_nxv8i16_nxv8f32(ptr %base, <vscale x 8 x i16> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x float> %passthru) {
1663 ; RV32-LABEL: mgather_baseidx_sext_nxv8i16_nxv8f32:
1665 ; RV32-NEXT: vsetvli a1, zero, e32, m4, ta, mu
1666 ; RV32-NEXT: vsext.vf2 v16, v8
1667 ; RV32-NEXT: vsll.vi v8, v16, 2
1668 ; RV32-NEXT: vluxei32.v v12, (a0), v8, v0.t
1669 ; RV32-NEXT: vmv.v.v v8, v12
1672 ; RV64-LABEL: mgather_baseidx_sext_nxv8i16_nxv8f32:
1674 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, ma
1675 ; RV64-NEXT: vsext.vf4 v16, v8
1676 ; RV64-NEXT: vsll.vi v16, v16, 2
1677 ; RV64-NEXT: vsetvli zero, zero, e32, m4, ta, mu
1678 ; RV64-NEXT: vluxei64.v v12, (a0), v16, v0.t
1679 ; RV64-NEXT: vmv.v.v v8, v12
1681 %eidxs = sext <vscale x 8 x i16> %idxs to <vscale x 8 x i32>
1682 %ptrs = getelementptr inbounds float, ptr %base, <vscale x 8 x i32> %eidxs
1683 %v = call <vscale x 8 x float> @llvm.masked.gather.nxv8f32.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 4, <vscale x 8 x i1> %m, <vscale x 8 x float> %passthru)
1684 ret <vscale x 8 x float> %v
1687 define <vscale x 8 x float> @mgather_baseidx_zext_nxv8i16_nxv8f32(ptr %base, <vscale x 8 x i16> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x float> %passthru) {
1688 ; CHECK-LABEL: mgather_baseidx_zext_nxv8i16_nxv8f32:
1690 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, mu
1691 ; CHECK-NEXT: vzext.vf2 v16, v8
1692 ; CHECK-NEXT: vsll.vi v8, v16, 2
1693 ; CHECK-NEXT: vluxei32.v v12, (a0), v8, v0.t
1694 ; CHECK-NEXT: vmv.v.v v8, v12
1696 %eidxs = zext <vscale x 8 x i16> %idxs to <vscale x 8 x i32>
1697 %ptrs = getelementptr inbounds float, ptr %base, <vscale x 8 x i32> %eidxs
1698 %v = call <vscale x 8 x float> @llvm.masked.gather.nxv8f32.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 4, <vscale x 8 x i1> %m, <vscale x 8 x float> %passthru)
1699 ret <vscale x 8 x float> %v
1702 define <vscale x 8 x float> @mgather_baseidx_nxv8f32(ptr %base, <vscale x 8 x i32> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x float> %passthru) {
1703 ; RV32-LABEL: mgather_baseidx_nxv8f32:
1705 ; RV32-NEXT: vsetvli a1, zero, e32, m4, ta, mu
1706 ; RV32-NEXT: vsll.vi v8, v8, 2
1707 ; RV32-NEXT: vluxei32.v v12, (a0), v8, v0.t
1708 ; RV32-NEXT: vmv.v.v v8, v12
1711 ; RV64-LABEL: mgather_baseidx_nxv8f32:
1713 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, ma
1714 ; RV64-NEXT: vsext.vf2 v16, v8
1715 ; RV64-NEXT: vsll.vi v16, v16, 2
1716 ; RV64-NEXT: vsetvli zero, zero, e32, m4, ta, mu
1717 ; RV64-NEXT: vluxei64.v v12, (a0), v16, v0.t
1718 ; RV64-NEXT: vmv.v.v v8, v12
1720 %ptrs = getelementptr inbounds float, ptr %base, <vscale x 8 x i32> %idxs
1721 %v = call <vscale x 8 x float> @llvm.masked.gather.nxv8f32.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 4, <vscale x 8 x i1> %m, <vscale x 8 x float> %passthru)
1722 ret <vscale x 8 x float> %v
1725 declare <vscale x 1 x double> @llvm.masked.gather.nxv1f64.nxv1p0(<vscale x 1 x ptr>, i32, <vscale x 1 x i1>, <vscale x 1 x double>)
1727 define <vscale x 1 x double> @mgather_nxv1f64(<vscale x 1 x ptr> %ptrs, <vscale x 1 x i1> %m, <vscale x 1 x double> %passthru) {
1728 ; RV32-LABEL: mgather_nxv1f64:
1730 ; RV32-NEXT: vsetvli a0, zero, e64, m1, ta, mu
1731 ; RV32-NEXT: vluxei32.v v9, (zero), v8, v0.t
1732 ; RV32-NEXT: vmv.v.v v8, v9
1735 ; RV64-LABEL: mgather_nxv1f64:
1737 ; RV64-NEXT: vsetvli a0, zero, e64, m1, ta, mu
1738 ; RV64-NEXT: vluxei64.v v9, (zero), v8, v0.t
1739 ; RV64-NEXT: vmv.v.v v8, v9
1741 %v = call <vscale x 1 x double> @llvm.masked.gather.nxv1f64.nxv1p0(<vscale x 1 x ptr> %ptrs, i32 8, <vscale x 1 x i1> %m, <vscale x 1 x double> %passthru)
1742 ret <vscale x 1 x double> %v
1745 declare <vscale x 2 x double> @llvm.masked.gather.nxv2f64.nxv2p0(<vscale x 2 x ptr>, i32, <vscale x 2 x i1>, <vscale x 2 x double>)
1747 define <vscale x 2 x double> @mgather_nxv2f64(<vscale x 2 x ptr> %ptrs, <vscale x 2 x i1> %m, <vscale x 2 x double> %passthru) {
1748 ; RV32-LABEL: mgather_nxv2f64:
1750 ; RV32-NEXT: vsetvli a0, zero, e64, m2, ta, mu
1751 ; RV32-NEXT: vluxei32.v v10, (zero), v8, v0.t
1752 ; RV32-NEXT: vmv.v.v v8, v10
1755 ; RV64-LABEL: mgather_nxv2f64:
1757 ; RV64-NEXT: vsetvli a0, zero, e64, m2, ta, mu
1758 ; RV64-NEXT: vluxei64.v v10, (zero), v8, v0.t
1759 ; RV64-NEXT: vmv.v.v v8, v10
1761 %v = call <vscale x 2 x double> @llvm.masked.gather.nxv2f64.nxv2p0(<vscale x 2 x ptr> %ptrs, i32 8, <vscale x 2 x i1> %m, <vscale x 2 x double> %passthru)
1762 ret <vscale x 2 x double> %v
1765 declare <vscale x 4 x double> @llvm.masked.gather.nxv4f64.nxv4p0(<vscale x 4 x ptr>, i32, <vscale x 4 x i1>, <vscale x 4 x double>)
1767 define <vscale x 4 x double> @mgather_nxv4f64(<vscale x 4 x ptr> %ptrs, <vscale x 4 x i1> %m, <vscale x 4 x double> %passthru) {
1768 ; RV32-LABEL: mgather_nxv4f64:
1770 ; RV32-NEXT: vsetvli a0, zero, e64, m4, ta, mu
1771 ; RV32-NEXT: vluxei32.v v12, (zero), v8, v0.t
1772 ; RV32-NEXT: vmv.v.v v8, v12
1775 ; RV64-LABEL: mgather_nxv4f64:
1777 ; RV64-NEXT: vsetvli a0, zero, e64, m4, ta, mu
1778 ; RV64-NEXT: vluxei64.v v12, (zero), v8, v0.t
1779 ; RV64-NEXT: vmv.v.v v8, v12
1781 %v = call <vscale x 4 x double> @llvm.masked.gather.nxv4f64.nxv4p0(<vscale x 4 x ptr> %ptrs, i32 8, <vscale x 4 x i1> %m, <vscale x 4 x double> %passthru)
1782 ret <vscale x 4 x double> %v
1785 define <vscale x 4 x double> @mgather_truemask_nxv4f64(<vscale x 4 x ptr> %ptrs, <vscale x 4 x double> %passthru) {
1786 ; RV32-LABEL: mgather_truemask_nxv4f64:
1788 ; RV32-NEXT: vsetvli a0, zero, e64, m4, ta, ma
1789 ; RV32-NEXT: vluxei32.v v12, (zero), v8
1790 ; RV32-NEXT: vmv.v.v v8, v12
1793 ; RV64-LABEL: mgather_truemask_nxv4f64:
1795 ; RV64-NEXT: vsetvli a0, zero, e64, m4, ta, ma
1796 ; RV64-NEXT: vluxei64.v v8, (zero), v8
1798 %v = call <vscale x 4 x double> @llvm.masked.gather.nxv4f64.nxv4p0(<vscale x 4 x ptr> %ptrs, i32 8, <vscale x 4 x i1> splat (i1 1), <vscale x 4 x double> %passthru)
1799 ret <vscale x 4 x double> %v
1802 define <vscale x 4 x double> @mgather_falsemask_nxv4f64(<vscale x 4 x ptr> %ptrs, <vscale x 4 x double> %passthru) {
1803 ; CHECK-LABEL: mgather_falsemask_nxv4f64:
1805 ; CHECK-NEXT: vmv4r.v v8, v12
1807 %v = call <vscale x 4 x double> @llvm.masked.gather.nxv4f64.nxv4p0(<vscale x 4 x ptr> %ptrs, i32 8, <vscale x 4 x i1> zeroinitializer, <vscale x 4 x double> %passthru)
1808 ret <vscale x 4 x double> %v
1811 declare <vscale x 8 x double> @llvm.masked.gather.nxv8f64.nxv8p0(<vscale x 8 x ptr>, i32, <vscale x 8 x i1>, <vscale x 8 x double>)
1813 define <vscale x 8 x double> @mgather_nxv8f64(<vscale x 8 x ptr> %ptrs, <vscale x 8 x i1> %m, <vscale x 8 x double> %passthru) {
1814 ; RV32-LABEL: mgather_nxv8f64:
1816 ; RV32-NEXT: vsetvli a0, zero, e64, m8, ta, mu
1817 ; RV32-NEXT: vluxei32.v v16, (zero), v8, v0.t
1818 ; RV32-NEXT: vmv.v.v v8, v16
1821 ; RV64-LABEL: mgather_nxv8f64:
1823 ; RV64-NEXT: vsetvli a0, zero, e64, m8, ta, mu
1824 ; RV64-NEXT: vluxei64.v v16, (zero), v8, v0.t
1825 ; RV64-NEXT: vmv.v.v v8, v16
1827 %v = call <vscale x 8 x double> @llvm.masked.gather.nxv8f64.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 8, <vscale x 8 x i1> %m, <vscale x 8 x double> %passthru)
1828 ret <vscale x 8 x double> %v
1831 define <vscale x 8 x double> @mgather_baseidx_nxv8i8_nxv8f64(ptr %base, <vscale x 8 x i8> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x double> %passthru) {
1832 ; RV32-LABEL: mgather_baseidx_nxv8i8_nxv8f64:
1834 ; RV32-NEXT: vsetvli a1, zero, e32, m4, ta, ma
1835 ; RV32-NEXT: vsext.vf4 v12, v8
1836 ; RV32-NEXT: vsll.vi v8, v12, 3
1837 ; RV32-NEXT: vsetvli zero, zero, e64, m8, ta, mu
1838 ; RV32-NEXT: vluxei32.v v16, (a0), v8, v0.t
1839 ; RV32-NEXT: vmv.v.v v8, v16
1842 ; RV64-LABEL: mgather_baseidx_nxv8i8_nxv8f64:
1844 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, mu
1845 ; RV64-NEXT: vsext.vf8 v24, v8
1846 ; RV64-NEXT: vsll.vi v8, v24, 3
1847 ; RV64-NEXT: vluxei64.v v16, (a0), v8, v0.t
1848 ; RV64-NEXT: vmv.v.v v8, v16
1850 %ptrs = getelementptr inbounds double, ptr %base, <vscale x 8 x i8> %idxs
1851 %v = call <vscale x 8 x double> @llvm.masked.gather.nxv8f64.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 8, <vscale x 8 x i1> %m, <vscale x 8 x double> %passthru)
1852 ret <vscale x 8 x double> %v
1855 define <vscale x 8 x double> @mgather_baseidx_sext_nxv8i8_nxv8f64(ptr %base, <vscale x 8 x i8> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x double> %passthru) {
1856 ; RV32-LABEL: mgather_baseidx_sext_nxv8i8_nxv8f64:
1858 ; RV32-NEXT: vsetvli a1, zero, e32, m4, ta, ma
1859 ; RV32-NEXT: vsext.vf4 v12, v8
1860 ; RV32-NEXT: vsll.vi v8, v12, 3
1861 ; RV32-NEXT: vsetvli zero, zero, e64, m8, ta, mu
1862 ; RV32-NEXT: vluxei32.v v16, (a0), v8, v0.t
1863 ; RV32-NEXT: vmv.v.v v8, v16
1866 ; RV64-LABEL: mgather_baseidx_sext_nxv8i8_nxv8f64:
1868 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, mu
1869 ; RV64-NEXT: vsext.vf8 v24, v8
1870 ; RV64-NEXT: vsll.vi v8, v24, 3
1871 ; RV64-NEXT: vluxei64.v v16, (a0), v8, v0.t
1872 ; RV64-NEXT: vmv.v.v v8, v16
1874 %eidxs = sext <vscale x 8 x i8> %idxs to <vscale x 8 x i64>
1875 %ptrs = getelementptr inbounds double, ptr %base, <vscale x 8 x i64> %eidxs
1876 %v = call <vscale x 8 x double> @llvm.masked.gather.nxv8f64.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 8, <vscale x 8 x i1> %m, <vscale x 8 x double> %passthru)
1877 ret <vscale x 8 x double> %v
1880 define <vscale x 8 x double> @mgather_baseidx_zext_nxv8i8_nxv8f64(ptr %base, <vscale x 8 x i8> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x double> %passthru) {
1881 ; CHECK-LABEL: mgather_baseidx_zext_nxv8i8_nxv8f64:
1883 ; CHECK-NEXT: vsetvli a1, zero, e16, m2, ta, ma
1884 ; CHECK-NEXT: vzext.vf2 v10, v8
1885 ; CHECK-NEXT: vsll.vi v8, v10, 3
1886 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, mu
1887 ; CHECK-NEXT: vluxei16.v v16, (a0), v8, v0.t
1888 ; CHECK-NEXT: vmv.v.v v8, v16
1890 %eidxs = zext <vscale x 8 x i8> %idxs to <vscale x 8 x i64>
1891 %ptrs = getelementptr inbounds double, ptr %base, <vscale x 8 x i64> %eidxs
1892 %v = call <vscale x 8 x double> @llvm.masked.gather.nxv8f64.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 8, <vscale x 8 x i1> %m, <vscale x 8 x double> %passthru)
1893 ret <vscale x 8 x double> %v
1896 define <vscale x 8 x double> @mgather_baseidx_nxv8i16_nxv8f64(ptr %base, <vscale x 8 x i16> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x double> %passthru) {
1897 ; RV32-LABEL: mgather_baseidx_nxv8i16_nxv8f64:
1899 ; RV32-NEXT: vsetvli a1, zero, e32, m4, ta, ma
1900 ; RV32-NEXT: vsext.vf2 v12, v8
1901 ; RV32-NEXT: vsll.vi v8, v12, 3
1902 ; RV32-NEXT: vsetvli zero, zero, e64, m8, ta, mu
1903 ; RV32-NEXT: vluxei32.v v16, (a0), v8, v0.t
1904 ; RV32-NEXT: vmv.v.v v8, v16
1907 ; RV64-LABEL: mgather_baseidx_nxv8i16_nxv8f64:
1909 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, mu
1910 ; RV64-NEXT: vsext.vf4 v24, v8
1911 ; RV64-NEXT: vsll.vi v8, v24, 3
1912 ; RV64-NEXT: vluxei64.v v16, (a0), v8, v0.t
1913 ; RV64-NEXT: vmv.v.v v8, v16
1915 %ptrs = getelementptr inbounds double, ptr %base, <vscale x 8 x i16> %idxs
1916 %v = call <vscale x 8 x double> @llvm.masked.gather.nxv8f64.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 8, <vscale x 8 x i1> %m, <vscale x 8 x double> %passthru)
1917 ret <vscale x 8 x double> %v
1920 define <vscale x 8 x double> @mgather_baseidx_sext_nxv8i16_nxv8f64(ptr %base, <vscale x 8 x i16> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x double> %passthru) {
1921 ; RV32-LABEL: mgather_baseidx_sext_nxv8i16_nxv8f64:
1923 ; RV32-NEXT: vsetvli a1, zero, e32, m4, ta, ma
1924 ; RV32-NEXT: vsext.vf2 v12, v8
1925 ; RV32-NEXT: vsll.vi v8, v12, 3
1926 ; RV32-NEXT: vsetvli zero, zero, e64, m8, ta, mu
1927 ; RV32-NEXT: vluxei32.v v16, (a0), v8, v0.t
1928 ; RV32-NEXT: vmv.v.v v8, v16
1931 ; RV64-LABEL: mgather_baseidx_sext_nxv8i16_nxv8f64:
1933 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, mu
1934 ; RV64-NEXT: vsext.vf4 v24, v8
1935 ; RV64-NEXT: vsll.vi v8, v24, 3
1936 ; RV64-NEXT: vluxei64.v v16, (a0), v8, v0.t
1937 ; RV64-NEXT: vmv.v.v v8, v16
1939 %eidxs = sext <vscale x 8 x i16> %idxs to <vscale x 8 x i64>
1940 %ptrs = getelementptr inbounds double, ptr %base, <vscale x 8 x i64> %eidxs
1941 %v = call <vscale x 8 x double> @llvm.masked.gather.nxv8f64.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 8, <vscale x 8 x i1> %m, <vscale x 8 x double> %passthru)
1942 ret <vscale x 8 x double> %v
1945 define <vscale x 8 x double> @mgather_baseidx_zext_nxv8i16_nxv8f64(ptr %base, <vscale x 8 x i16> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x double> %passthru) {
1946 ; CHECK-LABEL: mgather_baseidx_zext_nxv8i16_nxv8f64:
1948 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma
1949 ; CHECK-NEXT: vzext.vf2 v12, v8
1950 ; CHECK-NEXT: vsll.vi v8, v12, 3
1951 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, mu
1952 ; CHECK-NEXT: vluxei32.v v16, (a0), v8, v0.t
1953 ; CHECK-NEXT: vmv.v.v v8, v16
1955 %eidxs = zext <vscale x 8 x i16> %idxs to <vscale x 8 x i64>
1956 %ptrs = getelementptr inbounds double, ptr %base, <vscale x 8 x i64> %eidxs
1957 %v = call <vscale x 8 x double> @llvm.masked.gather.nxv8f64.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 8, <vscale x 8 x i1> %m, <vscale x 8 x double> %passthru)
1958 ret <vscale x 8 x double> %v
1961 define <vscale x 8 x double> @mgather_baseidx_nxv8i32_nxv8f64(ptr %base, <vscale x 8 x i32> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x double> %passthru) {
1962 ; RV32-LABEL: mgather_baseidx_nxv8i32_nxv8f64:
1964 ; RV32-NEXT: vsetvli a1, zero, e32, m4, ta, ma
1965 ; RV32-NEXT: vsll.vi v8, v8, 3
1966 ; RV32-NEXT: vsetvli zero, zero, e64, m8, ta, mu
1967 ; RV32-NEXT: vluxei32.v v16, (a0), v8, v0.t
1968 ; RV32-NEXT: vmv.v.v v8, v16
1971 ; RV64-LABEL: mgather_baseidx_nxv8i32_nxv8f64:
1973 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, mu
1974 ; RV64-NEXT: vsext.vf2 v24, v8
1975 ; RV64-NEXT: vsll.vi v8, v24, 3
1976 ; RV64-NEXT: vluxei64.v v16, (a0), v8, v0.t
1977 ; RV64-NEXT: vmv.v.v v8, v16
1979 %ptrs = getelementptr inbounds double, ptr %base, <vscale x 8 x i32> %idxs
1980 %v = call <vscale x 8 x double> @llvm.masked.gather.nxv8f64.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 8, <vscale x 8 x i1> %m, <vscale x 8 x double> %passthru)
1981 ret <vscale x 8 x double> %v
1984 define <vscale x 8 x double> @mgather_baseidx_sext_nxv8i32_nxv8f64(ptr %base, <vscale x 8 x i32> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x double> %passthru) {
1985 ; RV32-LABEL: mgather_baseidx_sext_nxv8i32_nxv8f64:
1987 ; RV32-NEXT: vsetvli a1, zero, e32, m4, ta, ma
1988 ; RV32-NEXT: vsll.vi v8, v8, 3
1989 ; RV32-NEXT: vsetvli zero, zero, e64, m8, ta, mu
1990 ; RV32-NEXT: vluxei32.v v16, (a0), v8, v0.t
1991 ; RV32-NEXT: vmv.v.v v8, v16
1994 ; RV64-LABEL: mgather_baseidx_sext_nxv8i32_nxv8f64:
1996 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, mu
1997 ; RV64-NEXT: vsext.vf2 v24, v8
1998 ; RV64-NEXT: vsll.vi v8, v24, 3
1999 ; RV64-NEXT: vluxei64.v v16, (a0), v8, v0.t
2000 ; RV64-NEXT: vmv.v.v v8, v16
2002 %eidxs = sext <vscale x 8 x i32> %idxs to <vscale x 8 x i64>
2003 %ptrs = getelementptr inbounds double, ptr %base, <vscale x 8 x i64> %eidxs
2004 %v = call <vscale x 8 x double> @llvm.masked.gather.nxv8f64.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 8, <vscale x 8 x i1> %m, <vscale x 8 x double> %passthru)
2005 ret <vscale x 8 x double> %v
2008 define <vscale x 8 x double> @mgather_baseidx_zext_nxv8i32_nxv8f64(ptr %base, <vscale x 8 x i32> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x double> %passthru) {
2009 ; RV32-LABEL: mgather_baseidx_zext_nxv8i32_nxv8f64:
2011 ; RV32-NEXT: vsetvli a1, zero, e32, m4, ta, ma
2012 ; RV32-NEXT: vsll.vi v8, v8, 3
2013 ; RV32-NEXT: vsetvli zero, zero, e64, m8, ta, mu
2014 ; RV32-NEXT: vluxei32.v v16, (a0), v8, v0.t
2015 ; RV32-NEXT: vmv.v.v v8, v16
2018 ; RV64-LABEL: mgather_baseidx_zext_nxv8i32_nxv8f64:
2020 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, mu
2021 ; RV64-NEXT: vzext.vf2 v24, v8
2022 ; RV64-NEXT: vsll.vi v8, v24, 3
2023 ; RV64-NEXT: vluxei64.v v16, (a0), v8, v0.t
2024 ; RV64-NEXT: vmv.v.v v8, v16
2026 %eidxs = zext <vscale x 8 x i32> %idxs to <vscale x 8 x i64>
2027 %ptrs = getelementptr inbounds double, ptr %base, <vscale x 8 x i64> %eidxs
2028 %v = call <vscale x 8 x double> @llvm.masked.gather.nxv8f64.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 8, <vscale x 8 x i1> %m, <vscale x 8 x double> %passthru)
2029 ret <vscale x 8 x double> %v
2032 define <vscale x 8 x double> @mgather_baseidx_nxv8f64(ptr %base, <vscale x 8 x i64> %idxs, <vscale x 8 x i1> %m, <vscale x 8 x double> %passthru) {
2033 ; RV32-LABEL: mgather_baseidx_nxv8f64:
2035 ; RV32-NEXT: vsetvli a1, zero, e32, m4, ta, ma
2036 ; RV32-NEXT: vnsrl.wi v24, v8, 0
2037 ; RV32-NEXT: vsll.vi v8, v24, 3
2038 ; RV32-NEXT: vsetvli zero, zero, e64, m8, ta, mu
2039 ; RV32-NEXT: vluxei32.v v16, (a0), v8, v0.t
2040 ; RV32-NEXT: vmv.v.v v8, v16
2043 ; RV64-LABEL: mgather_baseidx_nxv8f64:
2045 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, mu
2046 ; RV64-NEXT: vsll.vi v8, v8, 3
2047 ; RV64-NEXT: vluxei64.v v16, (a0), v8, v0.t
2048 ; RV64-NEXT: vmv.v.v v8, v16
2050 %ptrs = getelementptr inbounds double, ptr %base, <vscale x 8 x i64> %idxs
2051 %v = call <vscale x 8 x double> @llvm.masked.gather.nxv8f64.nxv8p0(<vscale x 8 x ptr> %ptrs, i32 8, <vscale x 8 x i1> %m, <vscale x 8 x double> %passthru)
2052 ret <vscale x 8 x double> %v
2055 declare <vscale x 16 x i8> @llvm.masked.gather.nxv16i8.nxv16p0(<vscale x 16 x ptr>, i32, <vscale x 16 x i1>, <vscale x 16 x i8>)
2057 define <vscale x 16 x i8> @mgather_baseidx_nxv16i8(ptr %base, <vscale x 16 x i8> %idxs, <vscale x 16 x i1> %m, <vscale x 16 x i8> %passthru) {
2058 ; RV32-LABEL: mgather_baseidx_nxv16i8:
2060 ; RV32-NEXT: vsetvli a1, zero, e32, m8, ta, ma
2061 ; RV32-NEXT: vsext.vf4 v16, v8
2062 ; RV32-NEXT: vsetvli zero, zero, e8, m2, ta, mu
2063 ; RV32-NEXT: vluxei32.v v10, (a0), v16, v0.t
2064 ; RV32-NEXT: vmv.v.v v8, v10
2067 ; RV64-LABEL: mgather_baseidx_nxv16i8:
2069 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, ma
2070 ; RV64-NEXT: vsext.vf8 v16, v8
2071 ; RV64-NEXT: vsetvli zero, zero, e8, m1, ta, mu
2072 ; RV64-NEXT: vluxei64.v v10, (a0), v16, v0.t
2073 ; RV64-NEXT: csrr a1, vlenb
2074 ; RV64-NEXT: srli a1, a1, 3
2075 ; RV64-NEXT: vsetvli a2, zero, e8, mf4, ta, ma
2076 ; RV64-NEXT: vslidedown.vx v0, v0, a1
2077 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, ma
2078 ; RV64-NEXT: vsext.vf8 v16, v9
2079 ; RV64-NEXT: vsetvli zero, zero, e8, m1, ta, mu
2080 ; RV64-NEXT: vluxei64.v v11, (a0), v16, v0.t
2081 ; RV64-NEXT: vmv2r.v v8, v10
2083 %ptrs = getelementptr inbounds i8, ptr %base, <vscale x 16 x i8> %idxs
2084 %v = call <vscale x 16 x i8> @llvm.masked.gather.nxv16i8.nxv16p0(<vscale x 16 x ptr> %ptrs, i32 2, <vscale x 16 x i1> %m, <vscale x 16 x i8> %passthru)
2085 ret <vscale x 16 x i8> %v
2088 declare <vscale x 32 x i8> @llvm.masked.gather.nxv32i8.nxv32p0(<vscale x 32 x ptr>, i32, <vscale x 32 x i1>, <vscale x 32 x i8>)
2090 define <vscale x 32 x i8> @mgather_baseidx_nxv32i8(ptr %base, <vscale x 32 x i8> %idxs, <vscale x 32 x i1> %m, <vscale x 32 x i8> %passthru) {
2091 ; RV32-LABEL: mgather_baseidx_nxv32i8:
2093 ; RV32-NEXT: vsetvli a1, zero, e32, m8, ta, ma
2094 ; RV32-NEXT: vsext.vf4 v16, v8
2095 ; RV32-NEXT: vsetvli zero, zero, e8, m2, ta, mu
2096 ; RV32-NEXT: vluxei32.v v12, (a0), v16, v0.t
2097 ; RV32-NEXT: csrr a1, vlenb
2098 ; RV32-NEXT: srli a1, a1, 2
2099 ; RV32-NEXT: vsetvli a2, zero, e8, mf2, ta, ma
2100 ; RV32-NEXT: vslidedown.vx v0, v0, a1
2101 ; RV32-NEXT: vsetvli a1, zero, e32, m8, ta, ma
2102 ; RV32-NEXT: vsext.vf4 v16, v10
2103 ; RV32-NEXT: vsetvli zero, zero, e8, m2, ta, mu
2104 ; RV32-NEXT: vluxei32.v v14, (a0), v16, v0.t
2105 ; RV32-NEXT: vmv4r.v v8, v12
2108 ; RV64-LABEL: mgather_baseidx_nxv32i8:
2110 ; RV64-NEXT: vmv1r.v v16, v0
2111 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, ma
2112 ; RV64-NEXT: vsext.vf8 v24, v8
2113 ; RV64-NEXT: vsetvli zero, zero, e8, m1, ta, mu
2114 ; RV64-NEXT: vluxei64.v v12, (a0), v24, v0.t
2115 ; RV64-NEXT: csrr a1, vlenb
2116 ; RV64-NEXT: srli a2, a1, 3
2117 ; RV64-NEXT: vsetvli a3, zero, e8, mf4, ta, ma
2118 ; RV64-NEXT: vslidedown.vx v0, v0, a2
2119 ; RV64-NEXT: vsetvli a3, zero, e64, m8, ta, ma
2120 ; RV64-NEXT: vsext.vf8 v24, v9
2121 ; RV64-NEXT: vsetvli zero, zero, e8, m1, ta, mu
2122 ; RV64-NEXT: vluxei64.v v13, (a0), v24, v0.t
2123 ; RV64-NEXT: srli a1, a1, 2
2124 ; RV64-NEXT: vsetvli a3, zero, e8, mf2, ta, ma
2125 ; RV64-NEXT: vslidedown.vx v8, v16, a1
2126 ; RV64-NEXT: vsetvli a1, zero, e8, mf4, ta, ma
2127 ; RV64-NEXT: vslidedown.vx v0, v8, a2
2128 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, ma
2129 ; RV64-NEXT: vsext.vf8 v16, v11
2130 ; RV64-NEXT: vsetvli zero, zero, e8, m1, ta, mu
2131 ; RV64-NEXT: vluxei64.v v15, (a0), v16, v0.t
2132 ; RV64-NEXT: vsetvli zero, zero, e64, m8, ta, ma
2133 ; RV64-NEXT: vsext.vf8 v16, v10
2134 ; RV64-NEXT: vmv1r.v v0, v8
2135 ; RV64-NEXT: vsetvli zero, zero, e8, m1, ta, mu
2136 ; RV64-NEXT: vluxei64.v v14, (a0), v16, v0.t
2137 ; RV64-NEXT: vmv4r.v v8, v12
2139 %ptrs = getelementptr inbounds i8, ptr %base, <vscale x 32 x i8> %idxs
2140 %v = call <vscale x 32 x i8> @llvm.masked.gather.nxv32i8.nxv32p0(<vscale x 32 x ptr> %ptrs, i32 2, <vscale x 32 x i1> %m, <vscale x 32 x i8> %passthru)
2141 ret <vscale x 32 x i8> %v
2144 define <vscale x 1 x i8> @mgather_baseidx_zext_nxv1i1_nxv1i8(ptr %base, <vscale x 1 x i1> %idxs, <vscale x 1 x i1> %m, <vscale x 1 x i8> %passthru) {
2145 ; CHECK-LABEL: mgather_baseidx_zext_nxv1i1_nxv1i8:
2147 ; CHECK-NEXT: vsetvli a1, zero, e8, mf8, ta, mu
2148 ; CHECK-NEXT: vmv.v.i v10, 0
2149 ; CHECK-NEXT: vmerge.vim v10, v10, 1, v0
2150 ; CHECK-NEXT: vmv1r.v v0, v8
2151 ; CHECK-NEXT: vluxei8.v v9, (a0), v10, v0.t
2152 ; CHECK-NEXT: vmv1r.v v8, v9
2154 %eidxs = zext <vscale x 1 x i1> %idxs to <vscale x 1 x i8>
2155 %ptrs = getelementptr inbounds i8, ptr %base, <vscale x 1 x i8> %eidxs
2156 %v = call <vscale x 1 x i8> @llvm.masked.gather.nxv1i8.nxv1p0(<vscale x 1 x ptr> %ptrs, i32 1, <vscale x 1 x i1> %m, <vscale x 1 x i8> %passthru)
2157 ret <vscale x 1 x i8> %v