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 %head = insertelement <vscale x 1 x i32> poison, i32 15, i32 0
123 %splat = shufflevector <vscale x 1 x i32> %head, <vscale x 1 x i32> poison, <vscale x 1 x i32> zeroinitializer
124 %vb = sext <vscale x 1 x i32> %splat to <vscale x 1 x i64>
125 %x = lshr <vscale x 1 x i64> %va, %vb
126 %y = trunc <vscale x 1 x i64> %x to <vscale x 1 x i32>
127 ret <vscale x 1 x i32> %y
130 define <vscale x 2 x i32> @vnsrl_wv_nxv2i32_sext(<vscale x 2 x i64> %va, <vscale x 2 x i32> %vb) {
131 ; CHECK-LABEL: vnsrl_wv_nxv2i32_sext:
133 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
134 ; CHECK-NEXT: vnsrl.wv v11, v8, v10
135 ; CHECK-NEXT: vmv.v.v v8, v11
137 %vc = sext <vscale x 2 x i32> %vb to <vscale x 2 x i64>
138 %x = lshr <vscale x 2 x i64> %va, %vc
139 %y = trunc <vscale x 2 x i64> %x to <vscale x 2 x i32>
140 ret <vscale x 2 x i32> %y
143 define <vscale x 2 x i32> @vnsrl_wx_i32_nxv2i32_sext(<vscale x 2 x i64> %va, i32 %b) {
144 ; CHECK-LABEL: vnsrl_wx_i32_nxv2i32_sext:
146 ; CHECK-NEXT: vsetvli a1, zero, e32, m1, ta, ma
147 ; CHECK-NEXT: vnsrl.wx v10, v8, a0
148 ; CHECK-NEXT: vmv.v.v v8, v10
150 %head = insertelement <vscale x 2 x i32> poison, i32 %b, i32 0
151 %splat = shufflevector <vscale x 2 x i32> %head, <vscale x 2 x i32> poison, <vscale x 2 x i32> zeroinitializer
152 %vb = sext <vscale x 2 x i32> %splat to <vscale x 2 x i64>
153 %x = lshr <vscale x 2 x i64> %va, %vb
154 %y = trunc <vscale x 2 x i64> %x to <vscale x 2 x i32>
155 ret <vscale x 2 x i32> %y
158 define <vscale x 2 x i32> @vnsrl_wx_i16_nxv2i32_sext(<vscale x 2 x i64> %va, i16 %b) {
159 ; CHECK-LABEL: vnsrl_wx_i16_nxv2i32_sext:
161 ; CHECK-NEXT: vsetvli a1, zero, e32, m1, ta, ma
162 ; CHECK-NEXT: vnsrl.wx v10, v8, a0
163 ; CHECK-NEXT: vmv.v.v v8, v10
165 %head = insertelement <vscale x 2 x i16> poison, i16 %b, i32 0
166 %splat = shufflevector <vscale x 2 x i16> %head, <vscale x 2 x i16> poison, <vscale x 2 x i32> zeroinitializer
167 %vb = sext <vscale x 2 x i16> %splat to <vscale x 2 x i64>
168 %x = lshr <vscale x 2 x i64> %va, %vb
169 %y = trunc <vscale x 2 x i64> %x to <vscale x 2 x i32>
170 ret <vscale x 2 x i32> %y
173 define <vscale x 2 x i32> @vnsrl_wx_i8_nxv2i32_sext(<vscale x 2 x i64> %va, i8 %b) {
174 ; CHECK-LABEL: vnsrl_wx_i8_nxv2i32_sext:
176 ; CHECK-NEXT: vsetvli a1, zero, e32, m1, ta, ma
177 ; CHECK-NEXT: vnsrl.wx v10, v8, a0
178 ; CHECK-NEXT: vmv.v.v v8, v10
180 %head = insertelement <vscale x 2 x i8> poison, i8 %b, i32 0
181 %splat = shufflevector <vscale x 2 x i8> %head, <vscale x 2 x i8> poison, <vscale x 2 x i32> zeroinitializer
182 %vb = sext <vscale x 2 x i8> %splat to <vscale x 2 x i64>
183 %x = lshr <vscale x 2 x i64> %va, %vb
184 %y = trunc <vscale x 2 x i64> %x to <vscale x 2 x i32>
185 ret <vscale x 2 x i32> %y
188 define <vscale x 2 x i32> @vnsrl_wi_i32_nxv2i32_sext(<vscale x 2 x i64> %va) {
189 ; CHECK-LABEL: vnsrl_wi_i32_nxv2i32_sext:
191 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
192 ; CHECK-NEXT: vnsrl.wi v10, v8, 15
193 ; CHECK-NEXT: vmv.v.v v8, v10
195 %head = insertelement <vscale x 2 x i32> poison, i32 15, i32 0
196 %splat = shufflevector <vscale x 2 x i32> %head, <vscale x 2 x i32> poison, <vscale x 2 x i32> zeroinitializer
197 %vb = sext <vscale x 2 x i32> %splat to <vscale x 2 x i64>
198 %x = lshr <vscale x 2 x i64> %va, %vb
199 %y = trunc <vscale x 2 x i64> %x to <vscale x 2 x i32>
200 ret <vscale x 2 x i32> %y
203 define <vscale x 4 x i32> @vnsrl_wv_nxv4i32_sext(<vscale x 4 x i64> %va, <vscale x 4 x i32> %vb) {
204 ; CHECK-LABEL: vnsrl_wv_nxv4i32_sext:
206 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
207 ; CHECK-NEXT: vnsrl.wv v14, v8, v12
208 ; CHECK-NEXT: vmv.v.v v8, v14
210 %vc = sext <vscale x 4 x i32> %vb to <vscale x 4 x i64>
211 %x = lshr <vscale x 4 x i64> %va, %vc
212 %y = trunc <vscale x 4 x i64> %x to <vscale x 4 x i32>
213 ret <vscale x 4 x i32> %y
216 define <vscale x 4 x i32> @vnsrl_wx_i32_nxv4i32_sext(<vscale x 4 x i64> %va, i32 %b) {
217 ; CHECK-LABEL: vnsrl_wx_i32_nxv4i32_sext:
219 ; CHECK-NEXT: vsetvli a1, zero, e32, m2, ta, ma
220 ; CHECK-NEXT: vnsrl.wx v12, v8, a0
221 ; CHECK-NEXT: vmv.v.v v8, v12
223 %head = insertelement <vscale x 4 x i32> poison, i32 %b, i32 0
224 %splat = shufflevector <vscale x 4 x i32> %head, <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
225 %vb = sext <vscale x 4 x i32> %splat to <vscale x 4 x i64>
226 %x = lshr <vscale x 4 x i64> %va, %vb
227 %y = trunc <vscale x 4 x i64> %x to <vscale x 4 x i32>
228 ret <vscale x 4 x i32> %y
231 define <vscale x 4 x i32> @vnsrl_wx_i16_nxv4i32_sext(<vscale x 4 x i64> %va, i16 %b) {
232 ; CHECK-LABEL: vnsrl_wx_i16_nxv4i32_sext:
234 ; CHECK-NEXT: vsetvli a1, zero, e32, m2, ta, ma
235 ; CHECK-NEXT: vnsrl.wx v12, v8, a0
236 ; CHECK-NEXT: vmv.v.v v8, v12
238 %head = insertelement <vscale x 4 x i16> poison, i16 %b, i32 0
239 %splat = shufflevector <vscale x 4 x i16> %head, <vscale x 4 x i16> poison, <vscale x 4 x i32> zeroinitializer
240 %vb = sext <vscale x 4 x i16> %splat to <vscale x 4 x i64>
241 %x = lshr <vscale x 4 x i64> %va, %vb
242 %y = trunc <vscale x 4 x i64> %x to <vscale x 4 x i32>
243 ret <vscale x 4 x i32> %y
246 define <vscale x 4 x i32> @vnsrl_wx_i8_nxv4i32_sext(<vscale x 4 x i64> %va, i8 %b) {
247 ; CHECK-LABEL: vnsrl_wx_i8_nxv4i32_sext:
249 ; CHECK-NEXT: vsetvli a1, zero, e32, m2, ta, ma
250 ; CHECK-NEXT: vnsrl.wx v12, v8, a0
251 ; CHECK-NEXT: vmv.v.v v8, v12
253 %head = insertelement <vscale x 4 x i8> poison, i8 %b, i32 0
254 %splat = shufflevector <vscale x 4 x i8> %head, <vscale x 4 x i8> poison, <vscale x 4 x i32> zeroinitializer
255 %vb = sext <vscale x 4 x i8> %splat to <vscale x 4 x i64>
256 %x = lshr <vscale x 4 x i64> %va, %vb
257 %y = trunc <vscale x 4 x i64> %x to <vscale x 4 x i32>
258 ret <vscale x 4 x i32> %y
261 define <vscale x 4 x i32> @vnsrl_wi_i32_nxv4i32_sext(<vscale x 4 x i64> %va) {
262 ; CHECK-LABEL: vnsrl_wi_i32_nxv4i32_sext:
264 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
265 ; CHECK-NEXT: vnsrl.wi v12, v8, 15
266 ; CHECK-NEXT: vmv.v.v v8, v12
268 %head = insertelement <vscale x 4 x i32> poison, i32 15, i32 0
269 %splat = shufflevector <vscale x 4 x i32> %head, <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
270 %vb = sext <vscale x 4 x i32> %splat to <vscale x 4 x i64>
271 %x = lshr <vscale x 4 x i64> %va, %vb
272 %y = trunc <vscale x 4 x i64> %x to <vscale x 4 x i32>
273 ret <vscale x 4 x i32> %y
276 define <vscale x 8 x i32> @vnsrl_wv_nxv8i32_sext(<vscale x 8 x i64> %va, <vscale x 8 x i32> %vb) {
277 ; CHECK-LABEL: vnsrl_wv_nxv8i32_sext:
279 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
280 ; CHECK-NEXT: vnsrl.wv v20, v8, v16
281 ; CHECK-NEXT: vmv.v.v v8, v20
283 %vc = sext <vscale x 8 x i32> %vb to <vscale x 8 x i64>
284 %x = lshr <vscale x 8 x i64> %va, %vc
285 %y = trunc <vscale x 8 x i64> %x to <vscale x 8 x i32>
286 ret <vscale x 8 x i32> %y
289 define <vscale x 8 x i32> @vnsrl_wx_i32_nxv8i32_sext(<vscale x 8 x i64> %va, i32 %b) {
290 ; CHECK-LABEL: vnsrl_wx_i32_nxv8i32_sext:
292 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma
293 ; CHECK-NEXT: vnsrl.wx v16, v8, a0
294 ; CHECK-NEXT: vmv.v.v v8, v16
296 %head = insertelement <vscale x 8 x i32> poison, i32 %b, i32 0
297 %splat = shufflevector <vscale x 8 x i32> %head, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
298 %vb = sext <vscale x 8 x i32> %splat to <vscale x 8 x i64>
299 %x = lshr <vscale x 8 x i64> %va, %vb
300 %y = trunc <vscale x 8 x i64> %x to <vscale x 8 x i32>
301 ret <vscale x 8 x i32> %y
304 define <vscale x 8 x i32> @vnsrl_wx_i16_nxv8i32_sext(<vscale x 8 x i64> %va, i16 %b) {
305 ; CHECK-LABEL: vnsrl_wx_i16_nxv8i32_sext:
307 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma
308 ; CHECK-NEXT: vnsrl.wx v16, v8, a0
309 ; CHECK-NEXT: vmv.v.v v8, v16
311 %head = insertelement <vscale x 8 x i16> poison, i16 %b, i32 0
312 %splat = shufflevector <vscale x 8 x i16> %head, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
313 %vb = sext <vscale x 8 x i16> %splat to <vscale x 8 x i64>
314 %x = lshr <vscale x 8 x i64> %va, %vb
315 %y = trunc <vscale x 8 x i64> %x to <vscale x 8 x i32>
316 ret <vscale x 8 x i32> %y
319 define <vscale x 8 x i32> @vnsrl_wx_i8_nxv8i32_sext(<vscale x 8 x i64> %va, i8 %b) {
320 ; CHECK-LABEL: vnsrl_wx_i8_nxv8i32_sext:
322 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma
323 ; CHECK-NEXT: vnsrl.wx v16, v8, a0
324 ; CHECK-NEXT: vmv.v.v v8, v16
326 %head = insertelement <vscale x 8 x i8> poison, i8 %b, i32 0
327 %splat = shufflevector <vscale x 8 x i8> %head, <vscale x 8 x i8> poison, <vscale x 8 x i32> zeroinitializer
328 %vb = sext <vscale x 8 x i8> %splat to <vscale x 8 x i64>
329 %x = lshr <vscale x 8 x i64> %va, %vb
330 %y = trunc <vscale x 8 x i64> %x to <vscale x 8 x i32>
331 ret <vscale x 8 x i32> %y
334 define <vscale x 8 x i32> @vnsrl_wi_i32_nxv8i32_sext(<vscale x 8 x i64> %va) {
335 ; CHECK-LABEL: vnsrl_wi_i32_nxv8i32_sext:
337 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
338 ; CHECK-NEXT: vnsrl.wi v16, v8, 15
339 ; CHECK-NEXT: vmv.v.v v8, v16
341 %head = insertelement <vscale x 8 x i32> poison, i32 15, i32 0
342 %splat = shufflevector <vscale x 8 x i32> %head, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
343 %vb = sext <vscale x 8 x i32> %splat to <vscale x 8 x i64>
344 %x = lshr <vscale x 8 x i64> %va, %vb
345 %y = trunc <vscale x 8 x i64> %x to <vscale x 8 x i32>
346 ret <vscale x 8 x i32> %y
349 define <vscale x 1 x i32> @vnsrl_wv_nxv1i32_zext(<vscale x 1 x i64> %va, <vscale x 1 x i32> %vb) {
350 ; CHECK-LABEL: vnsrl_wv_nxv1i32_zext:
352 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
353 ; CHECK-NEXT: vnsrl.wv v8, v8, v9
355 %vc = zext <vscale x 1 x i32> %vb to <vscale x 1 x i64>
356 %x = lshr <vscale x 1 x i64> %va, %vc
357 %y = trunc <vscale x 1 x i64> %x to <vscale x 1 x i32>
358 ret <vscale x 1 x i32> %y
361 define <vscale x 1 x i32> @vnsrl_wx_i32_nxv1i32_zext(<vscale x 1 x i64> %va, i32 %b) {
362 ; CHECK-LABEL: vnsrl_wx_i32_nxv1i32_zext:
364 ; CHECK-NEXT: vsetvli a1, zero, e32, mf2, ta, ma
365 ; CHECK-NEXT: vnsrl.wx v8, v8, a0
367 %head = insertelement <vscale x 1 x i32> poison, i32 %b, i32 0
368 %splat = shufflevector <vscale x 1 x i32> %head, <vscale x 1 x i32> poison, <vscale x 1 x i32> zeroinitializer
369 %vb = zext <vscale x 1 x i32> %splat to <vscale x 1 x i64>
370 %x = lshr <vscale x 1 x i64> %va, %vb
371 %y = trunc <vscale x 1 x i64> %x to <vscale x 1 x i32>
372 ret <vscale x 1 x i32> %y
375 define <vscale x 1 x i32> @vnsrl_wx_i16_nxv1i32_zext(<vscale x 1 x i64> %va, i16 %b) {
376 ; CHECK-LABEL: vnsrl_wx_i16_nxv1i32_zext:
378 ; CHECK-NEXT: vsetvli a1, zero, e32, mf2, ta, ma
379 ; CHECK-NEXT: vnsrl.wx v8, v8, a0
381 %head = insertelement <vscale x 1 x i16> poison, i16 %b, i32 0
382 %splat = shufflevector <vscale x 1 x i16> %head, <vscale x 1 x i16> poison, <vscale x 1 x i32> zeroinitializer
383 %vb = zext <vscale x 1 x i16> %splat to <vscale x 1 x i64>
384 %x = lshr <vscale x 1 x i64> %va, %vb
385 %y = trunc <vscale x 1 x i64> %x to <vscale x 1 x i32>
386 ret <vscale x 1 x i32> %y
389 define <vscale x 1 x i32> @vnsrl_wx_i8_nxv1i32_zext(<vscale x 1 x i64> %va, i8 %b) {
390 ; CHECK-LABEL: vnsrl_wx_i8_nxv1i32_zext:
392 ; CHECK-NEXT: vsetvli a1, zero, e32, mf2, ta, ma
393 ; CHECK-NEXT: vnsrl.wx v8, v8, a0
395 %head = insertelement <vscale x 1 x i8> poison, i8 %b, i32 0
396 %splat = shufflevector <vscale x 1 x i8> %head, <vscale x 1 x i8> poison, <vscale x 1 x i32> zeroinitializer
397 %vb = sext <vscale x 1 x i8> %splat to <vscale x 1 x i64>
398 %x = lshr <vscale x 1 x i64> %va, %vb
399 %y = trunc <vscale x 1 x i64> %x to <vscale x 1 x i32>
400 ret <vscale x 1 x i32> %y
403 define <vscale x 1 x i32> @vnsrl_wi_i32_nxv1i32_zext(<vscale x 1 x i64> %va) {
404 ; CHECK-LABEL: vnsrl_wi_i32_nxv1i32_zext:
406 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
407 ; CHECK-NEXT: vnsrl.wi v8, v8, 15
409 %head = insertelement <vscale x 1 x i32> poison, i32 15, i32 0
410 %splat = shufflevector <vscale x 1 x i32> %head, <vscale x 1 x i32> poison, <vscale x 1 x i32> zeroinitializer
411 %vb = zext <vscale x 1 x i32> %splat to <vscale x 1 x i64>
412 %x = lshr <vscale x 1 x i64> %va, %vb
413 %y = trunc <vscale x 1 x i64> %x to <vscale x 1 x i32>
414 ret <vscale x 1 x i32> %y
417 define <vscale x 2 x i32> @vnsrl_wv_nxv2i32_zext(<vscale x 2 x i64> %va, <vscale x 2 x i32> %vb) {
418 ; CHECK-LABEL: vnsrl_wv_nxv2i32_zext:
420 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
421 ; CHECK-NEXT: vnsrl.wv v11, v8, v10
422 ; CHECK-NEXT: vmv.v.v v8, v11
424 %vc = zext <vscale x 2 x i32> %vb to <vscale x 2 x i64>
425 %x = lshr <vscale x 2 x i64> %va, %vc
426 %y = trunc <vscale x 2 x i64> %x to <vscale x 2 x i32>
427 ret <vscale x 2 x i32> %y
430 define <vscale x 2 x i32> @vnsrl_wx_i32_nxv2i32_zext(<vscale x 2 x i64> %va, i32 %b) {
431 ; CHECK-LABEL: vnsrl_wx_i32_nxv2i32_zext:
433 ; CHECK-NEXT: vsetvli a1, zero, e32, m1, ta, ma
434 ; CHECK-NEXT: vnsrl.wx v10, v8, a0
435 ; CHECK-NEXT: vmv.v.v v8, v10
437 %head = insertelement <vscale x 2 x i32> poison, i32 %b, i32 0
438 %splat = shufflevector <vscale x 2 x i32> %head, <vscale x 2 x i32> poison, <vscale x 2 x i32> zeroinitializer
439 %vb = zext <vscale x 2 x i32> %splat to <vscale x 2 x i64>
440 %x = lshr <vscale x 2 x i64> %va, %vb
441 %y = trunc <vscale x 2 x i64> %x to <vscale x 2 x i32>
442 ret <vscale x 2 x i32> %y
445 define <vscale x 2 x i32> @vnsrl_wx_i16_nxv2i32_zext(<vscale x 2 x i64> %va, i16 %b) {
446 ; CHECK-LABEL: vnsrl_wx_i16_nxv2i32_zext:
448 ; CHECK-NEXT: vsetvli a1, zero, e32, m1, ta, ma
449 ; CHECK-NEXT: vnsrl.wx v10, v8, a0
450 ; CHECK-NEXT: vmv.v.v v8, v10
452 %head = insertelement <vscale x 2 x i16> poison, i16 %b, i32 0
453 %splat = shufflevector <vscale x 2 x i16> %head, <vscale x 2 x i16> poison, <vscale x 2 x i32> zeroinitializer
454 %vb = zext <vscale x 2 x i16> %splat to <vscale x 2 x i64>
455 %x = lshr <vscale x 2 x i64> %va, %vb
456 %y = trunc <vscale x 2 x i64> %x to <vscale x 2 x i32>
457 ret <vscale x 2 x i32> %y
460 define <vscale x 2 x i32> @vnsrl_wx_i8_nxv2i32_zext(<vscale x 2 x i64> %va, i8 %b) {
461 ; CHECK-LABEL: vnsrl_wx_i8_nxv2i32_zext:
463 ; CHECK-NEXT: vsetvli a1, zero, e32, m1, ta, ma
464 ; CHECK-NEXT: vnsrl.wx v10, v8, a0
465 ; CHECK-NEXT: vmv.v.v v8, v10
467 %head = insertelement <vscale x 2 x i8> poison, i8 %b, i32 0
468 %splat = shufflevector <vscale x 2 x i8> %head, <vscale x 2 x i8> poison, <vscale x 2 x i32> zeroinitializer
469 %vb = sext <vscale x 2 x i8> %splat to <vscale x 2 x i64>
470 %x = lshr <vscale x 2 x i64> %va, %vb
471 %y = trunc <vscale x 2 x i64> %x to <vscale x 2 x i32>
472 ret <vscale x 2 x i32> %y
475 define <vscale x 2 x i32> @vnsrl_wi_i32_nxv2i32_zext(<vscale x 2 x i64> %va) {
476 ; CHECK-LABEL: vnsrl_wi_i32_nxv2i32_zext:
478 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
479 ; CHECK-NEXT: vnsrl.wi v10, v8, 15
480 ; CHECK-NEXT: vmv.v.v v8, v10
482 %head = insertelement <vscale x 2 x i32> poison, i32 15, i32 0
483 %splat = shufflevector <vscale x 2 x i32> %head, <vscale x 2 x i32> poison, <vscale x 2 x i32> zeroinitializer
484 %vb = zext <vscale x 2 x i32> %splat to <vscale x 2 x i64>
485 %x = lshr <vscale x 2 x i64> %va, %vb
486 %y = trunc <vscale x 2 x i64> %x to <vscale x 2 x i32>
487 ret <vscale x 2 x i32> %y
490 define <vscale x 4 x i32> @vnsrl_wv_nxv4i32_zext(<vscale x 4 x i64> %va, <vscale x 4 x i32> %vb) {
491 ; CHECK-LABEL: vnsrl_wv_nxv4i32_zext:
493 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
494 ; CHECK-NEXT: vnsrl.wv v14, v8, v12
495 ; CHECK-NEXT: vmv.v.v v8, v14
497 %vc = zext <vscale x 4 x i32> %vb to <vscale x 4 x i64>
498 %x = lshr <vscale x 4 x i64> %va, %vc
499 %y = trunc <vscale x 4 x i64> %x to <vscale x 4 x i32>
500 ret <vscale x 4 x i32> %y
503 define <vscale x 4 x i32> @vnsrl_wx_i32_nxv4i32_zext(<vscale x 4 x i64> %va, i32 %b) {
504 ; CHECK-LABEL: vnsrl_wx_i32_nxv4i32_zext:
506 ; CHECK-NEXT: vsetvli a1, zero, e32, m2, ta, ma
507 ; CHECK-NEXT: vnsrl.wx v12, v8, a0
508 ; CHECK-NEXT: vmv.v.v v8, v12
510 %head = insertelement <vscale x 4 x i32> poison, i32 %b, i32 0
511 %splat = shufflevector <vscale x 4 x i32> %head, <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
512 %vb = zext <vscale x 4 x i32> %splat to <vscale x 4 x i64>
513 %x = lshr <vscale x 4 x i64> %va, %vb
514 %y = trunc <vscale x 4 x i64> %x to <vscale x 4 x i32>
515 ret <vscale x 4 x i32> %y
518 define <vscale x 4 x i32> @vnsrl_wx_i16_nxv4i32_zext(<vscale x 4 x i64> %va, i16 %b) {
519 ; CHECK-LABEL: vnsrl_wx_i16_nxv4i32_zext:
521 ; CHECK-NEXT: vsetvli a1, zero, e32, m2, ta, ma
522 ; CHECK-NEXT: vnsrl.wx v12, v8, a0
523 ; CHECK-NEXT: vmv.v.v v8, v12
525 %head = insertelement <vscale x 4 x i16> poison, i16 %b, i32 0
526 %splat = shufflevector <vscale x 4 x i16> %head, <vscale x 4 x i16> poison, <vscale x 4 x i32> zeroinitializer
527 %vb = zext <vscale x 4 x i16> %splat to <vscale x 4 x i64>
528 %x = lshr <vscale x 4 x i64> %va, %vb
529 %y = trunc <vscale x 4 x i64> %x to <vscale x 4 x i32>
530 ret <vscale x 4 x i32> %y
533 define <vscale x 4 x i32> @vnsrl_wx_i8_nxv4i32_zext(<vscale x 4 x i64> %va, i8 %b) {
534 ; CHECK-LABEL: vnsrl_wx_i8_nxv4i32_zext:
536 ; CHECK-NEXT: vsetvli a1, zero, e32, m2, ta, ma
537 ; CHECK-NEXT: vnsrl.wx v12, v8, a0
538 ; CHECK-NEXT: vmv.v.v v8, v12
540 %head = insertelement <vscale x 4 x i8> poison, i8 %b, i32 0
541 %splat = shufflevector <vscale x 4 x i8> %head, <vscale x 4 x i8> poison, <vscale x 4 x i32> zeroinitializer
542 %vb = sext <vscale x 4 x i8> %splat to <vscale x 4 x i64>
543 %x = lshr <vscale x 4 x i64> %va, %vb
544 %y = trunc <vscale x 4 x i64> %x to <vscale x 4 x i32>
545 ret <vscale x 4 x i32> %y
548 define <vscale x 4 x i32> @vnsrl_wi_i32_nxv4i32_zext(<vscale x 4 x i64> %va) {
549 ; CHECK-LABEL: vnsrl_wi_i32_nxv4i32_zext:
551 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
552 ; CHECK-NEXT: vnsrl.wi v12, v8, 15
553 ; CHECK-NEXT: vmv.v.v v8, v12
555 %head = insertelement <vscale x 4 x i32> poison, i32 15, i32 0
556 %splat = shufflevector <vscale x 4 x i32> %head, <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
557 %vb = zext <vscale x 4 x i32> %splat to <vscale x 4 x i64>
558 %x = lshr <vscale x 4 x i64> %va, %vb
559 %y = trunc <vscale x 4 x i64> %x to <vscale x 4 x i32>
560 ret <vscale x 4 x i32> %y
563 define <vscale x 8 x i32> @vnsrl_wv_nxv8i32_zext(<vscale x 8 x i64> %va, <vscale x 8 x i32> %vb) {
564 ; CHECK-LABEL: vnsrl_wv_nxv8i32_zext:
566 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
567 ; CHECK-NEXT: vnsrl.wv v20, v8, v16
568 ; CHECK-NEXT: vmv.v.v v8, v20
570 %vc = zext <vscale x 8 x i32> %vb to <vscale x 8 x i64>
571 %x = lshr <vscale x 8 x i64> %va, %vc
572 %y = trunc <vscale x 8 x i64> %x to <vscale x 8 x i32>
573 ret <vscale x 8 x i32> %y
576 define <vscale x 8 x i32> @vnsrl_wx_i32_nxv8i32_zext(<vscale x 8 x i64> %va, i32 %b) {
577 ; CHECK-LABEL: vnsrl_wx_i32_nxv8i32_zext:
579 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma
580 ; CHECK-NEXT: vnsrl.wx v16, v8, a0
581 ; CHECK-NEXT: vmv.v.v v8, v16
583 %head = insertelement <vscale x 8 x i32> poison, i32 %b, i32 0
584 %splat = shufflevector <vscale x 8 x i32> %head, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
585 %vb = zext <vscale x 8 x i32> %splat to <vscale x 8 x i64>
586 %x = lshr <vscale x 8 x i64> %va, %vb
587 %y = trunc <vscale x 8 x i64> %x to <vscale x 8 x i32>
588 ret <vscale x 8 x i32> %y
591 define <vscale x 8 x i32> @vnsrl_wx_i16_nxv8i32_zext(<vscale x 8 x i64> %va, i16 %b) {
592 ; CHECK-LABEL: vnsrl_wx_i16_nxv8i32_zext:
594 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma
595 ; CHECK-NEXT: vnsrl.wx v16, v8, a0
596 ; CHECK-NEXT: vmv.v.v v8, v16
598 %head = insertelement <vscale x 8 x i16> poison, i16 %b, i32 0
599 %splat = shufflevector <vscale x 8 x i16> %head, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
600 %vb = zext <vscale x 8 x i16> %splat to <vscale x 8 x i64>
601 %x = lshr <vscale x 8 x i64> %va, %vb
602 %y = trunc <vscale x 8 x i64> %x to <vscale x 8 x i32>
603 ret <vscale x 8 x i32> %y
606 define <vscale x 8 x i32> @vnsrl_wx_i8_nxv8i32_zext(<vscale x 8 x i64> %va, i8 %b) {
607 ; CHECK-LABEL: vnsrl_wx_i8_nxv8i32_zext:
609 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma
610 ; CHECK-NEXT: vnsrl.wx v16, v8, a0
611 ; CHECK-NEXT: vmv.v.v v8, v16
613 %head = insertelement <vscale x 8 x i8> poison, i8 %b, i32 0
614 %splat = shufflevector <vscale x 8 x i8> %head, <vscale x 8 x i8> poison, <vscale x 8 x i32> zeroinitializer
615 %vb = sext <vscale x 8 x i8> %splat to <vscale x 8 x i64>
616 %x = lshr <vscale x 8 x i64> %va, %vb
617 %y = trunc <vscale x 8 x i64> %x to <vscale x 8 x i32>
618 ret <vscale x 8 x i32> %y
621 define <vscale x 8 x i32> @vnsrl_wi_i32_nxv8i32_zext(<vscale x 8 x i64> %va) {
622 ; CHECK-LABEL: vnsrl_wi_i32_nxv8i32_zext:
624 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
625 ; CHECK-NEXT: vnsrl.wi v16, v8, 15
626 ; CHECK-NEXT: vmv.v.v v8, v16
628 %head = insertelement <vscale x 8 x i32> poison, i32 15, i32 0
629 %splat = shufflevector <vscale x 8 x i32> %head, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
630 %vb = zext <vscale x 8 x i32> %splat to <vscale x 8 x i64>
631 %x = lshr <vscale x 8 x i64> %va, %vb
632 %y = trunc <vscale x 8 x i64> %x to <vscale x 8 x i32>
633 ret <vscale x 8 x i32> %y
636 define <vscale x 1 x i16> @vnsrl_wx_i64_nxv1i16(<vscale x 1 x i32> %va, i64 %b) {
637 ; CHECK-LABEL: vnsrl_wx_i64_nxv1i16:
639 ; CHECK-NEXT: vsetvli a1, zero, e16, mf4, ta, ma
640 ; CHECK-NEXT: vnsrl.wx v8, v8, a0
642 %head = insertelement <vscale x 1 x i64> poison, i64 %b, i32 0
643 %splat = shufflevector <vscale x 1 x i64> %head, <vscale x 1 x i64> poison, <vscale x 1 x i32> zeroinitializer
644 %vb = trunc <vscale x 1 x i64> %splat to <vscale x 1 x i32>
645 %x = lshr <vscale x 1 x i32> %va, %vb
646 %y = trunc <vscale x 1 x i32> %x to <vscale x 1 x i16>
647 ret <vscale x 1 x i16> %y
650 define <vscale x 1 x i8> @vnsrl_wx_i64_nxv1i8(<vscale x 1 x i16> %va, i64 %b) {
651 ; CHECK-LABEL: vnsrl_wx_i64_nxv1i8:
653 ; CHECK-NEXT: vsetvli a1, zero, e8, mf8, ta, ma
654 ; CHECK-NEXT: vnsrl.wx v8, v8, a0
656 %head = insertelement <vscale x 1 x i64> poison, i64 %b, i32 0
657 %splat = shufflevector <vscale x 1 x i64> %head, <vscale x 1 x i64> poison, <vscale x 1 x i32> zeroinitializer
658 %vb = trunc <vscale x 1 x i64> %splat to <vscale x 1 x i16>
659 %x = lshr <vscale x 1 x i16> %va, %vb
660 %y = trunc <vscale x 1 x i16> %x to <vscale x 1 x i8>
661 ret <vscale x 1 x i8> %y