1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
2 ; RUN: sed 's/iXLen/i32/g' %s | llc -mtriple=riscv32 -mattr='+v' -verify-machineinstrs | FileCheck %s --check-prefix=RV32
3 ; RUN: sed 's/iXLen/i64/g' %s | llc -mtriple=riscv64 -mattr='+v' -verify-machineinstrs | FileCheck %s --check-prefix=RV64
5 define iXLen @bool_vec(<vscale x 2 x i1> %src, <vscale x 2 x i1> %m, i32 %evl) {
6 ; RV32-LABEL: bool_vec:
8 ; RV32-NEXT: vmv1r.v v9, v0
9 ; RV32-NEXT: vmv1r.v v0, v8
10 ; RV32-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
11 ; RV32-NEXT: vfirst.m a1, v9, v0.t
12 ; RV32-NEXT: bltz a1, .LBB0_2
14 ; RV32-NEXT: mv a0, a1
18 ; RV64-LABEL: bool_vec:
20 ; RV64-NEXT: vmv1r.v v9, v0
21 ; RV64-NEXT: slli a0, a0, 32
22 ; RV64-NEXT: srli a0, a0, 32
23 ; RV64-NEXT: vmv1r.v v0, v8
24 ; RV64-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
25 ; RV64-NEXT: vfirst.m a1, v9, v0.t
26 ; RV64-NEXT: bltz a1, .LBB0_2
28 ; RV64-NEXT: mv a0, a1
31 %r = call iXLen @llvm.vp.cttz.elts.iXLen.nxv2i1(<vscale x 2 x i1> %src, i1 0, <vscale x 2 x i1> %m, i32 %evl)
35 define iXLen @bool_vec_zero_poison(<vscale x 2 x i1> %src, <vscale x 2 x i1> %m, i32 %evl) {
36 ; RV32-LABEL: bool_vec_zero_poison:
38 ; RV32-NEXT: vmv1r.v v9, v0
39 ; RV32-NEXT: vmv1r.v v0, v8
40 ; RV32-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
41 ; RV32-NEXT: vfirst.m a0, v9, v0.t
44 ; RV64-LABEL: bool_vec_zero_poison:
46 ; RV64-NEXT: vmv1r.v v9, v0
47 ; RV64-NEXT: slli a0, a0, 32
48 ; RV64-NEXT: srli a0, a0, 32
49 ; RV64-NEXT: vmv1r.v v0, v8
50 ; RV64-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
51 ; RV64-NEXT: vfirst.m a0, v9, v0.t
53 %r = call iXLen @llvm.vp.cttz.elts.iXLen.nxv2i1(<vscale x 2 x i1> %src, i1 1, <vscale x 2 x i1> %m, i32 %evl)
57 define iXLen @nxv2i32(<vscale x 2 x i32> %src, <vscale x 2 x i1> %m, i32 %evl) {
58 ; RV32-LABEL: nxv2i32:
60 ; RV32-NEXT: vsetvli zero, a0, e32, m1, ta, ma
61 ; RV32-NEXT: vmsne.vi v8, v8, 0, v0.t
62 ; RV32-NEXT: vfirst.m a1, v8, v0.t
63 ; RV32-NEXT: bltz a1, .LBB2_2
65 ; RV32-NEXT: mv a0, a1
69 ; RV64-LABEL: nxv2i32:
71 ; RV64-NEXT: slli a0, a0, 32
72 ; RV64-NEXT: srli a0, a0, 32
73 ; RV64-NEXT: vsetvli zero, a0, e32, m1, ta, ma
74 ; RV64-NEXT: vmsne.vi v8, v8, 0, v0.t
75 ; RV64-NEXT: vfirst.m a1, v8, v0.t
76 ; RV64-NEXT: bltz a1, .LBB2_2
78 ; RV64-NEXT: mv a0, a1
81 %r = call iXLen @llvm.vp.cttz.elts.iXLen.nxv2i32(<vscale x 2 x i32> %src, i1 0, <vscale x 2 x i1> %m, i32 %evl)
85 define iXLen @nxv2i32_zero_poison(<vscale x 2 x i32> %src, <vscale x 2 x i1> %m, i32 %evl) {
86 ; RV32-LABEL: nxv2i32_zero_poison:
88 ; RV32-NEXT: vsetvli zero, a0, e32, m1, ta, ma
89 ; RV32-NEXT: vmsne.vi v8, v8, 0, v0.t
90 ; RV32-NEXT: vfirst.m a0, v8, v0.t
93 ; RV64-LABEL: nxv2i32_zero_poison:
95 ; RV64-NEXT: slli a0, a0, 32
96 ; RV64-NEXT: srli a0, a0, 32
97 ; RV64-NEXT: vsetvli zero, a0, e32, m1, ta, ma
98 ; RV64-NEXT: vmsne.vi v8, v8, 0, v0.t
99 ; RV64-NEXT: vfirst.m a0, v8, v0.t
101 %r = call iXLen @llvm.vp.cttz.elts.iXLen.nxv2i32(<vscale x 2 x i32> %src, i1 1, <vscale x 2 x i1> %m, i32 %evl)
105 define iXLen @nxv2i64(<vscale x 2 x i64> %src, <vscale x 2 x i1> %m, i32 %evl) {
106 ; RV32-LABEL: nxv2i64:
108 ; RV32-NEXT: vsetvli zero, a0, e64, m2, ta, ma
109 ; RV32-NEXT: vmsne.vi v10, v8, 0, v0.t
110 ; RV32-NEXT: vfirst.m a1, v10, v0.t
111 ; RV32-NEXT: bltz a1, .LBB4_2
112 ; RV32-NEXT: # %bb.1:
113 ; RV32-NEXT: mv a0, a1
114 ; RV32-NEXT: .LBB4_2:
117 ; RV64-LABEL: nxv2i64:
119 ; RV64-NEXT: slli a0, a0, 32
120 ; RV64-NEXT: srli a0, a0, 32
121 ; RV64-NEXT: vsetvli zero, a0, e64, m2, ta, ma
122 ; RV64-NEXT: vmsne.vi v10, v8, 0, v0.t
123 ; RV64-NEXT: vfirst.m a1, v10, v0.t
124 ; RV64-NEXT: bltz a1, .LBB4_2
125 ; RV64-NEXT: # %bb.1:
126 ; RV64-NEXT: mv a0, a1
127 ; RV64-NEXT: .LBB4_2:
129 %r = call iXLen @llvm.vp.cttz.elts.iXLen.nxv2i64(<vscale x 2 x i64> %src, i1 0, <vscale x 2 x i1> %m, i32 %evl)
133 define iXLen @nxv2i64_zero_poison(<vscale x 2 x i64> %src, <vscale x 2 x i1> %m, i32 %evl) {
134 ; RV32-LABEL: nxv2i64_zero_poison:
136 ; RV32-NEXT: vsetvli zero, a0, e64, m2, ta, ma
137 ; RV32-NEXT: vmsne.vi v10, v8, 0, v0.t
138 ; RV32-NEXT: vfirst.m a0, v10, v0.t
141 ; RV64-LABEL: nxv2i64_zero_poison:
143 ; RV64-NEXT: slli a0, a0, 32
144 ; RV64-NEXT: srli a0, a0, 32
145 ; RV64-NEXT: vsetvli zero, a0, e64, m2, ta, ma
146 ; RV64-NEXT: vmsne.vi v10, v8, 0, v0.t
147 ; RV64-NEXT: vfirst.m a0, v10, v0.t
149 %r = call iXLen @llvm.vp.cttz.elts.iXLen.nxv2i64(<vscale x 2 x i64> %src, i1 1, <vscale x 2 x i1> %m, i32 %evl)
153 define i1 @nxv2i32_cmp_evl(<vscale x 2 x i32> %src, <vscale x 2 x i1> %m, i32 %evl) {
154 ; RV32-LABEL: nxv2i32_cmp_evl:
156 ; RV32-NEXT: vsetvli zero, a0, e32, m1, ta, ma
157 ; RV32-NEXT: vmsne.vi v8, v8, 0, v0.t
158 ; RV32-NEXT: vfirst.m a2, v8, v0.t
159 ; RV32-NEXT: mv a1, a0
160 ; RV32-NEXT: bltz a2, .LBB6_2
161 ; RV32-NEXT: # %bb.1:
162 ; RV32-NEXT: mv a1, a2
163 ; RV32-NEXT: .LBB6_2:
164 ; RV32-NEXT: xor a0, a1, a0
165 ; RV32-NEXT: seqz a0, a0
168 ; RV64-LABEL: nxv2i32_cmp_evl:
170 ; RV64-NEXT: slli a1, a0, 32
171 ; RV64-NEXT: srli a1, a1, 32
172 ; RV64-NEXT: vsetvli zero, a1, e32, m1, ta, ma
173 ; RV64-NEXT: vmsne.vi v8, v8, 0, v0.t
174 ; RV64-NEXT: vfirst.m a2, v8, v0.t
175 ; RV64-NEXT: sext.w a0, a0
176 ; RV64-NEXT: bltz a2, .LBB6_2
177 ; RV64-NEXT: # %bb.1:
178 ; RV64-NEXT: mv a1, a2
179 ; RV64-NEXT: .LBB6_2:
180 ; RV64-NEXT: sext.w a1, a1
181 ; RV64-NEXT: xor a0, a1, a0
182 ; RV64-NEXT: seqz a0, a0
184 %r = call i32 @llvm.vp.cttz.elts.i32.nxv2i32(<vscale x 2 x i32> %src, i1 0, <vscale x 2 x i1> %m, i32 %evl)
185 %cmp = icmp eq i32 %r, %evl
189 define iXLen @fixed_v2i64(<2 x i64> %src, <2 x i1> %m, i32 %evl) {
190 ; RV32-LABEL: fixed_v2i64:
192 ; RV32-NEXT: vsetvli zero, a0, e64, m1, ta, ma
193 ; RV32-NEXT: vmsne.vi v8, v8, 0, v0.t
194 ; RV32-NEXT: vfirst.m a1, v8, v0.t
195 ; RV32-NEXT: bltz a1, .LBB7_2
196 ; RV32-NEXT: # %bb.1:
197 ; RV32-NEXT: mv a0, a1
198 ; RV32-NEXT: .LBB7_2:
201 ; RV64-LABEL: fixed_v2i64:
203 ; RV64-NEXT: slli a0, a0, 32
204 ; RV64-NEXT: srli a0, a0, 32
205 ; RV64-NEXT: vsetvli zero, a0, e64, m1, ta, ma
206 ; RV64-NEXT: vmsne.vi v8, v8, 0, v0.t
207 ; RV64-NEXT: vfirst.m a1, v8, v0.t
208 ; RV64-NEXT: bltz a1, .LBB7_2
209 ; RV64-NEXT: # %bb.1:
210 ; RV64-NEXT: mv a0, a1
211 ; RV64-NEXT: .LBB7_2:
213 %r = call iXLen @llvm.vp.cttz.elts.iXLen.v2i64(<2 x i64> %src, i1 0, <2 x i1> %m, i32 %evl)
217 define iXLen @fixed_v2i64_zero_poison(<2 x i64> %src, <2 x i1> %m, i32 %evl) {
218 ; RV32-LABEL: fixed_v2i64_zero_poison:
220 ; RV32-NEXT: vsetvli zero, a0, e64, m1, ta, ma
221 ; RV32-NEXT: vmsne.vi v8, v8, 0, v0.t
222 ; RV32-NEXT: vfirst.m a0, v8, v0.t
225 ; RV64-LABEL: fixed_v2i64_zero_poison:
227 ; RV64-NEXT: slli a0, a0, 32
228 ; RV64-NEXT: srli a0, a0, 32
229 ; RV64-NEXT: vsetvli zero, a0, e64, m1, ta, ma
230 ; RV64-NEXT: vmsne.vi v8, v8, 0, v0.t
231 ; RV64-NEXT: vfirst.m a0, v8, v0.t
233 %r = call iXLen @llvm.vp.cttz.elts.iXLen.v2i64(<2 x i64> %src, i1 1, <2 x i1> %m, i32 %evl)
237 declare iXLen @llvm.vp.cttz.elts.iXLen.nxv2i1(<vscale x 2 x i1>, i1, <vscale x 2 x i1>, i32)
238 declare iXLen @llvm.vp.cttz.elts.iXLen.nxv2i32(<vscale x 2 x i32>, i1, <vscale x 2 x i1>, i32)
239 declare iXLen @llvm.vp.cttz.elts.iXLen.nxv2i64(<vscale x 2 x i64>, i1, <vscale x 2 x i1>, i32)
240 declare iXLen @llvm.vp.cttz.elts.iXLen.v2i64(<2 x i64>, i1, <2 x i1>, i32)