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,CHECK-RV32
3 ; RUN: llc -mtriple=riscv64 -mattr=+v -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,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.fshr.v1i8(<1 x i8>, <1 x i8>, <1 x i8>)
8 declare <1 x i8> @llvm.fshl.v1i8(<1 x i8>, <1 x i8>, <1 x i8>)
10 define <1 x i8> @vror_vv_v1i8(<1 x i8> %a, <1 x i8> %b) {
11 ; CHECK-LABEL: vror_vv_v1i8:
13 ; CHECK-NEXT: vsetivli zero, 1, e8, mf8, ta, ma
14 ; CHECK-NEXT: vand.vi v10, v9, 7
15 ; CHECK-NEXT: vsrl.vv v10, v8, v10
16 ; CHECK-NEXT: vrsub.vi v9, v9, 0
17 ; CHECK-NEXT: vand.vi v9, v9, 7
18 ; CHECK-NEXT: vsll.vv v8, v8, v9
19 ; CHECK-NEXT: vor.vv v8, v10, v8
22 ; CHECK-ZVKB-LABEL: vror_vv_v1i8:
23 ; CHECK-ZVKB: # %bb.0:
24 ; CHECK-ZVKB-NEXT: vsetivli zero, 1, e8, mf8, ta, ma
25 ; CHECK-ZVKB-NEXT: vror.vv v8, v8, v9
26 ; CHECK-ZVKB-NEXT: ret
27 %x = call <1 x i8> @llvm.fshr.v1i8(<1 x i8> %a, <1 x i8> %a, <1 x i8> %b)
31 define <1 x i8> @vror_vx_v1i8(<1 x i8> %a, i8 %b) {
32 ; CHECK-LABEL: vror_vx_v1i8:
34 ; CHECK-NEXT: vsetivli zero, 1, e8, mf8, ta, ma
35 ; CHECK-NEXT: vmv.s.x v9, a0
36 ; CHECK-NEXT: vand.vi v10, v9, 7
37 ; CHECK-NEXT: vsrl.vv v10, v8, v10
38 ; CHECK-NEXT: vrsub.vi v9, v9, 0
39 ; CHECK-NEXT: vand.vi v9, v9, 7
40 ; CHECK-NEXT: vsll.vv v8, v8, v9
41 ; CHECK-NEXT: vor.vv v8, v10, v8
44 ; CHECK-ZVKB-LABEL: vror_vx_v1i8:
45 ; CHECK-ZVKB: # %bb.0:
46 ; CHECK-ZVKB-NEXT: vsetivli zero, 1, e8, mf8, ta, ma
47 ; CHECK-ZVKB-NEXT: vror.vx v8, v8, a0
48 ; CHECK-ZVKB-NEXT: ret
49 %b.head = insertelement <1 x i8> poison, i8 %b, i32 0
50 %b.splat = shufflevector <1 x i8> %b.head, <1 x i8> poison, <1 x i32> zeroinitializer
51 %x = call <1 x i8> @llvm.fshr.v1i8(<1 x i8> %a, <1 x i8> %a, <1 x i8> %b.splat)
55 define <1 x i8> @vror_vi_v1i8(<1 x i8> %a) {
56 ; CHECK-LABEL: vror_vi_v1i8:
58 ; CHECK-NEXT: vsetivli zero, 1, e8, mf8, ta, ma
59 ; CHECK-NEXT: vsll.vi v9, v8, 7
60 ; CHECK-NEXT: vsrl.vi v8, v8, 1
61 ; CHECK-NEXT: vor.vv v8, v8, v9
64 ; CHECK-ZVKB-LABEL: vror_vi_v1i8:
65 ; CHECK-ZVKB: # %bb.0:
66 ; CHECK-ZVKB-NEXT: vsetivli zero, 1, e8, mf8, ta, ma
67 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 1
68 ; CHECK-ZVKB-NEXT: ret
69 %x = call <1 x i8> @llvm.fshr.v1i8(<1 x i8> %a, <1 x i8> %a, <1 x i8> splat (i8 1))
73 define <1 x i8> @vror_vi_rotl_v1i8(<1 x i8> %a) {
74 ; CHECK-LABEL: vror_vi_rotl_v1i8:
76 ; CHECK-NEXT: vsetivli zero, 1, e8, mf8, ta, ma
77 ; CHECK-NEXT: vsrl.vi v9, v8, 7
78 ; CHECK-NEXT: vadd.vv v8, v8, v8
79 ; CHECK-NEXT: vor.vv v8, v8, v9
82 ; CHECK-ZVKB-LABEL: vror_vi_rotl_v1i8:
83 ; CHECK-ZVKB: # %bb.0:
84 ; CHECK-ZVKB-NEXT: vsetivli zero, 1, e8, mf8, ta, ma
85 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 7
86 ; CHECK-ZVKB-NEXT: ret
87 %x = call <1 x i8> @llvm.fshl.v1i8(<1 x i8> %a, <1 x i8> %a, <1 x i8> splat (i8 1))
91 declare <2 x i8> @llvm.fshr.v2i8(<2 x i8>, <2 x i8>, <2 x i8>)
92 declare <2 x i8> @llvm.fshl.v2i8(<2 x i8>, <2 x i8>, <2 x i8>)
94 define <2 x i8> @vror_vv_v2i8(<2 x i8> %a, <2 x i8> %b) {
95 ; CHECK-LABEL: vror_vv_v2i8:
97 ; CHECK-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
98 ; CHECK-NEXT: vand.vi v10, v9, 7
99 ; CHECK-NEXT: vsrl.vv v10, v8, v10
100 ; CHECK-NEXT: vrsub.vi v9, v9, 0
101 ; CHECK-NEXT: vand.vi v9, v9, 7
102 ; CHECK-NEXT: vsll.vv v8, v8, v9
103 ; CHECK-NEXT: vor.vv v8, v10, v8
106 ; CHECK-ZVKB-LABEL: vror_vv_v2i8:
107 ; CHECK-ZVKB: # %bb.0:
108 ; CHECK-ZVKB-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
109 ; CHECK-ZVKB-NEXT: vror.vv v8, v8, v9
110 ; CHECK-ZVKB-NEXT: ret
111 %x = call <2 x i8> @llvm.fshr.v2i8(<2 x i8> %a, <2 x i8> %a, <2 x i8> %b)
115 define <2 x i8> @vror_vx_v2i8(<2 x i8> %a, i8 %b) {
116 ; CHECK-LABEL: vror_vx_v2i8:
118 ; CHECK-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
119 ; CHECK-NEXT: vmv.v.x v9, a0
120 ; CHECK-NEXT: vand.vi v10, v9, 7
121 ; CHECK-NEXT: vsrl.vv v10, v8, v10
122 ; CHECK-NEXT: vrsub.vi v9, v9, 0
123 ; CHECK-NEXT: vand.vi v9, v9, 7
124 ; CHECK-NEXT: vsll.vv v8, v8, v9
125 ; CHECK-NEXT: vor.vv v8, v10, v8
128 ; CHECK-ZVKB-LABEL: vror_vx_v2i8:
129 ; CHECK-ZVKB: # %bb.0:
130 ; CHECK-ZVKB-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
131 ; CHECK-ZVKB-NEXT: vror.vx v8, v8, a0
132 ; CHECK-ZVKB-NEXT: ret
133 %b.head = insertelement <2 x i8> poison, i8 %b, i32 0
134 %b.splat = shufflevector <2 x i8> %b.head, <2 x i8> poison, <2 x i32> zeroinitializer
135 %x = call <2 x i8> @llvm.fshr.v2i8(<2 x i8> %a, <2 x i8> %a, <2 x i8> %b.splat)
139 define <2 x i8> @vror_vi_v2i8(<2 x i8> %a) {
140 ; CHECK-LABEL: vror_vi_v2i8:
142 ; CHECK-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
143 ; CHECK-NEXT: vsll.vi v9, v8, 7
144 ; CHECK-NEXT: vsrl.vi v8, v8, 1
145 ; CHECK-NEXT: vor.vv v8, v8, v9
148 ; CHECK-ZVKB-LABEL: vror_vi_v2i8:
149 ; CHECK-ZVKB: # %bb.0:
150 ; CHECK-ZVKB-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
151 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 1
152 ; CHECK-ZVKB-NEXT: ret
153 %x = call <2 x i8> @llvm.fshr.v2i8(<2 x i8> %a, <2 x i8> %a, <2 x i8> splat (i8 1))
157 define <2 x i8> @vror_vi_rotl_v2i8(<2 x i8> %a) {
158 ; CHECK-LABEL: vror_vi_rotl_v2i8:
160 ; CHECK-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
161 ; CHECK-NEXT: vsrl.vi v9, v8, 7
162 ; CHECK-NEXT: vadd.vv v8, v8, v8
163 ; CHECK-NEXT: vor.vv v8, v8, v9
166 ; CHECK-ZVKB-LABEL: vror_vi_rotl_v2i8:
167 ; CHECK-ZVKB: # %bb.0:
168 ; CHECK-ZVKB-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
169 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 7
170 ; CHECK-ZVKB-NEXT: ret
171 %x = call <2 x i8> @llvm.fshl.v2i8(<2 x i8> %a, <2 x i8> %a, <2 x i8> splat (i8 1))
175 declare <4 x i8> @llvm.fshr.v4i8(<4 x i8>, <4 x i8>, <4 x i8>)
176 declare <4 x i8> @llvm.fshl.v4i8(<4 x i8>, <4 x i8>, <4 x i8>)
178 define <4 x i8> @vror_vv_v4i8(<4 x i8> %a, <4 x i8> %b) {
179 ; CHECK-LABEL: vror_vv_v4i8:
181 ; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
182 ; CHECK-NEXT: vand.vi v10, v9, 7
183 ; CHECK-NEXT: vsrl.vv v10, v8, v10
184 ; CHECK-NEXT: vrsub.vi v9, v9, 0
185 ; CHECK-NEXT: vand.vi v9, v9, 7
186 ; CHECK-NEXT: vsll.vv v8, v8, v9
187 ; CHECK-NEXT: vor.vv v8, v10, v8
190 ; CHECK-ZVKB-LABEL: vror_vv_v4i8:
191 ; CHECK-ZVKB: # %bb.0:
192 ; CHECK-ZVKB-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
193 ; CHECK-ZVKB-NEXT: vror.vv v8, v8, v9
194 ; CHECK-ZVKB-NEXT: ret
195 %x = call <4 x i8> @llvm.fshr.v4i8(<4 x i8> %a, <4 x i8> %a, <4 x i8> %b)
199 define <4 x i8> @vror_vx_v4i8(<4 x i8> %a, i8 %b) {
200 ; CHECK-LABEL: vror_vx_v4i8:
202 ; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
203 ; CHECK-NEXT: vmv.v.x v9, a0
204 ; CHECK-NEXT: vand.vi v10, v9, 7
205 ; CHECK-NEXT: vsrl.vv v10, v8, v10
206 ; CHECK-NEXT: vrsub.vi v9, v9, 0
207 ; CHECK-NEXT: vand.vi v9, v9, 7
208 ; CHECK-NEXT: vsll.vv v8, v8, v9
209 ; CHECK-NEXT: vor.vv v8, v10, v8
212 ; CHECK-ZVKB-LABEL: vror_vx_v4i8:
213 ; CHECK-ZVKB: # %bb.0:
214 ; CHECK-ZVKB-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
215 ; CHECK-ZVKB-NEXT: vror.vx v8, v8, a0
216 ; CHECK-ZVKB-NEXT: ret
217 %b.head = insertelement <4 x i8> poison, i8 %b, i32 0
218 %b.splat = shufflevector <4 x i8> %b.head, <4 x i8> poison, <4 x i32> zeroinitializer
219 %x = call <4 x i8> @llvm.fshr.v4i8(<4 x i8> %a, <4 x i8> %a, <4 x i8> %b.splat)
223 define <4 x i8> @vror_vi_v4i8(<4 x i8> %a) {
224 ; CHECK-LABEL: vror_vi_v4i8:
226 ; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
227 ; CHECK-NEXT: vsll.vi v9, v8, 7
228 ; CHECK-NEXT: vsrl.vi v8, v8, 1
229 ; CHECK-NEXT: vor.vv v8, v8, v9
232 ; CHECK-ZVKB-LABEL: vror_vi_v4i8:
233 ; CHECK-ZVKB: # %bb.0:
234 ; CHECK-ZVKB-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
235 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 1
236 ; CHECK-ZVKB-NEXT: ret
237 %x = call <4 x i8> @llvm.fshr.v4i8(<4 x i8> %a, <4 x i8> %a, <4 x i8> splat (i8 1))
241 define <4 x i8> @vror_vi_rotl_v4i8(<4 x i8> %a) {
242 ; CHECK-LABEL: vror_vi_rotl_v4i8:
244 ; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
245 ; CHECK-NEXT: vsrl.vi v9, v8, 7
246 ; CHECK-NEXT: vadd.vv v8, v8, v8
247 ; CHECK-NEXT: vor.vv v8, v8, v9
250 ; CHECK-ZVKB-LABEL: vror_vi_rotl_v4i8:
251 ; CHECK-ZVKB: # %bb.0:
252 ; CHECK-ZVKB-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
253 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 7
254 ; CHECK-ZVKB-NEXT: ret
255 %x = call <4 x i8> @llvm.fshl.v4i8(<4 x i8> %a, <4 x i8> %a, <4 x i8> splat (i8 1))
259 declare <8 x i8> @llvm.fshr.v8i8(<8 x i8>, <8 x i8>, <8 x i8>)
260 declare <8 x i8> @llvm.fshl.v8i8(<8 x i8>, <8 x i8>, <8 x i8>)
262 define <8 x i8> @vror_vv_v8i8(<8 x i8> %a, <8 x i8> %b) {
263 ; CHECK-LABEL: vror_vv_v8i8:
265 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
266 ; CHECK-NEXT: vand.vi v10, v9, 7
267 ; CHECK-NEXT: vsrl.vv v10, v8, v10
268 ; CHECK-NEXT: vrsub.vi v9, v9, 0
269 ; CHECK-NEXT: vand.vi v9, v9, 7
270 ; CHECK-NEXT: vsll.vv v8, v8, v9
271 ; CHECK-NEXT: vor.vv v8, v10, v8
274 ; CHECK-ZVKB-LABEL: vror_vv_v8i8:
275 ; CHECK-ZVKB: # %bb.0:
276 ; CHECK-ZVKB-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
277 ; CHECK-ZVKB-NEXT: vror.vv v8, v8, v9
278 ; CHECK-ZVKB-NEXT: ret
279 %x = call <8 x i8> @llvm.fshr.v8i8(<8 x i8> %a, <8 x i8> %a, <8 x i8> %b)
283 define <8 x i8> @vror_vx_v8i8(<8 x i8> %a, i8 %b) {
284 ; CHECK-LABEL: vror_vx_v8i8:
286 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
287 ; CHECK-NEXT: vmv.v.x v9, a0
288 ; CHECK-NEXT: vand.vi v10, v9, 7
289 ; CHECK-NEXT: vsrl.vv v10, v8, v10
290 ; CHECK-NEXT: vrsub.vi v9, v9, 0
291 ; CHECK-NEXT: vand.vi v9, v9, 7
292 ; CHECK-NEXT: vsll.vv v8, v8, v9
293 ; CHECK-NEXT: vor.vv v8, v10, v8
296 ; CHECK-ZVKB-LABEL: vror_vx_v8i8:
297 ; CHECK-ZVKB: # %bb.0:
298 ; CHECK-ZVKB-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
299 ; CHECK-ZVKB-NEXT: vror.vx v8, v8, a0
300 ; CHECK-ZVKB-NEXT: ret
301 %b.head = insertelement <8 x i8> poison, i8 %b, i32 0
302 %b.splat = shufflevector <8 x i8> %b.head, <8 x i8> poison, <8 x i32> zeroinitializer
303 %x = call <8 x i8> @llvm.fshr.v8i8(<8 x i8> %a, <8 x i8> %a, <8 x i8> %b.splat)
307 define <8 x i8> @vror_vi_v8i8(<8 x i8> %a) {
308 ; CHECK-LABEL: vror_vi_v8i8:
310 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
311 ; CHECK-NEXT: vsll.vi v9, v8, 7
312 ; CHECK-NEXT: vsrl.vi v8, v8, 1
313 ; CHECK-NEXT: vor.vv v8, v8, v9
316 ; CHECK-ZVKB-LABEL: vror_vi_v8i8:
317 ; CHECK-ZVKB: # %bb.0:
318 ; CHECK-ZVKB-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
319 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 1
320 ; CHECK-ZVKB-NEXT: ret
321 %x = call <8 x i8> @llvm.fshr.v8i8(<8 x i8> %a, <8 x i8> %a, <8 x i8> splat (i8 1))
325 define <8 x i8> @vror_vi_rotl_v8i8(<8 x i8> %a) {
326 ; CHECK-LABEL: vror_vi_rotl_v8i8:
328 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
329 ; CHECK-NEXT: vsrl.vi v9, v8, 7
330 ; CHECK-NEXT: vadd.vv v8, v8, v8
331 ; CHECK-NEXT: vor.vv v8, v8, v9
334 ; CHECK-ZVKB-LABEL: vror_vi_rotl_v8i8:
335 ; CHECK-ZVKB: # %bb.0:
336 ; CHECK-ZVKB-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
337 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 7
338 ; CHECK-ZVKB-NEXT: ret
339 %x = call <8 x i8> @llvm.fshl.v8i8(<8 x i8> %a, <8 x i8> %a, <8 x i8> splat (i8 1))
343 declare <16 x i8> @llvm.fshr.v16i8(<16 x i8>, <16 x i8>, <16 x i8>)
344 declare <16 x i8> @llvm.fshl.v16i8(<16 x i8>, <16 x i8>, <16 x i8>)
346 define <16 x i8> @vror_vv_v16i8(<16 x i8> %a, <16 x i8> %b) {
347 ; CHECK-LABEL: vror_vv_v16i8:
349 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
350 ; CHECK-NEXT: vand.vi v10, v9, 7
351 ; CHECK-NEXT: vsrl.vv v10, v8, v10
352 ; CHECK-NEXT: vrsub.vi v9, v9, 0
353 ; CHECK-NEXT: vand.vi v9, v9, 7
354 ; CHECK-NEXT: vsll.vv v8, v8, v9
355 ; CHECK-NEXT: vor.vv v8, v10, v8
358 ; CHECK-ZVKB-LABEL: vror_vv_v16i8:
359 ; CHECK-ZVKB: # %bb.0:
360 ; CHECK-ZVKB-NEXT: vsetivli zero, 16, e8, m1, ta, ma
361 ; CHECK-ZVKB-NEXT: vror.vv v8, v8, v9
362 ; CHECK-ZVKB-NEXT: ret
363 %x = call <16 x i8> @llvm.fshr.v16i8(<16 x i8> %a, <16 x i8> %a, <16 x i8> %b)
367 define <16 x i8> @vror_vx_v16i8(<16 x i8> %a, i8 %b) {
368 ; CHECK-LABEL: vror_vx_v16i8:
370 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
371 ; CHECK-NEXT: vmv.v.x v9, a0
372 ; CHECK-NEXT: vand.vi v10, v9, 7
373 ; CHECK-NEXT: vsrl.vv v10, v8, v10
374 ; CHECK-NEXT: vrsub.vi v9, v9, 0
375 ; CHECK-NEXT: vand.vi v9, v9, 7
376 ; CHECK-NEXT: vsll.vv v8, v8, v9
377 ; CHECK-NEXT: vor.vv v8, v10, v8
380 ; CHECK-ZVKB-LABEL: vror_vx_v16i8:
381 ; CHECK-ZVKB: # %bb.0:
382 ; CHECK-ZVKB-NEXT: vsetivli zero, 16, e8, m1, ta, ma
383 ; CHECK-ZVKB-NEXT: vror.vx v8, v8, a0
384 ; CHECK-ZVKB-NEXT: ret
385 %b.head = insertelement <16 x i8> poison, i8 %b, i32 0
386 %b.splat = shufflevector <16 x i8> %b.head, <16 x i8> poison, <16 x i32> zeroinitializer
387 %x = call <16 x i8> @llvm.fshr.v16i8(<16 x i8> %a, <16 x i8> %a, <16 x i8> %b.splat)
391 define <16 x i8> @vror_vi_v16i8(<16 x i8> %a) {
392 ; CHECK-LABEL: vror_vi_v16i8:
394 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
395 ; CHECK-NEXT: vsll.vi v9, v8, 7
396 ; CHECK-NEXT: vsrl.vi v8, v8, 1
397 ; CHECK-NEXT: vor.vv v8, v8, v9
400 ; CHECK-ZVKB-LABEL: vror_vi_v16i8:
401 ; CHECK-ZVKB: # %bb.0:
402 ; CHECK-ZVKB-NEXT: vsetivli zero, 16, e8, m1, ta, ma
403 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 1
404 ; CHECK-ZVKB-NEXT: ret
405 %x = call <16 x i8> @llvm.fshr.v16i8(<16 x i8> %a, <16 x i8> %a, <16 x i8> splat (i8 1))
409 define <16 x i8> @vror_vi_rotl_v16i8(<16 x i8> %a) {
410 ; CHECK-LABEL: vror_vi_rotl_v16i8:
412 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
413 ; CHECK-NEXT: vsrl.vi v9, v8, 7
414 ; CHECK-NEXT: vadd.vv v8, v8, v8
415 ; CHECK-NEXT: vor.vv v8, v8, v9
418 ; CHECK-ZVKB-LABEL: vror_vi_rotl_v16i8:
419 ; CHECK-ZVKB: # %bb.0:
420 ; CHECK-ZVKB-NEXT: vsetivli zero, 16, e8, m1, ta, ma
421 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 7
422 ; CHECK-ZVKB-NEXT: ret
423 %x = call <16 x i8> @llvm.fshl.v16i8(<16 x i8> %a, <16 x i8> %a, <16 x i8> splat (i8 1))
427 declare <32 x i8> @llvm.fshr.v32i8(<32 x i8>, <32 x i8>, <32 x i8>)
428 declare <32 x i8> @llvm.fshl.v32i8(<32 x i8>, <32 x i8>, <32 x i8>)
430 define <32 x i8> @vror_vv_v32i8(<32 x i8> %a, <32 x i8> %b) {
431 ; CHECK-LABEL: vror_vv_v32i8:
433 ; CHECK-NEXT: li a0, 32
434 ; CHECK-NEXT: vsetvli zero, a0, e8, m2, ta, ma
435 ; CHECK-NEXT: vand.vi v12, v10, 7
436 ; CHECK-NEXT: vsrl.vv v12, v8, v12
437 ; CHECK-NEXT: vrsub.vi v10, v10, 0
438 ; CHECK-NEXT: vand.vi v10, v10, 7
439 ; CHECK-NEXT: vsll.vv v8, v8, v10
440 ; CHECK-NEXT: vor.vv v8, v12, v8
443 ; CHECK-ZVKB-LABEL: vror_vv_v32i8:
444 ; CHECK-ZVKB: # %bb.0:
445 ; CHECK-ZVKB-NEXT: li a0, 32
446 ; CHECK-ZVKB-NEXT: vsetvli zero, a0, e8, m2, ta, ma
447 ; CHECK-ZVKB-NEXT: vror.vv v8, v8, v10
448 ; CHECK-ZVKB-NEXT: ret
449 %x = call <32 x i8> @llvm.fshr.v32i8(<32 x i8> %a, <32 x i8> %a, <32 x i8> %b)
453 define <32 x i8> @vror_vx_v32i8(<32 x i8> %a, i8 %b) {
454 ; CHECK-LABEL: vror_vx_v32i8:
456 ; CHECK-NEXT: li a1, 32
457 ; CHECK-NEXT: vsetvli zero, a1, e8, m2, ta, ma
458 ; CHECK-NEXT: vmv.v.x v10, a0
459 ; CHECK-NEXT: vand.vi v12, v10, 7
460 ; CHECK-NEXT: vsrl.vv v12, v8, v12
461 ; CHECK-NEXT: vrsub.vi v10, v10, 0
462 ; CHECK-NEXT: vand.vi v10, v10, 7
463 ; CHECK-NEXT: vsll.vv v8, v8, v10
464 ; CHECK-NEXT: vor.vv v8, v12, v8
467 ; CHECK-ZVKB-LABEL: vror_vx_v32i8:
468 ; CHECK-ZVKB: # %bb.0:
469 ; CHECK-ZVKB-NEXT: li a1, 32
470 ; CHECK-ZVKB-NEXT: vsetvli zero, a1, e8, m2, ta, ma
471 ; CHECK-ZVKB-NEXT: vror.vx v8, v8, a0
472 ; CHECK-ZVKB-NEXT: ret
473 %b.head = insertelement <32 x i8> poison, i8 %b, i32 0
474 %b.splat = shufflevector <32 x i8> %b.head, <32 x i8> poison, <32 x i32> zeroinitializer
475 %x = call <32 x i8> @llvm.fshr.v32i8(<32 x i8> %a, <32 x i8> %a, <32 x i8> %b.splat)
479 define <32 x i8> @vror_vi_v32i8(<32 x i8> %a) {
480 ; CHECK-LABEL: vror_vi_v32i8:
482 ; CHECK-NEXT: li a0, 32
483 ; CHECK-NEXT: vsetvli zero, a0, e8, m2, ta, ma
484 ; CHECK-NEXT: vsll.vi v10, v8, 7
485 ; CHECK-NEXT: vsrl.vi v8, v8, 1
486 ; CHECK-NEXT: vor.vv v8, v8, v10
489 ; CHECK-ZVKB-LABEL: vror_vi_v32i8:
490 ; CHECK-ZVKB: # %bb.0:
491 ; CHECK-ZVKB-NEXT: li a0, 32
492 ; CHECK-ZVKB-NEXT: vsetvli zero, a0, e8, m2, ta, ma
493 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 1
494 ; CHECK-ZVKB-NEXT: ret
495 %x = call <32 x i8> @llvm.fshr.v32i8(<32 x i8> %a, <32 x i8> %a, <32 x i8> splat (i8 1))
499 define <32 x i8> @vror_vi_rotl_v32i8(<32 x i8> %a) {
500 ; CHECK-LABEL: vror_vi_rotl_v32i8:
502 ; CHECK-NEXT: li a0, 32
503 ; CHECK-NEXT: vsetvli zero, a0, e8, m2, ta, ma
504 ; CHECK-NEXT: vsrl.vi v10, v8, 7
505 ; CHECK-NEXT: vadd.vv v8, v8, v8
506 ; CHECK-NEXT: vor.vv v8, v8, v10
509 ; CHECK-ZVKB-LABEL: vror_vi_rotl_v32i8:
510 ; CHECK-ZVKB: # %bb.0:
511 ; CHECK-ZVKB-NEXT: li a0, 32
512 ; CHECK-ZVKB-NEXT: vsetvli zero, a0, e8, m2, ta, ma
513 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 7
514 ; CHECK-ZVKB-NEXT: ret
515 %x = call <32 x i8> @llvm.fshl.v32i8(<32 x i8> %a, <32 x i8> %a, <32 x i8> splat (i8 1))
519 declare <64 x i8> @llvm.fshr.v64i8(<64 x i8>, <64 x i8>, <64 x i8>)
520 declare <64 x i8> @llvm.fshl.v64i8(<64 x i8>, <64 x i8>, <64 x i8>)
522 define <64 x i8> @vror_vv_v64i8(<64 x i8> %a, <64 x i8> %b) {
523 ; CHECK-LABEL: vror_vv_v64i8:
525 ; CHECK-NEXT: li a0, 64
526 ; CHECK-NEXT: vsetvli zero, a0, e8, m4, ta, ma
527 ; CHECK-NEXT: vand.vi v16, v12, 7
528 ; CHECK-NEXT: vsrl.vv v16, v8, v16
529 ; CHECK-NEXT: vrsub.vi v12, v12, 0
530 ; CHECK-NEXT: vand.vi v12, v12, 7
531 ; CHECK-NEXT: vsll.vv v8, v8, v12
532 ; CHECK-NEXT: vor.vv v8, v16, v8
535 ; CHECK-ZVKB-LABEL: vror_vv_v64i8:
536 ; CHECK-ZVKB: # %bb.0:
537 ; CHECK-ZVKB-NEXT: li a0, 64
538 ; CHECK-ZVKB-NEXT: vsetvli zero, a0, e8, m4, ta, ma
539 ; CHECK-ZVKB-NEXT: vror.vv v8, v8, v12
540 ; CHECK-ZVKB-NEXT: ret
541 %x = call <64 x i8> @llvm.fshr.v64i8(<64 x i8> %a, <64 x i8> %a, <64 x i8> %b)
545 define <64 x i8> @vror_vx_v64i8(<64 x i8> %a, i8 %b) {
546 ; CHECK-LABEL: vror_vx_v64i8:
548 ; CHECK-NEXT: li a1, 64
549 ; CHECK-NEXT: vsetvli zero, a1, e8, m4, ta, ma
550 ; CHECK-NEXT: vmv.v.x v12, a0
551 ; CHECK-NEXT: vand.vi v16, v12, 7
552 ; CHECK-NEXT: vsrl.vv v16, v8, v16
553 ; CHECK-NEXT: vrsub.vi v12, v12, 0
554 ; CHECK-NEXT: vand.vi v12, v12, 7
555 ; CHECK-NEXT: vsll.vv v8, v8, v12
556 ; CHECK-NEXT: vor.vv v8, v16, v8
559 ; CHECK-ZVKB-LABEL: vror_vx_v64i8:
560 ; CHECK-ZVKB: # %bb.0:
561 ; CHECK-ZVKB-NEXT: li a1, 64
562 ; CHECK-ZVKB-NEXT: vsetvli zero, a1, e8, m4, ta, ma
563 ; CHECK-ZVKB-NEXT: vror.vx v8, v8, a0
564 ; CHECK-ZVKB-NEXT: ret
565 %b.head = insertelement <64 x i8> poison, i8 %b, i32 0
566 %b.splat = shufflevector <64 x i8> %b.head, <64 x i8> poison, <64 x i32> zeroinitializer
567 %x = call <64 x i8> @llvm.fshr.v64i8(<64 x i8> %a, <64 x i8> %a, <64 x i8> %b.splat)
571 define <64 x i8> @vror_vi_v64i8(<64 x i8> %a) {
572 ; CHECK-LABEL: vror_vi_v64i8:
574 ; CHECK-NEXT: li a0, 64
575 ; CHECK-NEXT: vsetvli zero, a0, e8, m4, ta, ma
576 ; CHECK-NEXT: vsll.vi v12, v8, 7
577 ; CHECK-NEXT: vsrl.vi v8, v8, 1
578 ; CHECK-NEXT: vor.vv v8, v8, v12
581 ; CHECK-ZVKB-LABEL: vror_vi_v64i8:
582 ; CHECK-ZVKB: # %bb.0:
583 ; CHECK-ZVKB-NEXT: li a0, 64
584 ; CHECK-ZVKB-NEXT: vsetvli zero, a0, e8, m4, ta, ma
585 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 1
586 ; CHECK-ZVKB-NEXT: ret
587 %x = call <64 x i8> @llvm.fshr.v64i8(<64 x i8> %a, <64 x i8> %a, <64 x i8> splat (i8 1))
591 define <64 x i8> @vror_vi_rotl_v64i8(<64 x i8> %a) {
592 ; CHECK-LABEL: vror_vi_rotl_v64i8:
594 ; CHECK-NEXT: li a0, 64
595 ; CHECK-NEXT: vsetvli zero, a0, e8, m4, ta, ma
596 ; CHECK-NEXT: vsrl.vi v12, v8, 7
597 ; CHECK-NEXT: vadd.vv v8, v8, v8
598 ; CHECK-NEXT: vor.vv v8, v8, v12
601 ; CHECK-ZVKB-LABEL: vror_vi_rotl_v64i8:
602 ; CHECK-ZVKB: # %bb.0:
603 ; CHECK-ZVKB-NEXT: li a0, 64
604 ; CHECK-ZVKB-NEXT: vsetvli zero, a0, e8, m4, ta, ma
605 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 7
606 ; CHECK-ZVKB-NEXT: ret
607 %x = call <64 x i8> @llvm.fshl.v64i8(<64 x i8> %a, <64 x i8> %a, <64 x i8> splat (i8 1))
611 declare <1 x i16> @llvm.fshr.v1i16(<1 x i16>, <1 x i16>, <1 x i16>)
612 declare <1 x i16> @llvm.fshl.v1i16(<1 x i16>, <1 x i16>, <1 x i16>)
614 define <1 x i16> @vror_vv_v1i16(<1 x i16> %a, <1 x i16> %b) {
615 ; CHECK-LABEL: vror_vv_v1i16:
617 ; CHECK-NEXT: vsetivli zero, 1, e16, mf4, ta, ma
618 ; CHECK-NEXT: vand.vi v10, v9, 15
619 ; CHECK-NEXT: vsrl.vv v10, v8, v10
620 ; CHECK-NEXT: vrsub.vi v9, v9, 0
621 ; CHECK-NEXT: vand.vi v9, v9, 15
622 ; CHECK-NEXT: vsll.vv v8, v8, v9
623 ; CHECK-NEXT: vor.vv v8, v10, v8
626 ; CHECK-ZVKB-LABEL: vror_vv_v1i16:
627 ; CHECK-ZVKB: # %bb.0:
628 ; CHECK-ZVKB-NEXT: vsetivli zero, 1, e16, mf4, ta, ma
629 ; CHECK-ZVKB-NEXT: vror.vv v8, v8, v9
630 ; CHECK-ZVKB-NEXT: ret
631 %x = call <1 x i16> @llvm.fshr.v1i16(<1 x i16> %a, <1 x i16> %a, <1 x i16> %b)
635 define <1 x i16> @vror_vx_v1i16(<1 x i16> %a, i16 %b) {
636 ; CHECK-LABEL: vror_vx_v1i16:
638 ; CHECK-NEXT: vsetivli zero, 1, e16, mf4, ta, ma
639 ; CHECK-NEXT: vmv.s.x v9, a0
640 ; CHECK-NEXT: vand.vi v10, v9, 15
641 ; CHECK-NEXT: vsrl.vv v10, v8, v10
642 ; CHECK-NEXT: vrsub.vi v9, v9, 0
643 ; CHECK-NEXT: vand.vi v9, v9, 15
644 ; CHECK-NEXT: vsll.vv v8, v8, v9
645 ; CHECK-NEXT: vor.vv v8, v10, v8
648 ; CHECK-ZVKB-LABEL: vror_vx_v1i16:
649 ; CHECK-ZVKB: # %bb.0:
650 ; CHECK-ZVKB-NEXT: vsetivli zero, 1, e16, mf4, ta, ma
651 ; CHECK-ZVKB-NEXT: vror.vx v8, v8, a0
652 ; CHECK-ZVKB-NEXT: ret
653 %b.head = insertelement <1 x i16> poison, i16 %b, i32 0
654 %b.splat = shufflevector <1 x i16> %b.head, <1 x i16> poison, <1 x i32> zeroinitializer
655 %x = call <1 x i16> @llvm.fshr.v1i16(<1 x i16> %a, <1 x i16> %a, <1 x i16> %b.splat)
659 define <1 x i16> @vror_vi_v1i16(<1 x i16> %a) {
660 ; CHECK-LABEL: vror_vi_v1i16:
662 ; CHECK-NEXT: vsetivli zero, 1, e16, mf4, ta, ma
663 ; CHECK-NEXT: vsll.vi v9, v8, 15
664 ; CHECK-NEXT: vsrl.vi v8, v8, 1
665 ; CHECK-NEXT: vor.vv v8, v8, v9
668 ; CHECK-ZVKB-LABEL: vror_vi_v1i16:
669 ; CHECK-ZVKB: # %bb.0:
670 ; CHECK-ZVKB-NEXT: vsetivli zero, 1, e16, mf4, ta, ma
671 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 1
672 ; CHECK-ZVKB-NEXT: ret
673 %x = call <1 x i16> @llvm.fshr.v1i16(<1 x i16> %a, <1 x i16> %a, <1 x i16> splat (i16 1))
677 define <1 x i16> @vror_vi_rotl_v1i16(<1 x i16> %a) {
678 ; CHECK-LABEL: vror_vi_rotl_v1i16:
680 ; CHECK-NEXT: vsetivli zero, 1, e16, mf4, ta, ma
681 ; CHECK-NEXT: vsrl.vi v9, v8, 15
682 ; CHECK-NEXT: vadd.vv v8, v8, v8
683 ; CHECK-NEXT: vor.vv v8, v8, v9
686 ; CHECK-ZVKB-LABEL: vror_vi_rotl_v1i16:
687 ; CHECK-ZVKB: # %bb.0:
688 ; CHECK-ZVKB-NEXT: vsetivli zero, 1, e16, mf4, ta, ma
689 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 15
690 ; CHECK-ZVKB-NEXT: ret
691 %x = call <1 x i16> @llvm.fshl.v1i16(<1 x i16> %a, <1 x i16> %a, <1 x i16> splat (i16 1))
695 declare <2 x i16> @llvm.fshr.v2i16(<2 x i16>, <2 x i16>, <2 x i16>)
696 declare <2 x i16> @llvm.fshl.v2i16(<2 x i16>, <2 x i16>, <2 x i16>)
698 define <2 x i16> @vror_vv_v2i16(<2 x i16> %a, <2 x i16> %b) {
699 ; CHECK-LABEL: vror_vv_v2i16:
701 ; CHECK-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
702 ; CHECK-NEXT: vand.vi v10, v9, 15
703 ; CHECK-NEXT: vsrl.vv v10, v8, v10
704 ; CHECK-NEXT: vrsub.vi v9, v9, 0
705 ; CHECK-NEXT: vand.vi v9, v9, 15
706 ; CHECK-NEXT: vsll.vv v8, v8, v9
707 ; CHECK-NEXT: vor.vv v8, v10, v8
710 ; CHECK-ZVKB-LABEL: vror_vv_v2i16:
711 ; CHECK-ZVKB: # %bb.0:
712 ; CHECK-ZVKB-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
713 ; CHECK-ZVKB-NEXT: vror.vv v8, v8, v9
714 ; CHECK-ZVKB-NEXT: ret
715 %x = call <2 x i16> @llvm.fshr.v2i16(<2 x i16> %a, <2 x i16> %a, <2 x i16> %b)
719 define <2 x i16> @vror_vx_v2i16(<2 x i16> %a, i16 %b) {
720 ; CHECK-LABEL: vror_vx_v2i16:
722 ; CHECK-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
723 ; CHECK-NEXT: vmv.v.x v9, a0
724 ; CHECK-NEXT: vand.vi v10, v9, 15
725 ; CHECK-NEXT: vsrl.vv v10, v8, v10
726 ; CHECK-NEXT: vrsub.vi v9, v9, 0
727 ; CHECK-NEXT: vand.vi v9, v9, 15
728 ; CHECK-NEXT: vsll.vv v8, v8, v9
729 ; CHECK-NEXT: vor.vv v8, v10, v8
732 ; CHECK-ZVKB-LABEL: vror_vx_v2i16:
733 ; CHECK-ZVKB: # %bb.0:
734 ; CHECK-ZVKB-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
735 ; CHECK-ZVKB-NEXT: vror.vx v8, v8, a0
736 ; CHECK-ZVKB-NEXT: ret
737 %b.head = insertelement <2 x i16> poison, i16 %b, i32 0
738 %b.splat = shufflevector <2 x i16> %b.head, <2 x i16> poison, <2 x i32> zeroinitializer
739 %x = call <2 x i16> @llvm.fshr.v2i16(<2 x i16> %a, <2 x i16> %a, <2 x i16> %b.splat)
743 define <2 x i16> @vror_vi_v2i16(<2 x i16> %a) {
744 ; CHECK-LABEL: vror_vi_v2i16:
746 ; CHECK-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
747 ; CHECK-NEXT: vsll.vi v9, v8, 15
748 ; CHECK-NEXT: vsrl.vi v8, v8, 1
749 ; CHECK-NEXT: vor.vv v8, v8, v9
752 ; CHECK-ZVKB-LABEL: vror_vi_v2i16:
753 ; CHECK-ZVKB: # %bb.0:
754 ; CHECK-ZVKB-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
755 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 1
756 ; CHECK-ZVKB-NEXT: ret
757 %x = call <2 x i16> @llvm.fshr.v2i16(<2 x i16> %a, <2 x i16> %a, <2 x i16> splat (i16 1))
761 define <2 x i16> @vror_vi_rotl_v2i16(<2 x i16> %a) {
762 ; CHECK-LABEL: vror_vi_rotl_v2i16:
764 ; CHECK-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
765 ; CHECK-NEXT: vsrl.vi v9, v8, 15
766 ; CHECK-NEXT: vadd.vv v8, v8, v8
767 ; CHECK-NEXT: vor.vv v8, v8, v9
770 ; CHECK-ZVKB-LABEL: vror_vi_rotl_v2i16:
771 ; CHECK-ZVKB: # %bb.0:
772 ; CHECK-ZVKB-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
773 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 15
774 ; CHECK-ZVKB-NEXT: ret
775 %x = call <2 x i16> @llvm.fshl.v2i16(<2 x i16> %a, <2 x i16> %a, <2 x i16> splat (i16 1))
779 declare <4 x i16> @llvm.fshr.v4i16(<4 x i16>, <4 x i16>, <4 x i16>)
780 declare <4 x i16> @llvm.fshl.v4i16(<4 x i16>, <4 x i16>, <4 x i16>)
782 define <4 x i16> @vror_vv_v4i16(<4 x i16> %a, <4 x i16> %b) {
783 ; CHECK-LABEL: vror_vv_v4i16:
785 ; CHECK-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
786 ; CHECK-NEXT: vand.vi v10, v9, 15
787 ; CHECK-NEXT: vsrl.vv v10, v8, v10
788 ; CHECK-NEXT: vrsub.vi v9, v9, 0
789 ; CHECK-NEXT: vand.vi v9, v9, 15
790 ; CHECK-NEXT: vsll.vv v8, v8, v9
791 ; CHECK-NEXT: vor.vv v8, v10, v8
794 ; CHECK-ZVKB-LABEL: vror_vv_v4i16:
795 ; CHECK-ZVKB: # %bb.0:
796 ; CHECK-ZVKB-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
797 ; CHECK-ZVKB-NEXT: vror.vv v8, v8, v9
798 ; CHECK-ZVKB-NEXT: ret
799 %x = call <4 x i16> @llvm.fshr.v4i16(<4 x i16> %a, <4 x i16> %a, <4 x i16> %b)
803 define <4 x i16> @vror_vx_v4i16(<4 x i16> %a, i16 %b) {
804 ; CHECK-LABEL: vror_vx_v4i16:
806 ; CHECK-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
807 ; CHECK-NEXT: vmv.v.x v9, a0
808 ; CHECK-NEXT: vand.vi v10, v9, 15
809 ; CHECK-NEXT: vsrl.vv v10, v8, v10
810 ; CHECK-NEXT: vrsub.vi v9, v9, 0
811 ; CHECK-NEXT: vand.vi v9, v9, 15
812 ; CHECK-NEXT: vsll.vv v8, v8, v9
813 ; CHECK-NEXT: vor.vv v8, v10, v8
816 ; CHECK-ZVKB-LABEL: vror_vx_v4i16:
817 ; CHECK-ZVKB: # %bb.0:
818 ; CHECK-ZVKB-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
819 ; CHECK-ZVKB-NEXT: vror.vx v8, v8, a0
820 ; CHECK-ZVKB-NEXT: ret
821 %b.head = insertelement <4 x i16> poison, i16 %b, i32 0
822 %b.splat = shufflevector <4 x i16> %b.head, <4 x i16> poison, <4 x i32> zeroinitializer
823 %x = call <4 x i16> @llvm.fshr.v4i16(<4 x i16> %a, <4 x i16> %a, <4 x i16> %b.splat)
827 define <4 x i16> @vror_vi_v4i16(<4 x i16> %a) {
828 ; CHECK-LABEL: vror_vi_v4i16:
830 ; CHECK-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
831 ; CHECK-NEXT: vsll.vi v9, v8, 15
832 ; CHECK-NEXT: vsrl.vi v8, v8, 1
833 ; CHECK-NEXT: vor.vv v8, v8, v9
836 ; CHECK-ZVKB-LABEL: vror_vi_v4i16:
837 ; CHECK-ZVKB: # %bb.0:
838 ; CHECK-ZVKB-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
839 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 1
840 ; CHECK-ZVKB-NEXT: ret
841 %x = call <4 x i16> @llvm.fshr.v4i16(<4 x i16> %a, <4 x i16> %a, <4 x i16> splat (i16 1))
845 define <4 x i16> @vror_vi_rotl_v4i16(<4 x i16> %a) {
846 ; CHECK-LABEL: vror_vi_rotl_v4i16:
848 ; CHECK-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
849 ; CHECK-NEXT: vsrl.vi v9, v8, 15
850 ; CHECK-NEXT: vadd.vv v8, v8, v8
851 ; CHECK-NEXT: vor.vv v8, v8, v9
854 ; CHECK-ZVKB-LABEL: vror_vi_rotl_v4i16:
855 ; CHECK-ZVKB: # %bb.0:
856 ; CHECK-ZVKB-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
857 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 15
858 ; CHECK-ZVKB-NEXT: ret
859 %x = call <4 x i16> @llvm.fshl.v4i16(<4 x i16> %a, <4 x i16> %a, <4 x i16> splat (i16 1))
863 declare <8 x i16> @llvm.fshr.v8i16(<8 x i16>, <8 x i16>, <8 x i16>)
864 declare <8 x i16> @llvm.fshl.v8i16(<8 x i16>, <8 x i16>, <8 x i16>)
866 define <8 x i16> @vror_vv_v8i16(<8 x i16> %a, <8 x i16> %b) {
867 ; CHECK-LABEL: vror_vv_v8i16:
869 ; CHECK-NEXT: vsetivli zero, 8, e16, m1, ta, ma
870 ; CHECK-NEXT: vand.vi v10, v9, 15
871 ; CHECK-NEXT: vsrl.vv v10, v8, v10
872 ; CHECK-NEXT: vrsub.vi v9, v9, 0
873 ; CHECK-NEXT: vand.vi v9, v9, 15
874 ; CHECK-NEXT: vsll.vv v8, v8, v9
875 ; CHECK-NEXT: vor.vv v8, v10, v8
878 ; CHECK-ZVKB-LABEL: vror_vv_v8i16:
879 ; CHECK-ZVKB: # %bb.0:
880 ; CHECK-ZVKB-NEXT: vsetivli zero, 8, e16, m1, ta, ma
881 ; CHECK-ZVKB-NEXT: vror.vv v8, v8, v9
882 ; CHECK-ZVKB-NEXT: ret
883 %x = call <8 x i16> @llvm.fshr.v8i16(<8 x i16> %a, <8 x i16> %a, <8 x i16> %b)
887 define <8 x i16> @vror_vx_v8i16(<8 x i16> %a, i16 %b) {
888 ; CHECK-LABEL: vror_vx_v8i16:
890 ; CHECK-NEXT: vsetivli zero, 8, e16, m1, ta, ma
891 ; CHECK-NEXT: vmv.v.x v9, a0
892 ; CHECK-NEXT: vand.vi v10, v9, 15
893 ; CHECK-NEXT: vsrl.vv v10, v8, v10
894 ; CHECK-NEXT: vrsub.vi v9, v9, 0
895 ; CHECK-NEXT: vand.vi v9, v9, 15
896 ; CHECK-NEXT: vsll.vv v8, v8, v9
897 ; CHECK-NEXT: vor.vv v8, v10, v8
900 ; CHECK-ZVKB-LABEL: vror_vx_v8i16:
901 ; CHECK-ZVKB: # %bb.0:
902 ; CHECK-ZVKB-NEXT: vsetivli zero, 8, e16, m1, ta, ma
903 ; CHECK-ZVKB-NEXT: vror.vx v8, v8, a0
904 ; CHECK-ZVKB-NEXT: ret
905 %b.head = insertelement <8 x i16> poison, i16 %b, i32 0
906 %b.splat = shufflevector <8 x i16> %b.head, <8 x i16> poison, <8 x i32> zeroinitializer
907 %x = call <8 x i16> @llvm.fshr.v8i16(<8 x i16> %a, <8 x i16> %a, <8 x i16> %b.splat)
911 define <8 x i16> @vror_vi_v8i16(<8 x i16> %a) {
912 ; CHECK-LABEL: vror_vi_v8i16:
914 ; CHECK-NEXT: vsetivli zero, 8, e16, m1, ta, ma
915 ; CHECK-NEXT: vsll.vi v9, v8, 15
916 ; CHECK-NEXT: vsrl.vi v8, v8, 1
917 ; CHECK-NEXT: vor.vv v8, v8, v9
920 ; CHECK-ZVKB-LABEL: vror_vi_v8i16:
921 ; CHECK-ZVKB: # %bb.0:
922 ; CHECK-ZVKB-NEXT: vsetivli zero, 8, e16, m1, ta, ma
923 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 1
924 ; CHECK-ZVKB-NEXT: ret
925 %x = call <8 x i16> @llvm.fshr.v8i16(<8 x i16> %a, <8 x i16> %a, <8 x i16> splat (i16 1))
929 define <8 x i16> @vror_vi_rotl_v8i16(<8 x i16> %a) {
930 ; CHECK-LABEL: vror_vi_rotl_v8i16:
932 ; CHECK-NEXT: vsetivli zero, 8, e16, m1, ta, ma
933 ; CHECK-NEXT: vsrl.vi v9, v8, 15
934 ; CHECK-NEXT: vadd.vv v8, v8, v8
935 ; CHECK-NEXT: vor.vv v8, v8, v9
938 ; CHECK-ZVKB-LABEL: vror_vi_rotl_v8i16:
939 ; CHECK-ZVKB: # %bb.0:
940 ; CHECK-ZVKB-NEXT: vsetivli zero, 8, e16, m1, ta, ma
941 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 15
942 ; CHECK-ZVKB-NEXT: ret
943 %x = call <8 x i16> @llvm.fshl.v8i16(<8 x i16> %a, <8 x i16> %a, <8 x i16> splat (i16 1))
947 declare <16 x i16> @llvm.fshr.v16i16(<16 x i16>, <16 x i16>, <16 x i16>)
948 declare <16 x i16> @llvm.fshl.v16i16(<16 x i16>, <16 x i16>, <16 x i16>)
950 define <16 x i16> @vror_vv_v16i16(<16 x i16> %a, <16 x i16> %b) {
951 ; CHECK-LABEL: vror_vv_v16i16:
953 ; CHECK-NEXT: vsetivli zero, 16, e16, m2, ta, ma
954 ; CHECK-NEXT: vand.vi v12, v10, 15
955 ; CHECK-NEXT: vsrl.vv v12, v8, v12
956 ; CHECK-NEXT: vrsub.vi v10, v10, 0
957 ; CHECK-NEXT: vand.vi v10, v10, 15
958 ; CHECK-NEXT: vsll.vv v8, v8, v10
959 ; CHECK-NEXT: vor.vv v8, v12, v8
962 ; CHECK-ZVKB-LABEL: vror_vv_v16i16:
963 ; CHECK-ZVKB: # %bb.0:
964 ; CHECK-ZVKB-NEXT: vsetivli zero, 16, e16, m2, ta, ma
965 ; CHECK-ZVKB-NEXT: vror.vv v8, v8, v10
966 ; CHECK-ZVKB-NEXT: ret
967 %x = call <16 x i16> @llvm.fshr.v16i16(<16 x i16> %a, <16 x i16> %a, <16 x i16> %b)
971 define <16 x i16> @vror_vx_v16i16(<16 x i16> %a, i16 %b) {
972 ; CHECK-LABEL: vror_vx_v16i16:
974 ; CHECK-NEXT: vsetivli zero, 16, e16, m2, ta, ma
975 ; CHECK-NEXT: vmv.v.x v10, a0
976 ; CHECK-NEXT: vand.vi v12, v10, 15
977 ; CHECK-NEXT: vsrl.vv v12, v8, v12
978 ; CHECK-NEXT: vrsub.vi v10, v10, 0
979 ; CHECK-NEXT: vand.vi v10, v10, 15
980 ; CHECK-NEXT: vsll.vv v8, v8, v10
981 ; CHECK-NEXT: vor.vv v8, v12, v8
984 ; CHECK-ZVKB-LABEL: vror_vx_v16i16:
985 ; CHECK-ZVKB: # %bb.0:
986 ; CHECK-ZVKB-NEXT: vsetivli zero, 16, e16, m2, ta, ma
987 ; CHECK-ZVKB-NEXT: vror.vx v8, v8, a0
988 ; CHECK-ZVKB-NEXT: ret
989 %b.head = insertelement <16 x i16> poison, i16 %b, i32 0
990 %b.splat = shufflevector <16 x i16> %b.head, <16 x i16> poison, <16 x i32> zeroinitializer
991 %x = call <16 x i16> @llvm.fshr.v16i16(<16 x i16> %a, <16 x i16> %a, <16 x i16> %b.splat)
995 define <16 x i16> @vror_vi_v16i16(<16 x i16> %a) {
996 ; CHECK-LABEL: vror_vi_v16i16:
998 ; CHECK-NEXT: vsetivli zero, 16, e16, m2, ta, ma
999 ; CHECK-NEXT: vsll.vi v10, v8, 15
1000 ; CHECK-NEXT: vsrl.vi v8, v8, 1
1001 ; CHECK-NEXT: vor.vv v8, v8, v10
1004 ; CHECK-ZVKB-LABEL: vror_vi_v16i16:
1005 ; CHECK-ZVKB: # %bb.0:
1006 ; CHECK-ZVKB-NEXT: vsetivli zero, 16, e16, m2, ta, ma
1007 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 1
1008 ; CHECK-ZVKB-NEXT: ret
1009 %x = call <16 x i16> @llvm.fshr.v16i16(<16 x i16> %a, <16 x i16> %a, <16 x i16> splat (i16 1))
1013 define <16 x i16> @vror_vi_rotl_v16i16(<16 x i16> %a) {
1014 ; CHECK-LABEL: vror_vi_rotl_v16i16:
1016 ; CHECK-NEXT: vsetivli zero, 16, e16, m2, ta, ma
1017 ; CHECK-NEXT: vsrl.vi v10, v8, 15
1018 ; CHECK-NEXT: vadd.vv v8, v8, v8
1019 ; CHECK-NEXT: vor.vv v8, v8, v10
1022 ; CHECK-ZVKB-LABEL: vror_vi_rotl_v16i16:
1023 ; CHECK-ZVKB: # %bb.0:
1024 ; CHECK-ZVKB-NEXT: vsetivli zero, 16, e16, m2, ta, ma
1025 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 15
1026 ; CHECK-ZVKB-NEXT: ret
1027 %x = call <16 x i16> @llvm.fshl.v16i16(<16 x i16> %a, <16 x i16> %a, <16 x i16> splat (i16 1))
1031 declare <32 x i16> @llvm.fshr.v32i16(<32 x i16>, <32 x i16>, <32 x i16>)
1032 declare <32 x i16> @llvm.fshl.v32i16(<32 x i16>, <32 x i16>, <32 x i16>)
1034 define <32 x i16> @vror_vv_v32i16(<32 x i16> %a, <32 x i16> %b) {
1035 ; CHECK-LABEL: vror_vv_v32i16:
1037 ; CHECK-NEXT: li a0, 32
1038 ; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, ma
1039 ; CHECK-NEXT: vand.vi v16, v12, 15
1040 ; CHECK-NEXT: vsrl.vv v16, v8, v16
1041 ; CHECK-NEXT: vrsub.vi v12, v12, 0
1042 ; CHECK-NEXT: vand.vi v12, v12, 15
1043 ; CHECK-NEXT: vsll.vv v8, v8, v12
1044 ; CHECK-NEXT: vor.vv v8, v16, v8
1047 ; CHECK-ZVKB-LABEL: vror_vv_v32i16:
1048 ; CHECK-ZVKB: # %bb.0:
1049 ; CHECK-ZVKB-NEXT: li a0, 32
1050 ; CHECK-ZVKB-NEXT: vsetvli zero, a0, e16, m4, ta, ma
1051 ; CHECK-ZVKB-NEXT: vror.vv v8, v8, v12
1052 ; CHECK-ZVKB-NEXT: ret
1053 %x = call <32 x i16> @llvm.fshr.v32i16(<32 x i16> %a, <32 x i16> %a, <32 x i16> %b)
1057 define <32 x i16> @vror_vx_v32i16(<32 x i16> %a, i16 %b) {
1058 ; CHECK-LABEL: vror_vx_v32i16:
1060 ; CHECK-NEXT: li a1, 32
1061 ; CHECK-NEXT: vsetvli zero, a1, e16, m4, ta, ma
1062 ; CHECK-NEXT: vmv.v.x v12, a0
1063 ; CHECK-NEXT: vand.vi v16, v12, 15
1064 ; CHECK-NEXT: vsrl.vv v16, v8, v16
1065 ; CHECK-NEXT: vrsub.vi v12, v12, 0
1066 ; CHECK-NEXT: vand.vi v12, v12, 15
1067 ; CHECK-NEXT: vsll.vv v8, v8, v12
1068 ; CHECK-NEXT: vor.vv v8, v16, v8
1071 ; CHECK-ZVKB-LABEL: vror_vx_v32i16:
1072 ; CHECK-ZVKB: # %bb.0:
1073 ; CHECK-ZVKB-NEXT: li a1, 32
1074 ; CHECK-ZVKB-NEXT: vsetvli zero, a1, e16, m4, ta, ma
1075 ; CHECK-ZVKB-NEXT: vror.vx v8, v8, a0
1076 ; CHECK-ZVKB-NEXT: ret
1077 %b.head = insertelement <32 x i16> poison, i16 %b, i32 0
1078 %b.splat = shufflevector <32 x i16> %b.head, <32 x i16> poison, <32 x i32> zeroinitializer
1079 %x = call <32 x i16> @llvm.fshr.v32i16(<32 x i16> %a, <32 x i16> %a, <32 x i16> %b.splat)
1083 define <32 x i16> @vror_vi_v32i16(<32 x i16> %a) {
1084 ; CHECK-LABEL: vror_vi_v32i16:
1086 ; CHECK-NEXT: li a0, 32
1087 ; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, ma
1088 ; CHECK-NEXT: vsll.vi v12, v8, 15
1089 ; CHECK-NEXT: vsrl.vi v8, v8, 1
1090 ; CHECK-NEXT: vor.vv v8, v8, v12
1093 ; CHECK-ZVKB-LABEL: vror_vi_v32i16:
1094 ; CHECK-ZVKB: # %bb.0:
1095 ; CHECK-ZVKB-NEXT: li a0, 32
1096 ; CHECK-ZVKB-NEXT: vsetvli zero, a0, e16, m4, ta, ma
1097 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 1
1098 ; CHECK-ZVKB-NEXT: ret
1099 %x = call <32 x i16> @llvm.fshr.v32i16(<32 x i16> %a, <32 x i16> %a, <32 x i16> splat (i16 1))
1103 define <32 x i16> @vror_vi_rotl_v32i16(<32 x i16> %a) {
1104 ; CHECK-LABEL: vror_vi_rotl_v32i16:
1106 ; CHECK-NEXT: li a0, 32
1107 ; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, ma
1108 ; CHECK-NEXT: vsrl.vi v12, v8, 15
1109 ; CHECK-NEXT: vadd.vv v8, v8, v8
1110 ; CHECK-NEXT: vor.vv v8, v8, v12
1113 ; CHECK-ZVKB-LABEL: vror_vi_rotl_v32i16:
1114 ; CHECK-ZVKB: # %bb.0:
1115 ; CHECK-ZVKB-NEXT: li a0, 32
1116 ; CHECK-ZVKB-NEXT: vsetvli zero, a0, e16, m4, ta, ma
1117 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 15
1118 ; CHECK-ZVKB-NEXT: ret
1119 %x = call <32 x i16> @llvm.fshl.v32i16(<32 x i16> %a, <32 x i16> %a, <32 x i16> splat (i16 1))
1123 declare <1 x i32> @llvm.fshr.v1i32(<1 x i32>, <1 x i32>, <1 x i32>)
1124 declare <1 x i32> @llvm.fshl.v1i32(<1 x i32>, <1 x i32>, <1 x i32>)
1126 define <1 x i32> @vror_vv_v1i32(<1 x i32> %a, <1 x i32> %b) {
1127 ; CHECK-LABEL: vror_vv_v1i32:
1129 ; CHECK-NEXT: li a0, 31
1130 ; CHECK-NEXT: vsetivli zero, 1, e32, mf2, ta, ma
1131 ; CHECK-NEXT: vand.vx v10, v9, a0
1132 ; CHECK-NEXT: vsrl.vv v10, v8, v10
1133 ; CHECK-NEXT: vrsub.vi v9, v9, 0
1134 ; CHECK-NEXT: vand.vx v9, v9, a0
1135 ; CHECK-NEXT: vsll.vv v8, v8, v9
1136 ; CHECK-NEXT: vor.vv v8, v10, v8
1139 ; CHECK-ZVKB-LABEL: vror_vv_v1i32:
1140 ; CHECK-ZVKB: # %bb.0:
1141 ; CHECK-ZVKB-NEXT: vsetivli zero, 1, e32, mf2, ta, ma
1142 ; CHECK-ZVKB-NEXT: vror.vv v8, v8, v9
1143 ; CHECK-ZVKB-NEXT: ret
1144 %x = call <1 x i32> @llvm.fshr.v1i32(<1 x i32> %a, <1 x i32> %a, <1 x i32> %b)
1148 define <1 x i32> @vror_vx_v1i32(<1 x i32> %a, i32 %b) {
1149 ; CHECK-LABEL: vror_vx_v1i32:
1151 ; CHECK-NEXT: vsetivli zero, 1, e32, mf2, ta, ma
1152 ; CHECK-NEXT: vmv.s.x v9, a0
1153 ; CHECK-NEXT: li a0, 31
1154 ; CHECK-NEXT: vand.vx v10, v9, a0
1155 ; CHECK-NEXT: vsrl.vv v10, v8, v10
1156 ; CHECK-NEXT: vrsub.vi v9, v9, 0
1157 ; CHECK-NEXT: vand.vx v9, v9, a0
1158 ; CHECK-NEXT: vsll.vv v8, v8, v9
1159 ; CHECK-NEXT: vor.vv v8, v10, v8
1162 ; CHECK-ZVKB-LABEL: vror_vx_v1i32:
1163 ; CHECK-ZVKB: # %bb.0:
1164 ; CHECK-ZVKB-NEXT: vsetivli zero, 1, e32, mf2, ta, ma
1165 ; CHECK-ZVKB-NEXT: vror.vx v8, v8, a0
1166 ; CHECK-ZVKB-NEXT: ret
1167 %b.head = insertelement <1 x i32> poison, i32 %b, i32 0
1168 %b.splat = shufflevector <1 x i32> %b.head, <1 x i32> poison, <1 x i32> zeroinitializer
1169 %x = call <1 x i32> @llvm.fshr.v1i32(<1 x i32> %a, <1 x i32> %a, <1 x i32> %b.splat)
1173 define <1 x i32> @vror_vi_v1i32(<1 x i32> %a) {
1174 ; CHECK-LABEL: vror_vi_v1i32:
1176 ; CHECK-NEXT: vsetivli zero, 1, e32, mf2, ta, ma
1177 ; CHECK-NEXT: vsll.vi v9, v8, 31
1178 ; CHECK-NEXT: vsrl.vi v8, v8, 1
1179 ; CHECK-NEXT: vor.vv v8, v8, v9
1182 ; CHECK-ZVKB-LABEL: vror_vi_v1i32:
1183 ; CHECK-ZVKB: # %bb.0:
1184 ; CHECK-ZVKB-NEXT: vsetivli zero, 1, e32, mf2, ta, ma
1185 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 1
1186 ; CHECK-ZVKB-NEXT: ret
1187 %x = call <1 x i32> @llvm.fshr.v1i32(<1 x i32> %a, <1 x i32> %a, <1 x i32> splat (i32 1))
1191 define <1 x i32> @vror_vi_rotl_v1i32(<1 x i32> %a) {
1192 ; CHECK-LABEL: vror_vi_rotl_v1i32:
1194 ; CHECK-NEXT: vsetivli zero, 1, e32, mf2, ta, ma
1195 ; CHECK-NEXT: vsrl.vi v9, v8, 31
1196 ; CHECK-NEXT: vadd.vv v8, v8, v8
1197 ; CHECK-NEXT: vor.vv v8, v8, v9
1200 ; CHECK-ZVKB-LABEL: vror_vi_rotl_v1i32:
1201 ; CHECK-ZVKB: # %bb.0:
1202 ; CHECK-ZVKB-NEXT: vsetivli zero, 1, e32, mf2, ta, ma
1203 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 31
1204 ; CHECK-ZVKB-NEXT: ret
1205 %x = call <1 x i32> @llvm.fshl.v1i32(<1 x i32> %a, <1 x i32> %a, <1 x i32> splat (i32 1))
1209 declare <2 x i32> @llvm.fshr.v2i32(<2 x i32>, <2 x i32>, <2 x i32>)
1210 declare <2 x i32> @llvm.fshl.v2i32(<2 x i32>, <2 x i32>, <2 x i32>)
1212 define <2 x i32> @vror_vv_v2i32(<2 x i32> %a, <2 x i32> %b) {
1213 ; CHECK-LABEL: vror_vv_v2i32:
1215 ; CHECK-NEXT: li a0, 31
1216 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
1217 ; CHECK-NEXT: vand.vx v10, v9, a0
1218 ; CHECK-NEXT: vsrl.vv v10, v8, v10
1219 ; CHECK-NEXT: vrsub.vi v9, v9, 0
1220 ; CHECK-NEXT: vand.vx v9, v9, a0
1221 ; CHECK-NEXT: vsll.vv v8, v8, v9
1222 ; CHECK-NEXT: vor.vv v8, v10, v8
1225 ; CHECK-ZVKB-LABEL: vror_vv_v2i32:
1226 ; CHECK-ZVKB: # %bb.0:
1227 ; CHECK-ZVKB-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
1228 ; CHECK-ZVKB-NEXT: vror.vv v8, v8, v9
1229 ; CHECK-ZVKB-NEXT: ret
1230 %x = call <2 x i32> @llvm.fshr.v2i32(<2 x i32> %a, <2 x i32> %a, <2 x i32> %b)
1234 define <2 x i32> @vror_vx_v2i32(<2 x i32> %a, i32 %b) {
1235 ; CHECK-LABEL: vror_vx_v2i32:
1237 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
1238 ; CHECK-NEXT: vmv.v.x v9, a0
1239 ; CHECK-NEXT: li a0, 31
1240 ; CHECK-NEXT: vand.vx v10, v9, a0
1241 ; CHECK-NEXT: vsrl.vv v10, v8, v10
1242 ; CHECK-NEXT: vrsub.vi v9, v9, 0
1243 ; CHECK-NEXT: vand.vx v9, v9, a0
1244 ; CHECK-NEXT: vsll.vv v8, v8, v9
1245 ; CHECK-NEXT: vor.vv v8, v10, v8
1248 ; CHECK-ZVKB-LABEL: vror_vx_v2i32:
1249 ; CHECK-ZVKB: # %bb.0:
1250 ; CHECK-ZVKB-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
1251 ; CHECK-ZVKB-NEXT: vror.vx v8, v8, a0
1252 ; CHECK-ZVKB-NEXT: ret
1253 %b.head = insertelement <2 x i32> poison, i32 %b, i32 0
1254 %b.splat = shufflevector <2 x i32> %b.head, <2 x i32> poison, <2 x i32> zeroinitializer
1255 %x = call <2 x i32> @llvm.fshr.v2i32(<2 x i32> %a, <2 x i32> %a, <2 x i32> %b.splat)
1259 define <2 x i32> @vror_vi_v2i32(<2 x i32> %a) {
1260 ; CHECK-LABEL: vror_vi_v2i32:
1262 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
1263 ; CHECK-NEXT: vsll.vi v9, v8, 31
1264 ; CHECK-NEXT: vsrl.vi v8, v8, 1
1265 ; CHECK-NEXT: vor.vv v8, v8, v9
1268 ; CHECK-ZVKB-LABEL: vror_vi_v2i32:
1269 ; CHECK-ZVKB: # %bb.0:
1270 ; CHECK-ZVKB-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
1271 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 1
1272 ; CHECK-ZVKB-NEXT: ret
1273 %x = call <2 x i32> @llvm.fshr.v2i32(<2 x i32> %a, <2 x i32> %a, <2 x i32> splat (i32 1))
1277 define <2 x i32> @vror_vi_rotl_v2i32(<2 x i32> %a) {
1278 ; CHECK-LABEL: vror_vi_rotl_v2i32:
1280 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
1281 ; CHECK-NEXT: vsrl.vi v9, v8, 31
1282 ; CHECK-NEXT: vadd.vv v8, v8, v8
1283 ; CHECK-NEXT: vor.vv v8, v8, v9
1286 ; CHECK-ZVKB-LABEL: vror_vi_rotl_v2i32:
1287 ; CHECK-ZVKB: # %bb.0:
1288 ; CHECK-ZVKB-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
1289 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 31
1290 ; CHECK-ZVKB-NEXT: ret
1291 %x = call <2 x i32> @llvm.fshl.v2i32(<2 x i32> %a, <2 x i32> %a, <2 x i32> splat (i32 1))
1295 declare <4 x i32> @llvm.fshr.v4i32(<4 x i32>, <4 x i32>, <4 x i32>)
1296 declare <4 x i32> @llvm.fshl.v4i32(<4 x i32>, <4 x i32>, <4 x i32>)
1298 define <4 x i32> @vror_vv_v4i32(<4 x i32> %a, <4 x i32> %b) {
1299 ; CHECK-LABEL: vror_vv_v4i32:
1301 ; CHECK-NEXT: li a0, 31
1302 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
1303 ; CHECK-NEXT: vand.vx v10, v9, a0
1304 ; CHECK-NEXT: vsrl.vv v10, v8, v10
1305 ; CHECK-NEXT: vrsub.vi v9, v9, 0
1306 ; CHECK-NEXT: vand.vx v9, v9, a0
1307 ; CHECK-NEXT: vsll.vv v8, v8, v9
1308 ; CHECK-NEXT: vor.vv v8, v10, v8
1311 ; CHECK-ZVKB-LABEL: vror_vv_v4i32:
1312 ; CHECK-ZVKB: # %bb.0:
1313 ; CHECK-ZVKB-NEXT: vsetivli zero, 4, e32, m1, ta, ma
1314 ; CHECK-ZVKB-NEXT: vror.vv v8, v8, v9
1315 ; CHECK-ZVKB-NEXT: ret
1316 %x = call <4 x i32> @llvm.fshr.v4i32(<4 x i32> %a, <4 x i32> %a, <4 x i32> %b)
1320 define <4 x i32> @vror_vx_v4i32(<4 x i32> %a, i32 %b) {
1321 ; CHECK-LABEL: vror_vx_v4i32:
1323 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
1324 ; CHECK-NEXT: vmv.v.x v9, a0
1325 ; CHECK-NEXT: li a0, 31
1326 ; CHECK-NEXT: vand.vx v10, v9, a0
1327 ; CHECK-NEXT: vsrl.vv v10, v8, v10
1328 ; CHECK-NEXT: vrsub.vi v9, v9, 0
1329 ; CHECK-NEXT: vand.vx v9, v9, a0
1330 ; CHECK-NEXT: vsll.vv v8, v8, v9
1331 ; CHECK-NEXT: vor.vv v8, v10, v8
1334 ; CHECK-ZVKB-LABEL: vror_vx_v4i32:
1335 ; CHECK-ZVKB: # %bb.0:
1336 ; CHECK-ZVKB-NEXT: vsetivli zero, 4, e32, m1, ta, ma
1337 ; CHECK-ZVKB-NEXT: vror.vx v8, v8, a0
1338 ; CHECK-ZVKB-NEXT: ret
1339 %b.head = insertelement <4 x i32> poison, i32 %b, i32 0
1340 %b.splat = shufflevector <4 x i32> %b.head, <4 x i32> poison, <4 x i32> zeroinitializer
1341 %x = call <4 x i32> @llvm.fshr.v4i32(<4 x i32> %a, <4 x i32> %a, <4 x i32> %b.splat)
1345 define <4 x i32> @vror_vi_v4i32(<4 x i32> %a) {
1346 ; CHECK-LABEL: vror_vi_v4i32:
1348 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
1349 ; CHECK-NEXT: vsll.vi v9, v8, 31
1350 ; CHECK-NEXT: vsrl.vi v8, v8, 1
1351 ; CHECK-NEXT: vor.vv v8, v8, v9
1354 ; CHECK-ZVKB-LABEL: vror_vi_v4i32:
1355 ; CHECK-ZVKB: # %bb.0:
1356 ; CHECK-ZVKB-NEXT: vsetivli zero, 4, e32, m1, ta, ma
1357 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 1
1358 ; CHECK-ZVKB-NEXT: ret
1359 %x = call <4 x i32> @llvm.fshr.v4i32(<4 x i32> %a, <4 x i32> %a, <4 x i32> splat (i32 1))
1363 define <4 x i32> @vror_vi_rotl_v4i32(<4 x i32> %a) {
1364 ; CHECK-LABEL: vror_vi_rotl_v4i32:
1366 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
1367 ; CHECK-NEXT: vsrl.vi v9, v8, 31
1368 ; CHECK-NEXT: vadd.vv v8, v8, v8
1369 ; CHECK-NEXT: vor.vv v8, v8, v9
1372 ; CHECK-ZVKB-LABEL: vror_vi_rotl_v4i32:
1373 ; CHECK-ZVKB: # %bb.0:
1374 ; CHECK-ZVKB-NEXT: vsetivli zero, 4, e32, m1, ta, ma
1375 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 31
1376 ; CHECK-ZVKB-NEXT: ret
1377 %x = call <4 x i32> @llvm.fshl.v4i32(<4 x i32> %a, <4 x i32> %a, <4 x i32> splat (i32 1))
1381 declare <8 x i32> @llvm.fshr.v8i32(<8 x i32>, <8 x i32>, <8 x i32>)
1382 declare <8 x i32> @llvm.fshl.v8i32(<8 x i32>, <8 x i32>, <8 x i32>)
1384 define <8 x i32> @vror_vv_v8i32(<8 x i32> %a, <8 x i32> %b) {
1385 ; CHECK-LABEL: vror_vv_v8i32:
1387 ; CHECK-NEXT: li a0, 31
1388 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
1389 ; CHECK-NEXT: vand.vx v12, v10, a0
1390 ; CHECK-NEXT: vsrl.vv v12, v8, v12
1391 ; CHECK-NEXT: vrsub.vi v10, v10, 0
1392 ; CHECK-NEXT: vand.vx v10, v10, a0
1393 ; CHECK-NEXT: vsll.vv v8, v8, v10
1394 ; CHECK-NEXT: vor.vv v8, v12, v8
1397 ; CHECK-ZVKB-LABEL: vror_vv_v8i32:
1398 ; CHECK-ZVKB: # %bb.0:
1399 ; CHECK-ZVKB-NEXT: vsetivli zero, 8, e32, m2, ta, ma
1400 ; CHECK-ZVKB-NEXT: vror.vv v8, v8, v10
1401 ; CHECK-ZVKB-NEXT: ret
1402 %x = call <8 x i32> @llvm.fshr.v8i32(<8 x i32> %a, <8 x i32> %a, <8 x i32> %b)
1406 define <8 x i32> @vror_vx_v8i32(<8 x i32> %a, i32 %b) {
1407 ; CHECK-LABEL: vror_vx_v8i32:
1409 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
1410 ; CHECK-NEXT: vmv.v.x v10, a0
1411 ; CHECK-NEXT: li a0, 31
1412 ; CHECK-NEXT: vand.vx v12, v10, a0
1413 ; CHECK-NEXT: vsrl.vv v12, v8, v12
1414 ; CHECK-NEXT: vrsub.vi v10, v10, 0
1415 ; CHECK-NEXT: vand.vx v10, v10, a0
1416 ; CHECK-NEXT: vsll.vv v8, v8, v10
1417 ; CHECK-NEXT: vor.vv v8, v12, v8
1420 ; CHECK-ZVKB-LABEL: vror_vx_v8i32:
1421 ; CHECK-ZVKB: # %bb.0:
1422 ; CHECK-ZVKB-NEXT: vsetivli zero, 8, e32, m2, ta, ma
1423 ; CHECK-ZVKB-NEXT: vror.vx v8, v8, a0
1424 ; CHECK-ZVKB-NEXT: ret
1425 %b.head = insertelement <8 x i32> poison, i32 %b, i32 0
1426 %b.splat = shufflevector <8 x i32> %b.head, <8 x i32> poison, <8 x i32> zeroinitializer
1427 %x = call <8 x i32> @llvm.fshr.v8i32(<8 x i32> %a, <8 x i32> %a, <8 x i32> %b.splat)
1431 define <8 x i32> @vror_vi_v8i32(<8 x i32> %a) {
1432 ; CHECK-LABEL: vror_vi_v8i32:
1434 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
1435 ; CHECK-NEXT: vsll.vi v10, v8, 31
1436 ; CHECK-NEXT: vsrl.vi v8, v8, 1
1437 ; CHECK-NEXT: vor.vv v8, v8, v10
1440 ; CHECK-ZVKB-LABEL: vror_vi_v8i32:
1441 ; CHECK-ZVKB: # %bb.0:
1442 ; CHECK-ZVKB-NEXT: vsetivli zero, 8, e32, m2, ta, ma
1443 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 1
1444 ; CHECK-ZVKB-NEXT: ret
1445 %x = call <8 x i32> @llvm.fshr.v8i32(<8 x i32> %a, <8 x i32> %a, <8 x i32> splat (i32 1))
1449 define <8 x i32> @vror_vi_rotl_v8i32(<8 x i32> %a) {
1450 ; CHECK-LABEL: vror_vi_rotl_v8i32:
1452 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
1453 ; CHECK-NEXT: vsrl.vi v10, v8, 31
1454 ; CHECK-NEXT: vadd.vv v8, v8, v8
1455 ; CHECK-NEXT: vor.vv v8, v8, v10
1458 ; CHECK-ZVKB-LABEL: vror_vi_rotl_v8i32:
1459 ; CHECK-ZVKB: # %bb.0:
1460 ; CHECK-ZVKB-NEXT: vsetivli zero, 8, e32, m2, ta, ma
1461 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 31
1462 ; CHECK-ZVKB-NEXT: ret
1463 %x = call <8 x i32> @llvm.fshl.v8i32(<8 x i32> %a, <8 x i32> %a, <8 x i32> splat (i32 1))
1467 declare <16 x i32> @llvm.fshr.v16i32(<16 x i32>, <16 x i32>, <16 x i32>)
1468 declare <16 x i32> @llvm.fshl.v16i32(<16 x i32>, <16 x i32>, <16 x i32>)
1470 define <16 x i32> @vror_vv_v16i32(<16 x i32> %a, <16 x i32> %b) {
1471 ; CHECK-LABEL: vror_vv_v16i32:
1473 ; CHECK-NEXT: li a0, 31
1474 ; CHECK-NEXT: vsetivli zero, 16, e32, m4, ta, ma
1475 ; CHECK-NEXT: vand.vx v16, v12, a0
1476 ; CHECK-NEXT: vsrl.vv v16, v8, v16
1477 ; CHECK-NEXT: vrsub.vi v12, v12, 0
1478 ; CHECK-NEXT: vand.vx v12, v12, a0
1479 ; CHECK-NEXT: vsll.vv v8, v8, v12
1480 ; CHECK-NEXT: vor.vv v8, v16, v8
1483 ; CHECK-ZVKB-LABEL: vror_vv_v16i32:
1484 ; CHECK-ZVKB: # %bb.0:
1485 ; CHECK-ZVKB-NEXT: vsetivli zero, 16, e32, m4, ta, ma
1486 ; CHECK-ZVKB-NEXT: vror.vv v8, v8, v12
1487 ; CHECK-ZVKB-NEXT: ret
1488 %x = call <16 x i32> @llvm.fshr.v16i32(<16 x i32> %a, <16 x i32> %a, <16 x i32> %b)
1492 define <16 x i32> @vror_vx_v16i32(<16 x i32> %a, i32 %b) {
1493 ; CHECK-LABEL: vror_vx_v16i32:
1495 ; CHECK-NEXT: vsetivli zero, 16, e32, m4, ta, ma
1496 ; CHECK-NEXT: vmv.v.x v12, a0
1497 ; CHECK-NEXT: li a0, 31
1498 ; CHECK-NEXT: vand.vx v16, v12, a0
1499 ; CHECK-NEXT: vsrl.vv v16, v8, v16
1500 ; CHECK-NEXT: vrsub.vi v12, v12, 0
1501 ; CHECK-NEXT: vand.vx v12, v12, a0
1502 ; CHECK-NEXT: vsll.vv v8, v8, v12
1503 ; CHECK-NEXT: vor.vv v8, v16, v8
1506 ; CHECK-ZVKB-LABEL: vror_vx_v16i32:
1507 ; CHECK-ZVKB: # %bb.0:
1508 ; CHECK-ZVKB-NEXT: vsetivli zero, 16, e32, m4, ta, ma
1509 ; CHECK-ZVKB-NEXT: vror.vx v8, v8, a0
1510 ; CHECK-ZVKB-NEXT: ret
1511 %b.head = insertelement <16 x i32> poison, i32 %b, i32 0
1512 %b.splat = shufflevector <16 x i32> %b.head, <16 x i32> poison, <16 x i32> zeroinitializer
1513 %x = call <16 x i32> @llvm.fshr.v16i32(<16 x i32> %a, <16 x i32> %a, <16 x i32> %b.splat)
1517 define <16 x i32> @vror_vi_v16i32(<16 x i32> %a) {
1518 ; CHECK-LABEL: vror_vi_v16i32:
1520 ; CHECK-NEXT: vsetivli zero, 16, e32, m4, ta, ma
1521 ; CHECK-NEXT: vsll.vi v12, v8, 31
1522 ; CHECK-NEXT: vsrl.vi v8, v8, 1
1523 ; CHECK-NEXT: vor.vv v8, v8, v12
1526 ; CHECK-ZVKB-LABEL: vror_vi_v16i32:
1527 ; CHECK-ZVKB: # %bb.0:
1528 ; CHECK-ZVKB-NEXT: vsetivli zero, 16, e32, m4, ta, ma
1529 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 1
1530 ; CHECK-ZVKB-NEXT: ret
1531 %x = call <16 x i32> @llvm.fshr.v16i32(<16 x i32> %a, <16 x i32> %a, <16 x i32> splat (i32 1))
1535 define <16 x i32> @vror_vi_rotl_v16i32(<16 x i32> %a) {
1536 ; CHECK-LABEL: vror_vi_rotl_v16i32:
1538 ; CHECK-NEXT: vsetivli zero, 16, e32, m4, ta, ma
1539 ; CHECK-NEXT: vsrl.vi v12, v8, 31
1540 ; CHECK-NEXT: vadd.vv v8, v8, v8
1541 ; CHECK-NEXT: vor.vv v8, v8, v12
1544 ; CHECK-ZVKB-LABEL: vror_vi_rotl_v16i32:
1545 ; CHECK-ZVKB: # %bb.0:
1546 ; CHECK-ZVKB-NEXT: vsetivli zero, 16, e32, m4, ta, ma
1547 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 31
1548 ; CHECK-ZVKB-NEXT: ret
1549 %x = call <16 x i32> @llvm.fshl.v16i32(<16 x i32> %a, <16 x i32> %a, <16 x i32> splat (i32 1))
1553 declare <1 x i64> @llvm.fshr.v1i64(<1 x i64>, <1 x i64>, <1 x i64>)
1554 declare <1 x i64> @llvm.fshl.v1i64(<1 x i64>, <1 x i64>, <1 x i64>)
1556 define <1 x i64> @vror_vv_v1i64(<1 x i64> %a, <1 x i64> %b) {
1557 ; CHECK-LABEL: vror_vv_v1i64:
1559 ; CHECK-NEXT: li a0, 63
1560 ; CHECK-NEXT: vsetivli zero, 1, e64, m1, ta, ma
1561 ; CHECK-NEXT: vand.vx v10, v9, a0
1562 ; CHECK-NEXT: vsrl.vv v10, v8, v10
1563 ; CHECK-NEXT: vrsub.vi v9, v9, 0
1564 ; CHECK-NEXT: vand.vx v9, v9, a0
1565 ; CHECK-NEXT: vsll.vv v8, v8, v9
1566 ; CHECK-NEXT: vor.vv v8, v10, v8
1569 ; CHECK-ZVKB-LABEL: vror_vv_v1i64:
1570 ; CHECK-ZVKB: # %bb.0:
1571 ; CHECK-ZVKB-NEXT: vsetivli zero, 1, e64, m1, ta, ma
1572 ; CHECK-ZVKB-NEXT: vror.vv v8, v8, v9
1573 ; CHECK-ZVKB-NEXT: ret
1574 %x = call <1 x i64> @llvm.fshr.v1i64(<1 x i64> %a, <1 x i64> %a, <1 x i64> %b)
1578 define <1 x i64> @vror_vx_v1i64(<1 x i64> %a, i64 %b) {
1579 ; CHECK-LABEL: vror_vx_v1i64:
1581 ; CHECK-NEXT: vsetivli zero, 1, e64, m1, ta, ma
1582 ; CHECK-NEXT: vmv.s.x v9, a0
1583 ; CHECK-NEXT: li a0, 63
1584 ; CHECK-NEXT: vand.vx v10, v9, a0
1585 ; CHECK-NEXT: vsrl.vv v10, v8, v10
1586 ; CHECK-NEXT: vrsub.vi v9, v9, 0
1587 ; CHECK-NEXT: vand.vx v9, v9, a0
1588 ; CHECK-NEXT: vsll.vv v8, v8, v9
1589 ; CHECK-NEXT: vor.vv v8, v10, v8
1592 ; CHECK-ZVKB-LABEL: vror_vx_v1i64:
1593 ; CHECK-ZVKB: # %bb.0:
1594 ; CHECK-ZVKB-NEXT: vsetivli zero, 1, e64, m1, ta, ma
1595 ; CHECK-ZVKB-NEXT: vror.vx v8, v8, a0
1596 ; CHECK-ZVKB-NEXT: ret
1597 %b.head = insertelement <1 x i64> poison, i64 %b, i32 0
1598 %b.splat = shufflevector <1 x i64> %b.head, <1 x i64> poison, <1 x i32> zeroinitializer
1599 %x = call <1 x i64> @llvm.fshr.v1i64(<1 x i64> %a, <1 x i64> %a, <1 x i64> %b.splat)
1603 define <1 x i64> @vror_vi_v1i64(<1 x i64> %a) {
1604 ; CHECK-RV32-LABEL: vror_vi_v1i64:
1605 ; CHECK-RV32: # %bb.0:
1606 ; CHECK-RV32-NEXT: vsetivli zero, 1, e64, m1, ta, ma
1607 ; CHECK-RV32-NEXT: vmv.v.i v9, 1
1608 ; CHECK-RV32-NEXT: vrsub.vi v9, v9, 0
1609 ; CHECK-RV32-NEXT: li a0, 63
1610 ; CHECK-RV32-NEXT: vand.vx v9, v9, a0
1611 ; CHECK-RV32-NEXT: vsll.vv v9, v8, v9
1612 ; CHECK-RV32-NEXT: vmv.s.x v10, a0
1613 ; CHECK-RV32-NEXT: vand.vi v10, v10, 1
1614 ; CHECK-RV32-NEXT: vsrl.vv v8, v8, v10
1615 ; CHECK-RV32-NEXT: vor.vv v8, v8, v9
1616 ; CHECK-RV32-NEXT: ret
1618 ; CHECK-RV64-LABEL: vror_vi_v1i64:
1619 ; CHECK-RV64: # %bb.0:
1620 ; CHECK-RV64-NEXT: li a0, 63
1621 ; CHECK-RV64-NEXT: vsetivli zero, 1, e64, m1, ta, ma
1622 ; CHECK-RV64-NEXT: vsll.vx v9, v8, a0
1623 ; CHECK-RV64-NEXT: vsrl.vi v8, v8, 1
1624 ; CHECK-RV64-NEXT: vor.vv v8, v8, v9
1625 ; CHECK-RV64-NEXT: ret
1627 ; CHECK-ZVKB-LABEL: vror_vi_v1i64:
1628 ; CHECK-ZVKB: # %bb.0:
1629 ; CHECK-ZVKB-NEXT: vsetivli zero, 1, e64, m1, ta, ma
1630 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 1
1631 ; CHECK-ZVKB-NEXT: ret
1632 %x = call <1 x i64> @llvm.fshr.v1i64(<1 x i64> %a, <1 x i64> %a, <1 x i64> splat (i64 1))
1636 define <1 x i64> @vror_vi_rotl_v1i64(<1 x i64> %a) {
1637 ; CHECK-RV32-LABEL: vror_vi_rotl_v1i64:
1638 ; CHECK-RV32: # %bb.0:
1639 ; CHECK-RV32-NEXT: vsetivli zero, 1, e64, m1, ta, ma
1640 ; CHECK-RV32-NEXT: vmv.v.i v9, 1
1641 ; CHECK-RV32-NEXT: vrsub.vi v9, v9, 0
1642 ; CHECK-RV32-NEXT: li a0, 63
1643 ; CHECK-RV32-NEXT: vand.vx v9, v9, a0
1644 ; CHECK-RV32-NEXT: vsrl.vv v9, v8, v9
1645 ; CHECK-RV32-NEXT: vmv.s.x v10, a0
1646 ; CHECK-RV32-NEXT: vand.vi v10, v10, 1
1647 ; CHECK-RV32-NEXT: vsll.vv v8, v8, v10
1648 ; CHECK-RV32-NEXT: vor.vv v8, v8, v9
1649 ; CHECK-RV32-NEXT: ret
1651 ; CHECK-RV64-LABEL: vror_vi_rotl_v1i64:
1652 ; CHECK-RV64: # %bb.0:
1653 ; CHECK-RV64-NEXT: li a0, 63
1654 ; CHECK-RV64-NEXT: vsetivli zero, 1, e64, m1, ta, ma
1655 ; CHECK-RV64-NEXT: vsrl.vx v9, v8, a0
1656 ; CHECK-RV64-NEXT: vadd.vv v8, v8, v8
1657 ; CHECK-RV64-NEXT: vor.vv v8, v8, v9
1658 ; CHECK-RV64-NEXT: ret
1660 ; CHECK-ZVKB-LABEL: vror_vi_rotl_v1i64:
1661 ; CHECK-ZVKB: # %bb.0:
1662 ; CHECK-ZVKB-NEXT: vsetivli zero, 1, e64, m1, ta, ma
1663 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 63
1664 ; CHECK-ZVKB-NEXT: ret
1665 %x = call <1 x i64> @llvm.fshl.v1i64(<1 x i64> %a, <1 x i64> %a, <1 x i64> splat (i64 1))
1669 declare <2 x i64> @llvm.fshr.v2i64(<2 x i64>, <2 x i64>, <2 x i64>)
1670 declare <2 x i64> @llvm.fshl.v2i64(<2 x i64>, <2 x i64>, <2 x i64>)
1672 define <2 x i64> @vror_vv_v2i64(<2 x i64> %a, <2 x i64> %b) {
1673 ; CHECK-LABEL: vror_vv_v2i64:
1675 ; CHECK-NEXT: li a0, 63
1676 ; CHECK-NEXT: vsetivli zero, 2, e64, m1, ta, ma
1677 ; CHECK-NEXT: vand.vx v10, v9, a0
1678 ; CHECK-NEXT: vsrl.vv v10, v8, v10
1679 ; CHECK-NEXT: vrsub.vi v9, v9, 0
1680 ; CHECK-NEXT: vand.vx v9, v9, a0
1681 ; CHECK-NEXT: vsll.vv v8, v8, v9
1682 ; CHECK-NEXT: vor.vv v8, v10, v8
1685 ; CHECK-ZVKB-LABEL: vror_vv_v2i64:
1686 ; CHECK-ZVKB: # %bb.0:
1687 ; CHECK-ZVKB-NEXT: vsetivli zero, 2, e64, m1, ta, ma
1688 ; CHECK-ZVKB-NEXT: vror.vv v8, v8, v9
1689 ; CHECK-ZVKB-NEXT: ret
1690 %x = call <2 x i64> @llvm.fshr.v2i64(<2 x i64> %a, <2 x i64> %a, <2 x i64> %b)
1694 define <2 x i64> @vror_vx_v2i64(<2 x i64> %a, i64 %b) {
1695 ; CHECK-LABEL: vror_vx_v2i64:
1697 ; CHECK-NEXT: vsetivli zero, 2, e64, m1, ta, ma
1698 ; CHECK-NEXT: vmv.v.x v9, a0
1699 ; CHECK-NEXT: li a0, 63
1700 ; CHECK-NEXT: vand.vx v10, v9, a0
1701 ; CHECK-NEXT: vsrl.vv v10, v8, v10
1702 ; CHECK-NEXT: vrsub.vi v9, v9, 0
1703 ; CHECK-NEXT: vand.vx v9, v9, a0
1704 ; CHECK-NEXT: vsll.vv v8, v8, v9
1705 ; CHECK-NEXT: vor.vv v8, v10, v8
1708 ; CHECK-ZVKB-LABEL: vror_vx_v2i64:
1709 ; CHECK-ZVKB: # %bb.0:
1710 ; CHECK-ZVKB-NEXT: vsetivli zero, 2, e64, m1, ta, ma
1711 ; CHECK-ZVKB-NEXT: vror.vx v8, v8, a0
1712 ; CHECK-ZVKB-NEXT: ret
1713 %b.head = insertelement <2 x i64> poison, i64 %b, i32 0
1714 %b.splat = shufflevector <2 x i64> %b.head, <2 x i64> poison, <2 x i32> zeroinitializer
1715 %x = call <2 x i64> @llvm.fshr.v2i64(<2 x i64> %a, <2 x i64> %a, <2 x i64> %b.splat)
1719 define <2 x i64> @vror_vi_v2i64(<2 x i64> %a) {
1720 ; CHECK-RV32-LABEL: vror_vi_v2i64:
1721 ; CHECK-RV32: # %bb.0:
1722 ; CHECK-RV32-NEXT: vsetivli zero, 2, e64, m1, ta, ma
1723 ; CHECK-RV32-NEXT: vmv.v.i v9, 1
1724 ; CHECK-RV32-NEXT: vrsub.vi v9, v9, 0
1725 ; CHECK-RV32-NEXT: li a0, 63
1726 ; CHECK-RV32-NEXT: vand.vx v9, v9, a0
1727 ; CHECK-RV32-NEXT: vsll.vv v9, v8, v9
1728 ; CHECK-RV32-NEXT: vmv.v.x v10, a0
1729 ; CHECK-RV32-NEXT: vand.vi v10, v10, 1
1730 ; CHECK-RV32-NEXT: vsrl.vv v8, v8, v10
1731 ; CHECK-RV32-NEXT: vor.vv v8, v8, v9
1732 ; CHECK-RV32-NEXT: ret
1734 ; CHECK-RV64-LABEL: vror_vi_v2i64:
1735 ; CHECK-RV64: # %bb.0:
1736 ; CHECK-RV64-NEXT: li a0, 63
1737 ; CHECK-RV64-NEXT: vsetivli zero, 2, e64, m1, ta, ma
1738 ; CHECK-RV64-NEXT: vsll.vx v9, v8, a0
1739 ; CHECK-RV64-NEXT: vsrl.vi v8, v8, 1
1740 ; CHECK-RV64-NEXT: vor.vv v8, v8, v9
1741 ; CHECK-RV64-NEXT: ret
1743 ; CHECK-ZVKB-LABEL: vror_vi_v2i64:
1744 ; CHECK-ZVKB: # %bb.0:
1745 ; CHECK-ZVKB-NEXT: vsetivli zero, 2, e64, m1, ta, ma
1746 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 1
1747 ; CHECK-ZVKB-NEXT: ret
1748 %x = call <2 x i64> @llvm.fshr.v2i64(<2 x i64> %a, <2 x i64> %a, <2 x i64> splat (i64 1))
1752 define <2 x i64> @vror_vi_rotl_v2i64(<2 x i64> %a) {
1753 ; CHECK-RV32-LABEL: vror_vi_rotl_v2i64:
1754 ; CHECK-RV32: # %bb.0:
1755 ; CHECK-RV32-NEXT: vsetivli zero, 2, e64, m1, ta, ma
1756 ; CHECK-RV32-NEXT: vmv.v.i v9, 1
1757 ; CHECK-RV32-NEXT: vrsub.vi v9, v9, 0
1758 ; CHECK-RV32-NEXT: li a0, 63
1759 ; CHECK-RV32-NEXT: vand.vx v9, v9, a0
1760 ; CHECK-RV32-NEXT: vsrl.vv v9, v8, v9
1761 ; CHECK-RV32-NEXT: vmv.v.x v10, a0
1762 ; CHECK-RV32-NEXT: vand.vi v10, v10, 1
1763 ; CHECK-RV32-NEXT: vsll.vv v8, v8, v10
1764 ; CHECK-RV32-NEXT: vor.vv v8, v8, v9
1765 ; CHECK-RV32-NEXT: ret
1767 ; CHECK-RV64-LABEL: vror_vi_rotl_v2i64:
1768 ; CHECK-RV64: # %bb.0:
1769 ; CHECK-RV64-NEXT: li a0, 63
1770 ; CHECK-RV64-NEXT: vsetivli zero, 2, e64, m1, ta, ma
1771 ; CHECK-RV64-NEXT: vsrl.vx v9, v8, a0
1772 ; CHECK-RV64-NEXT: vadd.vv v8, v8, v8
1773 ; CHECK-RV64-NEXT: vor.vv v8, v8, v9
1774 ; CHECK-RV64-NEXT: ret
1776 ; CHECK-ZVKB-LABEL: vror_vi_rotl_v2i64:
1777 ; CHECK-ZVKB: # %bb.0:
1778 ; CHECK-ZVKB-NEXT: vsetivli zero, 2, e64, m1, ta, ma
1779 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 63
1780 ; CHECK-ZVKB-NEXT: ret
1781 %x = call <2 x i64> @llvm.fshl.v2i64(<2 x i64> %a, <2 x i64> %a, <2 x i64> splat (i64 1))
1785 declare <4 x i64> @llvm.fshr.v4i64(<4 x i64>, <4 x i64>, <4 x i64>)
1786 declare <4 x i64> @llvm.fshl.v4i64(<4 x i64>, <4 x i64>, <4 x i64>)
1788 define <4 x i64> @vror_vv_v4i64(<4 x i64> %a, <4 x i64> %b) {
1789 ; CHECK-LABEL: vror_vv_v4i64:
1791 ; CHECK-NEXT: li a0, 63
1792 ; CHECK-NEXT: vsetivli zero, 4, e64, m2, ta, ma
1793 ; CHECK-NEXT: vand.vx v12, v10, a0
1794 ; CHECK-NEXT: vsrl.vv v12, v8, v12
1795 ; CHECK-NEXT: vrsub.vi v10, v10, 0
1796 ; CHECK-NEXT: vand.vx v10, v10, a0
1797 ; CHECK-NEXT: vsll.vv v8, v8, v10
1798 ; CHECK-NEXT: vor.vv v8, v12, v8
1801 ; CHECK-ZVKB-LABEL: vror_vv_v4i64:
1802 ; CHECK-ZVKB: # %bb.0:
1803 ; CHECK-ZVKB-NEXT: vsetivli zero, 4, e64, m2, ta, ma
1804 ; CHECK-ZVKB-NEXT: vror.vv v8, v8, v10
1805 ; CHECK-ZVKB-NEXT: ret
1806 %x = call <4 x i64> @llvm.fshr.v4i64(<4 x i64> %a, <4 x i64> %a, <4 x i64> %b)
1810 define <4 x i64> @vror_vx_v4i64(<4 x i64> %a, i64 %b) {
1811 ; CHECK-LABEL: vror_vx_v4i64:
1813 ; CHECK-NEXT: vsetivli zero, 4, e64, m2, ta, ma
1814 ; CHECK-NEXT: vmv.v.x v10, a0
1815 ; CHECK-NEXT: li a0, 63
1816 ; CHECK-NEXT: vand.vx v12, v10, a0
1817 ; CHECK-NEXT: vsrl.vv v12, v8, v12
1818 ; CHECK-NEXT: vrsub.vi v10, v10, 0
1819 ; CHECK-NEXT: vand.vx v10, v10, a0
1820 ; CHECK-NEXT: vsll.vv v8, v8, v10
1821 ; CHECK-NEXT: vor.vv v8, v12, v8
1824 ; CHECK-ZVKB-LABEL: vror_vx_v4i64:
1825 ; CHECK-ZVKB: # %bb.0:
1826 ; CHECK-ZVKB-NEXT: vsetivli zero, 4, e64, m2, ta, ma
1827 ; CHECK-ZVKB-NEXT: vror.vx v8, v8, a0
1828 ; CHECK-ZVKB-NEXT: ret
1829 %b.head = insertelement <4 x i64> poison, i64 %b, i32 0
1830 %b.splat = shufflevector <4 x i64> %b.head, <4 x i64> poison, <4 x i32> zeroinitializer
1831 %x = call <4 x i64> @llvm.fshr.v4i64(<4 x i64> %a, <4 x i64> %a, <4 x i64> %b.splat)
1835 define <4 x i64> @vror_vi_v4i64(<4 x i64> %a) {
1836 ; CHECK-RV32-LABEL: vror_vi_v4i64:
1837 ; CHECK-RV32: # %bb.0:
1838 ; CHECK-RV32-NEXT: vsetivli zero, 4, e64, m2, ta, ma
1839 ; CHECK-RV32-NEXT: vmv.v.i v10, 1
1840 ; CHECK-RV32-NEXT: vrsub.vi v10, v10, 0
1841 ; CHECK-RV32-NEXT: li a0, 63
1842 ; CHECK-RV32-NEXT: vand.vx v10, v10, a0
1843 ; CHECK-RV32-NEXT: vsll.vv v10, v8, v10
1844 ; CHECK-RV32-NEXT: vmv.v.x v12, a0
1845 ; CHECK-RV32-NEXT: vand.vi v12, v12, 1
1846 ; CHECK-RV32-NEXT: vsrl.vv v8, v8, v12
1847 ; CHECK-RV32-NEXT: vor.vv v8, v8, v10
1848 ; CHECK-RV32-NEXT: ret
1850 ; CHECK-RV64-LABEL: vror_vi_v4i64:
1851 ; CHECK-RV64: # %bb.0:
1852 ; CHECK-RV64-NEXT: li a0, 63
1853 ; CHECK-RV64-NEXT: vsetivli zero, 4, e64, m2, ta, ma
1854 ; CHECK-RV64-NEXT: vsll.vx v10, v8, a0
1855 ; CHECK-RV64-NEXT: vsrl.vi v8, v8, 1
1856 ; CHECK-RV64-NEXT: vor.vv v8, v8, v10
1857 ; CHECK-RV64-NEXT: ret
1859 ; CHECK-ZVKB-LABEL: vror_vi_v4i64:
1860 ; CHECK-ZVKB: # %bb.0:
1861 ; CHECK-ZVKB-NEXT: vsetivli zero, 4, e64, m2, ta, ma
1862 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 1
1863 ; CHECK-ZVKB-NEXT: ret
1864 %x = call <4 x i64> @llvm.fshr.v4i64(<4 x i64> %a, <4 x i64> %a, <4 x i64> splat (i64 1))
1868 define <4 x i64> @vror_vi_rotl_v4i64(<4 x i64> %a) {
1869 ; CHECK-RV32-LABEL: vror_vi_rotl_v4i64:
1870 ; CHECK-RV32: # %bb.0:
1871 ; CHECK-RV32-NEXT: vsetivli zero, 4, e64, m2, ta, ma
1872 ; CHECK-RV32-NEXT: vmv.v.i v10, 1
1873 ; CHECK-RV32-NEXT: vrsub.vi v10, v10, 0
1874 ; CHECK-RV32-NEXT: li a0, 63
1875 ; CHECK-RV32-NEXT: vand.vx v10, v10, a0
1876 ; CHECK-RV32-NEXT: vsrl.vv v10, v8, v10
1877 ; CHECK-RV32-NEXT: vmv.v.x v12, a0
1878 ; CHECK-RV32-NEXT: vand.vi v12, v12, 1
1879 ; CHECK-RV32-NEXT: vsll.vv v8, v8, v12
1880 ; CHECK-RV32-NEXT: vor.vv v8, v8, v10
1881 ; CHECK-RV32-NEXT: ret
1883 ; CHECK-RV64-LABEL: vror_vi_rotl_v4i64:
1884 ; CHECK-RV64: # %bb.0:
1885 ; CHECK-RV64-NEXT: li a0, 63
1886 ; CHECK-RV64-NEXT: vsetivli zero, 4, e64, m2, ta, ma
1887 ; CHECK-RV64-NEXT: vsrl.vx v10, v8, a0
1888 ; CHECK-RV64-NEXT: vadd.vv v8, v8, v8
1889 ; CHECK-RV64-NEXT: vor.vv v8, v8, v10
1890 ; CHECK-RV64-NEXT: ret
1892 ; CHECK-ZVKB-LABEL: vror_vi_rotl_v4i64:
1893 ; CHECK-ZVKB: # %bb.0:
1894 ; CHECK-ZVKB-NEXT: vsetivli zero, 4, e64, m2, ta, ma
1895 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 63
1896 ; CHECK-ZVKB-NEXT: ret
1897 %x = call <4 x i64> @llvm.fshl.v4i64(<4 x i64> %a, <4 x i64> %a, <4 x i64> splat (i64 1))
1901 declare <8 x i64> @llvm.fshr.v8i64(<8 x i64>, <8 x i64>, <8 x i64>)
1902 declare <8 x i64> @llvm.fshl.v8i64(<8 x i64>, <8 x i64>, <8 x i64>)
1904 define <8 x i64> @vror_vv_v8i64(<8 x i64> %a, <8 x i64> %b) {
1905 ; CHECK-LABEL: vror_vv_v8i64:
1907 ; CHECK-NEXT: li a0, 63
1908 ; CHECK-NEXT: vsetivli zero, 8, e64, m4, ta, ma
1909 ; CHECK-NEXT: vand.vx v16, v12, a0
1910 ; CHECK-NEXT: vsrl.vv v16, v8, v16
1911 ; CHECK-NEXT: vrsub.vi v12, v12, 0
1912 ; CHECK-NEXT: vand.vx v12, v12, a0
1913 ; CHECK-NEXT: vsll.vv v8, v8, v12
1914 ; CHECK-NEXT: vor.vv v8, v16, v8
1917 ; CHECK-ZVKB-LABEL: vror_vv_v8i64:
1918 ; CHECK-ZVKB: # %bb.0:
1919 ; CHECK-ZVKB-NEXT: vsetivli zero, 8, e64, m4, ta, ma
1920 ; CHECK-ZVKB-NEXT: vror.vv v8, v8, v12
1921 ; CHECK-ZVKB-NEXT: ret
1922 %x = call <8 x i64> @llvm.fshr.v8i64(<8 x i64> %a, <8 x i64> %a, <8 x i64> %b)
1926 define <8 x i64> @vror_vx_v8i64(<8 x i64> %a, i64 %b) {
1927 ; CHECK-LABEL: vror_vx_v8i64:
1929 ; CHECK-NEXT: vsetivli zero, 8, e64, m4, ta, ma
1930 ; CHECK-NEXT: vmv.v.x v12, a0
1931 ; CHECK-NEXT: li a0, 63
1932 ; CHECK-NEXT: vand.vx v16, v12, a0
1933 ; CHECK-NEXT: vsrl.vv v16, v8, v16
1934 ; CHECK-NEXT: vrsub.vi v12, v12, 0
1935 ; CHECK-NEXT: vand.vx v12, v12, a0
1936 ; CHECK-NEXT: vsll.vv v8, v8, v12
1937 ; CHECK-NEXT: vor.vv v8, v16, v8
1940 ; CHECK-ZVKB-LABEL: vror_vx_v8i64:
1941 ; CHECK-ZVKB: # %bb.0:
1942 ; CHECK-ZVKB-NEXT: vsetivli zero, 8, e64, m4, ta, ma
1943 ; CHECK-ZVKB-NEXT: vror.vx v8, v8, a0
1944 ; CHECK-ZVKB-NEXT: ret
1945 %b.head = insertelement <8 x i64> poison, i64 %b, i32 0
1946 %b.splat = shufflevector <8 x i64> %b.head, <8 x i64> poison, <8 x i32> zeroinitializer
1947 %x = call <8 x i64> @llvm.fshr.v8i64(<8 x i64> %a, <8 x i64> %a, <8 x i64> %b.splat)
1951 define <8 x i64> @vror_vi_v8i64(<8 x i64> %a) {
1952 ; CHECK-RV32-LABEL: vror_vi_v8i64:
1953 ; CHECK-RV32: # %bb.0:
1954 ; CHECK-RV32-NEXT: vsetivli zero, 8, e64, m4, ta, ma
1955 ; CHECK-RV32-NEXT: vmv.v.i v12, 1
1956 ; CHECK-RV32-NEXT: vrsub.vi v12, v12, 0
1957 ; CHECK-RV32-NEXT: li a0, 63
1958 ; CHECK-RV32-NEXT: vand.vx v12, v12, a0
1959 ; CHECK-RV32-NEXT: vsll.vv v12, v8, v12
1960 ; CHECK-RV32-NEXT: vmv.v.x v16, a0
1961 ; CHECK-RV32-NEXT: vand.vi v16, v16, 1
1962 ; CHECK-RV32-NEXT: vsrl.vv v8, v8, v16
1963 ; CHECK-RV32-NEXT: vor.vv v8, v8, v12
1964 ; CHECK-RV32-NEXT: ret
1966 ; CHECK-RV64-LABEL: vror_vi_v8i64:
1967 ; CHECK-RV64: # %bb.0:
1968 ; CHECK-RV64-NEXT: li a0, 63
1969 ; CHECK-RV64-NEXT: vsetivli zero, 8, e64, m4, ta, ma
1970 ; CHECK-RV64-NEXT: vsll.vx v12, v8, a0
1971 ; CHECK-RV64-NEXT: vsrl.vi v8, v8, 1
1972 ; CHECK-RV64-NEXT: vor.vv v8, v8, v12
1973 ; CHECK-RV64-NEXT: ret
1975 ; CHECK-ZVKB-LABEL: vror_vi_v8i64:
1976 ; CHECK-ZVKB: # %bb.0:
1977 ; CHECK-ZVKB-NEXT: vsetivli zero, 8, e64, m4, ta, ma
1978 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 1
1979 ; CHECK-ZVKB-NEXT: ret
1980 %x = call <8 x i64> @llvm.fshr.v8i64(<8 x i64> %a, <8 x i64> %a, <8 x i64> splat (i64 1))
1984 define <8 x i64> @vror_vi_rotl_v8i64(<8 x i64> %a) {
1985 ; CHECK-RV32-LABEL: vror_vi_rotl_v8i64:
1986 ; CHECK-RV32: # %bb.0:
1987 ; CHECK-RV32-NEXT: vsetivli zero, 8, e64, m4, ta, ma
1988 ; CHECK-RV32-NEXT: vmv.v.i v12, 1
1989 ; CHECK-RV32-NEXT: vrsub.vi v12, v12, 0
1990 ; CHECK-RV32-NEXT: li a0, 63
1991 ; CHECK-RV32-NEXT: vand.vx v12, v12, a0
1992 ; CHECK-RV32-NEXT: vsrl.vv v12, v8, v12
1993 ; CHECK-RV32-NEXT: vmv.v.x v16, a0
1994 ; CHECK-RV32-NEXT: vand.vi v16, v16, 1
1995 ; CHECK-RV32-NEXT: vsll.vv v8, v8, v16
1996 ; CHECK-RV32-NEXT: vor.vv v8, v8, v12
1997 ; CHECK-RV32-NEXT: ret
1999 ; CHECK-RV64-LABEL: vror_vi_rotl_v8i64:
2000 ; CHECK-RV64: # %bb.0:
2001 ; CHECK-RV64-NEXT: li a0, 63
2002 ; CHECK-RV64-NEXT: vsetivli zero, 8, e64, m4, ta, ma
2003 ; CHECK-RV64-NEXT: vsrl.vx v12, v8, a0
2004 ; CHECK-RV64-NEXT: vadd.vv v8, v8, v8
2005 ; CHECK-RV64-NEXT: vor.vv v8, v8, v12
2006 ; CHECK-RV64-NEXT: ret
2008 ; CHECK-ZVKB-LABEL: vror_vi_rotl_v8i64:
2009 ; CHECK-ZVKB: # %bb.0:
2010 ; CHECK-ZVKB-NEXT: vsetivli zero, 8, e64, m4, ta, ma
2011 ; CHECK-ZVKB-NEXT: vror.vi v8, v8, 63
2012 ; CHECK-ZVKB-NEXT: ret
2013 %x = call <8 x i64> @llvm.fshl.v8i64(<8 x i64> %a, <8 x i64> %a, <8 x i64> splat (i64 1))