1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
2 ; RUN: llc -mtriple=riscv32 -mattr=+v -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,RV32
3 ; RUN: llc -mtriple=riscv64 -mattr=+v -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,RV64
4 ; RUN: llc -mtriple=riscv32 -mattr=+v,+zvkb -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK-ZVKB
5 ; RUN: llc -mtriple=riscv64 -mattr=+v,+zvkb -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK-ZVKB
7 declare <1 x i8> @llvm.fshl.v1i8(<1 x i8>, <1 x i8>, <1 x i8>)
9 define <1 x i8> @vrol_vv_v1i8(<1 x i8> %a, <1 x i8> %b) {
10 ; CHECK-LABEL: vrol_vv_v1i8:
12 ; CHECK-NEXT: vsetivli zero, 1, e8, mf8, ta, ma
13 ; CHECK-NEXT: vand.vi v10, v9, 7
14 ; CHECK-NEXT: vsll.vv v10, v8, v10
15 ; CHECK-NEXT: vrsub.vi v9, v9, 0
16 ; CHECK-NEXT: vand.vi v9, v9, 7
17 ; CHECK-NEXT: vsrl.vv v8, v8, v9
18 ; CHECK-NEXT: vor.vv v8, v10, v8
21 ; CHECK-ZVKB-LABEL: vrol_vv_v1i8:
22 ; CHECK-ZVKB: # %bb.0:
23 ; CHECK-ZVKB-NEXT: vsetivli zero, 1, e8, mf8, ta, ma
24 ; CHECK-ZVKB-NEXT: vrol.vv v8, v8, v9
25 ; CHECK-ZVKB-NEXT: ret
26 %x = call <1 x i8> @llvm.fshl.v1i8(<1 x i8> %a, <1 x i8> %a, <1 x i8> %b)
30 define <1 x i8> @vrol_vx_v1i8(<1 x i8> %a, i8 %b) {
31 ; CHECK-LABEL: vrol_vx_v1i8:
33 ; CHECK-NEXT: vsetivli zero, 1, e8, mf8, ta, ma
34 ; CHECK-NEXT: vmv.s.x v9, a0
35 ; CHECK-NEXT: vand.vi v10, v9, 7
36 ; CHECK-NEXT: vsll.vv v10, v8, v10
37 ; CHECK-NEXT: vrsub.vi v9, v9, 0
38 ; CHECK-NEXT: vand.vi v9, v9, 7
39 ; CHECK-NEXT: vsrl.vv v8, v8, v9
40 ; CHECK-NEXT: vor.vv v8, v10, v8
43 ; CHECK-ZVKB-LABEL: vrol_vx_v1i8:
44 ; CHECK-ZVKB: # %bb.0:
45 ; CHECK-ZVKB-NEXT: vsetivli zero, 1, e8, mf8, ta, ma
46 ; CHECK-ZVKB-NEXT: vrol.vx v8, v8, a0
47 ; CHECK-ZVKB-NEXT: ret
48 %b.head = insertelement <1 x i8> poison, i8 %b, i32 0
49 %b.splat = shufflevector <1 x i8> %b.head, <1 x i8> poison, <1 x i32> zeroinitializer
50 %x = call <1 x i8> @llvm.fshl.v1i8(<1 x i8> %a, <1 x i8> %a, <1 x i8> %b.splat)
54 declare <2 x i8> @llvm.fshl.v2i8(<2 x i8>, <2 x i8>, <2 x i8>)
56 define <2 x i8> @vrol_vv_v2i8(<2 x i8> %a, <2 x i8> %b) {
57 ; CHECK-LABEL: vrol_vv_v2i8:
59 ; CHECK-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
60 ; CHECK-NEXT: vand.vi v10, v9, 7
61 ; CHECK-NEXT: vsll.vv v10, v8, v10
62 ; CHECK-NEXT: vrsub.vi v9, v9, 0
63 ; CHECK-NEXT: vand.vi v9, v9, 7
64 ; CHECK-NEXT: vsrl.vv v8, v8, v9
65 ; CHECK-NEXT: vor.vv v8, v10, v8
68 ; CHECK-ZVKB-LABEL: vrol_vv_v2i8:
69 ; CHECK-ZVKB: # %bb.0:
70 ; CHECK-ZVKB-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
71 ; CHECK-ZVKB-NEXT: vrol.vv v8, v8, v9
72 ; CHECK-ZVKB-NEXT: ret
73 %x = call <2 x i8> @llvm.fshl.v2i8(<2 x i8> %a, <2 x i8> %a, <2 x i8> %b)
77 define <2 x i8> @vrol_vx_v2i8(<2 x i8> %a, i8 %b) {
78 ; CHECK-LABEL: vrol_vx_v2i8:
80 ; CHECK-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
81 ; CHECK-NEXT: vmv.v.x v9, a0
82 ; CHECK-NEXT: vand.vi v10, v9, 7
83 ; CHECK-NEXT: vsll.vv v10, v8, v10
84 ; CHECK-NEXT: vrsub.vi v9, v9, 0
85 ; CHECK-NEXT: vand.vi v9, v9, 7
86 ; CHECK-NEXT: vsrl.vv v8, v8, v9
87 ; CHECK-NEXT: vor.vv v8, v10, v8
90 ; CHECK-ZVKB-LABEL: vrol_vx_v2i8:
91 ; CHECK-ZVKB: # %bb.0:
92 ; CHECK-ZVKB-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
93 ; CHECK-ZVKB-NEXT: vrol.vx v8, v8, a0
94 ; CHECK-ZVKB-NEXT: ret
95 %b.head = insertelement <2 x i8> poison, i8 %b, i32 0
96 %b.splat = shufflevector <2 x i8> %b.head, <2 x i8> poison, <2 x i32> zeroinitializer
97 %x = call <2 x i8> @llvm.fshl.v2i8(<2 x i8> %a, <2 x i8> %a, <2 x i8> %b.splat)
101 declare <4 x i8> @llvm.fshl.v4i8(<4 x i8>, <4 x i8>, <4 x i8>)
103 define <4 x i8> @vrol_vv_v4i8(<4 x i8> %a, <4 x i8> %b) {
104 ; CHECK-LABEL: vrol_vv_v4i8:
106 ; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
107 ; CHECK-NEXT: vand.vi v10, v9, 7
108 ; CHECK-NEXT: vsll.vv v10, v8, v10
109 ; CHECK-NEXT: vrsub.vi v9, v9, 0
110 ; CHECK-NEXT: vand.vi v9, v9, 7
111 ; CHECK-NEXT: vsrl.vv v8, v8, v9
112 ; CHECK-NEXT: vor.vv v8, v10, v8
115 ; CHECK-ZVKB-LABEL: vrol_vv_v4i8:
116 ; CHECK-ZVKB: # %bb.0:
117 ; CHECK-ZVKB-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
118 ; CHECK-ZVKB-NEXT: vrol.vv v8, v8, v9
119 ; CHECK-ZVKB-NEXT: ret
120 %x = call <4 x i8> @llvm.fshl.v4i8(<4 x i8> %a, <4 x i8> %a, <4 x i8> %b)
124 define <4 x i8> @vrol_vx_v4i8(<4 x i8> %a, i8 %b) {
125 ; CHECK-LABEL: vrol_vx_v4i8:
127 ; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
128 ; CHECK-NEXT: vmv.v.x v9, a0
129 ; CHECK-NEXT: vand.vi v10, v9, 7
130 ; CHECK-NEXT: vsll.vv v10, v8, v10
131 ; CHECK-NEXT: vrsub.vi v9, v9, 0
132 ; CHECK-NEXT: vand.vi v9, v9, 7
133 ; CHECK-NEXT: vsrl.vv v8, v8, v9
134 ; CHECK-NEXT: vor.vv v8, v10, v8
137 ; CHECK-ZVKB-LABEL: vrol_vx_v4i8:
138 ; CHECK-ZVKB: # %bb.0:
139 ; CHECK-ZVKB-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
140 ; CHECK-ZVKB-NEXT: vrol.vx v8, v8, a0
141 ; CHECK-ZVKB-NEXT: ret
142 %b.head = insertelement <4 x i8> poison, i8 %b, i32 0
143 %b.splat = shufflevector <4 x i8> %b.head, <4 x i8> poison, <4 x i32> zeroinitializer
144 %x = call <4 x i8> @llvm.fshl.v4i8(<4 x i8> %a, <4 x i8> %a, <4 x i8> %b.splat)
148 declare <8 x i8> @llvm.fshl.v8i8(<8 x i8>, <8 x i8>, <8 x i8>)
150 define <8 x i8> @vrol_vv_v8i8(<8 x i8> %a, <8 x i8> %b) {
151 ; CHECK-LABEL: vrol_vv_v8i8:
153 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
154 ; CHECK-NEXT: vand.vi v10, v9, 7
155 ; CHECK-NEXT: vsll.vv v10, v8, v10
156 ; CHECK-NEXT: vrsub.vi v9, v9, 0
157 ; CHECK-NEXT: vand.vi v9, v9, 7
158 ; CHECK-NEXT: vsrl.vv v8, v8, v9
159 ; CHECK-NEXT: vor.vv v8, v10, v8
162 ; CHECK-ZVKB-LABEL: vrol_vv_v8i8:
163 ; CHECK-ZVKB: # %bb.0:
164 ; CHECK-ZVKB-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
165 ; CHECK-ZVKB-NEXT: vrol.vv v8, v8, v9
166 ; CHECK-ZVKB-NEXT: ret
167 %x = call <8 x i8> @llvm.fshl.v8i8(<8 x i8> %a, <8 x i8> %a, <8 x i8> %b)
171 define <8 x i8> @vrol_vx_v8i8(<8 x i8> %a, i8 %b) {
172 ; CHECK-LABEL: vrol_vx_v8i8:
174 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
175 ; CHECK-NEXT: vmv.v.x v9, a0
176 ; CHECK-NEXT: vand.vi v10, v9, 7
177 ; CHECK-NEXT: vsll.vv v10, v8, v10
178 ; CHECK-NEXT: vrsub.vi v9, v9, 0
179 ; CHECK-NEXT: vand.vi v9, v9, 7
180 ; CHECK-NEXT: vsrl.vv v8, v8, v9
181 ; CHECK-NEXT: vor.vv v8, v10, v8
184 ; CHECK-ZVKB-LABEL: vrol_vx_v8i8:
185 ; CHECK-ZVKB: # %bb.0:
186 ; CHECK-ZVKB-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
187 ; CHECK-ZVKB-NEXT: vrol.vx v8, v8, a0
188 ; CHECK-ZVKB-NEXT: ret
189 %b.head = insertelement <8 x i8> poison, i8 %b, i32 0
190 %b.splat = shufflevector <8 x i8> %b.head, <8 x i8> poison, <8 x i32> zeroinitializer
191 %x = call <8 x i8> @llvm.fshl.v8i8(<8 x i8> %a, <8 x i8> %a, <8 x i8> %b.splat)
195 declare <16 x i8> @llvm.fshl.v16i8(<16 x i8>, <16 x i8>, <16 x i8>)
197 define <16 x i8> @vrol_vv_v16i8(<16 x i8> %a, <16 x i8> %b) {
198 ; CHECK-LABEL: vrol_vv_v16i8:
200 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
201 ; CHECK-NEXT: vand.vi v10, v9, 7
202 ; CHECK-NEXT: vsll.vv v10, v8, v10
203 ; CHECK-NEXT: vrsub.vi v9, v9, 0
204 ; CHECK-NEXT: vand.vi v9, v9, 7
205 ; CHECK-NEXT: vsrl.vv v8, v8, v9
206 ; CHECK-NEXT: vor.vv v8, v10, v8
209 ; CHECK-ZVKB-LABEL: vrol_vv_v16i8:
210 ; CHECK-ZVKB: # %bb.0:
211 ; CHECK-ZVKB-NEXT: vsetivli zero, 16, e8, m1, ta, ma
212 ; CHECK-ZVKB-NEXT: vrol.vv v8, v8, v9
213 ; CHECK-ZVKB-NEXT: ret
214 %x = call <16 x i8> @llvm.fshl.v16i8(<16 x i8> %a, <16 x i8> %a, <16 x i8> %b)
218 define <16 x i8> @vrol_vx_v16i8(<16 x i8> %a, i8 %b) {
219 ; CHECK-LABEL: vrol_vx_v16i8:
221 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
222 ; CHECK-NEXT: vmv.v.x v9, a0
223 ; CHECK-NEXT: vand.vi v10, v9, 7
224 ; CHECK-NEXT: vsll.vv v10, v8, v10
225 ; CHECK-NEXT: vrsub.vi v9, v9, 0
226 ; CHECK-NEXT: vand.vi v9, v9, 7
227 ; CHECK-NEXT: vsrl.vv v8, v8, v9
228 ; CHECK-NEXT: vor.vv v8, v10, v8
231 ; CHECK-ZVKB-LABEL: vrol_vx_v16i8:
232 ; CHECK-ZVKB: # %bb.0:
233 ; CHECK-ZVKB-NEXT: vsetivli zero, 16, e8, m1, ta, ma
234 ; CHECK-ZVKB-NEXT: vrol.vx v8, v8, a0
235 ; CHECK-ZVKB-NEXT: ret
236 %b.head = insertelement <16 x i8> poison, i8 %b, i32 0
237 %b.splat = shufflevector <16 x i8> %b.head, <16 x i8> poison, <16 x i32> zeroinitializer
238 %x = call <16 x i8> @llvm.fshl.v16i8(<16 x i8> %a, <16 x i8> %a, <16 x i8> %b.splat)
242 declare <32 x i8> @llvm.fshl.v32i8(<32 x i8>, <32 x i8>, <32 x i8>)
244 define <32 x i8> @vrol_vv_v32i8(<32 x i8> %a, <32 x i8> %b) {
245 ; CHECK-LABEL: vrol_vv_v32i8:
247 ; CHECK-NEXT: li a0, 32
248 ; CHECK-NEXT: vsetvli zero, a0, e8, m2, ta, ma
249 ; CHECK-NEXT: vand.vi v12, v10, 7
250 ; CHECK-NEXT: vsll.vv v12, v8, v12
251 ; CHECK-NEXT: vrsub.vi v10, v10, 0
252 ; CHECK-NEXT: vand.vi v10, v10, 7
253 ; CHECK-NEXT: vsrl.vv v8, v8, v10
254 ; CHECK-NEXT: vor.vv v8, v12, v8
257 ; CHECK-ZVKB-LABEL: vrol_vv_v32i8:
258 ; CHECK-ZVKB: # %bb.0:
259 ; CHECK-ZVKB-NEXT: li a0, 32
260 ; CHECK-ZVKB-NEXT: vsetvli zero, a0, e8, m2, ta, ma
261 ; CHECK-ZVKB-NEXT: vrol.vv v8, v8, v10
262 ; CHECK-ZVKB-NEXT: ret
263 %x = call <32 x i8> @llvm.fshl.v32i8(<32 x i8> %a, <32 x i8> %a, <32 x i8> %b)
267 define <32 x i8> @vrol_vx_v32i8(<32 x i8> %a, i8 %b) {
268 ; CHECK-LABEL: vrol_vx_v32i8:
270 ; CHECK-NEXT: li a1, 32
271 ; CHECK-NEXT: vsetvli zero, a1, e8, m2, ta, ma
272 ; CHECK-NEXT: vmv.v.x v10, a0
273 ; CHECK-NEXT: vand.vi v12, v10, 7
274 ; CHECK-NEXT: vsll.vv v12, v8, v12
275 ; CHECK-NEXT: vrsub.vi v10, v10, 0
276 ; CHECK-NEXT: vand.vi v10, v10, 7
277 ; CHECK-NEXT: vsrl.vv v8, v8, v10
278 ; CHECK-NEXT: vor.vv v8, v12, v8
281 ; CHECK-ZVKB-LABEL: vrol_vx_v32i8:
282 ; CHECK-ZVKB: # %bb.0:
283 ; CHECK-ZVKB-NEXT: li a1, 32
284 ; CHECK-ZVKB-NEXT: vsetvli zero, a1, e8, m2, ta, ma
285 ; CHECK-ZVKB-NEXT: vrol.vx v8, v8, a0
286 ; CHECK-ZVKB-NEXT: ret
287 %b.head = insertelement <32 x i8> poison, i8 %b, i32 0
288 %b.splat = shufflevector <32 x i8> %b.head, <32 x i8> poison, <32 x i32> zeroinitializer
289 %x = call <32 x i8> @llvm.fshl.v32i8(<32 x i8> %a, <32 x i8> %a, <32 x i8> %b.splat)
293 declare <64 x i8> @llvm.fshl.v64i8(<64 x i8>, <64 x i8>, <64 x i8>)
295 define <64 x i8> @vrol_vv_v64i8(<64 x i8> %a, <64 x i8> %b) {
296 ; CHECK-LABEL: vrol_vv_v64i8:
298 ; CHECK-NEXT: li a0, 64
299 ; CHECK-NEXT: vsetvli zero, a0, e8, m4, ta, ma
300 ; CHECK-NEXT: vand.vi v16, v12, 7
301 ; CHECK-NEXT: vsll.vv v16, v8, v16
302 ; CHECK-NEXT: vrsub.vi v12, v12, 0
303 ; CHECK-NEXT: vand.vi v12, v12, 7
304 ; CHECK-NEXT: vsrl.vv v8, v8, v12
305 ; CHECK-NEXT: vor.vv v8, v16, v8
308 ; CHECK-ZVKB-LABEL: vrol_vv_v64i8:
309 ; CHECK-ZVKB: # %bb.0:
310 ; CHECK-ZVKB-NEXT: li a0, 64
311 ; CHECK-ZVKB-NEXT: vsetvli zero, a0, e8, m4, ta, ma
312 ; CHECK-ZVKB-NEXT: vrol.vv v8, v8, v12
313 ; CHECK-ZVKB-NEXT: ret
314 %x = call <64 x i8> @llvm.fshl.v64i8(<64 x i8> %a, <64 x i8> %a, <64 x i8> %b)
318 define <64 x i8> @vrol_vx_v64i8(<64 x i8> %a, i8 %b) {
319 ; CHECK-LABEL: vrol_vx_v64i8:
321 ; CHECK-NEXT: li a1, 64
322 ; CHECK-NEXT: vsetvli zero, a1, e8, m4, ta, ma
323 ; CHECK-NEXT: vmv.v.x v12, a0
324 ; CHECK-NEXT: vand.vi v16, v12, 7
325 ; CHECK-NEXT: vsll.vv v16, v8, v16
326 ; CHECK-NEXT: vrsub.vi v12, v12, 0
327 ; CHECK-NEXT: vand.vi v12, v12, 7
328 ; CHECK-NEXT: vsrl.vv v8, v8, v12
329 ; CHECK-NEXT: vor.vv v8, v16, v8
332 ; CHECK-ZVKB-LABEL: vrol_vx_v64i8:
333 ; CHECK-ZVKB: # %bb.0:
334 ; CHECK-ZVKB-NEXT: li a1, 64
335 ; CHECK-ZVKB-NEXT: vsetvli zero, a1, e8, m4, ta, ma
336 ; CHECK-ZVKB-NEXT: vrol.vx v8, v8, a0
337 ; CHECK-ZVKB-NEXT: ret
338 %b.head = insertelement <64 x i8> poison, i8 %b, i32 0
339 %b.splat = shufflevector <64 x i8> %b.head, <64 x i8> poison, <64 x i32> zeroinitializer
340 %x = call <64 x i8> @llvm.fshl.v64i8(<64 x i8> %a, <64 x i8> %a, <64 x i8> %b.splat)
344 declare <1 x i16> @llvm.fshl.v1i16(<1 x i16>, <1 x i16>, <1 x i16>)
346 define <1 x i16> @vrol_vv_v1i16(<1 x i16> %a, <1 x i16> %b) {
347 ; CHECK-LABEL: vrol_vv_v1i16:
349 ; CHECK-NEXT: vsetivli zero, 1, e16, mf4, ta, ma
350 ; CHECK-NEXT: vand.vi v10, v9, 15
351 ; CHECK-NEXT: vsll.vv v10, v8, v10
352 ; CHECK-NEXT: vrsub.vi v9, v9, 0
353 ; CHECK-NEXT: vand.vi v9, v9, 15
354 ; CHECK-NEXT: vsrl.vv v8, v8, v9
355 ; CHECK-NEXT: vor.vv v8, v10, v8
358 ; CHECK-ZVKB-LABEL: vrol_vv_v1i16:
359 ; CHECK-ZVKB: # %bb.0:
360 ; CHECK-ZVKB-NEXT: vsetivli zero, 1, e16, mf4, ta, ma
361 ; CHECK-ZVKB-NEXT: vrol.vv v8, v8, v9
362 ; CHECK-ZVKB-NEXT: ret
363 %x = call <1 x i16> @llvm.fshl.v1i16(<1 x i16> %a, <1 x i16> %a, <1 x i16> %b)
367 define <1 x i16> @vrol_vx_v1i16(<1 x i16> %a, i16 %b) {
368 ; CHECK-LABEL: vrol_vx_v1i16:
370 ; CHECK-NEXT: vsetivli zero, 1, e16, mf4, ta, ma
371 ; CHECK-NEXT: vmv.s.x v9, a0
372 ; CHECK-NEXT: vand.vi v10, v9, 15
373 ; CHECK-NEXT: vsll.vv v10, v8, v10
374 ; CHECK-NEXT: vrsub.vi v9, v9, 0
375 ; CHECK-NEXT: vand.vi v9, v9, 15
376 ; CHECK-NEXT: vsrl.vv v8, v8, v9
377 ; CHECK-NEXT: vor.vv v8, v10, v8
380 ; CHECK-ZVKB-LABEL: vrol_vx_v1i16:
381 ; CHECK-ZVKB: # %bb.0:
382 ; CHECK-ZVKB-NEXT: vsetivli zero, 1, e16, mf4, ta, ma
383 ; CHECK-ZVKB-NEXT: vrol.vx v8, v8, a0
384 ; CHECK-ZVKB-NEXT: ret
385 %b.head = insertelement <1 x i16> poison, i16 %b, i32 0
386 %b.splat = shufflevector <1 x i16> %b.head, <1 x i16> poison, <1 x i32> zeroinitializer
387 %x = call <1 x i16> @llvm.fshl.v1i16(<1 x i16> %a, <1 x i16> %a, <1 x i16> %b.splat)
391 declare <2 x i16> @llvm.fshl.v2i16(<2 x i16>, <2 x i16>, <2 x i16>)
393 define <2 x i16> @vrol_vv_v2i16(<2 x i16> %a, <2 x i16> %b) {
394 ; CHECK-LABEL: vrol_vv_v2i16:
396 ; CHECK-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
397 ; CHECK-NEXT: vand.vi v10, v9, 15
398 ; CHECK-NEXT: vsll.vv v10, v8, v10
399 ; CHECK-NEXT: vrsub.vi v9, v9, 0
400 ; CHECK-NEXT: vand.vi v9, v9, 15
401 ; CHECK-NEXT: vsrl.vv v8, v8, v9
402 ; CHECK-NEXT: vor.vv v8, v10, v8
405 ; CHECK-ZVKB-LABEL: vrol_vv_v2i16:
406 ; CHECK-ZVKB: # %bb.0:
407 ; CHECK-ZVKB-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
408 ; CHECK-ZVKB-NEXT: vrol.vv v8, v8, v9
409 ; CHECK-ZVKB-NEXT: ret
410 %x = call <2 x i16> @llvm.fshl.v2i16(<2 x i16> %a, <2 x i16> %a, <2 x i16> %b)
414 define <2 x i16> @vrol_vx_v2i16(<2 x i16> %a, i16 %b) {
415 ; CHECK-LABEL: vrol_vx_v2i16:
417 ; CHECK-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
418 ; CHECK-NEXT: vmv.v.x v9, a0
419 ; CHECK-NEXT: vand.vi v10, v9, 15
420 ; CHECK-NEXT: vsll.vv v10, v8, v10
421 ; CHECK-NEXT: vrsub.vi v9, v9, 0
422 ; CHECK-NEXT: vand.vi v9, v9, 15
423 ; CHECK-NEXT: vsrl.vv v8, v8, v9
424 ; CHECK-NEXT: vor.vv v8, v10, v8
427 ; CHECK-ZVKB-LABEL: vrol_vx_v2i16:
428 ; CHECK-ZVKB: # %bb.0:
429 ; CHECK-ZVKB-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
430 ; CHECK-ZVKB-NEXT: vrol.vx v8, v8, a0
431 ; CHECK-ZVKB-NEXT: ret
432 %b.head = insertelement <2 x i16> poison, i16 %b, i32 0
433 %b.splat = shufflevector <2 x i16> %b.head, <2 x i16> poison, <2 x i32> zeroinitializer
434 %x = call <2 x i16> @llvm.fshl.v2i16(<2 x i16> %a, <2 x i16> %a, <2 x i16> %b.splat)
438 declare <4 x i16> @llvm.fshl.v4i16(<4 x i16>, <4 x i16>, <4 x i16>)
440 define <4 x i16> @vrol_vv_v4i16(<4 x i16> %a, <4 x i16> %b) {
441 ; CHECK-LABEL: vrol_vv_v4i16:
443 ; CHECK-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
444 ; CHECK-NEXT: vand.vi v10, v9, 15
445 ; CHECK-NEXT: vsll.vv v10, v8, v10
446 ; CHECK-NEXT: vrsub.vi v9, v9, 0
447 ; CHECK-NEXT: vand.vi v9, v9, 15
448 ; CHECK-NEXT: vsrl.vv v8, v8, v9
449 ; CHECK-NEXT: vor.vv v8, v10, v8
452 ; CHECK-ZVKB-LABEL: vrol_vv_v4i16:
453 ; CHECK-ZVKB: # %bb.0:
454 ; CHECK-ZVKB-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
455 ; CHECK-ZVKB-NEXT: vrol.vv v8, v8, v9
456 ; CHECK-ZVKB-NEXT: ret
457 %x = call <4 x i16> @llvm.fshl.v4i16(<4 x i16> %a, <4 x i16> %a, <4 x i16> %b)
461 define <4 x i16> @vrol_vx_v4i16(<4 x i16> %a, i16 %b) {
462 ; CHECK-LABEL: vrol_vx_v4i16:
464 ; CHECK-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
465 ; CHECK-NEXT: vmv.v.x v9, a0
466 ; CHECK-NEXT: vand.vi v10, v9, 15
467 ; CHECK-NEXT: vsll.vv v10, v8, v10
468 ; CHECK-NEXT: vrsub.vi v9, v9, 0
469 ; CHECK-NEXT: vand.vi v9, v9, 15
470 ; CHECK-NEXT: vsrl.vv v8, v8, v9
471 ; CHECK-NEXT: vor.vv v8, v10, v8
474 ; CHECK-ZVKB-LABEL: vrol_vx_v4i16:
475 ; CHECK-ZVKB: # %bb.0:
476 ; CHECK-ZVKB-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
477 ; CHECK-ZVKB-NEXT: vrol.vx v8, v8, a0
478 ; CHECK-ZVKB-NEXT: ret
479 %b.head = insertelement <4 x i16> poison, i16 %b, i32 0
480 %b.splat = shufflevector <4 x i16> %b.head, <4 x i16> poison, <4 x i32> zeroinitializer
481 %x = call <4 x i16> @llvm.fshl.v4i16(<4 x i16> %a, <4 x i16> %a, <4 x i16> %b.splat)
485 declare <8 x i16> @llvm.fshl.v8i16(<8 x i16>, <8 x i16>, <8 x i16>)
487 define <8 x i16> @vrol_vv_v8i16(<8 x i16> %a, <8 x i16> %b) {
488 ; CHECK-LABEL: vrol_vv_v8i16:
490 ; CHECK-NEXT: vsetivli zero, 8, e16, m1, ta, ma
491 ; CHECK-NEXT: vand.vi v10, v9, 15
492 ; CHECK-NEXT: vsll.vv v10, v8, v10
493 ; CHECK-NEXT: vrsub.vi v9, v9, 0
494 ; CHECK-NEXT: vand.vi v9, v9, 15
495 ; CHECK-NEXT: vsrl.vv v8, v8, v9
496 ; CHECK-NEXT: vor.vv v8, v10, v8
499 ; CHECK-ZVKB-LABEL: vrol_vv_v8i16:
500 ; CHECK-ZVKB: # %bb.0:
501 ; CHECK-ZVKB-NEXT: vsetivli zero, 8, e16, m1, ta, ma
502 ; CHECK-ZVKB-NEXT: vrol.vv v8, v8, v9
503 ; CHECK-ZVKB-NEXT: ret
504 %x = call <8 x i16> @llvm.fshl.v8i16(<8 x i16> %a, <8 x i16> %a, <8 x i16> %b)
508 define <8 x i16> @vrol_vx_v8i16(<8 x i16> %a, i16 %b) {
509 ; CHECK-LABEL: vrol_vx_v8i16:
511 ; CHECK-NEXT: vsetivli zero, 8, e16, m1, ta, ma
512 ; CHECK-NEXT: vmv.v.x v9, a0
513 ; CHECK-NEXT: vand.vi v10, v9, 15
514 ; CHECK-NEXT: vsll.vv v10, v8, v10
515 ; CHECK-NEXT: vrsub.vi v9, v9, 0
516 ; CHECK-NEXT: vand.vi v9, v9, 15
517 ; CHECK-NEXT: vsrl.vv v8, v8, v9
518 ; CHECK-NEXT: vor.vv v8, v10, v8
521 ; CHECK-ZVKB-LABEL: vrol_vx_v8i16:
522 ; CHECK-ZVKB: # %bb.0:
523 ; CHECK-ZVKB-NEXT: vsetivli zero, 8, e16, m1, ta, ma
524 ; CHECK-ZVKB-NEXT: vrol.vx v8, v8, a0
525 ; CHECK-ZVKB-NEXT: ret
526 %b.head = insertelement <8 x i16> poison, i16 %b, i32 0
527 %b.splat = shufflevector <8 x i16> %b.head, <8 x i16> poison, <8 x i32> zeroinitializer
528 %x = call <8 x i16> @llvm.fshl.v8i16(<8 x i16> %a, <8 x i16> %a, <8 x i16> %b.splat)
532 declare <16 x i16> @llvm.fshl.v16i16(<16 x i16>, <16 x i16>, <16 x i16>)
534 define <16 x i16> @vrol_vv_v16i16(<16 x i16> %a, <16 x i16> %b) {
535 ; CHECK-LABEL: vrol_vv_v16i16:
537 ; CHECK-NEXT: vsetivli zero, 16, e16, m2, ta, ma
538 ; CHECK-NEXT: vand.vi v12, v10, 15
539 ; CHECK-NEXT: vsll.vv v12, v8, v12
540 ; CHECK-NEXT: vrsub.vi v10, v10, 0
541 ; CHECK-NEXT: vand.vi v10, v10, 15
542 ; CHECK-NEXT: vsrl.vv v8, v8, v10
543 ; CHECK-NEXT: vor.vv v8, v12, v8
546 ; CHECK-ZVKB-LABEL: vrol_vv_v16i16:
547 ; CHECK-ZVKB: # %bb.0:
548 ; CHECK-ZVKB-NEXT: vsetivli zero, 16, e16, m2, ta, ma
549 ; CHECK-ZVKB-NEXT: vrol.vv v8, v8, v10
550 ; CHECK-ZVKB-NEXT: ret
551 %x = call <16 x i16> @llvm.fshl.v16i16(<16 x i16> %a, <16 x i16> %a, <16 x i16> %b)
555 define <16 x i16> @vrol_vx_v16i16(<16 x i16> %a, i16 %b) {
556 ; CHECK-LABEL: vrol_vx_v16i16:
558 ; CHECK-NEXT: vsetivli zero, 16, e16, m2, ta, ma
559 ; CHECK-NEXT: vmv.v.x v10, a0
560 ; CHECK-NEXT: vand.vi v12, v10, 15
561 ; CHECK-NEXT: vsll.vv v12, v8, v12
562 ; CHECK-NEXT: vrsub.vi v10, v10, 0
563 ; CHECK-NEXT: vand.vi v10, v10, 15
564 ; CHECK-NEXT: vsrl.vv v8, v8, v10
565 ; CHECK-NEXT: vor.vv v8, v12, v8
568 ; CHECK-ZVKB-LABEL: vrol_vx_v16i16:
569 ; CHECK-ZVKB: # %bb.0:
570 ; CHECK-ZVKB-NEXT: vsetivli zero, 16, e16, m2, ta, ma
571 ; CHECK-ZVKB-NEXT: vrol.vx v8, v8, a0
572 ; CHECK-ZVKB-NEXT: ret
573 %b.head = insertelement <16 x i16> poison, i16 %b, i32 0
574 %b.splat = shufflevector <16 x i16> %b.head, <16 x i16> poison, <16 x i32> zeroinitializer
575 %x = call <16 x i16> @llvm.fshl.v16i16(<16 x i16> %a, <16 x i16> %a, <16 x i16> %b.splat)
579 declare <32 x i16> @llvm.fshl.v32i16(<32 x i16>, <32 x i16>, <32 x i16>)
581 define <32 x i16> @vrol_vv_v32i16(<32 x i16> %a, <32 x i16> %b) {
582 ; CHECK-LABEL: vrol_vv_v32i16:
584 ; CHECK-NEXT: li a0, 32
585 ; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, ma
586 ; CHECK-NEXT: vand.vi v16, v12, 15
587 ; CHECK-NEXT: vsll.vv v16, v8, v16
588 ; CHECK-NEXT: vrsub.vi v12, v12, 0
589 ; CHECK-NEXT: vand.vi v12, v12, 15
590 ; CHECK-NEXT: vsrl.vv v8, v8, v12
591 ; CHECK-NEXT: vor.vv v8, v16, v8
594 ; CHECK-ZVKB-LABEL: vrol_vv_v32i16:
595 ; CHECK-ZVKB: # %bb.0:
596 ; CHECK-ZVKB-NEXT: li a0, 32
597 ; CHECK-ZVKB-NEXT: vsetvli zero, a0, e16, m4, ta, ma
598 ; CHECK-ZVKB-NEXT: vrol.vv v8, v8, v12
599 ; CHECK-ZVKB-NEXT: ret
600 %x = call <32 x i16> @llvm.fshl.v32i16(<32 x i16> %a, <32 x i16> %a, <32 x i16> %b)
604 define <32 x i16> @vrol_vx_v32i16(<32 x i16> %a, i16 %b) {
605 ; CHECK-LABEL: vrol_vx_v32i16:
607 ; CHECK-NEXT: li a1, 32
608 ; CHECK-NEXT: vsetvli zero, a1, e16, m4, ta, ma
609 ; CHECK-NEXT: vmv.v.x v12, a0
610 ; CHECK-NEXT: vand.vi v16, v12, 15
611 ; CHECK-NEXT: vsll.vv v16, v8, v16
612 ; CHECK-NEXT: vrsub.vi v12, v12, 0
613 ; CHECK-NEXT: vand.vi v12, v12, 15
614 ; CHECK-NEXT: vsrl.vv v8, v8, v12
615 ; CHECK-NEXT: vor.vv v8, v16, v8
618 ; CHECK-ZVKB-LABEL: vrol_vx_v32i16:
619 ; CHECK-ZVKB: # %bb.0:
620 ; CHECK-ZVKB-NEXT: li a1, 32
621 ; CHECK-ZVKB-NEXT: vsetvli zero, a1, e16, m4, ta, ma
622 ; CHECK-ZVKB-NEXT: vrol.vx v8, v8, a0
623 ; CHECK-ZVKB-NEXT: ret
624 %b.head = insertelement <32 x i16> poison, i16 %b, i32 0
625 %b.splat = shufflevector <32 x i16> %b.head, <32 x i16> poison, <32 x i32> zeroinitializer
626 %x = call <32 x i16> @llvm.fshl.v32i16(<32 x i16> %a, <32 x i16> %a, <32 x i16> %b.splat)
630 declare <1 x i32> @llvm.fshl.v1i32(<1 x i32>, <1 x i32>, <1 x i32>)
632 define <1 x i32> @vrol_vv_v1i32(<1 x i32> %a, <1 x i32> %b) {
633 ; CHECK-LABEL: vrol_vv_v1i32:
635 ; CHECK-NEXT: li a0, 31
636 ; CHECK-NEXT: vsetivli zero, 1, e32, mf2, ta, ma
637 ; CHECK-NEXT: vand.vx v10, v9, a0
638 ; CHECK-NEXT: vsll.vv v10, v8, v10
639 ; CHECK-NEXT: vrsub.vi v9, v9, 0
640 ; CHECK-NEXT: vand.vx v9, v9, a0
641 ; CHECK-NEXT: vsrl.vv v8, v8, v9
642 ; CHECK-NEXT: vor.vv v8, v10, v8
645 ; CHECK-ZVKB-LABEL: vrol_vv_v1i32:
646 ; CHECK-ZVKB: # %bb.0:
647 ; CHECK-ZVKB-NEXT: vsetivli zero, 1, e32, mf2, ta, ma
648 ; CHECK-ZVKB-NEXT: vrol.vv v8, v8, v9
649 ; CHECK-ZVKB-NEXT: ret
650 %x = call <1 x i32> @llvm.fshl.v1i32(<1 x i32> %a, <1 x i32> %a, <1 x i32> %b)
654 define <1 x i32> @vrol_vx_v1i32(<1 x i32> %a, i32 %b) {
655 ; CHECK-LABEL: vrol_vx_v1i32:
657 ; CHECK-NEXT: vsetivli zero, 1, e32, mf2, ta, ma
658 ; CHECK-NEXT: vmv.s.x v9, a0
659 ; CHECK-NEXT: li a0, 31
660 ; CHECK-NEXT: vand.vx v10, v9, a0
661 ; CHECK-NEXT: vsll.vv v10, v8, v10
662 ; CHECK-NEXT: vrsub.vi v9, v9, 0
663 ; CHECK-NEXT: vand.vx v9, v9, a0
664 ; CHECK-NEXT: vsrl.vv v8, v8, v9
665 ; CHECK-NEXT: vor.vv v8, v10, v8
668 ; CHECK-ZVKB-LABEL: vrol_vx_v1i32:
669 ; CHECK-ZVKB: # %bb.0:
670 ; CHECK-ZVKB-NEXT: vsetivli zero, 1, e32, mf2, ta, ma
671 ; CHECK-ZVKB-NEXT: vrol.vx v8, v8, a0
672 ; CHECK-ZVKB-NEXT: ret
673 %b.head = insertelement <1 x i32> poison, i32 %b, i32 0
674 %b.splat = shufflevector <1 x i32> %b.head, <1 x i32> poison, <1 x i32> zeroinitializer
675 %x = call <1 x i32> @llvm.fshl.v1i32(<1 x i32> %a, <1 x i32> %a, <1 x i32> %b.splat)
679 declare <2 x i32> @llvm.fshl.v2i32(<2 x i32>, <2 x i32>, <2 x i32>)
681 define <2 x i32> @vrol_vv_v2i32(<2 x i32> %a, <2 x i32> %b) {
682 ; CHECK-LABEL: vrol_vv_v2i32:
684 ; CHECK-NEXT: li a0, 31
685 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
686 ; CHECK-NEXT: vand.vx v10, v9, a0
687 ; CHECK-NEXT: vsll.vv v10, v8, v10
688 ; CHECK-NEXT: vrsub.vi v9, v9, 0
689 ; CHECK-NEXT: vand.vx v9, v9, a0
690 ; CHECK-NEXT: vsrl.vv v8, v8, v9
691 ; CHECK-NEXT: vor.vv v8, v10, v8
694 ; CHECK-ZVKB-LABEL: vrol_vv_v2i32:
695 ; CHECK-ZVKB: # %bb.0:
696 ; CHECK-ZVKB-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
697 ; CHECK-ZVKB-NEXT: vrol.vv v8, v8, v9
698 ; CHECK-ZVKB-NEXT: ret
699 %x = call <2 x i32> @llvm.fshl.v2i32(<2 x i32> %a, <2 x i32> %a, <2 x i32> %b)
703 define <2 x i32> @vrol_vx_v2i32(<2 x i32> %a, i32 %b) {
704 ; CHECK-LABEL: vrol_vx_v2i32:
706 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
707 ; CHECK-NEXT: vmv.v.x v9, a0
708 ; CHECK-NEXT: li a0, 31
709 ; CHECK-NEXT: vand.vx v10, v9, a0
710 ; CHECK-NEXT: vsll.vv v10, v8, v10
711 ; CHECK-NEXT: vrsub.vi v9, v9, 0
712 ; CHECK-NEXT: vand.vx v9, v9, a0
713 ; CHECK-NEXT: vsrl.vv v8, v8, v9
714 ; CHECK-NEXT: vor.vv v8, v10, v8
717 ; CHECK-ZVKB-LABEL: vrol_vx_v2i32:
718 ; CHECK-ZVKB: # %bb.0:
719 ; CHECK-ZVKB-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
720 ; CHECK-ZVKB-NEXT: vrol.vx v8, v8, a0
721 ; CHECK-ZVKB-NEXT: ret
722 %b.head = insertelement <2 x i32> poison, i32 %b, i32 0
723 %b.splat = shufflevector <2 x i32> %b.head, <2 x i32> poison, <2 x i32> zeroinitializer
724 %x = call <2 x i32> @llvm.fshl.v2i32(<2 x i32> %a, <2 x i32> %a, <2 x i32> %b.splat)
728 declare <4 x i32> @llvm.fshl.v4i32(<4 x i32>, <4 x i32>, <4 x i32>)
730 define <4 x i32> @vrol_vv_v4i32(<4 x i32> %a, <4 x i32> %b) {
731 ; CHECK-LABEL: vrol_vv_v4i32:
733 ; CHECK-NEXT: li a0, 31
734 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
735 ; CHECK-NEXT: vand.vx v10, v9, a0
736 ; CHECK-NEXT: vsll.vv v10, v8, v10
737 ; CHECK-NEXT: vrsub.vi v9, v9, 0
738 ; CHECK-NEXT: vand.vx v9, v9, a0
739 ; CHECK-NEXT: vsrl.vv v8, v8, v9
740 ; CHECK-NEXT: vor.vv v8, v10, v8
743 ; CHECK-ZVKB-LABEL: vrol_vv_v4i32:
744 ; CHECK-ZVKB: # %bb.0:
745 ; CHECK-ZVKB-NEXT: vsetivli zero, 4, e32, m1, ta, ma
746 ; CHECK-ZVKB-NEXT: vrol.vv v8, v8, v9
747 ; CHECK-ZVKB-NEXT: ret
748 %x = call <4 x i32> @llvm.fshl.v4i32(<4 x i32> %a, <4 x i32> %a, <4 x i32> %b)
752 define <4 x i32> @vrol_vx_v4i32(<4 x i32> %a, i32 %b) {
753 ; CHECK-LABEL: vrol_vx_v4i32:
755 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
756 ; CHECK-NEXT: vmv.v.x v9, a0
757 ; CHECK-NEXT: li a0, 31
758 ; CHECK-NEXT: vand.vx v10, v9, a0
759 ; CHECK-NEXT: vsll.vv v10, v8, v10
760 ; CHECK-NEXT: vrsub.vi v9, v9, 0
761 ; CHECK-NEXT: vand.vx v9, v9, a0
762 ; CHECK-NEXT: vsrl.vv v8, v8, v9
763 ; CHECK-NEXT: vor.vv v8, v10, v8
766 ; CHECK-ZVKB-LABEL: vrol_vx_v4i32:
767 ; CHECK-ZVKB: # %bb.0:
768 ; CHECK-ZVKB-NEXT: vsetivli zero, 4, e32, m1, ta, ma
769 ; CHECK-ZVKB-NEXT: vrol.vx v8, v8, a0
770 ; CHECK-ZVKB-NEXT: ret
771 %b.head = insertelement <4 x i32> poison, i32 %b, i32 0
772 %b.splat = shufflevector <4 x i32> %b.head, <4 x i32> poison, <4 x i32> zeroinitializer
773 %x = call <4 x i32> @llvm.fshl.v4i32(<4 x i32> %a, <4 x i32> %a, <4 x i32> %b.splat)
777 declare <8 x i32> @llvm.fshl.v8i32(<8 x i32>, <8 x i32>, <8 x i32>)
779 define <8 x i32> @vrol_vv_v8i32(<8 x i32> %a, <8 x i32> %b) {
780 ; CHECK-LABEL: vrol_vv_v8i32:
782 ; CHECK-NEXT: li a0, 31
783 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
784 ; CHECK-NEXT: vand.vx v12, v10, a0
785 ; CHECK-NEXT: vsll.vv v12, v8, v12
786 ; CHECK-NEXT: vrsub.vi v10, v10, 0
787 ; CHECK-NEXT: vand.vx v10, v10, a0
788 ; CHECK-NEXT: vsrl.vv v8, v8, v10
789 ; CHECK-NEXT: vor.vv v8, v12, v8
792 ; CHECK-ZVKB-LABEL: vrol_vv_v8i32:
793 ; CHECK-ZVKB: # %bb.0:
794 ; CHECK-ZVKB-NEXT: vsetivli zero, 8, e32, m2, ta, ma
795 ; CHECK-ZVKB-NEXT: vrol.vv v8, v8, v10
796 ; CHECK-ZVKB-NEXT: ret
797 %x = call <8 x i32> @llvm.fshl.v8i32(<8 x i32> %a, <8 x i32> %a, <8 x i32> %b)
801 define <8 x i32> @vrol_vx_v8i32(<8 x i32> %a, i32 %b) {
802 ; CHECK-LABEL: vrol_vx_v8i32:
804 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
805 ; CHECK-NEXT: vmv.v.x v10, a0
806 ; CHECK-NEXT: li a0, 31
807 ; CHECK-NEXT: vand.vx v12, v10, a0
808 ; CHECK-NEXT: vsll.vv v12, v8, v12
809 ; CHECK-NEXT: vrsub.vi v10, v10, 0
810 ; CHECK-NEXT: vand.vx v10, v10, a0
811 ; CHECK-NEXT: vsrl.vv v8, v8, v10
812 ; CHECK-NEXT: vor.vv v8, v12, v8
815 ; CHECK-ZVKB-LABEL: vrol_vx_v8i32:
816 ; CHECK-ZVKB: # %bb.0:
817 ; CHECK-ZVKB-NEXT: vsetivli zero, 8, e32, m2, ta, ma
818 ; CHECK-ZVKB-NEXT: vrol.vx v8, v8, a0
819 ; CHECK-ZVKB-NEXT: ret
820 %b.head = insertelement <8 x i32> poison, i32 %b, i32 0
821 %b.splat = shufflevector <8 x i32> %b.head, <8 x i32> poison, <8 x i32> zeroinitializer
822 %x = call <8 x i32> @llvm.fshl.v8i32(<8 x i32> %a, <8 x i32> %a, <8 x i32> %b.splat)
826 declare <16 x i32> @llvm.fshl.v16i32(<16 x i32>, <16 x i32>, <16 x i32>)
828 define <16 x i32> @vrol_vv_v16i32(<16 x i32> %a, <16 x i32> %b) {
829 ; CHECK-LABEL: vrol_vv_v16i32:
831 ; CHECK-NEXT: li a0, 31
832 ; CHECK-NEXT: vsetivli zero, 16, e32, m4, ta, ma
833 ; CHECK-NEXT: vand.vx v16, v12, a0
834 ; CHECK-NEXT: vsll.vv v16, v8, v16
835 ; CHECK-NEXT: vrsub.vi v12, v12, 0
836 ; CHECK-NEXT: vand.vx v12, v12, a0
837 ; CHECK-NEXT: vsrl.vv v8, v8, v12
838 ; CHECK-NEXT: vor.vv v8, v16, v8
841 ; CHECK-ZVKB-LABEL: vrol_vv_v16i32:
842 ; CHECK-ZVKB: # %bb.0:
843 ; CHECK-ZVKB-NEXT: vsetivli zero, 16, e32, m4, ta, ma
844 ; CHECK-ZVKB-NEXT: vrol.vv v8, v8, v12
845 ; CHECK-ZVKB-NEXT: ret
846 %x = call <16 x i32> @llvm.fshl.v16i32(<16 x i32> %a, <16 x i32> %a, <16 x i32> %b)
850 define <16 x i32> @vrol_vx_v16i32(<16 x i32> %a, i32 %b) {
851 ; CHECK-LABEL: vrol_vx_v16i32:
853 ; CHECK-NEXT: vsetivli zero, 16, e32, m4, ta, ma
854 ; CHECK-NEXT: vmv.v.x v12, a0
855 ; CHECK-NEXT: li a0, 31
856 ; CHECK-NEXT: vand.vx v16, v12, a0
857 ; CHECK-NEXT: vsll.vv v16, v8, v16
858 ; CHECK-NEXT: vrsub.vi v12, v12, 0
859 ; CHECK-NEXT: vand.vx v12, v12, a0
860 ; CHECK-NEXT: vsrl.vv v8, v8, v12
861 ; CHECK-NEXT: vor.vv v8, v16, v8
864 ; CHECK-ZVKB-LABEL: vrol_vx_v16i32:
865 ; CHECK-ZVKB: # %bb.0:
866 ; CHECK-ZVKB-NEXT: vsetivli zero, 16, e32, m4, ta, ma
867 ; CHECK-ZVKB-NEXT: vrol.vx v8, v8, a0
868 ; CHECK-ZVKB-NEXT: ret
869 %b.head = insertelement <16 x i32> poison, i32 %b, i32 0
870 %b.splat = shufflevector <16 x i32> %b.head, <16 x i32> poison, <16 x i32> zeroinitializer
871 %x = call <16 x i32> @llvm.fshl.v16i32(<16 x i32> %a, <16 x i32> %a, <16 x i32> %b.splat)
875 declare <1 x i64> @llvm.fshl.v1i64(<1 x i64>, <1 x i64>, <1 x i64>)
877 define <1 x i64> @vrol_vv_v1i64(<1 x i64> %a, <1 x i64> %b) {
878 ; CHECK-LABEL: vrol_vv_v1i64:
880 ; CHECK-NEXT: li a0, 63
881 ; CHECK-NEXT: vsetivli zero, 1, e64, m1, ta, ma
882 ; CHECK-NEXT: vand.vx v10, v9, a0
883 ; CHECK-NEXT: vsll.vv v10, v8, v10
884 ; CHECK-NEXT: vrsub.vi v9, v9, 0
885 ; CHECK-NEXT: vand.vx v9, v9, a0
886 ; CHECK-NEXT: vsrl.vv v8, v8, v9
887 ; CHECK-NEXT: vor.vv v8, v10, v8
890 ; CHECK-ZVKB-LABEL: vrol_vv_v1i64:
891 ; CHECK-ZVKB: # %bb.0:
892 ; CHECK-ZVKB-NEXT: vsetivli zero, 1, e64, m1, ta, ma
893 ; CHECK-ZVKB-NEXT: vrol.vv v8, v8, v9
894 ; CHECK-ZVKB-NEXT: ret
895 %x = call <1 x i64> @llvm.fshl.v1i64(<1 x i64> %a, <1 x i64> %a, <1 x i64> %b)
899 define <1 x i64> @vrol_vx_v1i64(<1 x i64> %a, i64 %b) {
900 ; CHECK-LABEL: vrol_vx_v1i64:
902 ; CHECK-NEXT: vsetivli zero, 1, e64, m1, ta, ma
903 ; CHECK-NEXT: vmv.s.x v9, a0
904 ; CHECK-NEXT: li a0, 63
905 ; CHECK-NEXT: vand.vx v10, v9, a0
906 ; CHECK-NEXT: vsll.vv v10, v8, v10
907 ; CHECK-NEXT: vrsub.vi v9, v9, 0
908 ; CHECK-NEXT: vand.vx v9, v9, a0
909 ; CHECK-NEXT: vsrl.vv v8, v8, v9
910 ; CHECK-NEXT: vor.vv v8, v10, v8
913 ; CHECK-ZVKB-LABEL: vrol_vx_v1i64:
914 ; CHECK-ZVKB: # %bb.0:
915 ; CHECK-ZVKB-NEXT: vsetivli zero, 1, e64, m1, ta, ma
916 ; CHECK-ZVKB-NEXT: vrol.vx v8, v8, a0
917 ; CHECK-ZVKB-NEXT: ret
918 %b.head = insertelement <1 x i64> poison, i64 %b, i32 0
919 %b.splat = shufflevector <1 x i64> %b.head, <1 x i64> poison, <1 x i32> zeroinitializer
920 %x = call <1 x i64> @llvm.fshl.v1i64(<1 x i64> %a, <1 x i64> %a, <1 x i64> %b.splat)
924 declare <2 x i64> @llvm.fshl.v2i64(<2 x i64>, <2 x i64>, <2 x i64>)
926 define <2 x i64> @vrol_vv_v2i64(<2 x i64> %a, <2 x i64> %b) {
927 ; CHECK-LABEL: vrol_vv_v2i64:
929 ; CHECK-NEXT: li a0, 63
930 ; CHECK-NEXT: vsetivli zero, 2, e64, m1, ta, ma
931 ; CHECK-NEXT: vand.vx v10, v9, a0
932 ; CHECK-NEXT: vsll.vv v10, v8, v10
933 ; CHECK-NEXT: vrsub.vi v9, v9, 0
934 ; CHECK-NEXT: vand.vx v9, v9, a0
935 ; CHECK-NEXT: vsrl.vv v8, v8, v9
936 ; CHECK-NEXT: vor.vv v8, v10, v8
939 ; CHECK-ZVKB-LABEL: vrol_vv_v2i64:
940 ; CHECK-ZVKB: # %bb.0:
941 ; CHECK-ZVKB-NEXT: vsetivli zero, 2, e64, m1, ta, ma
942 ; CHECK-ZVKB-NEXT: vrol.vv v8, v8, v9
943 ; CHECK-ZVKB-NEXT: ret
944 %x = call <2 x i64> @llvm.fshl.v2i64(<2 x i64> %a, <2 x i64> %a, <2 x i64> %b)
948 define <2 x i64> @vrol_vx_v2i64(<2 x i64> %a, i64 %b) {
949 ; RV32-LABEL: vrol_vx_v2i64:
951 ; RV32-NEXT: vsetivli zero, 2, e64, m1, ta, ma
952 ; RV32-NEXT: vmv.v.x v9, a0
953 ; RV32-NEXT: vsetvli zero, zero, e32, mf2, ta, ma
954 ; RV32-NEXT: vmv.v.i v10, 0
955 ; RV32-NEXT: vwsub.vx v11, v10, a0
956 ; RV32-NEXT: li a0, 63
957 ; RV32-NEXT: vsetvli zero, zero, e64, m1, ta, ma
958 ; RV32-NEXT: vand.vx v10, v11, a0
959 ; RV32-NEXT: vsrl.vv v10, v8, v10
960 ; RV32-NEXT: vand.vx v9, v9, a0
961 ; RV32-NEXT: vsll.vv v8, v8, v9
962 ; RV32-NEXT: vor.vv v8, v8, v10
965 ; RV64-LABEL: vrol_vx_v2i64:
967 ; RV64-NEXT: vsetivli zero, 2, e64, m1, ta, ma
968 ; RV64-NEXT: vmv.v.x v9, a0
969 ; RV64-NEXT: li a0, 63
970 ; RV64-NEXT: vand.vx v10, v9, a0
971 ; RV64-NEXT: vsll.vv v10, v8, v10
972 ; RV64-NEXT: vrsub.vi v9, v9, 0
973 ; RV64-NEXT: vand.vx v9, v9, a0
974 ; RV64-NEXT: vsrl.vv v8, v8, v9
975 ; RV64-NEXT: vor.vv v8, v10, v8
978 ; CHECK-ZVKB-LABEL: vrol_vx_v2i64:
979 ; CHECK-ZVKB: # %bb.0:
980 ; CHECK-ZVKB-NEXT: vsetivli zero, 2, e64, m1, ta, ma
981 ; CHECK-ZVKB-NEXT: vrol.vx v8, v8, a0
982 ; CHECK-ZVKB-NEXT: ret
983 %b.head = insertelement <2 x i64> poison, i64 %b, i32 0
984 %b.splat = shufflevector <2 x i64> %b.head, <2 x i64> poison, <2 x i32> zeroinitializer
985 %x = call <2 x i64> @llvm.fshl.v2i64(<2 x i64> %a, <2 x i64> %a, <2 x i64> %b.splat)
989 declare <4 x i64> @llvm.fshl.v4i64(<4 x i64>, <4 x i64>, <4 x i64>)
991 define <4 x i64> @vrol_vv_v4i64(<4 x i64> %a, <4 x i64> %b) {
992 ; CHECK-LABEL: vrol_vv_v4i64:
994 ; CHECK-NEXT: li a0, 63
995 ; CHECK-NEXT: vsetivli zero, 4, e64, m2, ta, ma
996 ; CHECK-NEXT: vand.vx v12, v10, a0
997 ; CHECK-NEXT: vsll.vv v12, v8, v12
998 ; CHECK-NEXT: vrsub.vi v10, v10, 0
999 ; CHECK-NEXT: vand.vx v10, v10, a0
1000 ; CHECK-NEXT: vsrl.vv v8, v8, v10
1001 ; CHECK-NEXT: vor.vv v8, v12, v8
1004 ; CHECK-ZVKB-LABEL: vrol_vv_v4i64:
1005 ; CHECK-ZVKB: # %bb.0:
1006 ; CHECK-ZVKB-NEXT: vsetivli zero, 4, e64, m2, ta, ma
1007 ; CHECK-ZVKB-NEXT: vrol.vv v8, v8, v10
1008 ; CHECK-ZVKB-NEXT: ret
1009 %x = call <4 x i64> @llvm.fshl.v4i64(<4 x i64> %a, <4 x i64> %a, <4 x i64> %b)
1013 define <4 x i64> @vrol_vx_v4i64(<4 x i64> %a, i64 %b) {
1014 ; RV32-LABEL: vrol_vx_v4i64:
1016 ; RV32-NEXT: vsetivli zero, 4, e64, m2, ta, ma
1017 ; RV32-NEXT: vmv.v.x v10, a0
1018 ; RV32-NEXT: vsetvli zero, zero, e32, m1, ta, ma
1019 ; RV32-NEXT: vmv.v.i v12, 0
1020 ; RV32-NEXT: vwsub.vx v14, v12, a0
1021 ; RV32-NEXT: li a0, 63
1022 ; RV32-NEXT: vsetvli zero, zero, e64, m2, ta, ma
1023 ; RV32-NEXT: vand.vx v12, v14, a0
1024 ; RV32-NEXT: vsrl.vv v12, v8, v12
1025 ; RV32-NEXT: vand.vx v10, v10, a0
1026 ; RV32-NEXT: vsll.vv v8, v8, v10
1027 ; RV32-NEXT: vor.vv v8, v8, v12
1030 ; RV64-LABEL: vrol_vx_v4i64:
1032 ; RV64-NEXT: vsetivli zero, 4, e64, m2, ta, ma
1033 ; RV64-NEXT: vmv.v.x v10, a0
1034 ; RV64-NEXT: li a0, 63
1035 ; RV64-NEXT: vand.vx v12, v10, a0
1036 ; RV64-NEXT: vsll.vv v12, v8, v12
1037 ; RV64-NEXT: vrsub.vi v10, v10, 0
1038 ; RV64-NEXT: vand.vx v10, v10, a0
1039 ; RV64-NEXT: vsrl.vv v8, v8, v10
1040 ; RV64-NEXT: vor.vv v8, v12, v8
1043 ; CHECK-ZVKB-LABEL: vrol_vx_v4i64:
1044 ; CHECK-ZVKB: # %bb.0:
1045 ; CHECK-ZVKB-NEXT: vsetivli zero, 4, e64, m2, ta, ma
1046 ; CHECK-ZVKB-NEXT: vrol.vx v8, v8, a0
1047 ; CHECK-ZVKB-NEXT: ret
1048 %b.head = insertelement <4 x i64> poison, i64 %b, i32 0
1049 %b.splat = shufflevector <4 x i64> %b.head, <4 x i64> poison, <4 x i32> zeroinitializer
1050 %x = call <4 x i64> @llvm.fshl.v4i64(<4 x i64> %a, <4 x i64> %a, <4 x i64> %b.splat)
1054 declare <8 x i64> @llvm.fshl.v8i64(<8 x i64>, <8 x i64>, <8 x i64>)
1056 define <8 x i64> @vrol_vv_v8i64(<8 x i64> %a, <8 x i64> %b) {
1057 ; CHECK-LABEL: vrol_vv_v8i64:
1059 ; CHECK-NEXT: li a0, 63
1060 ; CHECK-NEXT: vsetivli zero, 8, e64, m4, ta, ma
1061 ; CHECK-NEXT: vand.vx v16, v12, a0
1062 ; CHECK-NEXT: vsll.vv v16, v8, v16
1063 ; CHECK-NEXT: vrsub.vi v12, v12, 0
1064 ; CHECK-NEXT: vand.vx v12, v12, a0
1065 ; CHECK-NEXT: vsrl.vv v8, v8, v12
1066 ; CHECK-NEXT: vor.vv v8, v16, v8
1069 ; CHECK-ZVKB-LABEL: vrol_vv_v8i64:
1070 ; CHECK-ZVKB: # %bb.0:
1071 ; CHECK-ZVKB-NEXT: vsetivli zero, 8, e64, m4, ta, ma
1072 ; CHECK-ZVKB-NEXT: vrol.vv v8, v8, v12
1073 ; CHECK-ZVKB-NEXT: ret
1074 %x = call <8 x i64> @llvm.fshl.v8i64(<8 x i64> %a, <8 x i64> %a, <8 x i64> %b)
1078 define <8 x i64> @vrol_vx_v8i64(<8 x i64> %a, i64 %b) {
1079 ; RV32-LABEL: vrol_vx_v8i64:
1081 ; RV32-NEXT: vsetivli zero, 8, e64, m4, ta, ma
1082 ; RV32-NEXT: vmv.v.x v12, a0
1083 ; RV32-NEXT: vsetvli zero, zero, e32, m2, ta, ma
1084 ; RV32-NEXT: vmv.v.i v16, 0
1085 ; RV32-NEXT: vwsub.vx v20, v16, a0
1086 ; RV32-NEXT: li a0, 63
1087 ; RV32-NEXT: vsetvli zero, zero, e64, m4, ta, ma
1088 ; RV32-NEXT: vand.vx v16, v20, a0
1089 ; RV32-NEXT: vsrl.vv v16, v8, v16
1090 ; RV32-NEXT: vand.vx v12, v12, a0
1091 ; RV32-NEXT: vsll.vv v8, v8, v12
1092 ; RV32-NEXT: vor.vv v8, v8, v16
1095 ; RV64-LABEL: vrol_vx_v8i64:
1097 ; RV64-NEXT: vsetivli zero, 8, e64, m4, ta, ma
1098 ; RV64-NEXT: vmv.v.x v12, a0
1099 ; RV64-NEXT: li a0, 63
1100 ; RV64-NEXT: vand.vx v16, v12, a0
1101 ; RV64-NEXT: vsll.vv v16, v8, v16
1102 ; RV64-NEXT: vrsub.vi v12, v12, 0
1103 ; RV64-NEXT: vand.vx v12, v12, a0
1104 ; RV64-NEXT: vsrl.vv v8, v8, v12
1105 ; RV64-NEXT: vor.vv v8, v16, v8
1108 ; CHECK-ZVKB-LABEL: vrol_vx_v8i64:
1109 ; CHECK-ZVKB: # %bb.0:
1110 ; CHECK-ZVKB-NEXT: vsetivli zero, 8, e64, m4, ta, ma
1111 ; CHECK-ZVKB-NEXT: vrol.vx v8, v8, a0
1112 ; CHECK-ZVKB-NEXT: ret
1113 %b.head = insertelement <8 x i64> poison, i64 %b, i32 0
1114 %b.splat = shufflevector <8 x i64> %b.head, <8 x i64> poison, <8 x i32> zeroinitializer
1115 %x = call <8 x i64> @llvm.fshl.v8i64(<8 x i64> %a, <8 x i64> %a, <8 x i64> %b.splat)