1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv64 -mattr=+m,+v -verify-machineinstrs -riscv-v-vector-bits-min=128 \
3 ; RUN: < %s | FileCheck %s
5 define <2 x i1> @test_vp_reverse_v2i1_masked(<2 x i1> %src, <2 x i1> %mask, i32 zeroext %evl) {
6 ; CHECK-LABEL: test_vp_reverse_v2i1_masked:
8 ; CHECK-NEXT: vsetvli zero, a0, e8, mf8, ta, ma
9 ; CHECK-NEXT: vmv.v.i v9, 0
10 ; CHECK-NEXT: vmerge.vim v9, v9, 1, v0
11 ; CHECK-NEXT: vmv1r.v v0, v8
12 ; CHECK-NEXT: vsetvli zero, zero, e16, mf4, ta, ma
13 ; CHECK-NEXT: vid.v v10, v0.t
14 ; CHECK-NEXT: addi a0, a0, -1
15 ; CHECK-NEXT: vrsub.vx v10, v10, a0, v0.t
16 ; CHECK-NEXT: vsetvli zero, zero, e8, mf8, ta, ma
17 ; CHECK-NEXT: vrgatherei16.vv v11, v9, v10, v0.t
18 ; CHECK-NEXT: vmsne.vi v0, v11, 0, v0.t
20 %dst = call <2 x i1> @llvm.experimental.vp.reverse.v2i1(<2 x i1> %src, <2 x i1> %mask, i32 %evl)
24 define <2 x i1> @test_vp_reverse_v2i1(<2 x i1> %src, i32 zeroext %evl) {
25 ; CHECK-LABEL: test_vp_reverse_v2i1:
27 ; CHECK-NEXT: addi a1, a0, -1
28 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
29 ; CHECK-NEXT: vid.v v8
30 ; CHECK-NEXT: vrsub.vx v8, v8, a1
31 ; CHECK-NEXT: vsetvli zero, zero, e8, mf8, ta, ma
32 ; CHECK-NEXT: vmv.v.i v9, 0
33 ; CHECK-NEXT: vmerge.vim v9, v9, 1, v0
34 ; CHECK-NEXT: vrgatherei16.vv v10, v9, v8
35 ; CHECK-NEXT: vmsne.vi v0, v10, 0
38 %dst = call <2 x i1> @llvm.experimental.vp.reverse.v2i1(<2 x i1> %src, <2 x i1> splat (i1 1), i32 %evl)
42 define <4 x i1> @test_vp_reverse_v4i1_masked(<4 x i1> %src, <4 x i1> %mask, i32 zeroext %evl) {
43 ; CHECK-LABEL: test_vp_reverse_v4i1_masked:
45 ; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
46 ; CHECK-NEXT: vmv.v.i v9, 0
47 ; CHECK-NEXT: vmerge.vim v9, v9, 1, v0
48 ; CHECK-NEXT: vmv1r.v v0, v8
49 ; CHECK-NEXT: vsetvli zero, zero, e16, mf2, ta, ma
50 ; CHECK-NEXT: vid.v v10, v0.t
51 ; CHECK-NEXT: addi a0, a0, -1
52 ; CHECK-NEXT: vrsub.vx v10, v10, a0, v0.t
53 ; CHECK-NEXT: vsetvli zero, zero, e8, mf4, ta, ma
54 ; CHECK-NEXT: vrgatherei16.vv v11, v9, v10, v0.t
55 ; CHECK-NEXT: vmsne.vi v0, v11, 0, v0.t
57 %dst = call <4 x i1> @llvm.experimental.vp.reverse.v4i1(<4 x i1> %src, <4 x i1> %mask, i32 %evl)
61 define <4 x i1> @test_vp_reverse_v4i1(<4 x i1> %src, i32 zeroext %evl) {
62 ; CHECK-LABEL: test_vp_reverse_v4i1:
64 ; CHECK-NEXT: addi a1, a0, -1
65 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
66 ; CHECK-NEXT: vid.v v8
67 ; CHECK-NEXT: vrsub.vx v8, v8, a1
68 ; CHECK-NEXT: vsetvli zero, zero, e8, mf4, ta, ma
69 ; CHECK-NEXT: vmv.v.i v9, 0
70 ; CHECK-NEXT: vmerge.vim v9, v9, 1, v0
71 ; CHECK-NEXT: vrgatherei16.vv v10, v9, v8
72 ; CHECK-NEXT: vmsne.vi v0, v10, 0
75 %dst = call <4 x i1> @llvm.experimental.vp.reverse.v4i1(<4 x i1> %src, <4 x i1> splat (i1 1), i32 %evl)
79 define <8 x i1> @test_vp_reverse_v8i1_masked(<8 x i1> %src, <8 x i1> %mask, i32 zeroext %evl) {
80 ; CHECK-LABEL: test_vp_reverse_v8i1_masked:
82 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
83 ; CHECK-NEXT: vmv.v.i v9, 0
84 ; CHECK-NEXT: vmerge.vim v9, v9, 1, v0
85 ; CHECK-NEXT: vmv1r.v v0, v8
86 ; CHECK-NEXT: vsetvli zero, zero, e16, m1, ta, ma
87 ; CHECK-NEXT: vid.v v10, v0.t
88 ; CHECK-NEXT: addi a0, a0, -1
89 ; CHECK-NEXT: vrsub.vx v10, v10, a0, v0.t
90 ; CHECK-NEXT: vsetvli zero, zero, e8, mf2, ta, ma
91 ; CHECK-NEXT: vrgatherei16.vv v11, v9, v10, v0.t
92 ; CHECK-NEXT: vmsne.vi v0, v11, 0, v0.t
94 %dst = call <8 x i1> @llvm.experimental.vp.reverse.v8i1(<8 x i1> %src, <8 x i1> %mask, i32 %evl)
98 define <8 x i1> @test_vp_reverse_v8i1(<8 x i1> %src, i32 zeroext %evl) {
99 ; CHECK-LABEL: test_vp_reverse_v8i1:
101 ; CHECK-NEXT: addi a1, a0, -1
102 ; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, ma
103 ; CHECK-NEXT: vid.v v8
104 ; CHECK-NEXT: vrsub.vx v8, v8, a1
105 ; CHECK-NEXT: vsetvli zero, zero, e8, mf2, ta, ma
106 ; CHECK-NEXT: vmv.v.i v9, 0
107 ; CHECK-NEXT: vmerge.vim v9, v9, 1, v0
108 ; CHECK-NEXT: vrgatherei16.vv v10, v9, v8
109 ; CHECK-NEXT: vmsne.vi v0, v10, 0
112 %dst = call <8 x i1> @llvm.experimental.vp.reverse.v8i1(<8 x i1> %src, <8 x i1> splat (i1 1), i32 %evl)
116 define <16 x i1> @test_vp_reverse_v16i1_masked(<16 x i1> %src, <16 x i1> %mask, i32 zeroext %evl) {
117 ; CHECK-LABEL: test_vp_reverse_v16i1_masked:
119 ; CHECK-NEXT: vsetvli zero, a0, e8, m1, ta, ma
120 ; CHECK-NEXT: vmv.v.i v9, 0
121 ; CHECK-NEXT: vmerge.vim v9, v9, 1, v0
122 ; CHECK-NEXT: vmv1r.v v0, v8
123 ; CHECK-NEXT: vsetvli zero, zero, e16, m2, ta, ma
124 ; CHECK-NEXT: vid.v v10, v0.t
125 ; CHECK-NEXT: addi a0, a0, -1
126 ; CHECK-NEXT: vrsub.vx v10, v10, a0, v0.t
127 ; CHECK-NEXT: vsetvli zero, zero, e8, m1, ta, ma
128 ; CHECK-NEXT: vrgatherei16.vv v12, v9, v10, v0.t
129 ; CHECK-NEXT: vmsne.vi v0, v12, 0, v0.t
131 %dst = call <16 x i1> @llvm.experimental.vp.reverse.v16i1(<16 x i1> %src, <16 x i1> %mask, i32 %evl)
135 define <16 x i1> @test_vp_reverse_v16i1(<16 x i1> %src, i32 zeroext %evl) {
136 ; CHECK-LABEL: test_vp_reverse_v16i1:
138 ; CHECK-NEXT: addi a1, a0, -1
139 ; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, ma
140 ; CHECK-NEXT: vid.v v8
141 ; CHECK-NEXT: vrsub.vx v8, v8, a1
142 ; CHECK-NEXT: vsetvli zero, zero, e8, m1, ta, ma
143 ; CHECK-NEXT: vmv.v.i v10, 0
144 ; CHECK-NEXT: vmerge.vim v10, v10, 1, v0
145 ; CHECK-NEXT: vrgatherei16.vv v11, v10, v8
146 ; CHECK-NEXT: vmsne.vi v0, v11, 0
149 %dst = call <16 x i1> @llvm.experimental.vp.reverse.v16i1(<16 x i1> %src, <16 x i1> splat (i1 1), i32 %evl)
153 declare <2 x i1> @llvm.experimental.vp.reverse.v2i1(<2 x i1>,<2 x i1>,i32)
154 declare <4 x i1> @llvm.experimental.vp.reverse.v4i1(<4 x i1>,<4 x i1>,i32)
155 declare <8 x i1> @llvm.experimental.vp.reverse.v8i1(<8 x i1>,<8 x i1>,i32)
156 declare <16 x i1> @llvm.experimental.vp.reverse.v16i1(<16 x i1>,<16 x i1>,i32)