1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+v -target-abi=ilp32 \
3 ; RUN: -verify-machineinstrs < %s | FileCheck %s
4 ; RUN: llc -mtriple=riscv64 -mattr=+v -target-abi=lp64 \
5 ; RUN: -verify-machineinstrs < %s | FileCheck %s
7 define <vscale x 1 x i32> @vnsrl_wx_i64_nxv1i32(<vscale x 1 x i64> %va, i64 %b) {
8 ; CHECK-LABEL: vnsrl_wx_i64_nxv1i32:
10 ; CHECK-NEXT: vsetvli a1, zero, e32, mf2, ta, ma
11 ; CHECK-NEXT: vnsrl.wx v8, v8, a0
13 %head = insertelement <vscale x 1 x i64> poison, i64 %b, i32 0
14 %splat = shufflevector <vscale x 1 x i64> %head, <vscale x 1 x i64> poison, <vscale x 1 x i32> zeroinitializer
15 %x = lshr <vscale x 1 x i64> %va, %splat
16 %y = trunc <vscale x 1 x i64> %x to <vscale x 1 x i32>
17 ret <vscale x 1 x i32> %y
20 define <vscale x 2 x i32> @vnsrl_wx_i64_nxv2i32(<vscale x 2 x i64> %va, i64 %b) {
21 ; CHECK-LABEL: vnsrl_wx_i64_nxv2i32:
23 ; CHECK-NEXT: vsetvli a1, zero, e32, m1, ta, ma
24 ; CHECK-NEXT: vnsrl.wx v10, v8, a0
25 ; CHECK-NEXT: vmv.v.v v8, v10
27 %head = insertelement <vscale x 2 x i64> poison, i64 %b, i32 0
28 %splat = shufflevector <vscale x 2 x i64> %head, <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
29 %x = lshr <vscale x 2 x i64> %va, %splat
30 %y = trunc <vscale x 2 x i64> %x to <vscale x 2 x i32>
31 ret <vscale x 2 x i32> %y
34 define <vscale x 4 x i32> @vnsrl_wx_i64_nxv4i32(<vscale x 4 x i64> %va, i64 %b) {
35 ; CHECK-LABEL: vnsrl_wx_i64_nxv4i32:
37 ; CHECK-NEXT: vsetvli a1, zero, e32, m2, ta, ma
38 ; CHECK-NEXT: vnsrl.wx v12, v8, a0
39 ; CHECK-NEXT: vmv.v.v v8, v12
41 %head = insertelement <vscale x 4 x i64> poison, i64 %b, i32 0
42 %splat = shufflevector <vscale x 4 x i64> %head, <vscale x 4 x i64> poison, <vscale x 4 x i32> zeroinitializer
43 %x = lshr <vscale x 4 x i64> %va, %splat
44 %y = trunc <vscale x 4 x i64> %x to <vscale x 4 x i32>
45 ret <vscale x 4 x i32> %y
48 define <vscale x 8 x i32> @vnsrl_wx_i64_nxv8i32(<vscale x 8 x i64> %va, i64 %b) {
49 ; CHECK-LABEL: vnsrl_wx_i64_nxv8i32:
51 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma
52 ; CHECK-NEXT: vnsrl.wx v16, v8, a0
53 ; CHECK-NEXT: vmv.v.v v8, v16
55 %head = insertelement <vscale x 8 x i64> poison, i64 %b, i32 0
56 %splat = shufflevector <vscale x 8 x i64> %head, <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer
57 %x = lshr <vscale x 8 x i64> %va, %splat
58 %y = trunc <vscale x 8 x i64> %x to <vscale x 8 x i32>
59 ret <vscale x 8 x i32> %y
62 define <vscale x 1 x i32> @vnsrl_wv_nxv1i32_sext(<vscale x 1 x i64> %va, <vscale x 1 x i32> %vb) {
63 ; CHECK-LABEL: vnsrl_wv_nxv1i32_sext:
65 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
66 ; CHECK-NEXT: vnsrl.wv v8, v8, v9
68 %vc = sext <vscale x 1 x i32> %vb to <vscale x 1 x i64>
69 %x = lshr <vscale x 1 x i64> %va, %vc
70 %y = trunc <vscale x 1 x i64> %x to <vscale x 1 x i32>
71 ret <vscale x 1 x i32> %y
74 define <vscale x 1 x i32> @vnsrl_wx_i32_nxv1i32_sext(<vscale x 1 x i64> %va, i32 %b) {
75 ; CHECK-LABEL: vnsrl_wx_i32_nxv1i32_sext:
77 ; CHECK-NEXT: vsetvli a1, zero, e32, mf2, ta, ma
78 ; CHECK-NEXT: vnsrl.wx v8, v8, a0
80 %head = insertelement <vscale x 1 x i32> poison, i32 %b, i32 0
81 %splat = shufflevector <vscale x 1 x i32> %head, <vscale x 1 x i32> poison, <vscale x 1 x i32> zeroinitializer
82 %vb = sext <vscale x 1 x i32> %splat to <vscale x 1 x i64>
83 %x = lshr <vscale x 1 x i64> %va, %vb
84 %y = trunc <vscale x 1 x i64> %x to <vscale x 1 x i32>
85 ret <vscale x 1 x i32> %y
88 define <vscale x 1 x i32> @vnsrl_wx_i16_nxv1i32_sext(<vscale x 1 x i64> %va, i16 %b) {
89 ; CHECK-LABEL: vnsrl_wx_i16_nxv1i32_sext:
91 ; CHECK-NEXT: vsetvli a1, zero, e32, mf2, ta, ma
92 ; CHECK-NEXT: vnsrl.wx v8, v8, a0
94 %head = insertelement <vscale x 1 x i16> poison, i16 %b, i32 0
95 %splat = shufflevector <vscale x 1 x i16> %head, <vscale x 1 x i16> poison, <vscale x 1 x i32> zeroinitializer
96 %vb = sext <vscale x 1 x i16> %splat to <vscale x 1 x i64>
97 %x = lshr <vscale x 1 x i64> %va, %vb
98 %y = trunc <vscale x 1 x i64> %x to <vscale x 1 x i32>
99 ret <vscale x 1 x i32> %y
102 define <vscale x 1 x i32> @vnsrl_wx_i8_nxv1i32_sext(<vscale x 1 x i64> %va, i8 %b) {
103 ; CHECK-LABEL: vnsrl_wx_i8_nxv1i32_sext:
105 ; CHECK-NEXT: vsetvli a1, zero, e32, mf2, ta, ma
106 ; CHECK-NEXT: vnsrl.wx v8, v8, a0
108 %head = insertelement <vscale x 1 x i8> poison, i8 %b, i32 0
109 %splat = shufflevector <vscale x 1 x i8> %head, <vscale x 1 x i8> poison, <vscale x 1 x i32> zeroinitializer
110 %vb = sext <vscale x 1 x i8> %splat to <vscale x 1 x i64>
111 %x = lshr <vscale x 1 x i64> %va, %vb
112 %y = trunc <vscale x 1 x i64> %x to <vscale x 1 x i32>
113 ret <vscale x 1 x i32> %y
116 define <vscale x 1 x i32> @vnsrl_wi_i32_nxv1i32_sext(<vscale x 1 x i64> %va) {
117 ; CHECK-LABEL: vnsrl_wi_i32_nxv1i32_sext:
119 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
120 ; CHECK-NEXT: vnsrl.wi v8, v8, 15
122 %vb = sext <vscale x 1 x i32> splat (i32 15) to <vscale x 1 x i64>
123 %x = lshr <vscale x 1 x i64> %va, %vb
124 %y = trunc <vscale x 1 x i64> %x to <vscale x 1 x i32>
125 ret <vscale x 1 x i32> %y
128 define <vscale x 2 x i32> @vnsrl_wv_nxv2i32_sext(<vscale x 2 x i64> %va, <vscale x 2 x i32> %vb) {
129 ; CHECK-LABEL: vnsrl_wv_nxv2i32_sext:
131 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
132 ; CHECK-NEXT: vnsrl.wv v11, v8, v10
133 ; CHECK-NEXT: vmv.v.v v8, v11
135 %vc = sext <vscale x 2 x i32> %vb to <vscale x 2 x i64>
136 %x = lshr <vscale x 2 x i64> %va, %vc
137 %y = trunc <vscale x 2 x i64> %x to <vscale x 2 x i32>
138 ret <vscale x 2 x i32> %y
141 define <vscale x 2 x i32> @vnsrl_wx_i32_nxv2i32_sext(<vscale x 2 x i64> %va, i32 %b) {
142 ; CHECK-LABEL: vnsrl_wx_i32_nxv2i32_sext:
144 ; CHECK-NEXT: vsetvli a1, zero, e32, m1, ta, ma
145 ; CHECK-NEXT: vnsrl.wx v10, v8, a0
146 ; CHECK-NEXT: vmv.v.v v8, v10
148 %head = insertelement <vscale x 2 x i32> poison, i32 %b, i32 0
149 %splat = shufflevector <vscale x 2 x i32> %head, <vscale x 2 x i32> poison, <vscale x 2 x i32> zeroinitializer
150 %vb = sext <vscale x 2 x i32> %splat to <vscale x 2 x i64>
151 %x = lshr <vscale x 2 x i64> %va, %vb
152 %y = trunc <vscale x 2 x i64> %x to <vscale x 2 x i32>
153 ret <vscale x 2 x i32> %y
156 define <vscale x 2 x i32> @vnsrl_wx_i16_nxv2i32_sext(<vscale x 2 x i64> %va, i16 %b) {
157 ; CHECK-LABEL: vnsrl_wx_i16_nxv2i32_sext:
159 ; CHECK-NEXT: vsetvli a1, zero, e32, m1, ta, ma
160 ; CHECK-NEXT: vnsrl.wx v10, v8, a0
161 ; CHECK-NEXT: vmv.v.v v8, v10
163 %head = insertelement <vscale x 2 x i16> poison, i16 %b, i32 0
164 %splat = shufflevector <vscale x 2 x i16> %head, <vscale x 2 x i16> poison, <vscale x 2 x i32> zeroinitializer
165 %vb = sext <vscale x 2 x i16> %splat to <vscale x 2 x i64>
166 %x = lshr <vscale x 2 x i64> %va, %vb
167 %y = trunc <vscale x 2 x i64> %x to <vscale x 2 x i32>
168 ret <vscale x 2 x i32> %y
171 define <vscale x 2 x i32> @vnsrl_wx_i8_nxv2i32_sext(<vscale x 2 x i64> %va, i8 %b) {
172 ; CHECK-LABEL: vnsrl_wx_i8_nxv2i32_sext:
174 ; CHECK-NEXT: vsetvli a1, zero, e32, m1, ta, ma
175 ; CHECK-NEXT: vnsrl.wx v10, v8, a0
176 ; CHECK-NEXT: vmv.v.v v8, v10
178 %head = insertelement <vscale x 2 x i8> poison, i8 %b, i32 0
179 %splat = shufflevector <vscale x 2 x i8> %head, <vscale x 2 x i8> poison, <vscale x 2 x i32> zeroinitializer
180 %vb = sext <vscale x 2 x i8> %splat to <vscale x 2 x i64>
181 %x = lshr <vscale x 2 x i64> %va, %vb
182 %y = trunc <vscale x 2 x i64> %x to <vscale x 2 x i32>
183 ret <vscale x 2 x i32> %y
186 define <vscale x 2 x i32> @vnsrl_wi_i32_nxv2i32_sext(<vscale x 2 x i64> %va) {
187 ; CHECK-LABEL: vnsrl_wi_i32_nxv2i32_sext:
189 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
190 ; CHECK-NEXT: vnsrl.wi v10, v8, 15
191 ; CHECK-NEXT: vmv.v.v v8, v10
193 %vb = sext <vscale x 2 x i32> splat (i32 15) to <vscale x 2 x i64>
194 %x = lshr <vscale x 2 x i64> %va, %vb
195 %y = trunc <vscale x 2 x i64> %x to <vscale x 2 x i32>
196 ret <vscale x 2 x i32> %y
199 define <vscale x 4 x i32> @vnsrl_wv_nxv4i32_sext(<vscale x 4 x i64> %va, <vscale x 4 x i32> %vb) {
200 ; CHECK-LABEL: vnsrl_wv_nxv4i32_sext:
202 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
203 ; CHECK-NEXT: vnsrl.wv v14, v8, v12
204 ; CHECK-NEXT: vmv.v.v v8, v14
206 %vc = sext <vscale x 4 x i32> %vb to <vscale x 4 x i64>
207 %x = lshr <vscale x 4 x i64> %va, %vc
208 %y = trunc <vscale x 4 x i64> %x to <vscale x 4 x i32>
209 ret <vscale x 4 x i32> %y
212 define <vscale x 4 x i32> @vnsrl_wx_i32_nxv4i32_sext(<vscale x 4 x i64> %va, i32 %b) {
213 ; CHECK-LABEL: vnsrl_wx_i32_nxv4i32_sext:
215 ; CHECK-NEXT: vsetvli a1, zero, e32, m2, ta, ma
216 ; CHECK-NEXT: vnsrl.wx v12, v8, a0
217 ; CHECK-NEXT: vmv.v.v v8, v12
219 %head = insertelement <vscale x 4 x i32> poison, i32 %b, i32 0
220 %splat = shufflevector <vscale x 4 x i32> %head, <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
221 %vb = sext <vscale x 4 x i32> %splat to <vscale x 4 x i64>
222 %x = lshr <vscale x 4 x i64> %va, %vb
223 %y = trunc <vscale x 4 x i64> %x to <vscale x 4 x i32>
224 ret <vscale x 4 x i32> %y
227 define <vscale x 4 x i32> @vnsrl_wx_i16_nxv4i32_sext(<vscale x 4 x i64> %va, i16 %b) {
228 ; CHECK-LABEL: vnsrl_wx_i16_nxv4i32_sext:
230 ; CHECK-NEXT: vsetvli a1, zero, e32, m2, ta, ma
231 ; CHECK-NEXT: vnsrl.wx v12, v8, a0
232 ; CHECK-NEXT: vmv.v.v v8, v12
234 %head = insertelement <vscale x 4 x i16> poison, i16 %b, i32 0
235 %splat = shufflevector <vscale x 4 x i16> %head, <vscale x 4 x i16> poison, <vscale x 4 x i32> zeroinitializer
236 %vb = sext <vscale x 4 x i16> %splat to <vscale x 4 x i64>
237 %x = lshr <vscale x 4 x i64> %va, %vb
238 %y = trunc <vscale x 4 x i64> %x to <vscale x 4 x i32>
239 ret <vscale x 4 x i32> %y
242 define <vscale x 4 x i32> @vnsrl_wx_i8_nxv4i32_sext(<vscale x 4 x i64> %va, i8 %b) {
243 ; CHECK-LABEL: vnsrl_wx_i8_nxv4i32_sext:
245 ; CHECK-NEXT: vsetvli a1, zero, e32, m2, ta, ma
246 ; CHECK-NEXT: vnsrl.wx v12, v8, a0
247 ; CHECK-NEXT: vmv.v.v v8, v12
249 %head = insertelement <vscale x 4 x i8> poison, i8 %b, i32 0
250 %splat = shufflevector <vscale x 4 x i8> %head, <vscale x 4 x i8> poison, <vscale x 4 x i32> zeroinitializer
251 %vb = sext <vscale x 4 x i8> %splat to <vscale x 4 x i64>
252 %x = lshr <vscale x 4 x i64> %va, %vb
253 %y = trunc <vscale x 4 x i64> %x to <vscale x 4 x i32>
254 ret <vscale x 4 x i32> %y
257 define <vscale x 4 x i32> @vnsrl_wi_i32_nxv4i32_sext(<vscale x 4 x i64> %va) {
258 ; CHECK-LABEL: vnsrl_wi_i32_nxv4i32_sext:
260 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
261 ; CHECK-NEXT: vnsrl.wi v12, v8, 15
262 ; CHECK-NEXT: vmv.v.v v8, v12
264 %vb = sext <vscale x 4 x i32> splat (i32 15) to <vscale x 4 x i64>
265 %x = lshr <vscale x 4 x i64> %va, %vb
266 %y = trunc <vscale x 4 x i64> %x to <vscale x 4 x i32>
267 ret <vscale x 4 x i32> %y
270 define <vscale x 8 x i32> @vnsrl_wv_nxv8i32_sext(<vscale x 8 x i64> %va, <vscale x 8 x i32> %vb) {
271 ; CHECK-LABEL: vnsrl_wv_nxv8i32_sext:
273 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
274 ; CHECK-NEXT: vnsrl.wv v20, v8, v16
275 ; CHECK-NEXT: vmv.v.v v8, v20
277 %vc = sext <vscale x 8 x i32> %vb to <vscale x 8 x i64>
278 %x = lshr <vscale x 8 x i64> %va, %vc
279 %y = trunc <vscale x 8 x i64> %x to <vscale x 8 x i32>
280 ret <vscale x 8 x i32> %y
283 define <vscale x 8 x i32> @vnsrl_wx_i32_nxv8i32_sext(<vscale x 8 x i64> %va, i32 %b) {
284 ; CHECK-LABEL: vnsrl_wx_i32_nxv8i32_sext:
286 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma
287 ; CHECK-NEXT: vnsrl.wx v16, v8, a0
288 ; CHECK-NEXT: vmv.v.v v8, v16
290 %head = insertelement <vscale x 8 x i32> poison, i32 %b, i32 0
291 %splat = shufflevector <vscale x 8 x i32> %head, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
292 %vb = sext <vscale x 8 x i32> %splat to <vscale x 8 x i64>
293 %x = lshr <vscale x 8 x i64> %va, %vb
294 %y = trunc <vscale x 8 x i64> %x to <vscale x 8 x i32>
295 ret <vscale x 8 x i32> %y
298 define <vscale x 8 x i32> @vnsrl_wx_i16_nxv8i32_sext(<vscale x 8 x i64> %va, i16 %b) {
299 ; CHECK-LABEL: vnsrl_wx_i16_nxv8i32_sext:
301 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma
302 ; CHECK-NEXT: vnsrl.wx v16, v8, a0
303 ; CHECK-NEXT: vmv.v.v v8, v16
305 %head = insertelement <vscale x 8 x i16> poison, i16 %b, i32 0
306 %splat = shufflevector <vscale x 8 x i16> %head, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
307 %vb = sext <vscale x 8 x i16> %splat to <vscale x 8 x i64>
308 %x = lshr <vscale x 8 x i64> %va, %vb
309 %y = trunc <vscale x 8 x i64> %x to <vscale x 8 x i32>
310 ret <vscale x 8 x i32> %y
313 define <vscale x 8 x i32> @vnsrl_wx_i8_nxv8i32_sext(<vscale x 8 x i64> %va, i8 %b) {
314 ; CHECK-LABEL: vnsrl_wx_i8_nxv8i32_sext:
316 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma
317 ; CHECK-NEXT: vnsrl.wx v16, v8, a0
318 ; CHECK-NEXT: vmv.v.v v8, v16
320 %head = insertelement <vscale x 8 x i8> poison, i8 %b, i32 0
321 %splat = shufflevector <vscale x 8 x i8> %head, <vscale x 8 x i8> poison, <vscale x 8 x i32> zeroinitializer
322 %vb = sext <vscale x 8 x i8> %splat to <vscale x 8 x i64>
323 %x = lshr <vscale x 8 x i64> %va, %vb
324 %y = trunc <vscale x 8 x i64> %x to <vscale x 8 x i32>
325 ret <vscale x 8 x i32> %y
328 define <vscale x 8 x i32> @vnsrl_wi_i32_nxv8i32_sext(<vscale x 8 x i64> %va) {
329 ; CHECK-LABEL: vnsrl_wi_i32_nxv8i32_sext:
331 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
332 ; CHECK-NEXT: vnsrl.wi v16, v8, 15
333 ; CHECK-NEXT: vmv.v.v v8, v16
335 %vb = sext <vscale x 8 x i32> splat (i32 15) to <vscale x 8 x i64>
336 %x = lshr <vscale x 8 x i64> %va, %vb
337 %y = trunc <vscale x 8 x i64> %x to <vscale x 8 x i32>
338 ret <vscale x 8 x i32> %y
341 define <vscale x 1 x i32> @vnsrl_wv_nxv1i32_zext(<vscale x 1 x i64> %va, <vscale x 1 x i32> %vb) {
342 ; CHECK-LABEL: vnsrl_wv_nxv1i32_zext:
344 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
345 ; CHECK-NEXT: vnsrl.wv v8, v8, v9
347 %vc = zext <vscale x 1 x i32> %vb to <vscale x 1 x i64>
348 %x = lshr <vscale x 1 x i64> %va, %vc
349 %y = trunc <vscale x 1 x i64> %x to <vscale x 1 x i32>
350 ret <vscale x 1 x i32> %y
353 define <vscale x 1 x i32> @vnsrl_wx_i32_nxv1i32_zext(<vscale x 1 x i64> %va, i32 %b) {
354 ; CHECK-LABEL: vnsrl_wx_i32_nxv1i32_zext:
356 ; CHECK-NEXT: vsetvli a1, zero, e32, mf2, ta, ma
357 ; CHECK-NEXT: vnsrl.wx v8, v8, a0
359 %head = insertelement <vscale x 1 x i32> poison, i32 %b, i32 0
360 %splat = shufflevector <vscale x 1 x i32> %head, <vscale x 1 x i32> poison, <vscale x 1 x i32> zeroinitializer
361 %vb = zext <vscale x 1 x i32> %splat to <vscale x 1 x i64>
362 %x = lshr <vscale x 1 x i64> %va, %vb
363 %y = trunc <vscale x 1 x i64> %x to <vscale x 1 x i32>
364 ret <vscale x 1 x i32> %y
367 define <vscale x 1 x i32> @vnsrl_wx_i16_nxv1i32_zext(<vscale x 1 x i64> %va, i16 %b) {
368 ; CHECK-LABEL: vnsrl_wx_i16_nxv1i32_zext:
370 ; CHECK-NEXT: vsetvli a1, zero, e32, mf2, ta, ma
371 ; CHECK-NEXT: vnsrl.wx v8, v8, a0
373 %head = insertelement <vscale x 1 x i16> poison, i16 %b, i32 0
374 %splat = shufflevector <vscale x 1 x i16> %head, <vscale x 1 x i16> poison, <vscale x 1 x i32> zeroinitializer
375 %vb = zext <vscale x 1 x i16> %splat to <vscale x 1 x i64>
376 %x = lshr <vscale x 1 x i64> %va, %vb
377 %y = trunc <vscale x 1 x i64> %x to <vscale x 1 x i32>
378 ret <vscale x 1 x i32> %y
381 define <vscale x 1 x i32> @vnsrl_wx_i8_nxv1i32_zext(<vscale x 1 x i64> %va, i8 %b) {
382 ; CHECK-LABEL: vnsrl_wx_i8_nxv1i32_zext:
384 ; CHECK-NEXT: vsetvli a1, zero, e32, mf2, ta, ma
385 ; CHECK-NEXT: vnsrl.wx v8, v8, a0
387 %head = insertelement <vscale x 1 x i8> poison, i8 %b, i32 0
388 %splat = shufflevector <vscale x 1 x i8> %head, <vscale x 1 x i8> poison, <vscale x 1 x i32> zeroinitializer
389 %vb = sext <vscale x 1 x i8> %splat to <vscale x 1 x i64>
390 %x = lshr <vscale x 1 x i64> %va, %vb
391 %y = trunc <vscale x 1 x i64> %x to <vscale x 1 x i32>
392 ret <vscale x 1 x i32> %y
395 define <vscale x 1 x i32> @vnsrl_wi_i32_nxv1i32_zext(<vscale x 1 x i64> %va) {
396 ; CHECK-LABEL: vnsrl_wi_i32_nxv1i32_zext:
398 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
399 ; CHECK-NEXT: vnsrl.wi v8, v8, 15
401 %vb = zext <vscale x 1 x i32> splat (i32 15) to <vscale x 1 x i64>
402 %x = lshr <vscale x 1 x i64> %va, %vb
403 %y = trunc <vscale x 1 x i64> %x to <vscale x 1 x i32>
404 ret <vscale x 1 x i32> %y
407 define <vscale x 2 x i32> @vnsrl_wv_nxv2i32_zext(<vscale x 2 x i64> %va, <vscale x 2 x i32> %vb) {
408 ; CHECK-LABEL: vnsrl_wv_nxv2i32_zext:
410 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
411 ; CHECK-NEXT: vnsrl.wv v11, v8, v10
412 ; CHECK-NEXT: vmv.v.v v8, v11
414 %vc = zext <vscale x 2 x i32> %vb to <vscale x 2 x i64>
415 %x = lshr <vscale x 2 x i64> %va, %vc
416 %y = trunc <vscale x 2 x i64> %x to <vscale x 2 x i32>
417 ret <vscale x 2 x i32> %y
420 define <vscale x 2 x i32> @vnsrl_wx_i32_nxv2i32_zext(<vscale x 2 x i64> %va, i32 %b) {
421 ; CHECK-LABEL: vnsrl_wx_i32_nxv2i32_zext:
423 ; CHECK-NEXT: vsetvli a1, zero, e32, m1, ta, ma
424 ; CHECK-NEXT: vnsrl.wx v10, v8, a0
425 ; CHECK-NEXT: vmv.v.v v8, v10
427 %head = insertelement <vscale x 2 x i32> poison, i32 %b, i32 0
428 %splat = shufflevector <vscale x 2 x i32> %head, <vscale x 2 x i32> poison, <vscale x 2 x i32> zeroinitializer
429 %vb = zext <vscale x 2 x i32> %splat to <vscale x 2 x i64>
430 %x = lshr <vscale x 2 x i64> %va, %vb
431 %y = trunc <vscale x 2 x i64> %x to <vscale x 2 x i32>
432 ret <vscale x 2 x i32> %y
435 define <vscale x 2 x i32> @vnsrl_wx_i16_nxv2i32_zext(<vscale x 2 x i64> %va, i16 %b) {
436 ; CHECK-LABEL: vnsrl_wx_i16_nxv2i32_zext:
438 ; CHECK-NEXT: vsetvli a1, zero, e32, m1, ta, ma
439 ; CHECK-NEXT: vnsrl.wx v10, v8, a0
440 ; CHECK-NEXT: vmv.v.v v8, v10
442 %head = insertelement <vscale x 2 x i16> poison, i16 %b, i32 0
443 %splat = shufflevector <vscale x 2 x i16> %head, <vscale x 2 x i16> poison, <vscale x 2 x i32> zeroinitializer
444 %vb = zext <vscale x 2 x i16> %splat to <vscale x 2 x i64>
445 %x = lshr <vscale x 2 x i64> %va, %vb
446 %y = trunc <vscale x 2 x i64> %x to <vscale x 2 x i32>
447 ret <vscale x 2 x i32> %y
450 define <vscale x 2 x i32> @vnsrl_wx_i8_nxv2i32_zext(<vscale x 2 x i64> %va, i8 %b) {
451 ; CHECK-LABEL: vnsrl_wx_i8_nxv2i32_zext:
453 ; CHECK-NEXT: vsetvli a1, zero, e32, m1, ta, ma
454 ; CHECK-NEXT: vnsrl.wx v10, v8, a0
455 ; CHECK-NEXT: vmv.v.v v8, v10
457 %head = insertelement <vscale x 2 x i8> poison, i8 %b, i32 0
458 %splat = shufflevector <vscale x 2 x i8> %head, <vscale x 2 x i8> poison, <vscale x 2 x i32> zeroinitializer
459 %vb = sext <vscale x 2 x i8> %splat to <vscale x 2 x i64>
460 %x = lshr <vscale x 2 x i64> %va, %vb
461 %y = trunc <vscale x 2 x i64> %x to <vscale x 2 x i32>
462 ret <vscale x 2 x i32> %y
465 define <vscale x 2 x i32> @vnsrl_wi_i32_nxv2i32_zext(<vscale x 2 x i64> %va) {
466 ; CHECK-LABEL: vnsrl_wi_i32_nxv2i32_zext:
468 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
469 ; CHECK-NEXT: vnsrl.wi v10, v8, 15
470 ; CHECK-NEXT: vmv.v.v v8, v10
472 %vb = zext <vscale x 2 x i32> splat (i32 15) to <vscale x 2 x i64>
473 %x = lshr <vscale x 2 x i64> %va, %vb
474 %y = trunc <vscale x 2 x i64> %x to <vscale x 2 x i32>
475 ret <vscale x 2 x i32> %y
478 define <vscale x 4 x i32> @vnsrl_wv_nxv4i32_zext(<vscale x 4 x i64> %va, <vscale x 4 x i32> %vb) {
479 ; CHECK-LABEL: vnsrl_wv_nxv4i32_zext:
481 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
482 ; CHECK-NEXT: vnsrl.wv v14, v8, v12
483 ; CHECK-NEXT: vmv.v.v v8, v14
485 %vc = zext <vscale x 4 x i32> %vb to <vscale x 4 x i64>
486 %x = lshr <vscale x 4 x i64> %va, %vc
487 %y = trunc <vscale x 4 x i64> %x to <vscale x 4 x i32>
488 ret <vscale x 4 x i32> %y
491 define <vscale x 4 x i32> @vnsrl_wx_i32_nxv4i32_zext(<vscale x 4 x i64> %va, i32 %b) {
492 ; CHECK-LABEL: vnsrl_wx_i32_nxv4i32_zext:
494 ; CHECK-NEXT: vsetvli a1, zero, e32, m2, ta, ma
495 ; CHECK-NEXT: vnsrl.wx v12, v8, a0
496 ; CHECK-NEXT: vmv.v.v v8, v12
498 %head = insertelement <vscale x 4 x i32> poison, i32 %b, i32 0
499 %splat = shufflevector <vscale x 4 x i32> %head, <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
500 %vb = zext <vscale x 4 x i32> %splat to <vscale x 4 x i64>
501 %x = lshr <vscale x 4 x i64> %va, %vb
502 %y = trunc <vscale x 4 x i64> %x to <vscale x 4 x i32>
503 ret <vscale x 4 x i32> %y
506 define <vscale x 4 x i32> @vnsrl_wx_i16_nxv4i32_zext(<vscale x 4 x i64> %va, i16 %b) {
507 ; CHECK-LABEL: vnsrl_wx_i16_nxv4i32_zext:
509 ; CHECK-NEXT: vsetvli a1, zero, e32, m2, ta, ma
510 ; CHECK-NEXT: vnsrl.wx v12, v8, a0
511 ; CHECK-NEXT: vmv.v.v v8, v12
513 %head = insertelement <vscale x 4 x i16> poison, i16 %b, i32 0
514 %splat = shufflevector <vscale x 4 x i16> %head, <vscale x 4 x i16> poison, <vscale x 4 x i32> zeroinitializer
515 %vb = zext <vscale x 4 x i16> %splat to <vscale x 4 x i64>
516 %x = lshr <vscale x 4 x i64> %va, %vb
517 %y = trunc <vscale x 4 x i64> %x to <vscale x 4 x i32>
518 ret <vscale x 4 x i32> %y
521 define <vscale x 4 x i32> @vnsrl_wx_i8_nxv4i32_zext(<vscale x 4 x i64> %va, i8 %b) {
522 ; CHECK-LABEL: vnsrl_wx_i8_nxv4i32_zext:
524 ; CHECK-NEXT: vsetvli a1, zero, e32, m2, ta, ma
525 ; CHECK-NEXT: vnsrl.wx v12, v8, a0
526 ; CHECK-NEXT: vmv.v.v v8, v12
528 %head = insertelement <vscale x 4 x i8> poison, i8 %b, i32 0
529 %splat = shufflevector <vscale x 4 x i8> %head, <vscale x 4 x i8> poison, <vscale x 4 x i32> zeroinitializer
530 %vb = sext <vscale x 4 x i8> %splat to <vscale x 4 x i64>
531 %x = lshr <vscale x 4 x i64> %va, %vb
532 %y = trunc <vscale x 4 x i64> %x to <vscale x 4 x i32>
533 ret <vscale x 4 x i32> %y
536 define <vscale x 4 x i32> @vnsrl_wi_i32_nxv4i32_zext(<vscale x 4 x i64> %va) {
537 ; CHECK-LABEL: vnsrl_wi_i32_nxv4i32_zext:
539 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
540 ; CHECK-NEXT: vnsrl.wi v12, v8, 15
541 ; CHECK-NEXT: vmv.v.v v8, v12
543 %vb = zext <vscale x 4 x i32> splat (i32 15) to <vscale x 4 x i64>
544 %x = lshr <vscale x 4 x i64> %va, %vb
545 %y = trunc <vscale x 4 x i64> %x to <vscale x 4 x i32>
546 ret <vscale x 4 x i32> %y
549 define <vscale x 8 x i32> @vnsrl_wv_nxv8i32_zext(<vscale x 8 x i64> %va, <vscale x 8 x i32> %vb) {
550 ; CHECK-LABEL: vnsrl_wv_nxv8i32_zext:
552 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
553 ; CHECK-NEXT: vnsrl.wv v20, v8, v16
554 ; CHECK-NEXT: vmv.v.v v8, v20
556 %vc = zext <vscale x 8 x i32> %vb to <vscale x 8 x i64>
557 %x = lshr <vscale x 8 x i64> %va, %vc
558 %y = trunc <vscale x 8 x i64> %x to <vscale x 8 x i32>
559 ret <vscale x 8 x i32> %y
562 define <vscale x 8 x i32> @vnsrl_wx_i32_nxv8i32_zext(<vscale x 8 x i64> %va, i32 %b) {
563 ; CHECK-LABEL: vnsrl_wx_i32_nxv8i32_zext:
565 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma
566 ; CHECK-NEXT: vnsrl.wx v16, v8, a0
567 ; CHECK-NEXT: vmv.v.v v8, v16
569 %head = insertelement <vscale x 8 x i32> poison, i32 %b, i32 0
570 %splat = shufflevector <vscale x 8 x i32> %head, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
571 %vb = zext <vscale x 8 x i32> %splat to <vscale x 8 x i64>
572 %x = lshr <vscale x 8 x i64> %va, %vb
573 %y = trunc <vscale x 8 x i64> %x to <vscale x 8 x i32>
574 ret <vscale x 8 x i32> %y
577 define <vscale x 8 x i32> @vnsrl_wx_i16_nxv8i32_zext(<vscale x 8 x i64> %va, i16 %b) {
578 ; CHECK-LABEL: vnsrl_wx_i16_nxv8i32_zext:
580 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma
581 ; CHECK-NEXT: vnsrl.wx v16, v8, a0
582 ; CHECK-NEXT: vmv.v.v v8, v16
584 %head = insertelement <vscale x 8 x i16> poison, i16 %b, i32 0
585 %splat = shufflevector <vscale x 8 x i16> %head, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
586 %vb = zext <vscale x 8 x i16> %splat to <vscale x 8 x i64>
587 %x = lshr <vscale x 8 x i64> %va, %vb
588 %y = trunc <vscale x 8 x i64> %x to <vscale x 8 x i32>
589 ret <vscale x 8 x i32> %y
592 define <vscale x 8 x i32> @vnsrl_wx_i8_nxv8i32_zext(<vscale x 8 x i64> %va, i8 %b) {
593 ; CHECK-LABEL: vnsrl_wx_i8_nxv8i32_zext:
595 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma
596 ; CHECK-NEXT: vnsrl.wx v16, v8, a0
597 ; CHECK-NEXT: vmv.v.v v8, v16
599 %head = insertelement <vscale x 8 x i8> poison, i8 %b, i32 0
600 %splat = shufflevector <vscale x 8 x i8> %head, <vscale x 8 x i8> poison, <vscale x 8 x i32> zeroinitializer
601 %vb = sext <vscale x 8 x i8> %splat to <vscale x 8 x i64>
602 %x = lshr <vscale x 8 x i64> %va, %vb
603 %y = trunc <vscale x 8 x i64> %x to <vscale x 8 x i32>
604 ret <vscale x 8 x i32> %y
607 define <vscale x 8 x i32> @vnsrl_wi_i32_nxv8i32_zext(<vscale x 8 x i64> %va) {
608 ; CHECK-LABEL: vnsrl_wi_i32_nxv8i32_zext:
610 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
611 ; CHECK-NEXT: vnsrl.wi v16, v8, 15
612 ; CHECK-NEXT: vmv.v.v v8, v16
614 %vb = zext <vscale x 8 x i32> splat (i32 15) to <vscale x 8 x i64>
615 %x = lshr <vscale x 8 x i64> %va, %vb
616 %y = trunc <vscale x 8 x i64> %x to <vscale x 8 x i32>
617 ret <vscale x 8 x i32> %y
620 define <vscale x 1 x i16> @vnsrl_wx_i64_nxv1i16(<vscale x 1 x i32> %va, i64 %b) {
621 ; CHECK-LABEL: vnsrl_wx_i64_nxv1i16:
623 ; CHECK-NEXT: vsetvli a1, zero, e16, mf4, ta, ma
624 ; CHECK-NEXT: vnsrl.wx v8, v8, a0
626 %head = insertelement <vscale x 1 x i64> poison, i64 %b, i32 0
627 %splat = shufflevector <vscale x 1 x i64> %head, <vscale x 1 x i64> poison, <vscale x 1 x i32> zeroinitializer
628 %vb = trunc <vscale x 1 x i64> %splat to <vscale x 1 x i32>
629 %x = lshr <vscale x 1 x i32> %va, %vb
630 %y = trunc <vscale x 1 x i32> %x to <vscale x 1 x i16>
631 ret <vscale x 1 x i16> %y
634 define <vscale x 1 x i8> @vnsrl_wx_i64_nxv1i8(<vscale x 1 x i16> %va, i64 %b) {
635 ; CHECK-LABEL: vnsrl_wx_i64_nxv1i8:
637 ; CHECK-NEXT: vsetvli a1, zero, e8, mf8, ta, ma
638 ; CHECK-NEXT: vnsrl.wx v8, v8, a0
640 %head = insertelement <vscale x 1 x i64> poison, i64 %b, i32 0
641 %splat = shufflevector <vscale x 1 x i64> %head, <vscale x 1 x i64> poison, <vscale x 1 x i32> zeroinitializer
642 %vb = trunc <vscale x 1 x i64> %splat to <vscale x 1 x i16>
643 %x = lshr <vscale x 1 x i16> %va, %vb
644 %y = trunc <vscale x 1 x i16> %x to <vscale x 1 x i8>
645 ret <vscale x 1 x i8> %y