1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+m,+zve64x,+zvl128b -riscv-v-fixed-length-vector-lmul-max=2 -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,LMULMAX2,LMULMAX2-RV32,LMULMAX2-RV32I
3 ; RUN: llc -mtriple=riscv64 -mattr=+m,+zve64x,+zvl128b -riscv-v-fixed-length-vector-lmul-max=2 -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,LMULMAX2,LMULMAX2-RV64,LMULMAX2-RV64I
4 ; RUN: llc -mtriple=riscv32 -mattr=+m,+zve64x,+zvl128b -riscv-v-fixed-length-vector-lmul-max=1 -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,LMULMAX1,LMULMAX1-RV32
5 ; RUN: llc -mtriple=riscv64 -mattr=+m,+zve64x,+zvl128b -riscv-v-fixed-length-vector-lmul-max=1 -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,LMULMAX1,LMULMAX1-RV64
6 ; RUN: llc -mtriple=riscv32 -mattr=+m,+zve64f,+zvl128b,+f -riscv-v-fixed-length-vector-lmul-max=2 -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,LMULMAX2,LMULMAX2-RV32,LMULMAX2-RV32F
7 ; RUN: llc -mtriple=riscv64 -mattr=+m,+zve64f,+zvl128b,+f -riscv-v-fixed-length-vector-lmul-max=2 -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,LMULMAX2,LMULMAX2-RV64,LMULMAX2-RV64F
8 ; RUN: llc -mtriple=riscv32 -mattr=+m,+v,+d -riscv-v-fixed-length-vector-lmul-max=2 -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,LMULMAX2,LMULMAX2-RV32,LMULMAX2-RV32D
9 ; RUN: llc -mtriple=riscv64 -mattr=+m,+v,+d -riscv-v-fixed-length-vector-lmul-max=2 -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,LMULMAX2,LMULMAX2-RV64,LMULMAX2-RV64D
10 ; RUN: llc -mtriple=riscv32 -mattr=+m,+v,+d -riscv-v-fixed-length-vector-lmul-max=1 -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,LMULMAX1,LMULMAX1-RV32
11 ; RUN: llc -mtriple=riscv64 -mattr=+m,+v,+d -riscv-v-fixed-length-vector-lmul-max=1 -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,LMULMAX1,LMULMAX1-RV64
12 ; RUN: llc -mtriple=riscv32 -mattr=+m,+v,+d -riscv-v-fixed-length-vector-lmul-max=8 -verify-machineinstrs < %s | FileCheck %s --check-prefixes=LMULMAX8
13 ; RUN: llc -mtriple=riscv64 -mattr=+m,+v,+d -riscv-v-fixed-length-vector-lmul-max=8 -verify-machineinstrs < %s | FileCheck %s --check-prefixes=LMULMAX8
14 ; RUN: llc -mtriple=riscv32 -mattr=+v,+zvbb -verify-machineinstrs < %s | FileCheck %s --check-prefixes=ZVBB
15 ; RUN: llc -mtriple=riscv64 -mattr=+v,+zvbb -verify-machineinstrs < %s | FileCheck %s --check-prefixes=ZVBB
17 define void @ctlz_v16i8(ptr %x, ptr %y) nounwind {
18 ; CHECK-LABEL: ctlz_v16i8:
20 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
21 ; CHECK-NEXT: vle8.v v8, (a0)
22 ; CHECK-NEXT: vsrl.vi v9, v8, 1
23 ; CHECK-NEXT: vor.vv v8, v8, v9
24 ; CHECK-NEXT: vsrl.vi v9, v8, 2
25 ; CHECK-NEXT: vor.vv v8, v8, v9
26 ; CHECK-NEXT: vsrl.vi v9, v8, 4
27 ; CHECK-NEXT: vor.vv v8, v8, v9
28 ; CHECK-NEXT: vnot.v v8, v8
29 ; CHECK-NEXT: vsrl.vi v9, v8, 1
30 ; CHECK-NEXT: li a1, 85
31 ; CHECK-NEXT: vand.vx v9, v9, a1
32 ; CHECK-NEXT: vsub.vv v8, v8, v9
33 ; CHECK-NEXT: li a1, 51
34 ; CHECK-NEXT: vand.vx v9, v8, a1
35 ; CHECK-NEXT: vsrl.vi v8, v8, 2
36 ; CHECK-NEXT: vand.vx v8, v8, a1
37 ; CHECK-NEXT: vadd.vv v8, v9, v8
38 ; CHECK-NEXT: vsrl.vi v9, v8, 4
39 ; CHECK-NEXT: vadd.vv v8, v8, v9
40 ; CHECK-NEXT: vand.vi v8, v8, 15
41 ; CHECK-NEXT: vse8.v v8, (a0)
44 ; LMULMAX8-LABEL: ctlz_v16i8:
46 ; LMULMAX8-NEXT: vsetivli zero, 16, e16, m2, ta, ma
47 ; LMULMAX8-NEXT: vle8.v v8, (a0)
48 ; LMULMAX8-NEXT: vzext.vf2 v10, v8
49 ; LMULMAX8-NEXT: vfwcvt.f.xu.v v12, v10
50 ; LMULMAX8-NEXT: vnsrl.wi v8, v12, 23
51 ; LMULMAX8-NEXT: vsetvli zero, zero, e8, m1, ta, ma
52 ; LMULMAX8-NEXT: vnsrl.wi v10, v8, 0
53 ; LMULMAX8-NEXT: li a1, 134
54 ; LMULMAX8-NEXT: vrsub.vx v8, v10, a1
55 ; LMULMAX8-NEXT: li a1, 8
56 ; LMULMAX8-NEXT: vminu.vx v8, v8, a1
57 ; LMULMAX8-NEXT: vse8.v v8, (a0)
60 ; ZVBB-LABEL: ctlz_v16i8:
62 ; ZVBB-NEXT: vsetivli zero, 16, e8, m1, ta, ma
63 ; ZVBB-NEXT: vle8.v v8, (a0)
64 ; ZVBB-NEXT: vclz.v v8, v8
65 ; ZVBB-NEXT: vse8.v v8, (a0)
67 %a = load <16 x i8>, ptr %x
68 %b = load <16 x i8>, ptr %y
69 %c = call <16 x i8> @llvm.ctlz.v16i8(<16 x i8> %a, i1 false)
70 store <16 x i8> %c, ptr %x
73 declare <16 x i8> @llvm.ctlz.v16i8(<16 x i8>, i1)
75 define void @ctlz_v8i16(ptr %x, ptr %y) nounwind {
76 ; LMULMAX2-RV32I-LABEL: ctlz_v8i16:
77 ; LMULMAX2-RV32I: # %bb.0:
78 ; LMULMAX2-RV32I-NEXT: vsetivli zero, 8, e16, m1, ta, ma
79 ; LMULMAX2-RV32I-NEXT: vle16.v v8, (a0)
80 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 1
81 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v9
82 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 2
83 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v9
84 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 4
85 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v9
86 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 8
87 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v9
88 ; LMULMAX2-RV32I-NEXT: vnot.v v8, v8
89 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 1
90 ; LMULMAX2-RV32I-NEXT: lui a1, 5
91 ; LMULMAX2-RV32I-NEXT: addi a1, a1, 1365
92 ; LMULMAX2-RV32I-NEXT: vand.vx v9, v9, a1
93 ; LMULMAX2-RV32I-NEXT: vsub.vv v8, v8, v9
94 ; LMULMAX2-RV32I-NEXT: lui a1, 3
95 ; LMULMAX2-RV32I-NEXT: addi a1, a1, 819
96 ; LMULMAX2-RV32I-NEXT: vand.vx v9, v8, a1
97 ; LMULMAX2-RV32I-NEXT: vsrl.vi v8, v8, 2
98 ; LMULMAX2-RV32I-NEXT: vand.vx v8, v8, a1
99 ; LMULMAX2-RV32I-NEXT: vadd.vv v8, v9, v8
100 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 4
101 ; LMULMAX2-RV32I-NEXT: vadd.vv v8, v8, v9
102 ; LMULMAX2-RV32I-NEXT: lui a1, 1
103 ; LMULMAX2-RV32I-NEXT: addi a1, a1, -241
104 ; LMULMAX2-RV32I-NEXT: vand.vx v8, v8, a1
105 ; LMULMAX2-RV32I-NEXT: li a1, 257
106 ; LMULMAX2-RV32I-NEXT: vmul.vx v8, v8, a1
107 ; LMULMAX2-RV32I-NEXT: vsrl.vi v8, v8, 8
108 ; LMULMAX2-RV32I-NEXT: vse16.v v8, (a0)
109 ; LMULMAX2-RV32I-NEXT: ret
111 ; LMULMAX2-RV64I-LABEL: ctlz_v8i16:
112 ; LMULMAX2-RV64I: # %bb.0:
113 ; LMULMAX2-RV64I-NEXT: vsetivli zero, 8, e16, m1, ta, ma
114 ; LMULMAX2-RV64I-NEXT: vle16.v v8, (a0)
115 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 1
116 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v9
117 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 2
118 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v9
119 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 4
120 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v9
121 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 8
122 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v9
123 ; LMULMAX2-RV64I-NEXT: vnot.v v8, v8
124 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 1
125 ; LMULMAX2-RV64I-NEXT: lui a1, 5
126 ; LMULMAX2-RV64I-NEXT: addi a1, a1, 1365
127 ; LMULMAX2-RV64I-NEXT: vand.vx v9, v9, a1
128 ; LMULMAX2-RV64I-NEXT: vsub.vv v8, v8, v9
129 ; LMULMAX2-RV64I-NEXT: lui a1, 3
130 ; LMULMAX2-RV64I-NEXT: addi a1, a1, 819
131 ; LMULMAX2-RV64I-NEXT: vand.vx v9, v8, a1
132 ; LMULMAX2-RV64I-NEXT: vsrl.vi v8, v8, 2
133 ; LMULMAX2-RV64I-NEXT: vand.vx v8, v8, a1
134 ; LMULMAX2-RV64I-NEXT: vadd.vv v8, v9, v8
135 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 4
136 ; LMULMAX2-RV64I-NEXT: vadd.vv v8, v8, v9
137 ; LMULMAX2-RV64I-NEXT: lui a1, 1
138 ; LMULMAX2-RV64I-NEXT: addi a1, a1, -241
139 ; LMULMAX2-RV64I-NEXT: vand.vx v8, v8, a1
140 ; LMULMAX2-RV64I-NEXT: li a1, 257
141 ; LMULMAX2-RV64I-NEXT: vmul.vx v8, v8, a1
142 ; LMULMAX2-RV64I-NEXT: vsrl.vi v8, v8, 8
143 ; LMULMAX2-RV64I-NEXT: vse16.v v8, (a0)
144 ; LMULMAX2-RV64I-NEXT: ret
146 ; LMULMAX1-LABEL: ctlz_v8i16:
148 ; LMULMAX1-NEXT: vsetivli zero, 8, e16, m1, ta, ma
149 ; LMULMAX1-NEXT: vle16.v v8, (a0)
150 ; LMULMAX1-NEXT: vsrl.vi v9, v8, 1
151 ; LMULMAX1-NEXT: vor.vv v8, v8, v9
152 ; LMULMAX1-NEXT: vsrl.vi v9, v8, 2
153 ; LMULMAX1-NEXT: vor.vv v8, v8, v9
154 ; LMULMAX1-NEXT: vsrl.vi v9, v8, 4
155 ; LMULMAX1-NEXT: vor.vv v8, v8, v9
156 ; LMULMAX1-NEXT: vsrl.vi v9, v8, 8
157 ; LMULMAX1-NEXT: vor.vv v8, v8, v9
158 ; LMULMAX1-NEXT: vnot.v v8, v8
159 ; LMULMAX1-NEXT: vsrl.vi v9, v8, 1
160 ; LMULMAX1-NEXT: lui a1, 5
161 ; LMULMAX1-NEXT: addi a1, a1, 1365
162 ; LMULMAX1-NEXT: vand.vx v9, v9, a1
163 ; LMULMAX1-NEXT: vsub.vv v8, v8, v9
164 ; LMULMAX1-NEXT: lui a1, 3
165 ; LMULMAX1-NEXT: addi a1, a1, 819
166 ; LMULMAX1-NEXT: vand.vx v9, v8, a1
167 ; LMULMAX1-NEXT: vsrl.vi v8, v8, 2
168 ; LMULMAX1-NEXT: vand.vx v8, v8, a1
169 ; LMULMAX1-NEXT: vadd.vv v8, v9, v8
170 ; LMULMAX1-NEXT: vsrl.vi v9, v8, 4
171 ; LMULMAX1-NEXT: vadd.vv v8, v8, v9
172 ; LMULMAX1-NEXT: lui a1, 1
173 ; LMULMAX1-NEXT: addi a1, a1, -241
174 ; LMULMAX1-NEXT: vand.vx v8, v8, a1
175 ; LMULMAX1-NEXT: li a1, 257
176 ; LMULMAX1-NEXT: vmul.vx v8, v8, a1
177 ; LMULMAX1-NEXT: vsrl.vi v8, v8, 8
178 ; LMULMAX1-NEXT: vse16.v v8, (a0)
181 ; LMULMAX2-RV32F-LABEL: ctlz_v8i16:
182 ; LMULMAX2-RV32F: # %bb.0:
183 ; LMULMAX2-RV32F-NEXT: vsetivli zero, 8, e16, m1, ta, ma
184 ; LMULMAX2-RV32F-NEXT: vle16.v v8, (a0)
185 ; LMULMAX2-RV32F-NEXT: vfwcvt.f.xu.v v10, v8
186 ; LMULMAX2-RV32F-NEXT: vnsrl.wi v8, v10, 23
187 ; LMULMAX2-RV32F-NEXT: li a1, 142
188 ; LMULMAX2-RV32F-NEXT: vrsub.vx v8, v8, a1
189 ; LMULMAX2-RV32F-NEXT: li a1, 16
190 ; LMULMAX2-RV32F-NEXT: vminu.vx v8, v8, a1
191 ; LMULMAX2-RV32F-NEXT: vse16.v v8, (a0)
192 ; LMULMAX2-RV32F-NEXT: ret
194 ; LMULMAX2-RV64F-LABEL: ctlz_v8i16:
195 ; LMULMAX2-RV64F: # %bb.0:
196 ; LMULMAX2-RV64F-NEXT: vsetivli zero, 8, e16, m1, ta, ma
197 ; LMULMAX2-RV64F-NEXT: vle16.v v8, (a0)
198 ; LMULMAX2-RV64F-NEXT: vfwcvt.f.xu.v v10, v8
199 ; LMULMAX2-RV64F-NEXT: vnsrl.wi v8, v10, 23
200 ; LMULMAX2-RV64F-NEXT: li a1, 142
201 ; LMULMAX2-RV64F-NEXT: vrsub.vx v8, v8, a1
202 ; LMULMAX2-RV64F-NEXT: li a1, 16
203 ; LMULMAX2-RV64F-NEXT: vminu.vx v8, v8, a1
204 ; LMULMAX2-RV64F-NEXT: vse16.v v8, (a0)
205 ; LMULMAX2-RV64F-NEXT: ret
207 ; LMULMAX2-RV32D-LABEL: ctlz_v8i16:
208 ; LMULMAX2-RV32D: # %bb.0:
209 ; LMULMAX2-RV32D-NEXT: vsetivli zero, 8, e16, m1, ta, ma
210 ; LMULMAX2-RV32D-NEXT: vle16.v v8, (a0)
211 ; LMULMAX2-RV32D-NEXT: vfwcvt.f.xu.v v10, v8
212 ; LMULMAX2-RV32D-NEXT: vnsrl.wi v8, v10, 23
213 ; LMULMAX2-RV32D-NEXT: li a1, 142
214 ; LMULMAX2-RV32D-NEXT: vrsub.vx v8, v8, a1
215 ; LMULMAX2-RV32D-NEXT: li a1, 16
216 ; LMULMAX2-RV32D-NEXT: vminu.vx v8, v8, a1
217 ; LMULMAX2-RV32D-NEXT: vse16.v v8, (a0)
218 ; LMULMAX2-RV32D-NEXT: ret
220 ; LMULMAX2-RV64D-LABEL: ctlz_v8i16:
221 ; LMULMAX2-RV64D: # %bb.0:
222 ; LMULMAX2-RV64D-NEXT: vsetivli zero, 8, e16, m1, ta, ma
223 ; LMULMAX2-RV64D-NEXT: vle16.v v8, (a0)
224 ; LMULMAX2-RV64D-NEXT: vfwcvt.f.xu.v v10, v8
225 ; LMULMAX2-RV64D-NEXT: vnsrl.wi v8, v10, 23
226 ; LMULMAX2-RV64D-NEXT: li a1, 142
227 ; LMULMAX2-RV64D-NEXT: vrsub.vx v8, v8, a1
228 ; LMULMAX2-RV64D-NEXT: li a1, 16
229 ; LMULMAX2-RV64D-NEXT: vminu.vx v8, v8, a1
230 ; LMULMAX2-RV64D-NEXT: vse16.v v8, (a0)
231 ; LMULMAX2-RV64D-NEXT: ret
233 ; LMULMAX8-LABEL: ctlz_v8i16:
235 ; LMULMAX8-NEXT: vsetivli zero, 8, e16, m1, ta, ma
236 ; LMULMAX8-NEXT: vle16.v v8, (a0)
237 ; LMULMAX8-NEXT: vfwcvt.f.xu.v v10, v8
238 ; LMULMAX8-NEXT: vnsrl.wi v8, v10, 23
239 ; LMULMAX8-NEXT: li a1, 142
240 ; LMULMAX8-NEXT: vrsub.vx v8, v8, a1
241 ; LMULMAX8-NEXT: li a1, 16
242 ; LMULMAX8-NEXT: vminu.vx v8, v8, a1
243 ; LMULMAX8-NEXT: vse16.v v8, (a0)
246 ; ZVBB-LABEL: ctlz_v8i16:
248 ; ZVBB-NEXT: vsetivli zero, 8, e16, m1, ta, ma
249 ; ZVBB-NEXT: vle16.v v8, (a0)
250 ; ZVBB-NEXT: vclz.v v8, v8
251 ; ZVBB-NEXT: vse16.v v8, (a0)
253 %a = load <8 x i16>, ptr %x
254 %b = load <8 x i16>, ptr %y
255 %c = call <8 x i16> @llvm.ctlz.v8i16(<8 x i16> %a, i1 false)
256 store <8 x i16> %c, ptr %x
259 declare <8 x i16> @llvm.ctlz.v8i16(<8 x i16>, i1)
261 define void @ctlz_v4i32(ptr %x, ptr %y) nounwind {
262 ; LMULMAX2-RV32I-LABEL: ctlz_v4i32:
263 ; LMULMAX2-RV32I: # %bb.0:
264 ; LMULMAX2-RV32I-NEXT: vsetivli zero, 4, e32, m1, ta, ma
265 ; LMULMAX2-RV32I-NEXT: vle32.v v8, (a0)
266 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 1
267 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v9
268 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 2
269 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v9
270 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 4
271 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v9
272 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 8
273 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v9
274 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 16
275 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v9
276 ; LMULMAX2-RV32I-NEXT: vnot.v v8, v8
277 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 1
278 ; LMULMAX2-RV32I-NEXT: lui a1, 349525
279 ; LMULMAX2-RV32I-NEXT: addi a1, a1, 1365
280 ; LMULMAX2-RV32I-NEXT: vand.vx v9, v9, a1
281 ; LMULMAX2-RV32I-NEXT: vsub.vv v8, v8, v9
282 ; LMULMAX2-RV32I-NEXT: lui a1, 209715
283 ; LMULMAX2-RV32I-NEXT: addi a1, a1, 819
284 ; LMULMAX2-RV32I-NEXT: vand.vx v9, v8, a1
285 ; LMULMAX2-RV32I-NEXT: vsrl.vi v8, v8, 2
286 ; LMULMAX2-RV32I-NEXT: vand.vx v8, v8, a1
287 ; LMULMAX2-RV32I-NEXT: vadd.vv v8, v9, v8
288 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 4
289 ; LMULMAX2-RV32I-NEXT: vadd.vv v8, v8, v9
290 ; LMULMAX2-RV32I-NEXT: lui a1, 61681
291 ; LMULMAX2-RV32I-NEXT: addi a1, a1, -241
292 ; LMULMAX2-RV32I-NEXT: vand.vx v8, v8, a1
293 ; LMULMAX2-RV32I-NEXT: lui a1, 4112
294 ; LMULMAX2-RV32I-NEXT: addi a1, a1, 257
295 ; LMULMAX2-RV32I-NEXT: vmul.vx v8, v8, a1
296 ; LMULMAX2-RV32I-NEXT: vsrl.vi v8, v8, 24
297 ; LMULMAX2-RV32I-NEXT: vse32.v v8, (a0)
298 ; LMULMAX2-RV32I-NEXT: ret
300 ; LMULMAX2-RV64I-LABEL: ctlz_v4i32:
301 ; LMULMAX2-RV64I: # %bb.0:
302 ; LMULMAX2-RV64I-NEXT: vsetivli zero, 4, e32, m1, ta, ma
303 ; LMULMAX2-RV64I-NEXT: vle32.v v8, (a0)
304 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 1
305 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v9
306 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 2
307 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v9
308 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 4
309 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v9
310 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 8
311 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v9
312 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 16
313 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v9
314 ; LMULMAX2-RV64I-NEXT: vnot.v v8, v8
315 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 1
316 ; LMULMAX2-RV64I-NEXT: lui a1, 349525
317 ; LMULMAX2-RV64I-NEXT: addi a1, a1, 1365
318 ; LMULMAX2-RV64I-NEXT: vand.vx v9, v9, a1
319 ; LMULMAX2-RV64I-NEXT: vsub.vv v8, v8, v9
320 ; LMULMAX2-RV64I-NEXT: lui a1, 209715
321 ; LMULMAX2-RV64I-NEXT: addi a1, a1, 819
322 ; LMULMAX2-RV64I-NEXT: vand.vx v9, v8, a1
323 ; LMULMAX2-RV64I-NEXT: vsrl.vi v8, v8, 2
324 ; LMULMAX2-RV64I-NEXT: vand.vx v8, v8, a1
325 ; LMULMAX2-RV64I-NEXT: vadd.vv v8, v9, v8
326 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 4
327 ; LMULMAX2-RV64I-NEXT: vadd.vv v8, v8, v9
328 ; LMULMAX2-RV64I-NEXT: lui a1, 61681
329 ; LMULMAX2-RV64I-NEXT: addi a1, a1, -241
330 ; LMULMAX2-RV64I-NEXT: vand.vx v8, v8, a1
331 ; LMULMAX2-RV64I-NEXT: lui a1, 4112
332 ; LMULMAX2-RV64I-NEXT: addi a1, a1, 257
333 ; LMULMAX2-RV64I-NEXT: vmul.vx v8, v8, a1
334 ; LMULMAX2-RV64I-NEXT: vsrl.vi v8, v8, 24
335 ; LMULMAX2-RV64I-NEXT: vse32.v v8, (a0)
336 ; LMULMAX2-RV64I-NEXT: ret
338 ; LMULMAX2-RV32F-LABEL: ctlz_v4i32:
339 ; LMULMAX2-RV32F: # %bb.0:
340 ; LMULMAX2-RV32F-NEXT: vsetivli zero, 4, e32, m1, ta, ma
341 ; LMULMAX2-RV32F-NEXT: vle32.v v8, (a0)
342 ; LMULMAX2-RV32F-NEXT: fsrmi a1, 1
343 ; LMULMAX2-RV32F-NEXT: vfcvt.f.xu.v v8, v8
344 ; LMULMAX2-RV32F-NEXT: fsrm a1
345 ; LMULMAX2-RV32F-NEXT: vsrl.vi v8, v8, 23
346 ; LMULMAX2-RV32F-NEXT: li a1, 158
347 ; LMULMAX2-RV32F-NEXT: vrsub.vx v8, v8, a1
348 ; LMULMAX2-RV32F-NEXT: li a1, 32
349 ; LMULMAX2-RV32F-NEXT: vminu.vx v8, v8, a1
350 ; LMULMAX2-RV32F-NEXT: vse32.v v8, (a0)
351 ; LMULMAX2-RV32F-NEXT: ret
353 ; LMULMAX2-RV64F-LABEL: ctlz_v4i32:
354 ; LMULMAX2-RV64F: # %bb.0:
355 ; LMULMAX2-RV64F-NEXT: vsetivli zero, 4, e32, m1, ta, ma
356 ; LMULMAX2-RV64F-NEXT: vle32.v v8, (a0)
357 ; LMULMAX2-RV64F-NEXT: fsrmi a1, 1
358 ; LMULMAX2-RV64F-NEXT: vfcvt.f.xu.v v8, v8
359 ; LMULMAX2-RV64F-NEXT: fsrm a1
360 ; LMULMAX2-RV64F-NEXT: vsrl.vi v8, v8, 23
361 ; LMULMAX2-RV64F-NEXT: li a1, 158
362 ; LMULMAX2-RV64F-NEXT: vrsub.vx v8, v8, a1
363 ; LMULMAX2-RV64F-NEXT: li a1, 32
364 ; LMULMAX2-RV64F-NEXT: vminu.vx v8, v8, a1
365 ; LMULMAX2-RV64F-NEXT: vse32.v v8, (a0)
366 ; LMULMAX2-RV64F-NEXT: ret
368 ; LMULMAX2-RV32D-LABEL: ctlz_v4i32:
369 ; LMULMAX2-RV32D: # %bb.0:
370 ; LMULMAX2-RV32D-NEXT: vsetivli zero, 4, e32, m1, ta, ma
371 ; LMULMAX2-RV32D-NEXT: vle32.v v8, (a0)
372 ; LMULMAX2-RV32D-NEXT: vfwcvt.f.xu.v v10, v8
373 ; LMULMAX2-RV32D-NEXT: li a1, 52
374 ; LMULMAX2-RV32D-NEXT: vnsrl.wx v8, v10, a1
375 ; LMULMAX2-RV32D-NEXT: li a1, 1054
376 ; LMULMAX2-RV32D-NEXT: vrsub.vx v8, v8, a1
377 ; LMULMAX2-RV32D-NEXT: li a1, 32
378 ; LMULMAX2-RV32D-NEXT: vminu.vx v8, v8, a1
379 ; LMULMAX2-RV32D-NEXT: vse32.v v8, (a0)
380 ; LMULMAX2-RV32D-NEXT: ret
382 ; LMULMAX2-RV64D-LABEL: ctlz_v4i32:
383 ; LMULMAX2-RV64D: # %bb.0:
384 ; LMULMAX2-RV64D-NEXT: vsetivli zero, 4, e32, m1, ta, ma
385 ; LMULMAX2-RV64D-NEXT: vle32.v v8, (a0)
386 ; LMULMAX2-RV64D-NEXT: vfwcvt.f.xu.v v10, v8
387 ; LMULMAX2-RV64D-NEXT: li a1, 52
388 ; LMULMAX2-RV64D-NEXT: vnsrl.wx v8, v10, a1
389 ; LMULMAX2-RV64D-NEXT: li a1, 1054
390 ; LMULMAX2-RV64D-NEXT: vrsub.vx v8, v8, a1
391 ; LMULMAX2-RV64D-NEXT: li a1, 32
392 ; LMULMAX2-RV64D-NEXT: vminu.vx v8, v8, a1
393 ; LMULMAX2-RV64D-NEXT: vse32.v v8, (a0)
394 ; LMULMAX2-RV64D-NEXT: ret
396 ; LMULMAX8-LABEL: ctlz_v4i32:
398 ; LMULMAX8-NEXT: vsetivli zero, 4, e32, m1, ta, ma
399 ; LMULMAX8-NEXT: vle32.v v8, (a0)
400 ; LMULMAX8-NEXT: vfwcvt.f.xu.v v10, v8
401 ; LMULMAX8-NEXT: li a1, 52
402 ; LMULMAX8-NEXT: vnsrl.wx v8, v10, a1
403 ; LMULMAX8-NEXT: li a1, 1054
404 ; LMULMAX8-NEXT: vrsub.vx v8, v8, a1
405 ; LMULMAX8-NEXT: li a1, 32
406 ; LMULMAX8-NEXT: vminu.vx v8, v8, a1
407 ; LMULMAX8-NEXT: vse32.v v8, (a0)
410 ; ZVBB-LABEL: ctlz_v4i32:
412 ; ZVBB-NEXT: vsetivli zero, 4, e32, m1, ta, ma
413 ; ZVBB-NEXT: vle32.v v8, (a0)
414 ; ZVBB-NEXT: vclz.v v8, v8
415 ; ZVBB-NEXT: vse32.v v8, (a0)
417 %a = load <4 x i32>, ptr %x
418 %b = load <4 x i32>, ptr %y
419 %c = call <4 x i32> @llvm.ctlz.v4i32(<4 x i32> %a, i1 false)
420 store <4 x i32> %c, ptr %x
423 declare <4 x i32> @llvm.ctlz.v4i32(<4 x i32>, i1)
425 define void @ctlz_v2i64(ptr %x, ptr %y) nounwind {
426 ; LMULMAX2-RV32I-LABEL: ctlz_v2i64:
427 ; LMULMAX2-RV32I: # %bb.0:
428 ; LMULMAX2-RV32I-NEXT: vsetivli zero, 2, e64, m1, ta, ma
429 ; LMULMAX2-RV32I-NEXT: vle64.v v8, (a0)
430 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 1
431 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v9
432 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 2
433 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v9
434 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 4
435 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v9
436 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 8
437 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v9
438 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 16
439 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v9
440 ; LMULMAX2-RV32I-NEXT: li a1, 32
441 ; LMULMAX2-RV32I-NEXT: vsrl.vx v9, v8, a1
442 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v9
443 ; LMULMAX2-RV32I-NEXT: vnot.v v8, v8
444 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 1
445 ; LMULMAX2-RV32I-NEXT: lui a1, 349525
446 ; LMULMAX2-RV32I-NEXT: addi a1, a1, 1365
447 ; LMULMAX2-RV32I-NEXT: vsetvli a2, zero, e32, m1, ta, ma
448 ; LMULMAX2-RV32I-NEXT: vmv.v.x v10, a1
449 ; LMULMAX2-RV32I-NEXT: vsetivli zero, 2, e64, m1, ta, ma
450 ; LMULMAX2-RV32I-NEXT: vand.vv v9, v9, v10
451 ; LMULMAX2-RV32I-NEXT: vsub.vv v8, v8, v9
452 ; LMULMAX2-RV32I-NEXT: lui a1, 209715
453 ; LMULMAX2-RV32I-NEXT: addi a1, a1, 819
454 ; LMULMAX2-RV32I-NEXT: vsetvli a2, zero, e32, m1, ta, ma
455 ; LMULMAX2-RV32I-NEXT: vmv.v.x v9, a1
456 ; LMULMAX2-RV32I-NEXT: vsetivli zero, 2, e64, m1, ta, ma
457 ; LMULMAX2-RV32I-NEXT: vand.vv v10, v8, v9
458 ; LMULMAX2-RV32I-NEXT: vsrl.vi v8, v8, 2
459 ; LMULMAX2-RV32I-NEXT: vand.vv v8, v8, v9
460 ; LMULMAX2-RV32I-NEXT: vadd.vv v8, v10, v8
461 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 4
462 ; LMULMAX2-RV32I-NEXT: vadd.vv v8, v8, v9
463 ; LMULMAX2-RV32I-NEXT: lui a1, 61681
464 ; LMULMAX2-RV32I-NEXT: addi a1, a1, -241
465 ; LMULMAX2-RV32I-NEXT: vsetvli a2, zero, e32, m1, ta, ma
466 ; LMULMAX2-RV32I-NEXT: vmv.v.x v9, a1
467 ; LMULMAX2-RV32I-NEXT: vsetivli zero, 2, e64, m1, ta, ma
468 ; LMULMAX2-RV32I-NEXT: vand.vv v8, v8, v9
469 ; LMULMAX2-RV32I-NEXT: lui a1, 4112
470 ; LMULMAX2-RV32I-NEXT: addi a1, a1, 257
471 ; LMULMAX2-RV32I-NEXT: vsetvli a2, zero, e32, m1, ta, ma
472 ; LMULMAX2-RV32I-NEXT: vmv.v.x v9, a1
473 ; LMULMAX2-RV32I-NEXT: vsetivli zero, 2, e64, m1, ta, ma
474 ; LMULMAX2-RV32I-NEXT: vmul.vv v8, v8, v9
475 ; LMULMAX2-RV32I-NEXT: li a1, 56
476 ; LMULMAX2-RV32I-NEXT: vsrl.vx v8, v8, a1
477 ; LMULMAX2-RV32I-NEXT: vse64.v v8, (a0)
478 ; LMULMAX2-RV32I-NEXT: ret
480 ; LMULMAX2-RV64I-LABEL: ctlz_v2i64:
481 ; LMULMAX2-RV64I: # %bb.0:
482 ; LMULMAX2-RV64I-NEXT: vsetivli zero, 2, e64, m1, ta, ma
483 ; LMULMAX2-RV64I-NEXT: vle64.v v8, (a0)
484 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 1
485 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v9
486 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 2
487 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v9
488 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 4
489 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v9
490 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 8
491 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v9
492 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 16
493 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v9
494 ; LMULMAX2-RV64I-NEXT: li a1, 32
495 ; LMULMAX2-RV64I-NEXT: vsrl.vx v9, v8, a1
496 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v9
497 ; LMULMAX2-RV64I-NEXT: vnot.v v8, v8
498 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 1
499 ; LMULMAX2-RV64I-NEXT: lui a1, 349525
500 ; LMULMAX2-RV64I-NEXT: addiw a1, a1, 1365
501 ; LMULMAX2-RV64I-NEXT: slli a2, a1, 32
502 ; LMULMAX2-RV64I-NEXT: add a1, a1, a2
503 ; LMULMAX2-RV64I-NEXT: vand.vx v9, v9, a1
504 ; LMULMAX2-RV64I-NEXT: vsub.vv v8, v8, v9
505 ; LMULMAX2-RV64I-NEXT: lui a1, 209715
506 ; LMULMAX2-RV64I-NEXT: addiw a1, a1, 819
507 ; LMULMAX2-RV64I-NEXT: slli a2, a1, 32
508 ; LMULMAX2-RV64I-NEXT: add a1, a1, a2
509 ; LMULMAX2-RV64I-NEXT: vand.vx v9, v8, a1
510 ; LMULMAX2-RV64I-NEXT: vsrl.vi v8, v8, 2
511 ; LMULMAX2-RV64I-NEXT: vand.vx v8, v8, a1
512 ; LMULMAX2-RV64I-NEXT: vadd.vv v8, v9, v8
513 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 4
514 ; LMULMAX2-RV64I-NEXT: vadd.vv v8, v8, v9
515 ; LMULMAX2-RV64I-NEXT: lui a1, 61681
516 ; LMULMAX2-RV64I-NEXT: addiw a1, a1, -241
517 ; LMULMAX2-RV64I-NEXT: slli a2, a1, 32
518 ; LMULMAX2-RV64I-NEXT: add a1, a1, a2
519 ; LMULMAX2-RV64I-NEXT: vand.vx v8, v8, a1
520 ; LMULMAX2-RV64I-NEXT: lui a1, 4112
521 ; LMULMAX2-RV64I-NEXT: addiw a1, a1, 257
522 ; LMULMAX2-RV64I-NEXT: slli a2, a1, 32
523 ; LMULMAX2-RV64I-NEXT: add a1, a1, a2
524 ; LMULMAX2-RV64I-NEXT: vmul.vx v8, v8, a1
525 ; LMULMAX2-RV64I-NEXT: li a1, 56
526 ; LMULMAX2-RV64I-NEXT: vsrl.vx v8, v8, a1
527 ; LMULMAX2-RV64I-NEXT: vse64.v v8, (a0)
528 ; LMULMAX2-RV64I-NEXT: ret
530 ; LMULMAX2-RV32F-LABEL: ctlz_v2i64:
531 ; LMULMAX2-RV32F: # %bb.0:
532 ; LMULMAX2-RV32F-NEXT: vsetivli zero, 2, e64, m1, ta, ma
533 ; LMULMAX2-RV32F-NEXT: vle64.v v8, (a0)
534 ; LMULMAX2-RV32F-NEXT: li a1, 190
535 ; LMULMAX2-RV32F-NEXT: vmv.v.x v9, a1
536 ; LMULMAX2-RV32F-NEXT: vsetvli zero, zero, e32, mf2, ta, ma
537 ; LMULMAX2-RV32F-NEXT: fsrmi a1, 1
538 ; LMULMAX2-RV32F-NEXT: vfncvt.f.xu.w v10, v8
539 ; LMULMAX2-RV32F-NEXT: fsrm a1
540 ; LMULMAX2-RV32F-NEXT: vsrl.vi v8, v10, 23
541 ; LMULMAX2-RV32F-NEXT: vwsubu.wv v9, v9, v8
542 ; LMULMAX2-RV32F-NEXT: li a1, 64
543 ; LMULMAX2-RV32F-NEXT: vsetvli zero, zero, e64, m1, ta, ma
544 ; LMULMAX2-RV32F-NEXT: vminu.vx v8, v9, a1
545 ; LMULMAX2-RV32F-NEXT: vse64.v v8, (a0)
546 ; LMULMAX2-RV32F-NEXT: ret
548 ; LMULMAX2-RV64F-LABEL: ctlz_v2i64:
549 ; LMULMAX2-RV64F: # %bb.0:
550 ; LMULMAX2-RV64F-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
551 ; LMULMAX2-RV64F-NEXT: vle64.v v8, (a0)
552 ; LMULMAX2-RV64F-NEXT: li a1, 190
553 ; LMULMAX2-RV64F-NEXT: vmv.v.x v9, a1
554 ; LMULMAX2-RV64F-NEXT: fsrmi a1, 1
555 ; LMULMAX2-RV64F-NEXT: vfncvt.f.xu.w v10, v8
556 ; LMULMAX2-RV64F-NEXT: fsrm a1
557 ; LMULMAX2-RV64F-NEXT: vsrl.vi v8, v10, 23
558 ; LMULMAX2-RV64F-NEXT: vwsubu.vv v10, v9, v8
559 ; LMULMAX2-RV64F-NEXT: li a1, 64
560 ; LMULMAX2-RV64F-NEXT: vsetvli zero, zero, e64, m1, ta, ma
561 ; LMULMAX2-RV64F-NEXT: vminu.vx v8, v10, a1
562 ; LMULMAX2-RV64F-NEXT: vse64.v v8, (a0)
563 ; LMULMAX2-RV64F-NEXT: ret
565 ; LMULMAX2-RV32D-LABEL: ctlz_v2i64:
566 ; LMULMAX2-RV32D: # %bb.0:
567 ; LMULMAX2-RV32D-NEXT: vsetivli zero, 2, e64, m1, ta, ma
568 ; LMULMAX2-RV32D-NEXT: vle64.v v8, (a0)
569 ; LMULMAX2-RV32D-NEXT: fsrmi a1, 1
570 ; LMULMAX2-RV32D-NEXT: vfcvt.f.xu.v v8, v8
571 ; LMULMAX2-RV32D-NEXT: fsrm a1
572 ; LMULMAX2-RV32D-NEXT: li a1, 52
573 ; LMULMAX2-RV32D-NEXT: vsrl.vx v8, v8, a1
574 ; LMULMAX2-RV32D-NEXT: li a1, 1086
575 ; LMULMAX2-RV32D-NEXT: vrsub.vx v8, v8, a1
576 ; LMULMAX2-RV32D-NEXT: li a1, 64
577 ; LMULMAX2-RV32D-NEXT: vminu.vx v8, v8, a1
578 ; LMULMAX2-RV32D-NEXT: vse64.v v8, (a0)
579 ; LMULMAX2-RV32D-NEXT: ret
581 ; LMULMAX2-RV64D-LABEL: ctlz_v2i64:
582 ; LMULMAX2-RV64D: # %bb.0:
583 ; LMULMAX2-RV64D-NEXT: vsetivli zero, 2, e64, m1, ta, ma
584 ; LMULMAX2-RV64D-NEXT: vle64.v v8, (a0)
585 ; LMULMAX2-RV64D-NEXT: fsrmi a1, 1
586 ; LMULMAX2-RV64D-NEXT: vfcvt.f.xu.v v8, v8
587 ; LMULMAX2-RV64D-NEXT: fsrm a1
588 ; LMULMAX2-RV64D-NEXT: li a1, 52
589 ; LMULMAX2-RV64D-NEXT: vsrl.vx v8, v8, a1
590 ; LMULMAX2-RV64D-NEXT: li a1, 1086
591 ; LMULMAX2-RV64D-NEXT: vrsub.vx v8, v8, a1
592 ; LMULMAX2-RV64D-NEXT: li a1, 64
593 ; LMULMAX2-RV64D-NEXT: vminu.vx v8, v8, a1
594 ; LMULMAX2-RV64D-NEXT: vse64.v v8, (a0)
595 ; LMULMAX2-RV64D-NEXT: ret
597 ; LMULMAX8-LABEL: ctlz_v2i64:
599 ; LMULMAX8-NEXT: vsetivli zero, 2, e64, m1, ta, ma
600 ; LMULMAX8-NEXT: vle64.v v8, (a0)
601 ; LMULMAX8-NEXT: fsrmi a1, 1
602 ; LMULMAX8-NEXT: vfcvt.f.xu.v v8, v8
603 ; LMULMAX8-NEXT: fsrm a1
604 ; LMULMAX8-NEXT: li a1, 52
605 ; LMULMAX8-NEXT: vsrl.vx v8, v8, a1
606 ; LMULMAX8-NEXT: li a1, 1086
607 ; LMULMAX8-NEXT: vrsub.vx v8, v8, a1
608 ; LMULMAX8-NEXT: li a1, 64
609 ; LMULMAX8-NEXT: vminu.vx v8, v8, a1
610 ; LMULMAX8-NEXT: vse64.v v8, (a0)
613 ; ZVBB-LABEL: ctlz_v2i64:
615 ; ZVBB-NEXT: vsetivli zero, 2, e64, m1, ta, ma
616 ; ZVBB-NEXT: vle64.v v8, (a0)
617 ; ZVBB-NEXT: vclz.v v8, v8
618 ; ZVBB-NEXT: vse64.v v8, (a0)
620 %a = load <2 x i64>, ptr %x
621 %b = load <2 x i64>, ptr %y
622 %c = call <2 x i64> @llvm.ctlz.v2i64(<2 x i64> %a, i1 false)
623 store <2 x i64> %c, ptr %x
626 declare <2 x i64> @llvm.ctlz.v2i64(<2 x i64>, i1)
628 define void @ctlz_v32i8(ptr %x, ptr %y) nounwind {
629 ; LMULMAX2-LABEL: ctlz_v32i8:
631 ; LMULMAX2-NEXT: li a1, 32
632 ; LMULMAX2-NEXT: vsetvli zero, a1, e8, m2, ta, ma
633 ; LMULMAX2-NEXT: vle8.v v8, (a0)
634 ; LMULMAX2-NEXT: vsrl.vi v10, v8, 1
635 ; LMULMAX2-NEXT: vor.vv v8, v8, v10
636 ; LMULMAX2-NEXT: vsrl.vi v10, v8, 2
637 ; LMULMAX2-NEXT: vor.vv v8, v8, v10
638 ; LMULMAX2-NEXT: vsrl.vi v10, v8, 4
639 ; LMULMAX2-NEXT: vor.vv v8, v8, v10
640 ; LMULMAX2-NEXT: vnot.v v8, v8
641 ; LMULMAX2-NEXT: vsrl.vi v10, v8, 1
642 ; LMULMAX2-NEXT: li a1, 85
643 ; LMULMAX2-NEXT: vand.vx v10, v10, a1
644 ; LMULMAX2-NEXT: vsub.vv v8, v8, v10
645 ; LMULMAX2-NEXT: li a1, 51
646 ; LMULMAX2-NEXT: vand.vx v10, v8, a1
647 ; LMULMAX2-NEXT: vsrl.vi v8, v8, 2
648 ; LMULMAX2-NEXT: vand.vx v8, v8, a1
649 ; LMULMAX2-NEXT: vadd.vv v8, v10, v8
650 ; LMULMAX2-NEXT: vsrl.vi v10, v8, 4
651 ; LMULMAX2-NEXT: vadd.vv v8, v8, v10
652 ; LMULMAX2-NEXT: vand.vi v8, v8, 15
653 ; LMULMAX2-NEXT: vse8.v v8, (a0)
656 ; LMULMAX1-LABEL: ctlz_v32i8:
658 ; LMULMAX1-NEXT: vsetivli zero, 16, e8, m1, ta, ma
659 ; LMULMAX1-NEXT: addi a1, a0, 16
660 ; LMULMAX1-NEXT: vle8.v v8, (a1)
661 ; LMULMAX1-NEXT: vle8.v v9, (a0)
662 ; LMULMAX1-NEXT: vsrl.vi v10, v8, 1
663 ; LMULMAX1-NEXT: vor.vv v8, v8, v10
664 ; LMULMAX1-NEXT: vsrl.vi v10, v8, 2
665 ; LMULMAX1-NEXT: vor.vv v8, v8, v10
666 ; LMULMAX1-NEXT: vsrl.vi v10, v8, 4
667 ; LMULMAX1-NEXT: vor.vv v8, v8, v10
668 ; LMULMAX1-NEXT: vnot.v v8, v8
669 ; LMULMAX1-NEXT: vsrl.vi v10, v8, 1
670 ; LMULMAX1-NEXT: li a2, 85
671 ; LMULMAX1-NEXT: vand.vx v10, v10, a2
672 ; LMULMAX1-NEXT: vsub.vv v8, v8, v10
673 ; LMULMAX1-NEXT: li a3, 51
674 ; LMULMAX1-NEXT: vand.vx v10, v8, a3
675 ; LMULMAX1-NEXT: vsrl.vi v8, v8, 2
676 ; LMULMAX1-NEXT: vand.vx v8, v8, a3
677 ; LMULMAX1-NEXT: vadd.vv v8, v10, v8
678 ; LMULMAX1-NEXT: vsrl.vi v10, v8, 4
679 ; LMULMAX1-NEXT: vadd.vv v8, v8, v10
680 ; LMULMAX1-NEXT: vand.vi v8, v8, 15
681 ; LMULMAX1-NEXT: vsrl.vi v10, v9, 1
682 ; LMULMAX1-NEXT: vor.vv v9, v9, v10
683 ; LMULMAX1-NEXT: vsrl.vi v10, v9, 2
684 ; LMULMAX1-NEXT: vor.vv v9, v9, v10
685 ; LMULMAX1-NEXT: vsrl.vi v10, v9, 4
686 ; LMULMAX1-NEXT: vor.vv v9, v9, v10
687 ; LMULMAX1-NEXT: vnot.v v9, v9
688 ; LMULMAX1-NEXT: vsrl.vi v10, v9, 1
689 ; LMULMAX1-NEXT: vand.vx v10, v10, a2
690 ; LMULMAX1-NEXT: vsub.vv v9, v9, v10
691 ; LMULMAX1-NEXT: vand.vx v10, v9, a3
692 ; LMULMAX1-NEXT: vsrl.vi v9, v9, 2
693 ; LMULMAX1-NEXT: vand.vx v9, v9, a3
694 ; LMULMAX1-NEXT: vadd.vv v9, v10, v9
695 ; LMULMAX1-NEXT: vsrl.vi v10, v9, 4
696 ; LMULMAX1-NEXT: vadd.vv v9, v9, v10
697 ; LMULMAX1-NEXT: vand.vi v9, v9, 15
698 ; LMULMAX1-NEXT: vse8.v v9, (a0)
699 ; LMULMAX1-NEXT: vse8.v v8, (a1)
702 ; LMULMAX8-LABEL: ctlz_v32i8:
704 ; LMULMAX8-NEXT: li a1, 32
705 ; LMULMAX8-NEXT: vsetvli zero, a1, e16, m4, ta, ma
706 ; LMULMAX8-NEXT: vle8.v v8, (a0)
707 ; LMULMAX8-NEXT: vzext.vf2 v12, v8
708 ; LMULMAX8-NEXT: vfwcvt.f.xu.v v16, v12
709 ; LMULMAX8-NEXT: vnsrl.wi v8, v16, 23
710 ; LMULMAX8-NEXT: vsetvli zero, zero, e8, m2, ta, ma
711 ; LMULMAX8-NEXT: vnsrl.wi v12, v8, 0
712 ; LMULMAX8-NEXT: li a1, 134
713 ; LMULMAX8-NEXT: vrsub.vx v8, v12, a1
714 ; LMULMAX8-NEXT: li a1, 8
715 ; LMULMAX8-NEXT: vminu.vx v8, v8, a1
716 ; LMULMAX8-NEXT: vse8.v v8, (a0)
719 ; ZVBB-LABEL: ctlz_v32i8:
721 ; ZVBB-NEXT: li a1, 32
722 ; ZVBB-NEXT: vsetvli zero, a1, e8, m2, ta, ma
723 ; ZVBB-NEXT: vle8.v v8, (a0)
724 ; ZVBB-NEXT: vclz.v v8, v8
725 ; ZVBB-NEXT: vse8.v v8, (a0)
727 %a = load <32 x i8>, ptr %x
728 %b = load <32 x i8>, ptr %y
729 %c = call <32 x i8> @llvm.ctlz.v32i8(<32 x i8> %a, i1 false)
730 store <32 x i8> %c, ptr %x
733 declare <32 x i8> @llvm.ctlz.v32i8(<32 x i8>, i1)
735 define void @ctlz_v16i16(ptr %x, ptr %y) nounwind {
736 ; LMULMAX2-LABEL: ctlz_v16i16:
738 ; LMULMAX2-NEXT: vsetivli zero, 16, e16, m2, ta, ma
739 ; LMULMAX2-NEXT: vle16.v v8, (a0)
740 ; LMULMAX2-NEXT: vsrl.vi v10, v8, 1
741 ; LMULMAX2-NEXT: vor.vv v8, v8, v10
742 ; LMULMAX2-NEXT: vsrl.vi v10, v8, 2
743 ; LMULMAX2-NEXT: vor.vv v8, v8, v10
744 ; LMULMAX2-NEXT: vsrl.vi v10, v8, 4
745 ; LMULMAX2-NEXT: vor.vv v8, v8, v10
746 ; LMULMAX2-NEXT: vsrl.vi v10, v8, 8
747 ; LMULMAX2-NEXT: vor.vv v8, v8, v10
748 ; LMULMAX2-NEXT: vnot.v v8, v8
749 ; LMULMAX2-NEXT: vsrl.vi v10, v8, 1
750 ; LMULMAX2-NEXT: lui a1, 5
751 ; LMULMAX2-NEXT: addi a1, a1, 1365
752 ; LMULMAX2-NEXT: vand.vx v10, v10, a1
753 ; LMULMAX2-NEXT: vsub.vv v8, v8, v10
754 ; LMULMAX2-NEXT: lui a1, 3
755 ; LMULMAX2-NEXT: addi a1, a1, 819
756 ; LMULMAX2-NEXT: vand.vx v10, v8, a1
757 ; LMULMAX2-NEXT: vsrl.vi v8, v8, 2
758 ; LMULMAX2-NEXT: vand.vx v8, v8, a1
759 ; LMULMAX2-NEXT: vadd.vv v8, v10, v8
760 ; LMULMAX2-NEXT: vsrl.vi v10, v8, 4
761 ; LMULMAX2-NEXT: vadd.vv v8, v8, v10
762 ; LMULMAX2-NEXT: lui a1, 1
763 ; LMULMAX2-NEXT: addi a1, a1, -241
764 ; LMULMAX2-NEXT: vand.vx v8, v8, a1
765 ; LMULMAX2-NEXT: li a1, 257
766 ; LMULMAX2-NEXT: vmul.vx v8, v8, a1
767 ; LMULMAX2-NEXT: vsrl.vi v8, v8, 8
768 ; LMULMAX2-NEXT: vse16.v v8, (a0)
771 ; LMULMAX1-LABEL: ctlz_v16i16:
773 ; LMULMAX1-NEXT: vsetivli zero, 8, e16, m1, ta, ma
774 ; LMULMAX1-NEXT: addi a1, a0, 16
775 ; LMULMAX1-NEXT: vle16.v v8, (a1)
776 ; LMULMAX1-NEXT: vle16.v v9, (a0)
777 ; LMULMAX1-NEXT: vsrl.vi v10, v8, 1
778 ; LMULMAX1-NEXT: vor.vv v8, v8, v10
779 ; LMULMAX1-NEXT: vsrl.vi v10, v8, 2
780 ; LMULMAX1-NEXT: vor.vv v8, v8, v10
781 ; LMULMAX1-NEXT: vsrl.vi v10, v8, 4
782 ; LMULMAX1-NEXT: vor.vv v8, v8, v10
783 ; LMULMAX1-NEXT: vsrl.vi v10, v8, 8
784 ; LMULMAX1-NEXT: vor.vv v8, v8, v10
785 ; LMULMAX1-NEXT: vnot.v v8, v8
786 ; LMULMAX1-NEXT: vsrl.vi v10, v8, 1
787 ; LMULMAX1-NEXT: lui a2, 5
788 ; LMULMAX1-NEXT: addi a2, a2, 1365
789 ; LMULMAX1-NEXT: vand.vx v10, v10, a2
790 ; LMULMAX1-NEXT: vsub.vv v8, v8, v10
791 ; LMULMAX1-NEXT: lui a3, 3
792 ; LMULMAX1-NEXT: addi a3, a3, 819
793 ; LMULMAX1-NEXT: vand.vx v10, v8, a3
794 ; LMULMAX1-NEXT: vsrl.vi v8, v8, 2
795 ; LMULMAX1-NEXT: vand.vx v8, v8, a3
796 ; LMULMAX1-NEXT: vadd.vv v8, v10, v8
797 ; LMULMAX1-NEXT: vsrl.vi v10, v8, 4
798 ; LMULMAX1-NEXT: vadd.vv v8, v8, v10
799 ; LMULMAX1-NEXT: lui a4, 1
800 ; LMULMAX1-NEXT: addi a4, a4, -241
801 ; LMULMAX1-NEXT: vand.vx v8, v8, a4
802 ; LMULMAX1-NEXT: li a5, 257
803 ; LMULMAX1-NEXT: vmul.vx v8, v8, a5
804 ; LMULMAX1-NEXT: vsrl.vi v8, v8, 8
805 ; LMULMAX1-NEXT: vsrl.vi v10, v9, 1
806 ; LMULMAX1-NEXT: vor.vv v9, v9, v10
807 ; LMULMAX1-NEXT: vsrl.vi v10, v9, 2
808 ; LMULMAX1-NEXT: vor.vv v9, v9, v10
809 ; LMULMAX1-NEXT: vsrl.vi v10, v9, 4
810 ; LMULMAX1-NEXT: vor.vv v9, v9, v10
811 ; LMULMAX1-NEXT: vsrl.vi v10, v9, 8
812 ; LMULMAX1-NEXT: vor.vv v9, v9, v10
813 ; LMULMAX1-NEXT: vnot.v v9, v9
814 ; LMULMAX1-NEXT: vsrl.vi v10, v9, 1
815 ; LMULMAX1-NEXT: vand.vx v10, v10, a2
816 ; LMULMAX1-NEXT: vsub.vv v9, v9, v10
817 ; LMULMAX1-NEXT: vand.vx v10, v9, a3
818 ; LMULMAX1-NEXT: vsrl.vi v9, v9, 2
819 ; LMULMAX1-NEXT: vand.vx v9, v9, a3
820 ; LMULMAX1-NEXT: vadd.vv v9, v10, v9
821 ; LMULMAX1-NEXT: vsrl.vi v10, v9, 4
822 ; LMULMAX1-NEXT: vadd.vv v9, v9, v10
823 ; LMULMAX1-NEXT: vand.vx v9, v9, a4
824 ; LMULMAX1-NEXT: vmul.vx v9, v9, a5
825 ; LMULMAX1-NEXT: vsrl.vi v9, v9, 8
826 ; LMULMAX1-NEXT: vse16.v v9, (a0)
827 ; LMULMAX1-NEXT: vse16.v v8, (a1)
830 ; LMULMAX8-LABEL: ctlz_v16i16:
832 ; LMULMAX8-NEXT: vsetivli zero, 16, e16, m2, ta, ma
833 ; LMULMAX8-NEXT: vle16.v v8, (a0)
834 ; LMULMAX8-NEXT: vfwcvt.f.xu.v v12, v8
835 ; LMULMAX8-NEXT: vnsrl.wi v8, v12, 23
836 ; LMULMAX8-NEXT: li a1, 142
837 ; LMULMAX8-NEXT: vrsub.vx v8, v8, a1
838 ; LMULMAX8-NEXT: li a1, 16
839 ; LMULMAX8-NEXT: vminu.vx v8, v8, a1
840 ; LMULMAX8-NEXT: vse16.v v8, (a0)
843 ; ZVBB-LABEL: ctlz_v16i16:
845 ; ZVBB-NEXT: vsetivli zero, 16, e16, m2, ta, ma
846 ; ZVBB-NEXT: vle16.v v8, (a0)
847 ; ZVBB-NEXT: vclz.v v8, v8
848 ; ZVBB-NEXT: vse16.v v8, (a0)
850 %a = load <16 x i16>, ptr %x
851 %b = load <16 x i16>, ptr %y
852 %c = call <16 x i16> @llvm.ctlz.v16i16(<16 x i16> %a, i1 false)
853 store <16 x i16> %c, ptr %x
856 declare <16 x i16> @llvm.ctlz.v16i16(<16 x i16>, i1)
858 define void @ctlz_v8i32(ptr %x, ptr %y) nounwind {
859 ; LMULMAX2-RV32I-LABEL: ctlz_v8i32:
860 ; LMULMAX2-RV32I: # %bb.0:
861 ; LMULMAX2-RV32I-NEXT: vsetivli zero, 8, e32, m2, ta, ma
862 ; LMULMAX2-RV32I-NEXT: vle32.v v8, (a0)
863 ; LMULMAX2-RV32I-NEXT: vsrl.vi v10, v8, 1
864 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v10
865 ; LMULMAX2-RV32I-NEXT: vsrl.vi v10, v8, 2
866 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v10
867 ; LMULMAX2-RV32I-NEXT: vsrl.vi v10, v8, 4
868 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v10
869 ; LMULMAX2-RV32I-NEXT: vsrl.vi v10, v8, 8
870 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v10
871 ; LMULMAX2-RV32I-NEXT: vsrl.vi v10, v8, 16
872 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v10
873 ; LMULMAX2-RV32I-NEXT: vnot.v v8, v8
874 ; LMULMAX2-RV32I-NEXT: vsrl.vi v10, v8, 1
875 ; LMULMAX2-RV32I-NEXT: lui a1, 349525
876 ; LMULMAX2-RV32I-NEXT: addi a1, a1, 1365
877 ; LMULMAX2-RV32I-NEXT: vand.vx v10, v10, a1
878 ; LMULMAX2-RV32I-NEXT: vsub.vv v8, v8, v10
879 ; LMULMAX2-RV32I-NEXT: lui a1, 209715
880 ; LMULMAX2-RV32I-NEXT: addi a1, a1, 819
881 ; LMULMAX2-RV32I-NEXT: vand.vx v10, v8, a1
882 ; LMULMAX2-RV32I-NEXT: vsrl.vi v8, v8, 2
883 ; LMULMAX2-RV32I-NEXT: vand.vx v8, v8, a1
884 ; LMULMAX2-RV32I-NEXT: vadd.vv v8, v10, v8
885 ; LMULMAX2-RV32I-NEXT: vsrl.vi v10, v8, 4
886 ; LMULMAX2-RV32I-NEXT: vadd.vv v8, v8, v10
887 ; LMULMAX2-RV32I-NEXT: lui a1, 61681
888 ; LMULMAX2-RV32I-NEXT: addi a1, a1, -241
889 ; LMULMAX2-RV32I-NEXT: vand.vx v8, v8, a1
890 ; LMULMAX2-RV32I-NEXT: lui a1, 4112
891 ; LMULMAX2-RV32I-NEXT: addi a1, a1, 257
892 ; LMULMAX2-RV32I-NEXT: vmul.vx v8, v8, a1
893 ; LMULMAX2-RV32I-NEXT: vsrl.vi v8, v8, 24
894 ; LMULMAX2-RV32I-NEXT: vse32.v v8, (a0)
895 ; LMULMAX2-RV32I-NEXT: ret
897 ; LMULMAX2-RV64I-LABEL: ctlz_v8i32:
898 ; LMULMAX2-RV64I: # %bb.0:
899 ; LMULMAX2-RV64I-NEXT: vsetivli zero, 8, e32, m2, ta, ma
900 ; LMULMAX2-RV64I-NEXT: vle32.v v8, (a0)
901 ; LMULMAX2-RV64I-NEXT: vsrl.vi v10, v8, 1
902 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v10
903 ; LMULMAX2-RV64I-NEXT: vsrl.vi v10, v8, 2
904 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v10
905 ; LMULMAX2-RV64I-NEXT: vsrl.vi v10, v8, 4
906 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v10
907 ; LMULMAX2-RV64I-NEXT: vsrl.vi v10, v8, 8
908 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v10
909 ; LMULMAX2-RV64I-NEXT: vsrl.vi v10, v8, 16
910 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v10
911 ; LMULMAX2-RV64I-NEXT: vnot.v v8, v8
912 ; LMULMAX2-RV64I-NEXT: vsrl.vi v10, v8, 1
913 ; LMULMAX2-RV64I-NEXT: lui a1, 349525
914 ; LMULMAX2-RV64I-NEXT: addi a1, a1, 1365
915 ; LMULMAX2-RV64I-NEXT: vand.vx v10, v10, a1
916 ; LMULMAX2-RV64I-NEXT: vsub.vv v8, v8, v10
917 ; LMULMAX2-RV64I-NEXT: lui a1, 209715
918 ; LMULMAX2-RV64I-NEXT: addi a1, a1, 819
919 ; LMULMAX2-RV64I-NEXT: vand.vx v10, v8, a1
920 ; LMULMAX2-RV64I-NEXT: vsrl.vi v8, v8, 2
921 ; LMULMAX2-RV64I-NEXT: vand.vx v8, v8, a1
922 ; LMULMAX2-RV64I-NEXT: vadd.vv v8, v10, v8
923 ; LMULMAX2-RV64I-NEXT: vsrl.vi v10, v8, 4
924 ; LMULMAX2-RV64I-NEXT: vadd.vv v8, v8, v10
925 ; LMULMAX2-RV64I-NEXT: lui a1, 61681
926 ; LMULMAX2-RV64I-NEXT: addi a1, a1, -241
927 ; LMULMAX2-RV64I-NEXT: vand.vx v8, v8, a1
928 ; LMULMAX2-RV64I-NEXT: lui a1, 4112
929 ; LMULMAX2-RV64I-NEXT: addi a1, a1, 257
930 ; LMULMAX2-RV64I-NEXT: vmul.vx v8, v8, a1
931 ; LMULMAX2-RV64I-NEXT: vsrl.vi v8, v8, 24
932 ; LMULMAX2-RV64I-NEXT: vse32.v v8, (a0)
933 ; LMULMAX2-RV64I-NEXT: ret
935 ; LMULMAX2-RV32F-LABEL: ctlz_v8i32:
936 ; LMULMAX2-RV32F: # %bb.0:
937 ; LMULMAX2-RV32F-NEXT: vsetivli zero, 8, e32, m2, ta, ma
938 ; LMULMAX2-RV32F-NEXT: vle32.v v8, (a0)
939 ; LMULMAX2-RV32F-NEXT: fsrmi a1, 1
940 ; LMULMAX2-RV32F-NEXT: vfcvt.f.xu.v v8, v8
941 ; LMULMAX2-RV32F-NEXT: fsrm a1
942 ; LMULMAX2-RV32F-NEXT: vsrl.vi v8, v8, 23
943 ; LMULMAX2-RV32F-NEXT: li a1, 158
944 ; LMULMAX2-RV32F-NEXT: vrsub.vx v8, v8, a1
945 ; LMULMAX2-RV32F-NEXT: li a1, 32
946 ; LMULMAX2-RV32F-NEXT: vminu.vx v8, v8, a1
947 ; LMULMAX2-RV32F-NEXT: vse32.v v8, (a0)
948 ; LMULMAX2-RV32F-NEXT: ret
950 ; LMULMAX2-RV64F-LABEL: ctlz_v8i32:
951 ; LMULMAX2-RV64F: # %bb.0:
952 ; LMULMAX2-RV64F-NEXT: vsetivli zero, 8, e32, m2, ta, ma
953 ; LMULMAX2-RV64F-NEXT: vle32.v v8, (a0)
954 ; LMULMAX2-RV64F-NEXT: fsrmi a1, 1
955 ; LMULMAX2-RV64F-NEXT: vfcvt.f.xu.v v8, v8
956 ; LMULMAX2-RV64F-NEXT: fsrm a1
957 ; LMULMAX2-RV64F-NEXT: vsrl.vi v8, v8, 23
958 ; LMULMAX2-RV64F-NEXT: li a1, 158
959 ; LMULMAX2-RV64F-NEXT: vrsub.vx v8, v8, a1
960 ; LMULMAX2-RV64F-NEXT: li a1, 32
961 ; LMULMAX2-RV64F-NEXT: vminu.vx v8, v8, a1
962 ; LMULMAX2-RV64F-NEXT: vse32.v v8, (a0)
963 ; LMULMAX2-RV64F-NEXT: ret
965 ; LMULMAX2-RV32D-LABEL: ctlz_v8i32:
966 ; LMULMAX2-RV32D: # %bb.0:
967 ; LMULMAX2-RV32D-NEXT: vsetivli zero, 8, e32, m2, ta, ma
968 ; LMULMAX2-RV32D-NEXT: vle32.v v8, (a0)
969 ; LMULMAX2-RV32D-NEXT: fsrmi a1, 1
970 ; LMULMAX2-RV32D-NEXT: vfcvt.f.xu.v v8, v8
971 ; LMULMAX2-RV32D-NEXT: fsrm a1
972 ; LMULMAX2-RV32D-NEXT: vsrl.vi v8, v8, 23
973 ; LMULMAX2-RV32D-NEXT: li a1, 158
974 ; LMULMAX2-RV32D-NEXT: vrsub.vx v8, v8, a1
975 ; LMULMAX2-RV32D-NEXT: li a1, 32
976 ; LMULMAX2-RV32D-NEXT: vminu.vx v8, v8, a1
977 ; LMULMAX2-RV32D-NEXT: vse32.v v8, (a0)
978 ; LMULMAX2-RV32D-NEXT: ret
980 ; LMULMAX2-RV64D-LABEL: ctlz_v8i32:
981 ; LMULMAX2-RV64D: # %bb.0:
982 ; LMULMAX2-RV64D-NEXT: vsetivli zero, 8, e32, m2, ta, ma
983 ; LMULMAX2-RV64D-NEXT: vle32.v v8, (a0)
984 ; LMULMAX2-RV64D-NEXT: fsrmi a1, 1
985 ; LMULMAX2-RV64D-NEXT: vfcvt.f.xu.v v8, v8
986 ; LMULMAX2-RV64D-NEXT: fsrm a1
987 ; LMULMAX2-RV64D-NEXT: vsrl.vi v8, v8, 23
988 ; LMULMAX2-RV64D-NEXT: li a1, 158
989 ; LMULMAX2-RV64D-NEXT: vrsub.vx v8, v8, a1
990 ; LMULMAX2-RV64D-NEXT: li a1, 32
991 ; LMULMAX2-RV64D-NEXT: vminu.vx v8, v8, a1
992 ; LMULMAX2-RV64D-NEXT: vse32.v v8, (a0)
993 ; LMULMAX2-RV64D-NEXT: ret
995 ; LMULMAX8-LABEL: ctlz_v8i32:
997 ; LMULMAX8-NEXT: vsetivli zero, 8, e32, m2, ta, ma
998 ; LMULMAX8-NEXT: vle32.v v8, (a0)
999 ; LMULMAX8-NEXT: vfwcvt.f.xu.v v12, v8
1000 ; LMULMAX8-NEXT: li a1, 52
1001 ; LMULMAX8-NEXT: vnsrl.wx v8, v12, a1
1002 ; LMULMAX8-NEXT: li a1, 1054
1003 ; LMULMAX8-NEXT: vrsub.vx v8, v8, a1
1004 ; LMULMAX8-NEXT: li a1, 32
1005 ; LMULMAX8-NEXT: vminu.vx v8, v8, a1
1006 ; LMULMAX8-NEXT: vse32.v v8, (a0)
1007 ; LMULMAX8-NEXT: ret
1009 ; ZVBB-LABEL: ctlz_v8i32:
1011 ; ZVBB-NEXT: vsetivli zero, 8, e32, m2, ta, ma
1012 ; ZVBB-NEXT: vle32.v v8, (a0)
1013 ; ZVBB-NEXT: vclz.v v8, v8
1014 ; ZVBB-NEXT: vse32.v v8, (a0)
1016 %a = load <8 x i32>, ptr %x
1017 %b = load <8 x i32>, ptr %y
1018 %c = call <8 x i32> @llvm.ctlz.v8i32(<8 x i32> %a, i1 false)
1019 store <8 x i32> %c, ptr %x
1022 declare <8 x i32> @llvm.ctlz.v8i32(<8 x i32>, i1)
1024 define void @ctlz_v4i64(ptr %x, ptr %y) nounwind {
1025 ; LMULMAX2-RV32I-LABEL: ctlz_v4i64:
1026 ; LMULMAX2-RV32I: # %bb.0:
1027 ; LMULMAX2-RV32I-NEXT: vsetivli zero, 4, e64, m2, ta, ma
1028 ; LMULMAX2-RV32I-NEXT: vle64.v v8, (a0)
1029 ; LMULMAX2-RV32I-NEXT: vsrl.vi v10, v8, 1
1030 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v10
1031 ; LMULMAX2-RV32I-NEXT: vsrl.vi v10, v8, 2
1032 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v10
1033 ; LMULMAX2-RV32I-NEXT: vsrl.vi v10, v8, 4
1034 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v10
1035 ; LMULMAX2-RV32I-NEXT: vsrl.vi v10, v8, 8
1036 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v10
1037 ; LMULMAX2-RV32I-NEXT: vsrl.vi v10, v8, 16
1038 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v10
1039 ; LMULMAX2-RV32I-NEXT: li a1, 32
1040 ; LMULMAX2-RV32I-NEXT: vsrl.vx v10, v8, a1
1041 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v10
1042 ; LMULMAX2-RV32I-NEXT: vnot.v v8, v8
1043 ; LMULMAX2-RV32I-NEXT: vsrl.vi v10, v8, 1
1044 ; LMULMAX2-RV32I-NEXT: lui a1, 349525
1045 ; LMULMAX2-RV32I-NEXT: addi a1, a1, 1365
1046 ; LMULMAX2-RV32I-NEXT: vsetvli a2, zero, e32, m2, ta, ma
1047 ; LMULMAX2-RV32I-NEXT: vmv.v.x v12, a1
1048 ; LMULMAX2-RV32I-NEXT: vsetivli zero, 4, e64, m2, ta, ma
1049 ; LMULMAX2-RV32I-NEXT: vand.vv v10, v10, v12
1050 ; LMULMAX2-RV32I-NEXT: vsub.vv v8, v8, v10
1051 ; LMULMAX2-RV32I-NEXT: lui a1, 209715
1052 ; LMULMAX2-RV32I-NEXT: addi a1, a1, 819
1053 ; LMULMAX2-RV32I-NEXT: vsetvli a2, zero, e32, m2, ta, ma
1054 ; LMULMAX2-RV32I-NEXT: vmv.v.x v10, a1
1055 ; LMULMAX2-RV32I-NEXT: vsetivli zero, 4, e64, m2, ta, ma
1056 ; LMULMAX2-RV32I-NEXT: vand.vv v12, v8, v10
1057 ; LMULMAX2-RV32I-NEXT: vsrl.vi v8, v8, 2
1058 ; LMULMAX2-RV32I-NEXT: vand.vv v8, v8, v10
1059 ; LMULMAX2-RV32I-NEXT: vadd.vv v8, v12, v8
1060 ; LMULMAX2-RV32I-NEXT: vsrl.vi v10, v8, 4
1061 ; LMULMAX2-RV32I-NEXT: vadd.vv v8, v8, v10
1062 ; LMULMAX2-RV32I-NEXT: lui a1, 61681
1063 ; LMULMAX2-RV32I-NEXT: addi a1, a1, -241
1064 ; LMULMAX2-RV32I-NEXT: vsetvli a2, zero, e32, m2, ta, ma
1065 ; LMULMAX2-RV32I-NEXT: vmv.v.x v10, a1
1066 ; LMULMAX2-RV32I-NEXT: vsetivli zero, 4, e64, m2, ta, ma
1067 ; LMULMAX2-RV32I-NEXT: vand.vv v8, v8, v10
1068 ; LMULMAX2-RV32I-NEXT: lui a1, 4112
1069 ; LMULMAX2-RV32I-NEXT: addi a1, a1, 257
1070 ; LMULMAX2-RV32I-NEXT: vsetvli a2, zero, e32, m2, ta, ma
1071 ; LMULMAX2-RV32I-NEXT: vmv.v.x v10, a1
1072 ; LMULMAX2-RV32I-NEXT: vsetivli zero, 4, e64, m2, ta, ma
1073 ; LMULMAX2-RV32I-NEXT: vmul.vv v8, v8, v10
1074 ; LMULMAX2-RV32I-NEXT: li a1, 56
1075 ; LMULMAX2-RV32I-NEXT: vsrl.vx v8, v8, a1
1076 ; LMULMAX2-RV32I-NEXT: vse64.v v8, (a0)
1077 ; LMULMAX2-RV32I-NEXT: ret
1079 ; LMULMAX2-RV64I-LABEL: ctlz_v4i64:
1080 ; LMULMAX2-RV64I: # %bb.0:
1081 ; LMULMAX2-RV64I-NEXT: vsetivli zero, 4, e64, m2, ta, ma
1082 ; LMULMAX2-RV64I-NEXT: vle64.v v8, (a0)
1083 ; LMULMAX2-RV64I-NEXT: vsrl.vi v10, v8, 1
1084 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v10
1085 ; LMULMAX2-RV64I-NEXT: vsrl.vi v10, v8, 2
1086 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v10
1087 ; LMULMAX2-RV64I-NEXT: vsrl.vi v10, v8, 4
1088 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v10
1089 ; LMULMAX2-RV64I-NEXT: vsrl.vi v10, v8, 8
1090 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v10
1091 ; LMULMAX2-RV64I-NEXT: vsrl.vi v10, v8, 16
1092 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v10
1093 ; LMULMAX2-RV64I-NEXT: li a1, 32
1094 ; LMULMAX2-RV64I-NEXT: vsrl.vx v10, v8, a1
1095 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v10
1096 ; LMULMAX2-RV64I-NEXT: vnot.v v8, v8
1097 ; LMULMAX2-RV64I-NEXT: vsrl.vi v10, v8, 1
1098 ; LMULMAX2-RV64I-NEXT: lui a1, 349525
1099 ; LMULMAX2-RV64I-NEXT: addiw a1, a1, 1365
1100 ; LMULMAX2-RV64I-NEXT: slli a2, a1, 32
1101 ; LMULMAX2-RV64I-NEXT: add a1, a1, a2
1102 ; LMULMAX2-RV64I-NEXT: vand.vx v10, v10, a1
1103 ; LMULMAX2-RV64I-NEXT: vsub.vv v8, v8, v10
1104 ; LMULMAX2-RV64I-NEXT: lui a1, 209715
1105 ; LMULMAX2-RV64I-NEXT: addiw a1, a1, 819
1106 ; LMULMAX2-RV64I-NEXT: slli a2, a1, 32
1107 ; LMULMAX2-RV64I-NEXT: add a1, a1, a2
1108 ; LMULMAX2-RV64I-NEXT: vand.vx v10, v8, a1
1109 ; LMULMAX2-RV64I-NEXT: vsrl.vi v8, v8, 2
1110 ; LMULMAX2-RV64I-NEXT: vand.vx v8, v8, a1
1111 ; LMULMAX2-RV64I-NEXT: vadd.vv v8, v10, v8
1112 ; LMULMAX2-RV64I-NEXT: vsrl.vi v10, v8, 4
1113 ; LMULMAX2-RV64I-NEXT: vadd.vv v8, v8, v10
1114 ; LMULMAX2-RV64I-NEXT: lui a1, 61681
1115 ; LMULMAX2-RV64I-NEXT: addiw a1, a1, -241
1116 ; LMULMAX2-RV64I-NEXT: slli a2, a1, 32
1117 ; LMULMAX2-RV64I-NEXT: add a1, a1, a2
1118 ; LMULMAX2-RV64I-NEXT: vand.vx v8, v8, a1
1119 ; LMULMAX2-RV64I-NEXT: lui a1, 4112
1120 ; LMULMAX2-RV64I-NEXT: addiw a1, a1, 257
1121 ; LMULMAX2-RV64I-NEXT: slli a2, a1, 32
1122 ; LMULMAX2-RV64I-NEXT: add a1, a1, a2
1123 ; LMULMAX2-RV64I-NEXT: vmul.vx v8, v8, a1
1124 ; LMULMAX2-RV64I-NEXT: li a1, 56
1125 ; LMULMAX2-RV64I-NEXT: vsrl.vx v8, v8, a1
1126 ; LMULMAX2-RV64I-NEXT: vse64.v v8, (a0)
1127 ; LMULMAX2-RV64I-NEXT: ret
1129 ; LMULMAX2-RV32F-LABEL: ctlz_v4i64:
1130 ; LMULMAX2-RV32F: # %bb.0:
1131 ; LMULMAX2-RV32F-NEXT: vsetivli zero, 4, e64, m2, ta, ma
1132 ; LMULMAX2-RV32F-NEXT: vle64.v v8, (a0)
1133 ; LMULMAX2-RV32F-NEXT: li a1, 190
1134 ; LMULMAX2-RV32F-NEXT: vmv.v.x v10, a1
1135 ; LMULMAX2-RV32F-NEXT: vsetvli zero, zero, e32, m1, ta, ma
1136 ; LMULMAX2-RV32F-NEXT: fsrmi a1, 1
1137 ; LMULMAX2-RV32F-NEXT: vfncvt.f.xu.w v12, v8
1138 ; LMULMAX2-RV32F-NEXT: fsrm a1
1139 ; LMULMAX2-RV32F-NEXT: vsrl.vi v8, v12, 23
1140 ; LMULMAX2-RV32F-NEXT: vwsubu.wv v10, v10, v8
1141 ; LMULMAX2-RV32F-NEXT: li a1, 64
1142 ; LMULMAX2-RV32F-NEXT: vsetvli zero, zero, e64, m2, ta, ma
1143 ; LMULMAX2-RV32F-NEXT: vminu.vx v8, v10, a1
1144 ; LMULMAX2-RV32F-NEXT: vse64.v v8, (a0)
1145 ; LMULMAX2-RV32F-NEXT: ret
1147 ; LMULMAX2-RV64F-LABEL: ctlz_v4i64:
1148 ; LMULMAX2-RV64F: # %bb.0:
1149 ; LMULMAX2-RV64F-NEXT: vsetivli zero, 4, e32, m1, ta, ma
1150 ; LMULMAX2-RV64F-NEXT: vle64.v v8, (a0)
1151 ; LMULMAX2-RV64F-NEXT: li a1, 190
1152 ; LMULMAX2-RV64F-NEXT: vmv.v.x v10, a1
1153 ; LMULMAX2-RV64F-NEXT: fsrmi a1, 1
1154 ; LMULMAX2-RV64F-NEXT: vfncvt.f.xu.w v11, v8
1155 ; LMULMAX2-RV64F-NEXT: fsrm a1
1156 ; LMULMAX2-RV64F-NEXT: vsrl.vi v8, v11, 23
1157 ; LMULMAX2-RV64F-NEXT: vwsubu.vv v12, v10, v8
1158 ; LMULMAX2-RV64F-NEXT: li a1, 64
1159 ; LMULMAX2-RV64F-NEXT: vsetvli zero, zero, e64, m2, ta, ma
1160 ; LMULMAX2-RV64F-NEXT: vminu.vx v8, v12, a1
1161 ; LMULMAX2-RV64F-NEXT: vse64.v v8, (a0)
1162 ; LMULMAX2-RV64F-NEXT: ret
1164 ; LMULMAX2-RV32D-LABEL: ctlz_v4i64:
1165 ; LMULMAX2-RV32D: # %bb.0:
1166 ; LMULMAX2-RV32D-NEXT: vsetivli zero, 4, e64, m2, ta, ma
1167 ; LMULMAX2-RV32D-NEXT: vle64.v v8, (a0)
1168 ; LMULMAX2-RV32D-NEXT: fsrmi a1, 1
1169 ; LMULMAX2-RV32D-NEXT: vfcvt.f.xu.v v8, v8
1170 ; LMULMAX2-RV32D-NEXT: fsrm a1
1171 ; LMULMAX2-RV32D-NEXT: li a1, 52
1172 ; LMULMAX2-RV32D-NEXT: vsrl.vx v8, v8, a1
1173 ; LMULMAX2-RV32D-NEXT: li a1, 1086
1174 ; LMULMAX2-RV32D-NEXT: vrsub.vx v8, v8, a1
1175 ; LMULMAX2-RV32D-NEXT: li a1, 64
1176 ; LMULMAX2-RV32D-NEXT: vminu.vx v8, v8, a1
1177 ; LMULMAX2-RV32D-NEXT: vse64.v v8, (a0)
1178 ; LMULMAX2-RV32D-NEXT: ret
1180 ; LMULMAX2-RV64D-LABEL: ctlz_v4i64:
1181 ; LMULMAX2-RV64D: # %bb.0:
1182 ; LMULMAX2-RV64D-NEXT: vsetivli zero, 4, e64, m2, ta, ma
1183 ; LMULMAX2-RV64D-NEXT: vle64.v v8, (a0)
1184 ; LMULMAX2-RV64D-NEXT: fsrmi a1, 1
1185 ; LMULMAX2-RV64D-NEXT: vfcvt.f.xu.v v8, v8
1186 ; LMULMAX2-RV64D-NEXT: fsrm a1
1187 ; LMULMAX2-RV64D-NEXT: li a1, 52
1188 ; LMULMAX2-RV64D-NEXT: vsrl.vx v8, v8, a1
1189 ; LMULMAX2-RV64D-NEXT: li a1, 1086
1190 ; LMULMAX2-RV64D-NEXT: vrsub.vx v8, v8, a1
1191 ; LMULMAX2-RV64D-NEXT: li a1, 64
1192 ; LMULMAX2-RV64D-NEXT: vminu.vx v8, v8, a1
1193 ; LMULMAX2-RV64D-NEXT: vse64.v v8, (a0)
1194 ; LMULMAX2-RV64D-NEXT: ret
1196 ; LMULMAX8-LABEL: ctlz_v4i64:
1197 ; LMULMAX8: # %bb.0:
1198 ; LMULMAX8-NEXT: vsetivli zero, 4, e64, m2, ta, ma
1199 ; LMULMAX8-NEXT: vle64.v v8, (a0)
1200 ; LMULMAX8-NEXT: fsrmi a1, 1
1201 ; LMULMAX8-NEXT: vfcvt.f.xu.v v8, v8
1202 ; LMULMAX8-NEXT: fsrm a1
1203 ; LMULMAX8-NEXT: li a1, 52
1204 ; LMULMAX8-NEXT: vsrl.vx v8, v8, a1
1205 ; LMULMAX8-NEXT: li a1, 1086
1206 ; LMULMAX8-NEXT: vrsub.vx v8, v8, a1
1207 ; LMULMAX8-NEXT: li a1, 64
1208 ; LMULMAX8-NEXT: vminu.vx v8, v8, a1
1209 ; LMULMAX8-NEXT: vse64.v v8, (a0)
1210 ; LMULMAX8-NEXT: ret
1212 ; ZVBB-LABEL: ctlz_v4i64:
1214 ; ZVBB-NEXT: vsetivli zero, 4, e64, m2, ta, ma
1215 ; ZVBB-NEXT: vle64.v v8, (a0)
1216 ; ZVBB-NEXT: vclz.v v8, v8
1217 ; ZVBB-NEXT: vse64.v v8, (a0)
1219 %a = load <4 x i64>, ptr %x
1220 %b = load <4 x i64>, ptr %y
1221 %c = call <4 x i64> @llvm.ctlz.v4i64(<4 x i64> %a, i1 false)
1222 store <4 x i64> %c, ptr %x
1225 declare <4 x i64> @llvm.ctlz.v4i64(<4 x i64>, i1)
1227 define void @ctlz_zero_undef_v16i8(ptr %x, ptr %y) nounwind {
1228 ; CHECK-LABEL: ctlz_zero_undef_v16i8:
1230 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
1231 ; CHECK-NEXT: vle8.v v8, (a0)
1232 ; CHECK-NEXT: vsrl.vi v9, v8, 1
1233 ; CHECK-NEXT: vor.vv v8, v8, v9
1234 ; CHECK-NEXT: vsrl.vi v9, v8, 2
1235 ; CHECK-NEXT: vor.vv v8, v8, v9
1236 ; CHECK-NEXT: vsrl.vi v9, v8, 4
1237 ; CHECK-NEXT: vor.vv v8, v8, v9
1238 ; CHECK-NEXT: vnot.v v8, v8
1239 ; CHECK-NEXT: vsrl.vi v9, v8, 1
1240 ; CHECK-NEXT: li a1, 85
1241 ; CHECK-NEXT: vand.vx v9, v9, a1
1242 ; CHECK-NEXT: vsub.vv v8, v8, v9
1243 ; CHECK-NEXT: li a1, 51
1244 ; CHECK-NEXT: vand.vx v9, v8, a1
1245 ; CHECK-NEXT: vsrl.vi v8, v8, 2
1246 ; CHECK-NEXT: vand.vx v8, v8, a1
1247 ; CHECK-NEXT: vadd.vv v8, v9, v8
1248 ; CHECK-NEXT: vsrl.vi v9, v8, 4
1249 ; CHECK-NEXT: vadd.vv v8, v8, v9
1250 ; CHECK-NEXT: vand.vi v8, v8, 15
1251 ; CHECK-NEXT: vse8.v v8, (a0)
1254 ; LMULMAX8-LABEL: ctlz_zero_undef_v16i8:
1255 ; LMULMAX8: # %bb.0:
1256 ; LMULMAX8-NEXT: vsetivli zero, 16, e16, m2, ta, ma
1257 ; LMULMAX8-NEXT: vle8.v v8, (a0)
1258 ; LMULMAX8-NEXT: vzext.vf2 v10, v8
1259 ; LMULMAX8-NEXT: vfwcvt.f.xu.v v12, v10
1260 ; LMULMAX8-NEXT: vnsrl.wi v8, v12, 23
1261 ; LMULMAX8-NEXT: vsetvli zero, zero, e8, m1, ta, ma
1262 ; LMULMAX8-NEXT: vnsrl.wi v10, v8, 0
1263 ; LMULMAX8-NEXT: li a1, 134
1264 ; LMULMAX8-NEXT: vrsub.vx v8, v10, a1
1265 ; LMULMAX8-NEXT: vse8.v v8, (a0)
1266 ; LMULMAX8-NEXT: ret
1268 ; ZVBB-LABEL: ctlz_zero_undef_v16i8:
1270 ; ZVBB-NEXT: vsetivli zero, 16, e8, m1, ta, ma
1271 ; ZVBB-NEXT: vle8.v v8, (a0)
1272 ; ZVBB-NEXT: vclz.v v8, v8
1273 ; ZVBB-NEXT: vse8.v v8, (a0)
1275 %a = load <16 x i8>, ptr %x
1276 %b = load <16 x i8>, ptr %y
1277 %c = call <16 x i8> @llvm.ctlz.v16i8(<16 x i8> %a, i1 true)
1278 store <16 x i8> %c, ptr %x
1282 define void @ctlz_zero_undef_v8i16(ptr %x, ptr %y) nounwind {
1283 ; LMULMAX2-RV32I-LABEL: ctlz_zero_undef_v8i16:
1284 ; LMULMAX2-RV32I: # %bb.0:
1285 ; LMULMAX2-RV32I-NEXT: vsetivli zero, 8, e16, m1, ta, ma
1286 ; LMULMAX2-RV32I-NEXT: vle16.v v8, (a0)
1287 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 1
1288 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v9
1289 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 2
1290 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v9
1291 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 4
1292 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v9
1293 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 8
1294 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v9
1295 ; LMULMAX2-RV32I-NEXT: vnot.v v8, v8
1296 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 1
1297 ; LMULMAX2-RV32I-NEXT: lui a1, 5
1298 ; LMULMAX2-RV32I-NEXT: addi a1, a1, 1365
1299 ; LMULMAX2-RV32I-NEXT: vand.vx v9, v9, a1
1300 ; LMULMAX2-RV32I-NEXT: vsub.vv v8, v8, v9
1301 ; LMULMAX2-RV32I-NEXT: lui a1, 3
1302 ; LMULMAX2-RV32I-NEXT: addi a1, a1, 819
1303 ; LMULMAX2-RV32I-NEXT: vand.vx v9, v8, a1
1304 ; LMULMAX2-RV32I-NEXT: vsrl.vi v8, v8, 2
1305 ; LMULMAX2-RV32I-NEXT: vand.vx v8, v8, a1
1306 ; LMULMAX2-RV32I-NEXT: vadd.vv v8, v9, v8
1307 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 4
1308 ; LMULMAX2-RV32I-NEXT: vadd.vv v8, v8, v9
1309 ; LMULMAX2-RV32I-NEXT: lui a1, 1
1310 ; LMULMAX2-RV32I-NEXT: addi a1, a1, -241
1311 ; LMULMAX2-RV32I-NEXT: vand.vx v8, v8, a1
1312 ; LMULMAX2-RV32I-NEXT: li a1, 257
1313 ; LMULMAX2-RV32I-NEXT: vmul.vx v8, v8, a1
1314 ; LMULMAX2-RV32I-NEXT: vsrl.vi v8, v8, 8
1315 ; LMULMAX2-RV32I-NEXT: vse16.v v8, (a0)
1316 ; LMULMAX2-RV32I-NEXT: ret
1318 ; LMULMAX2-RV64I-LABEL: ctlz_zero_undef_v8i16:
1319 ; LMULMAX2-RV64I: # %bb.0:
1320 ; LMULMAX2-RV64I-NEXT: vsetivli zero, 8, e16, m1, ta, ma
1321 ; LMULMAX2-RV64I-NEXT: vle16.v v8, (a0)
1322 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 1
1323 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v9
1324 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 2
1325 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v9
1326 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 4
1327 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v9
1328 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 8
1329 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v9
1330 ; LMULMAX2-RV64I-NEXT: vnot.v v8, v8
1331 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 1
1332 ; LMULMAX2-RV64I-NEXT: lui a1, 5
1333 ; LMULMAX2-RV64I-NEXT: addi a1, a1, 1365
1334 ; LMULMAX2-RV64I-NEXT: vand.vx v9, v9, a1
1335 ; LMULMAX2-RV64I-NEXT: vsub.vv v8, v8, v9
1336 ; LMULMAX2-RV64I-NEXT: lui a1, 3
1337 ; LMULMAX2-RV64I-NEXT: addi a1, a1, 819
1338 ; LMULMAX2-RV64I-NEXT: vand.vx v9, v8, a1
1339 ; LMULMAX2-RV64I-NEXT: vsrl.vi v8, v8, 2
1340 ; LMULMAX2-RV64I-NEXT: vand.vx v8, v8, a1
1341 ; LMULMAX2-RV64I-NEXT: vadd.vv v8, v9, v8
1342 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 4
1343 ; LMULMAX2-RV64I-NEXT: vadd.vv v8, v8, v9
1344 ; LMULMAX2-RV64I-NEXT: lui a1, 1
1345 ; LMULMAX2-RV64I-NEXT: addi a1, a1, -241
1346 ; LMULMAX2-RV64I-NEXT: vand.vx v8, v8, a1
1347 ; LMULMAX2-RV64I-NEXT: li a1, 257
1348 ; LMULMAX2-RV64I-NEXT: vmul.vx v8, v8, a1
1349 ; LMULMAX2-RV64I-NEXT: vsrl.vi v8, v8, 8
1350 ; LMULMAX2-RV64I-NEXT: vse16.v v8, (a0)
1351 ; LMULMAX2-RV64I-NEXT: ret
1353 ; LMULMAX1-LABEL: ctlz_zero_undef_v8i16:
1354 ; LMULMAX1: # %bb.0:
1355 ; LMULMAX1-NEXT: vsetivli zero, 8, e16, m1, ta, ma
1356 ; LMULMAX1-NEXT: vle16.v v8, (a0)
1357 ; LMULMAX1-NEXT: vsrl.vi v9, v8, 1
1358 ; LMULMAX1-NEXT: vor.vv v8, v8, v9
1359 ; LMULMAX1-NEXT: vsrl.vi v9, v8, 2
1360 ; LMULMAX1-NEXT: vor.vv v8, v8, v9
1361 ; LMULMAX1-NEXT: vsrl.vi v9, v8, 4
1362 ; LMULMAX1-NEXT: vor.vv v8, v8, v9
1363 ; LMULMAX1-NEXT: vsrl.vi v9, v8, 8
1364 ; LMULMAX1-NEXT: vor.vv v8, v8, v9
1365 ; LMULMAX1-NEXT: vnot.v v8, v8
1366 ; LMULMAX1-NEXT: vsrl.vi v9, v8, 1
1367 ; LMULMAX1-NEXT: lui a1, 5
1368 ; LMULMAX1-NEXT: addi a1, a1, 1365
1369 ; LMULMAX1-NEXT: vand.vx v9, v9, a1
1370 ; LMULMAX1-NEXT: vsub.vv v8, v8, v9
1371 ; LMULMAX1-NEXT: lui a1, 3
1372 ; LMULMAX1-NEXT: addi a1, a1, 819
1373 ; LMULMAX1-NEXT: vand.vx v9, v8, a1
1374 ; LMULMAX1-NEXT: vsrl.vi v8, v8, 2
1375 ; LMULMAX1-NEXT: vand.vx v8, v8, a1
1376 ; LMULMAX1-NEXT: vadd.vv v8, v9, v8
1377 ; LMULMAX1-NEXT: vsrl.vi v9, v8, 4
1378 ; LMULMAX1-NEXT: vadd.vv v8, v8, v9
1379 ; LMULMAX1-NEXT: lui a1, 1
1380 ; LMULMAX1-NEXT: addi a1, a1, -241
1381 ; LMULMAX1-NEXT: vand.vx v8, v8, a1
1382 ; LMULMAX1-NEXT: li a1, 257
1383 ; LMULMAX1-NEXT: vmul.vx v8, v8, a1
1384 ; LMULMAX1-NEXT: vsrl.vi v8, v8, 8
1385 ; LMULMAX1-NEXT: vse16.v v8, (a0)
1386 ; LMULMAX1-NEXT: ret
1388 ; LMULMAX2-RV32F-LABEL: ctlz_zero_undef_v8i16:
1389 ; LMULMAX2-RV32F: # %bb.0:
1390 ; LMULMAX2-RV32F-NEXT: vsetivli zero, 8, e16, m1, ta, ma
1391 ; LMULMAX2-RV32F-NEXT: vle16.v v8, (a0)
1392 ; LMULMAX2-RV32F-NEXT: vfwcvt.f.xu.v v10, v8
1393 ; LMULMAX2-RV32F-NEXT: vnsrl.wi v8, v10, 23
1394 ; LMULMAX2-RV32F-NEXT: li a1, 142
1395 ; LMULMAX2-RV32F-NEXT: vrsub.vx v8, v8, a1
1396 ; LMULMAX2-RV32F-NEXT: vse16.v v8, (a0)
1397 ; LMULMAX2-RV32F-NEXT: ret
1399 ; LMULMAX2-RV64F-LABEL: ctlz_zero_undef_v8i16:
1400 ; LMULMAX2-RV64F: # %bb.0:
1401 ; LMULMAX2-RV64F-NEXT: vsetivli zero, 8, e16, m1, ta, ma
1402 ; LMULMAX2-RV64F-NEXT: vle16.v v8, (a0)
1403 ; LMULMAX2-RV64F-NEXT: vfwcvt.f.xu.v v10, v8
1404 ; LMULMAX2-RV64F-NEXT: vnsrl.wi v8, v10, 23
1405 ; LMULMAX2-RV64F-NEXT: li a1, 142
1406 ; LMULMAX2-RV64F-NEXT: vrsub.vx v8, v8, a1
1407 ; LMULMAX2-RV64F-NEXT: vse16.v v8, (a0)
1408 ; LMULMAX2-RV64F-NEXT: ret
1410 ; LMULMAX2-RV32D-LABEL: ctlz_zero_undef_v8i16:
1411 ; LMULMAX2-RV32D: # %bb.0:
1412 ; LMULMAX2-RV32D-NEXT: vsetivli zero, 8, e16, m1, ta, ma
1413 ; LMULMAX2-RV32D-NEXT: vle16.v v8, (a0)
1414 ; LMULMAX2-RV32D-NEXT: vfwcvt.f.xu.v v10, v8
1415 ; LMULMAX2-RV32D-NEXT: vnsrl.wi v8, v10, 23
1416 ; LMULMAX2-RV32D-NEXT: li a1, 142
1417 ; LMULMAX2-RV32D-NEXT: vrsub.vx v8, v8, a1
1418 ; LMULMAX2-RV32D-NEXT: vse16.v v8, (a0)
1419 ; LMULMAX2-RV32D-NEXT: ret
1421 ; LMULMAX2-RV64D-LABEL: ctlz_zero_undef_v8i16:
1422 ; LMULMAX2-RV64D: # %bb.0:
1423 ; LMULMAX2-RV64D-NEXT: vsetivli zero, 8, e16, m1, ta, ma
1424 ; LMULMAX2-RV64D-NEXT: vle16.v v8, (a0)
1425 ; LMULMAX2-RV64D-NEXT: vfwcvt.f.xu.v v10, v8
1426 ; LMULMAX2-RV64D-NEXT: vnsrl.wi v8, v10, 23
1427 ; LMULMAX2-RV64D-NEXT: li a1, 142
1428 ; LMULMAX2-RV64D-NEXT: vrsub.vx v8, v8, a1
1429 ; LMULMAX2-RV64D-NEXT: vse16.v v8, (a0)
1430 ; LMULMAX2-RV64D-NEXT: ret
1432 ; LMULMAX8-LABEL: ctlz_zero_undef_v8i16:
1433 ; LMULMAX8: # %bb.0:
1434 ; LMULMAX8-NEXT: vsetivli zero, 8, e16, m1, ta, ma
1435 ; LMULMAX8-NEXT: vle16.v v8, (a0)
1436 ; LMULMAX8-NEXT: vfwcvt.f.xu.v v10, v8
1437 ; LMULMAX8-NEXT: vnsrl.wi v8, v10, 23
1438 ; LMULMAX8-NEXT: li a1, 142
1439 ; LMULMAX8-NEXT: vrsub.vx v8, v8, a1
1440 ; LMULMAX8-NEXT: vse16.v v8, (a0)
1441 ; LMULMAX8-NEXT: ret
1443 ; ZVBB-LABEL: ctlz_zero_undef_v8i16:
1445 ; ZVBB-NEXT: vsetivli zero, 8, e16, m1, ta, ma
1446 ; ZVBB-NEXT: vle16.v v8, (a0)
1447 ; ZVBB-NEXT: vclz.v v8, v8
1448 ; ZVBB-NEXT: vse16.v v8, (a0)
1450 %a = load <8 x i16>, ptr %x
1451 %b = load <8 x i16>, ptr %y
1452 %c = call <8 x i16> @llvm.ctlz.v8i16(<8 x i16> %a, i1 true)
1453 store <8 x i16> %c, ptr %x
1457 define void @ctlz_zero_undef_v4i32(ptr %x, ptr %y) nounwind {
1458 ; LMULMAX2-RV32I-LABEL: ctlz_zero_undef_v4i32:
1459 ; LMULMAX2-RV32I: # %bb.0:
1460 ; LMULMAX2-RV32I-NEXT: vsetivli zero, 4, e32, m1, ta, ma
1461 ; LMULMAX2-RV32I-NEXT: vle32.v v8, (a0)
1462 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 1
1463 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v9
1464 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 2
1465 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v9
1466 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 4
1467 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v9
1468 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 8
1469 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v9
1470 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 16
1471 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v9
1472 ; LMULMAX2-RV32I-NEXT: vnot.v v8, v8
1473 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 1
1474 ; LMULMAX2-RV32I-NEXT: lui a1, 349525
1475 ; LMULMAX2-RV32I-NEXT: addi a1, a1, 1365
1476 ; LMULMAX2-RV32I-NEXT: vand.vx v9, v9, a1
1477 ; LMULMAX2-RV32I-NEXT: vsub.vv v8, v8, v9
1478 ; LMULMAX2-RV32I-NEXT: lui a1, 209715
1479 ; LMULMAX2-RV32I-NEXT: addi a1, a1, 819
1480 ; LMULMAX2-RV32I-NEXT: vand.vx v9, v8, a1
1481 ; LMULMAX2-RV32I-NEXT: vsrl.vi v8, v8, 2
1482 ; LMULMAX2-RV32I-NEXT: vand.vx v8, v8, a1
1483 ; LMULMAX2-RV32I-NEXT: vadd.vv v8, v9, v8
1484 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 4
1485 ; LMULMAX2-RV32I-NEXT: vadd.vv v8, v8, v9
1486 ; LMULMAX2-RV32I-NEXT: lui a1, 61681
1487 ; LMULMAX2-RV32I-NEXT: addi a1, a1, -241
1488 ; LMULMAX2-RV32I-NEXT: vand.vx v8, v8, a1
1489 ; LMULMAX2-RV32I-NEXT: lui a1, 4112
1490 ; LMULMAX2-RV32I-NEXT: addi a1, a1, 257
1491 ; LMULMAX2-RV32I-NEXT: vmul.vx v8, v8, a1
1492 ; LMULMAX2-RV32I-NEXT: vsrl.vi v8, v8, 24
1493 ; LMULMAX2-RV32I-NEXT: vse32.v v8, (a0)
1494 ; LMULMAX2-RV32I-NEXT: ret
1496 ; LMULMAX2-RV64I-LABEL: ctlz_zero_undef_v4i32:
1497 ; LMULMAX2-RV64I: # %bb.0:
1498 ; LMULMAX2-RV64I-NEXT: vsetivli zero, 4, e32, m1, ta, ma
1499 ; LMULMAX2-RV64I-NEXT: vle32.v v8, (a0)
1500 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 1
1501 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v9
1502 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 2
1503 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v9
1504 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 4
1505 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v9
1506 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 8
1507 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v9
1508 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 16
1509 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v9
1510 ; LMULMAX2-RV64I-NEXT: vnot.v v8, v8
1511 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 1
1512 ; LMULMAX2-RV64I-NEXT: lui a1, 349525
1513 ; LMULMAX2-RV64I-NEXT: addi a1, a1, 1365
1514 ; LMULMAX2-RV64I-NEXT: vand.vx v9, v9, a1
1515 ; LMULMAX2-RV64I-NEXT: vsub.vv v8, v8, v9
1516 ; LMULMAX2-RV64I-NEXT: lui a1, 209715
1517 ; LMULMAX2-RV64I-NEXT: addi a1, a1, 819
1518 ; LMULMAX2-RV64I-NEXT: vand.vx v9, v8, a1
1519 ; LMULMAX2-RV64I-NEXT: vsrl.vi v8, v8, 2
1520 ; LMULMAX2-RV64I-NEXT: vand.vx v8, v8, a1
1521 ; LMULMAX2-RV64I-NEXT: vadd.vv v8, v9, v8
1522 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 4
1523 ; LMULMAX2-RV64I-NEXT: vadd.vv v8, v8, v9
1524 ; LMULMAX2-RV64I-NEXT: lui a1, 61681
1525 ; LMULMAX2-RV64I-NEXT: addi a1, a1, -241
1526 ; LMULMAX2-RV64I-NEXT: vand.vx v8, v8, a1
1527 ; LMULMAX2-RV64I-NEXT: lui a1, 4112
1528 ; LMULMAX2-RV64I-NEXT: addi a1, a1, 257
1529 ; LMULMAX2-RV64I-NEXT: vmul.vx v8, v8, a1
1530 ; LMULMAX2-RV64I-NEXT: vsrl.vi v8, v8, 24
1531 ; LMULMAX2-RV64I-NEXT: vse32.v v8, (a0)
1532 ; LMULMAX2-RV64I-NEXT: ret
1534 ; LMULMAX2-RV32F-LABEL: ctlz_zero_undef_v4i32:
1535 ; LMULMAX2-RV32F: # %bb.0:
1536 ; LMULMAX2-RV32F-NEXT: vsetivli zero, 4, e32, m1, ta, ma
1537 ; LMULMAX2-RV32F-NEXT: vle32.v v8, (a0)
1538 ; LMULMAX2-RV32F-NEXT: fsrmi a1, 1
1539 ; LMULMAX2-RV32F-NEXT: vfcvt.f.xu.v v8, v8
1540 ; LMULMAX2-RV32F-NEXT: fsrm a1
1541 ; LMULMAX2-RV32F-NEXT: vsrl.vi v8, v8, 23
1542 ; LMULMAX2-RV32F-NEXT: li a1, 158
1543 ; LMULMAX2-RV32F-NEXT: vrsub.vx v8, v8, a1
1544 ; LMULMAX2-RV32F-NEXT: vse32.v v8, (a0)
1545 ; LMULMAX2-RV32F-NEXT: ret
1547 ; LMULMAX2-RV64F-LABEL: ctlz_zero_undef_v4i32:
1548 ; LMULMAX2-RV64F: # %bb.0:
1549 ; LMULMAX2-RV64F-NEXT: vsetivli zero, 4, e32, m1, ta, ma
1550 ; LMULMAX2-RV64F-NEXT: vle32.v v8, (a0)
1551 ; LMULMAX2-RV64F-NEXT: fsrmi a1, 1
1552 ; LMULMAX2-RV64F-NEXT: vfcvt.f.xu.v v8, v8
1553 ; LMULMAX2-RV64F-NEXT: fsrm a1
1554 ; LMULMAX2-RV64F-NEXT: vsrl.vi v8, v8, 23
1555 ; LMULMAX2-RV64F-NEXT: li a1, 158
1556 ; LMULMAX2-RV64F-NEXT: vrsub.vx v8, v8, a1
1557 ; LMULMAX2-RV64F-NEXT: vse32.v v8, (a0)
1558 ; LMULMAX2-RV64F-NEXT: ret
1560 ; LMULMAX2-RV32D-LABEL: ctlz_zero_undef_v4i32:
1561 ; LMULMAX2-RV32D: # %bb.0:
1562 ; LMULMAX2-RV32D-NEXT: vsetivli zero, 4, e32, m1, ta, ma
1563 ; LMULMAX2-RV32D-NEXT: vle32.v v8, (a0)
1564 ; LMULMAX2-RV32D-NEXT: vfwcvt.f.xu.v v10, v8
1565 ; LMULMAX2-RV32D-NEXT: li a1, 52
1566 ; LMULMAX2-RV32D-NEXT: vnsrl.wx v8, v10, a1
1567 ; LMULMAX2-RV32D-NEXT: li a1, 1054
1568 ; LMULMAX2-RV32D-NEXT: vrsub.vx v8, v8, a1
1569 ; LMULMAX2-RV32D-NEXT: vse32.v v8, (a0)
1570 ; LMULMAX2-RV32D-NEXT: ret
1572 ; LMULMAX2-RV64D-LABEL: ctlz_zero_undef_v4i32:
1573 ; LMULMAX2-RV64D: # %bb.0:
1574 ; LMULMAX2-RV64D-NEXT: vsetivli zero, 4, e32, m1, ta, ma
1575 ; LMULMAX2-RV64D-NEXT: vle32.v v8, (a0)
1576 ; LMULMAX2-RV64D-NEXT: vfwcvt.f.xu.v v10, v8
1577 ; LMULMAX2-RV64D-NEXT: li a1, 52
1578 ; LMULMAX2-RV64D-NEXT: vnsrl.wx v8, v10, a1
1579 ; LMULMAX2-RV64D-NEXT: li a1, 1054
1580 ; LMULMAX2-RV64D-NEXT: vrsub.vx v8, v8, a1
1581 ; LMULMAX2-RV64D-NEXT: vse32.v v8, (a0)
1582 ; LMULMAX2-RV64D-NEXT: ret
1584 ; LMULMAX8-LABEL: ctlz_zero_undef_v4i32:
1585 ; LMULMAX8: # %bb.0:
1586 ; LMULMAX8-NEXT: vsetivli zero, 4, e32, m1, ta, ma
1587 ; LMULMAX8-NEXT: vle32.v v8, (a0)
1588 ; LMULMAX8-NEXT: vfwcvt.f.xu.v v10, v8
1589 ; LMULMAX8-NEXT: li a1, 52
1590 ; LMULMAX8-NEXT: vnsrl.wx v8, v10, a1
1591 ; LMULMAX8-NEXT: li a1, 1054
1592 ; LMULMAX8-NEXT: vrsub.vx v8, v8, a1
1593 ; LMULMAX8-NEXT: vse32.v v8, (a0)
1594 ; LMULMAX8-NEXT: ret
1596 ; ZVBB-LABEL: ctlz_zero_undef_v4i32:
1598 ; ZVBB-NEXT: vsetivli zero, 4, e32, m1, ta, ma
1599 ; ZVBB-NEXT: vle32.v v8, (a0)
1600 ; ZVBB-NEXT: vclz.v v8, v8
1601 ; ZVBB-NEXT: vse32.v v8, (a0)
1603 %a = load <4 x i32>, ptr %x
1604 %b = load <4 x i32>, ptr %y
1605 %c = call <4 x i32> @llvm.ctlz.v4i32(<4 x i32> %a, i1 true)
1606 store <4 x i32> %c, ptr %x
1610 define void @ctlz_zero_undef_v2i64(ptr %x, ptr %y) nounwind {
1611 ; LMULMAX2-RV32I-LABEL: ctlz_zero_undef_v2i64:
1612 ; LMULMAX2-RV32I: # %bb.0:
1613 ; LMULMAX2-RV32I-NEXT: vsetivli zero, 2, e64, m1, ta, ma
1614 ; LMULMAX2-RV32I-NEXT: vle64.v v8, (a0)
1615 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 1
1616 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v9
1617 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 2
1618 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v9
1619 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 4
1620 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v9
1621 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 8
1622 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v9
1623 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 16
1624 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v9
1625 ; LMULMAX2-RV32I-NEXT: li a1, 32
1626 ; LMULMAX2-RV32I-NEXT: vsrl.vx v9, v8, a1
1627 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v9
1628 ; LMULMAX2-RV32I-NEXT: vnot.v v8, v8
1629 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 1
1630 ; LMULMAX2-RV32I-NEXT: lui a1, 349525
1631 ; LMULMAX2-RV32I-NEXT: addi a1, a1, 1365
1632 ; LMULMAX2-RV32I-NEXT: vsetvli a2, zero, e32, m1, ta, ma
1633 ; LMULMAX2-RV32I-NEXT: vmv.v.x v10, a1
1634 ; LMULMAX2-RV32I-NEXT: vsetivli zero, 2, e64, m1, ta, ma
1635 ; LMULMAX2-RV32I-NEXT: vand.vv v9, v9, v10
1636 ; LMULMAX2-RV32I-NEXT: vsub.vv v8, v8, v9
1637 ; LMULMAX2-RV32I-NEXT: lui a1, 209715
1638 ; LMULMAX2-RV32I-NEXT: addi a1, a1, 819
1639 ; LMULMAX2-RV32I-NEXT: vsetvli a2, zero, e32, m1, ta, ma
1640 ; LMULMAX2-RV32I-NEXT: vmv.v.x v9, a1
1641 ; LMULMAX2-RV32I-NEXT: vsetivli zero, 2, e64, m1, ta, ma
1642 ; LMULMAX2-RV32I-NEXT: vand.vv v10, v8, v9
1643 ; LMULMAX2-RV32I-NEXT: vsrl.vi v8, v8, 2
1644 ; LMULMAX2-RV32I-NEXT: vand.vv v8, v8, v9
1645 ; LMULMAX2-RV32I-NEXT: vadd.vv v8, v10, v8
1646 ; LMULMAX2-RV32I-NEXT: vsrl.vi v9, v8, 4
1647 ; LMULMAX2-RV32I-NEXT: vadd.vv v8, v8, v9
1648 ; LMULMAX2-RV32I-NEXT: lui a1, 61681
1649 ; LMULMAX2-RV32I-NEXT: addi a1, a1, -241
1650 ; LMULMAX2-RV32I-NEXT: vsetvli a2, zero, e32, m1, ta, ma
1651 ; LMULMAX2-RV32I-NEXT: vmv.v.x v9, a1
1652 ; LMULMAX2-RV32I-NEXT: vsetivli zero, 2, e64, m1, ta, ma
1653 ; LMULMAX2-RV32I-NEXT: vand.vv v8, v8, v9
1654 ; LMULMAX2-RV32I-NEXT: lui a1, 4112
1655 ; LMULMAX2-RV32I-NEXT: addi a1, a1, 257
1656 ; LMULMAX2-RV32I-NEXT: vsetvli a2, zero, e32, m1, ta, ma
1657 ; LMULMAX2-RV32I-NEXT: vmv.v.x v9, a1
1658 ; LMULMAX2-RV32I-NEXT: vsetivli zero, 2, e64, m1, ta, ma
1659 ; LMULMAX2-RV32I-NEXT: vmul.vv v8, v8, v9
1660 ; LMULMAX2-RV32I-NEXT: li a1, 56
1661 ; LMULMAX2-RV32I-NEXT: vsrl.vx v8, v8, a1
1662 ; LMULMAX2-RV32I-NEXT: vse64.v v8, (a0)
1663 ; LMULMAX2-RV32I-NEXT: ret
1665 ; LMULMAX2-RV64I-LABEL: ctlz_zero_undef_v2i64:
1666 ; LMULMAX2-RV64I: # %bb.0:
1667 ; LMULMAX2-RV64I-NEXT: vsetivli zero, 2, e64, m1, ta, ma
1668 ; LMULMAX2-RV64I-NEXT: vle64.v v8, (a0)
1669 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 1
1670 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v9
1671 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 2
1672 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v9
1673 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 4
1674 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v9
1675 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 8
1676 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v9
1677 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 16
1678 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v9
1679 ; LMULMAX2-RV64I-NEXT: li a1, 32
1680 ; LMULMAX2-RV64I-NEXT: vsrl.vx v9, v8, a1
1681 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v9
1682 ; LMULMAX2-RV64I-NEXT: vnot.v v8, v8
1683 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 1
1684 ; LMULMAX2-RV64I-NEXT: lui a1, 349525
1685 ; LMULMAX2-RV64I-NEXT: addiw a1, a1, 1365
1686 ; LMULMAX2-RV64I-NEXT: slli a2, a1, 32
1687 ; LMULMAX2-RV64I-NEXT: add a1, a1, a2
1688 ; LMULMAX2-RV64I-NEXT: vand.vx v9, v9, a1
1689 ; LMULMAX2-RV64I-NEXT: vsub.vv v8, v8, v9
1690 ; LMULMAX2-RV64I-NEXT: lui a1, 209715
1691 ; LMULMAX2-RV64I-NEXT: addiw a1, a1, 819
1692 ; LMULMAX2-RV64I-NEXT: slli a2, a1, 32
1693 ; LMULMAX2-RV64I-NEXT: add a1, a1, a2
1694 ; LMULMAX2-RV64I-NEXT: vand.vx v9, v8, a1
1695 ; LMULMAX2-RV64I-NEXT: vsrl.vi v8, v8, 2
1696 ; LMULMAX2-RV64I-NEXT: vand.vx v8, v8, a1
1697 ; LMULMAX2-RV64I-NEXT: vadd.vv v8, v9, v8
1698 ; LMULMAX2-RV64I-NEXT: vsrl.vi v9, v8, 4
1699 ; LMULMAX2-RV64I-NEXT: vadd.vv v8, v8, v9
1700 ; LMULMAX2-RV64I-NEXT: lui a1, 61681
1701 ; LMULMAX2-RV64I-NEXT: addiw a1, a1, -241
1702 ; LMULMAX2-RV64I-NEXT: slli a2, a1, 32
1703 ; LMULMAX2-RV64I-NEXT: add a1, a1, a2
1704 ; LMULMAX2-RV64I-NEXT: vand.vx v8, v8, a1
1705 ; LMULMAX2-RV64I-NEXT: lui a1, 4112
1706 ; LMULMAX2-RV64I-NEXT: addiw a1, a1, 257
1707 ; LMULMAX2-RV64I-NEXT: slli a2, a1, 32
1708 ; LMULMAX2-RV64I-NEXT: add a1, a1, a2
1709 ; LMULMAX2-RV64I-NEXT: vmul.vx v8, v8, a1
1710 ; LMULMAX2-RV64I-NEXT: li a1, 56
1711 ; LMULMAX2-RV64I-NEXT: vsrl.vx v8, v8, a1
1712 ; LMULMAX2-RV64I-NEXT: vse64.v v8, (a0)
1713 ; LMULMAX2-RV64I-NEXT: ret
1715 ; LMULMAX2-RV32F-LABEL: ctlz_zero_undef_v2i64:
1716 ; LMULMAX2-RV32F: # %bb.0:
1717 ; LMULMAX2-RV32F-NEXT: vsetivli zero, 2, e64, m1, ta, ma
1718 ; LMULMAX2-RV32F-NEXT: vle64.v v8, (a0)
1719 ; LMULMAX2-RV32F-NEXT: li a1, 190
1720 ; LMULMAX2-RV32F-NEXT: vmv.v.x v9, a1
1721 ; LMULMAX2-RV32F-NEXT: vsetvli zero, zero, e32, mf2, ta, ma
1722 ; LMULMAX2-RV32F-NEXT: fsrmi a1, 1
1723 ; LMULMAX2-RV32F-NEXT: vfncvt.f.xu.w v10, v8
1724 ; LMULMAX2-RV32F-NEXT: fsrm a1
1725 ; LMULMAX2-RV32F-NEXT: vsrl.vi v8, v10, 23
1726 ; LMULMAX2-RV32F-NEXT: vwsubu.wv v9, v9, v8
1727 ; LMULMAX2-RV32F-NEXT: vse64.v v9, (a0)
1728 ; LMULMAX2-RV32F-NEXT: ret
1730 ; LMULMAX2-RV64F-LABEL: ctlz_zero_undef_v2i64:
1731 ; LMULMAX2-RV64F: # %bb.0:
1732 ; LMULMAX2-RV64F-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
1733 ; LMULMAX2-RV64F-NEXT: vle64.v v8, (a0)
1734 ; LMULMAX2-RV64F-NEXT: li a1, 190
1735 ; LMULMAX2-RV64F-NEXT: vmv.v.x v9, a1
1736 ; LMULMAX2-RV64F-NEXT: fsrmi a1, 1
1737 ; LMULMAX2-RV64F-NEXT: vfncvt.f.xu.w v10, v8
1738 ; LMULMAX2-RV64F-NEXT: fsrm a1
1739 ; LMULMAX2-RV64F-NEXT: vsrl.vi v8, v10, 23
1740 ; LMULMAX2-RV64F-NEXT: vwsubu.vv v10, v9, v8
1741 ; LMULMAX2-RV64F-NEXT: vse64.v v10, (a0)
1742 ; LMULMAX2-RV64F-NEXT: ret
1744 ; LMULMAX2-RV32D-LABEL: ctlz_zero_undef_v2i64:
1745 ; LMULMAX2-RV32D: # %bb.0:
1746 ; LMULMAX2-RV32D-NEXT: vsetivli zero, 2, e64, m1, ta, ma
1747 ; LMULMAX2-RV32D-NEXT: vle64.v v8, (a0)
1748 ; LMULMAX2-RV32D-NEXT: fsrmi a1, 1
1749 ; LMULMAX2-RV32D-NEXT: vfcvt.f.xu.v v8, v8
1750 ; LMULMAX2-RV32D-NEXT: fsrm a1
1751 ; LMULMAX2-RV32D-NEXT: li a1, 52
1752 ; LMULMAX2-RV32D-NEXT: vsrl.vx v8, v8, a1
1753 ; LMULMAX2-RV32D-NEXT: li a1, 1086
1754 ; LMULMAX2-RV32D-NEXT: vrsub.vx v8, v8, a1
1755 ; LMULMAX2-RV32D-NEXT: vse64.v v8, (a0)
1756 ; LMULMAX2-RV32D-NEXT: ret
1758 ; LMULMAX2-RV64D-LABEL: ctlz_zero_undef_v2i64:
1759 ; LMULMAX2-RV64D: # %bb.0:
1760 ; LMULMAX2-RV64D-NEXT: vsetivli zero, 2, e64, m1, ta, ma
1761 ; LMULMAX2-RV64D-NEXT: vle64.v v8, (a0)
1762 ; LMULMAX2-RV64D-NEXT: fsrmi a1, 1
1763 ; LMULMAX2-RV64D-NEXT: vfcvt.f.xu.v v8, v8
1764 ; LMULMAX2-RV64D-NEXT: fsrm a1
1765 ; LMULMAX2-RV64D-NEXT: li a1, 52
1766 ; LMULMAX2-RV64D-NEXT: vsrl.vx v8, v8, a1
1767 ; LMULMAX2-RV64D-NEXT: li a1, 1086
1768 ; LMULMAX2-RV64D-NEXT: vrsub.vx v8, v8, a1
1769 ; LMULMAX2-RV64D-NEXT: vse64.v v8, (a0)
1770 ; LMULMAX2-RV64D-NEXT: ret
1772 ; LMULMAX8-LABEL: ctlz_zero_undef_v2i64:
1773 ; LMULMAX8: # %bb.0:
1774 ; LMULMAX8-NEXT: vsetivli zero, 2, e64, m1, ta, ma
1775 ; LMULMAX8-NEXT: vle64.v v8, (a0)
1776 ; LMULMAX8-NEXT: fsrmi a1, 1
1777 ; LMULMAX8-NEXT: vfcvt.f.xu.v v8, v8
1778 ; LMULMAX8-NEXT: fsrm a1
1779 ; LMULMAX8-NEXT: li a1, 52
1780 ; LMULMAX8-NEXT: vsrl.vx v8, v8, a1
1781 ; LMULMAX8-NEXT: li a1, 1086
1782 ; LMULMAX8-NEXT: vrsub.vx v8, v8, a1
1783 ; LMULMAX8-NEXT: vse64.v v8, (a0)
1784 ; LMULMAX8-NEXT: ret
1786 ; ZVBB-LABEL: ctlz_zero_undef_v2i64:
1788 ; ZVBB-NEXT: vsetivli zero, 2, e64, m1, ta, ma
1789 ; ZVBB-NEXT: vle64.v v8, (a0)
1790 ; ZVBB-NEXT: vclz.v v8, v8
1791 ; ZVBB-NEXT: vse64.v v8, (a0)
1793 %a = load <2 x i64>, ptr %x
1794 %b = load <2 x i64>, ptr %y
1795 %c = call <2 x i64> @llvm.ctlz.v2i64(<2 x i64> %a, i1 true)
1796 store <2 x i64> %c, ptr %x
1800 define void @ctlz_zero_undef_v32i8(ptr %x, ptr %y) nounwind {
1801 ; LMULMAX2-LABEL: ctlz_zero_undef_v32i8:
1802 ; LMULMAX2: # %bb.0:
1803 ; LMULMAX2-NEXT: li a1, 32
1804 ; LMULMAX2-NEXT: vsetvli zero, a1, e8, m2, ta, ma
1805 ; LMULMAX2-NEXT: vle8.v v8, (a0)
1806 ; LMULMAX2-NEXT: vsrl.vi v10, v8, 1
1807 ; LMULMAX2-NEXT: vor.vv v8, v8, v10
1808 ; LMULMAX2-NEXT: vsrl.vi v10, v8, 2
1809 ; LMULMAX2-NEXT: vor.vv v8, v8, v10
1810 ; LMULMAX2-NEXT: vsrl.vi v10, v8, 4
1811 ; LMULMAX2-NEXT: vor.vv v8, v8, v10
1812 ; LMULMAX2-NEXT: vnot.v v8, v8
1813 ; LMULMAX2-NEXT: vsrl.vi v10, v8, 1
1814 ; LMULMAX2-NEXT: li a1, 85
1815 ; LMULMAX2-NEXT: vand.vx v10, v10, a1
1816 ; LMULMAX2-NEXT: vsub.vv v8, v8, v10
1817 ; LMULMAX2-NEXT: li a1, 51
1818 ; LMULMAX2-NEXT: vand.vx v10, v8, a1
1819 ; LMULMAX2-NEXT: vsrl.vi v8, v8, 2
1820 ; LMULMAX2-NEXT: vand.vx v8, v8, a1
1821 ; LMULMAX2-NEXT: vadd.vv v8, v10, v8
1822 ; LMULMAX2-NEXT: vsrl.vi v10, v8, 4
1823 ; LMULMAX2-NEXT: vadd.vv v8, v8, v10
1824 ; LMULMAX2-NEXT: vand.vi v8, v8, 15
1825 ; LMULMAX2-NEXT: vse8.v v8, (a0)
1826 ; LMULMAX2-NEXT: ret
1828 ; LMULMAX1-LABEL: ctlz_zero_undef_v32i8:
1829 ; LMULMAX1: # %bb.0:
1830 ; LMULMAX1-NEXT: vsetivli zero, 16, e8, m1, ta, ma
1831 ; LMULMAX1-NEXT: addi a1, a0, 16
1832 ; LMULMAX1-NEXT: vle8.v v8, (a1)
1833 ; LMULMAX1-NEXT: vle8.v v9, (a0)
1834 ; LMULMAX1-NEXT: vsrl.vi v10, v8, 1
1835 ; LMULMAX1-NEXT: vor.vv v8, v8, v10
1836 ; LMULMAX1-NEXT: vsrl.vi v10, v8, 2
1837 ; LMULMAX1-NEXT: vor.vv v8, v8, v10
1838 ; LMULMAX1-NEXT: vsrl.vi v10, v8, 4
1839 ; LMULMAX1-NEXT: vor.vv v8, v8, v10
1840 ; LMULMAX1-NEXT: vnot.v v8, v8
1841 ; LMULMAX1-NEXT: vsrl.vi v10, v8, 1
1842 ; LMULMAX1-NEXT: li a2, 85
1843 ; LMULMAX1-NEXT: vand.vx v10, v10, a2
1844 ; LMULMAX1-NEXT: vsub.vv v8, v8, v10
1845 ; LMULMAX1-NEXT: li a3, 51
1846 ; LMULMAX1-NEXT: vand.vx v10, v8, a3
1847 ; LMULMAX1-NEXT: vsrl.vi v8, v8, 2
1848 ; LMULMAX1-NEXT: vand.vx v8, v8, a3
1849 ; LMULMAX1-NEXT: vadd.vv v8, v10, v8
1850 ; LMULMAX1-NEXT: vsrl.vi v10, v8, 4
1851 ; LMULMAX1-NEXT: vadd.vv v8, v8, v10
1852 ; LMULMAX1-NEXT: vand.vi v8, v8, 15
1853 ; LMULMAX1-NEXT: vsrl.vi v10, v9, 1
1854 ; LMULMAX1-NEXT: vor.vv v9, v9, v10
1855 ; LMULMAX1-NEXT: vsrl.vi v10, v9, 2
1856 ; LMULMAX1-NEXT: vor.vv v9, v9, v10
1857 ; LMULMAX1-NEXT: vsrl.vi v10, v9, 4
1858 ; LMULMAX1-NEXT: vor.vv v9, v9, v10
1859 ; LMULMAX1-NEXT: vnot.v v9, v9
1860 ; LMULMAX1-NEXT: vsrl.vi v10, v9, 1
1861 ; LMULMAX1-NEXT: vand.vx v10, v10, a2
1862 ; LMULMAX1-NEXT: vsub.vv v9, v9, v10
1863 ; LMULMAX1-NEXT: vand.vx v10, v9, a3
1864 ; LMULMAX1-NEXT: vsrl.vi v9, v9, 2
1865 ; LMULMAX1-NEXT: vand.vx v9, v9, a3
1866 ; LMULMAX1-NEXT: vadd.vv v9, v10, v9
1867 ; LMULMAX1-NEXT: vsrl.vi v10, v9, 4
1868 ; LMULMAX1-NEXT: vadd.vv v9, v9, v10
1869 ; LMULMAX1-NEXT: vand.vi v9, v9, 15
1870 ; LMULMAX1-NEXT: vse8.v v9, (a0)
1871 ; LMULMAX1-NEXT: vse8.v v8, (a1)
1872 ; LMULMAX1-NEXT: ret
1874 ; LMULMAX8-LABEL: ctlz_zero_undef_v32i8:
1875 ; LMULMAX8: # %bb.0:
1876 ; LMULMAX8-NEXT: li a1, 32
1877 ; LMULMAX8-NEXT: vsetvli zero, a1, e16, m4, ta, ma
1878 ; LMULMAX8-NEXT: vle8.v v8, (a0)
1879 ; LMULMAX8-NEXT: vzext.vf2 v12, v8
1880 ; LMULMAX8-NEXT: vfwcvt.f.xu.v v16, v12
1881 ; LMULMAX8-NEXT: vnsrl.wi v8, v16, 23
1882 ; LMULMAX8-NEXT: vsetvli zero, zero, e8, m2, ta, ma
1883 ; LMULMAX8-NEXT: vnsrl.wi v12, v8, 0
1884 ; LMULMAX8-NEXT: li a1, 134
1885 ; LMULMAX8-NEXT: vrsub.vx v8, v12, a1
1886 ; LMULMAX8-NEXT: vse8.v v8, (a0)
1887 ; LMULMAX8-NEXT: ret
1889 ; ZVBB-LABEL: ctlz_zero_undef_v32i8:
1891 ; ZVBB-NEXT: li a1, 32
1892 ; ZVBB-NEXT: vsetvli zero, a1, e8, m2, ta, ma
1893 ; ZVBB-NEXT: vle8.v v8, (a0)
1894 ; ZVBB-NEXT: vclz.v v8, v8
1895 ; ZVBB-NEXT: vse8.v v8, (a0)
1897 %a = load <32 x i8>, ptr %x
1898 %b = load <32 x i8>, ptr %y
1899 %c = call <32 x i8> @llvm.ctlz.v32i8(<32 x i8> %a, i1 true)
1900 store <32 x i8> %c, ptr %x
1904 define void @ctlz_zero_undef_v16i16(ptr %x, ptr %y) nounwind {
1905 ; LMULMAX2-LABEL: ctlz_zero_undef_v16i16:
1906 ; LMULMAX2: # %bb.0:
1907 ; LMULMAX2-NEXT: vsetivli zero, 16, e16, m2, ta, ma
1908 ; LMULMAX2-NEXT: vle16.v v8, (a0)
1909 ; LMULMAX2-NEXT: vsrl.vi v10, v8, 1
1910 ; LMULMAX2-NEXT: vor.vv v8, v8, v10
1911 ; LMULMAX2-NEXT: vsrl.vi v10, v8, 2
1912 ; LMULMAX2-NEXT: vor.vv v8, v8, v10
1913 ; LMULMAX2-NEXT: vsrl.vi v10, v8, 4
1914 ; LMULMAX2-NEXT: vor.vv v8, v8, v10
1915 ; LMULMAX2-NEXT: vsrl.vi v10, v8, 8
1916 ; LMULMAX2-NEXT: vor.vv v8, v8, v10
1917 ; LMULMAX2-NEXT: vnot.v v8, v8
1918 ; LMULMAX2-NEXT: vsrl.vi v10, v8, 1
1919 ; LMULMAX2-NEXT: lui a1, 5
1920 ; LMULMAX2-NEXT: addi a1, a1, 1365
1921 ; LMULMAX2-NEXT: vand.vx v10, v10, a1
1922 ; LMULMAX2-NEXT: vsub.vv v8, v8, v10
1923 ; LMULMAX2-NEXT: lui a1, 3
1924 ; LMULMAX2-NEXT: addi a1, a1, 819
1925 ; LMULMAX2-NEXT: vand.vx v10, v8, a1
1926 ; LMULMAX2-NEXT: vsrl.vi v8, v8, 2
1927 ; LMULMAX2-NEXT: vand.vx v8, v8, a1
1928 ; LMULMAX2-NEXT: vadd.vv v8, v10, v8
1929 ; LMULMAX2-NEXT: vsrl.vi v10, v8, 4
1930 ; LMULMAX2-NEXT: vadd.vv v8, v8, v10
1931 ; LMULMAX2-NEXT: lui a1, 1
1932 ; LMULMAX2-NEXT: addi a1, a1, -241
1933 ; LMULMAX2-NEXT: vand.vx v8, v8, a1
1934 ; LMULMAX2-NEXT: li a1, 257
1935 ; LMULMAX2-NEXT: vmul.vx v8, v8, a1
1936 ; LMULMAX2-NEXT: vsrl.vi v8, v8, 8
1937 ; LMULMAX2-NEXT: vse16.v v8, (a0)
1938 ; LMULMAX2-NEXT: ret
1940 ; LMULMAX1-LABEL: ctlz_zero_undef_v16i16:
1941 ; LMULMAX1: # %bb.0:
1942 ; LMULMAX1-NEXT: vsetivli zero, 8, e16, m1, ta, ma
1943 ; LMULMAX1-NEXT: addi a1, a0, 16
1944 ; LMULMAX1-NEXT: vle16.v v8, (a1)
1945 ; LMULMAX1-NEXT: vle16.v v9, (a0)
1946 ; LMULMAX1-NEXT: vsrl.vi v10, v8, 1
1947 ; LMULMAX1-NEXT: vor.vv v8, v8, v10
1948 ; LMULMAX1-NEXT: vsrl.vi v10, v8, 2
1949 ; LMULMAX1-NEXT: vor.vv v8, v8, v10
1950 ; LMULMAX1-NEXT: vsrl.vi v10, v8, 4
1951 ; LMULMAX1-NEXT: vor.vv v8, v8, v10
1952 ; LMULMAX1-NEXT: vsrl.vi v10, v8, 8
1953 ; LMULMAX1-NEXT: vor.vv v8, v8, v10
1954 ; LMULMAX1-NEXT: vnot.v v8, v8
1955 ; LMULMAX1-NEXT: vsrl.vi v10, v8, 1
1956 ; LMULMAX1-NEXT: lui a2, 5
1957 ; LMULMAX1-NEXT: addi a2, a2, 1365
1958 ; LMULMAX1-NEXT: vand.vx v10, v10, a2
1959 ; LMULMAX1-NEXT: vsub.vv v8, v8, v10
1960 ; LMULMAX1-NEXT: lui a3, 3
1961 ; LMULMAX1-NEXT: addi a3, a3, 819
1962 ; LMULMAX1-NEXT: vand.vx v10, v8, a3
1963 ; LMULMAX1-NEXT: vsrl.vi v8, v8, 2
1964 ; LMULMAX1-NEXT: vand.vx v8, v8, a3
1965 ; LMULMAX1-NEXT: vadd.vv v8, v10, v8
1966 ; LMULMAX1-NEXT: vsrl.vi v10, v8, 4
1967 ; LMULMAX1-NEXT: vadd.vv v8, v8, v10
1968 ; LMULMAX1-NEXT: lui a4, 1
1969 ; LMULMAX1-NEXT: addi a4, a4, -241
1970 ; LMULMAX1-NEXT: vand.vx v8, v8, a4
1971 ; LMULMAX1-NEXT: li a5, 257
1972 ; LMULMAX1-NEXT: vmul.vx v8, v8, a5
1973 ; LMULMAX1-NEXT: vsrl.vi v8, v8, 8
1974 ; LMULMAX1-NEXT: vsrl.vi v10, v9, 1
1975 ; LMULMAX1-NEXT: vor.vv v9, v9, v10
1976 ; LMULMAX1-NEXT: vsrl.vi v10, v9, 2
1977 ; LMULMAX1-NEXT: vor.vv v9, v9, v10
1978 ; LMULMAX1-NEXT: vsrl.vi v10, v9, 4
1979 ; LMULMAX1-NEXT: vor.vv v9, v9, v10
1980 ; LMULMAX1-NEXT: vsrl.vi v10, v9, 8
1981 ; LMULMAX1-NEXT: vor.vv v9, v9, v10
1982 ; LMULMAX1-NEXT: vnot.v v9, v9
1983 ; LMULMAX1-NEXT: vsrl.vi v10, v9, 1
1984 ; LMULMAX1-NEXT: vand.vx v10, v10, a2
1985 ; LMULMAX1-NEXT: vsub.vv v9, v9, v10
1986 ; LMULMAX1-NEXT: vand.vx v10, v9, a3
1987 ; LMULMAX1-NEXT: vsrl.vi v9, v9, 2
1988 ; LMULMAX1-NEXT: vand.vx v9, v9, a3
1989 ; LMULMAX1-NEXT: vadd.vv v9, v10, v9
1990 ; LMULMAX1-NEXT: vsrl.vi v10, v9, 4
1991 ; LMULMAX1-NEXT: vadd.vv v9, v9, v10
1992 ; LMULMAX1-NEXT: vand.vx v9, v9, a4
1993 ; LMULMAX1-NEXT: vmul.vx v9, v9, a5
1994 ; LMULMAX1-NEXT: vsrl.vi v9, v9, 8
1995 ; LMULMAX1-NEXT: vse16.v v9, (a0)
1996 ; LMULMAX1-NEXT: vse16.v v8, (a1)
1997 ; LMULMAX1-NEXT: ret
1999 ; LMULMAX8-LABEL: ctlz_zero_undef_v16i16:
2000 ; LMULMAX8: # %bb.0:
2001 ; LMULMAX8-NEXT: vsetivli zero, 16, e16, m2, ta, ma
2002 ; LMULMAX8-NEXT: vle16.v v8, (a0)
2003 ; LMULMAX8-NEXT: vfwcvt.f.xu.v v12, v8
2004 ; LMULMAX8-NEXT: vnsrl.wi v8, v12, 23
2005 ; LMULMAX8-NEXT: li a1, 142
2006 ; LMULMAX8-NEXT: vrsub.vx v8, v8, a1
2007 ; LMULMAX8-NEXT: vse16.v v8, (a0)
2008 ; LMULMAX8-NEXT: ret
2010 ; ZVBB-LABEL: ctlz_zero_undef_v16i16:
2012 ; ZVBB-NEXT: vsetivli zero, 16, e16, m2, ta, ma
2013 ; ZVBB-NEXT: vle16.v v8, (a0)
2014 ; ZVBB-NEXT: vclz.v v8, v8
2015 ; ZVBB-NEXT: vse16.v v8, (a0)
2017 %a = load <16 x i16>, ptr %x
2018 %b = load <16 x i16>, ptr %y
2019 %c = call <16 x i16> @llvm.ctlz.v16i16(<16 x i16> %a, i1 true)
2020 store <16 x i16> %c, ptr %x
2024 define void @ctlz_zero_undef_v8i32(ptr %x, ptr %y) nounwind {
2025 ; LMULMAX2-RV32I-LABEL: ctlz_zero_undef_v8i32:
2026 ; LMULMAX2-RV32I: # %bb.0:
2027 ; LMULMAX2-RV32I-NEXT: vsetivli zero, 8, e32, m2, ta, ma
2028 ; LMULMAX2-RV32I-NEXT: vle32.v v8, (a0)
2029 ; LMULMAX2-RV32I-NEXT: vsrl.vi v10, v8, 1
2030 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v10
2031 ; LMULMAX2-RV32I-NEXT: vsrl.vi v10, v8, 2
2032 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v10
2033 ; LMULMAX2-RV32I-NEXT: vsrl.vi v10, v8, 4
2034 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v10
2035 ; LMULMAX2-RV32I-NEXT: vsrl.vi v10, v8, 8
2036 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v10
2037 ; LMULMAX2-RV32I-NEXT: vsrl.vi v10, v8, 16
2038 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v10
2039 ; LMULMAX2-RV32I-NEXT: vnot.v v8, v8
2040 ; LMULMAX2-RV32I-NEXT: vsrl.vi v10, v8, 1
2041 ; LMULMAX2-RV32I-NEXT: lui a1, 349525
2042 ; LMULMAX2-RV32I-NEXT: addi a1, a1, 1365
2043 ; LMULMAX2-RV32I-NEXT: vand.vx v10, v10, a1
2044 ; LMULMAX2-RV32I-NEXT: vsub.vv v8, v8, v10
2045 ; LMULMAX2-RV32I-NEXT: lui a1, 209715
2046 ; LMULMAX2-RV32I-NEXT: addi a1, a1, 819
2047 ; LMULMAX2-RV32I-NEXT: vand.vx v10, v8, a1
2048 ; LMULMAX2-RV32I-NEXT: vsrl.vi v8, v8, 2
2049 ; LMULMAX2-RV32I-NEXT: vand.vx v8, v8, a1
2050 ; LMULMAX2-RV32I-NEXT: vadd.vv v8, v10, v8
2051 ; LMULMAX2-RV32I-NEXT: vsrl.vi v10, v8, 4
2052 ; LMULMAX2-RV32I-NEXT: vadd.vv v8, v8, v10
2053 ; LMULMAX2-RV32I-NEXT: lui a1, 61681
2054 ; LMULMAX2-RV32I-NEXT: addi a1, a1, -241
2055 ; LMULMAX2-RV32I-NEXT: vand.vx v8, v8, a1
2056 ; LMULMAX2-RV32I-NEXT: lui a1, 4112
2057 ; LMULMAX2-RV32I-NEXT: addi a1, a1, 257
2058 ; LMULMAX2-RV32I-NEXT: vmul.vx v8, v8, a1
2059 ; LMULMAX2-RV32I-NEXT: vsrl.vi v8, v8, 24
2060 ; LMULMAX2-RV32I-NEXT: vse32.v v8, (a0)
2061 ; LMULMAX2-RV32I-NEXT: ret
2063 ; LMULMAX2-RV64I-LABEL: ctlz_zero_undef_v8i32:
2064 ; LMULMAX2-RV64I: # %bb.0:
2065 ; LMULMAX2-RV64I-NEXT: vsetivli zero, 8, e32, m2, ta, ma
2066 ; LMULMAX2-RV64I-NEXT: vle32.v v8, (a0)
2067 ; LMULMAX2-RV64I-NEXT: vsrl.vi v10, v8, 1
2068 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v10
2069 ; LMULMAX2-RV64I-NEXT: vsrl.vi v10, v8, 2
2070 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v10
2071 ; LMULMAX2-RV64I-NEXT: vsrl.vi v10, v8, 4
2072 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v10
2073 ; LMULMAX2-RV64I-NEXT: vsrl.vi v10, v8, 8
2074 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v10
2075 ; LMULMAX2-RV64I-NEXT: vsrl.vi v10, v8, 16
2076 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v10
2077 ; LMULMAX2-RV64I-NEXT: vnot.v v8, v8
2078 ; LMULMAX2-RV64I-NEXT: vsrl.vi v10, v8, 1
2079 ; LMULMAX2-RV64I-NEXT: lui a1, 349525
2080 ; LMULMAX2-RV64I-NEXT: addi a1, a1, 1365
2081 ; LMULMAX2-RV64I-NEXT: vand.vx v10, v10, a1
2082 ; LMULMAX2-RV64I-NEXT: vsub.vv v8, v8, v10
2083 ; LMULMAX2-RV64I-NEXT: lui a1, 209715
2084 ; LMULMAX2-RV64I-NEXT: addi a1, a1, 819
2085 ; LMULMAX2-RV64I-NEXT: vand.vx v10, v8, a1
2086 ; LMULMAX2-RV64I-NEXT: vsrl.vi v8, v8, 2
2087 ; LMULMAX2-RV64I-NEXT: vand.vx v8, v8, a1
2088 ; LMULMAX2-RV64I-NEXT: vadd.vv v8, v10, v8
2089 ; LMULMAX2-RV64I-NEXT: vsrl.vi v10, v8, 4
2090 ; LMULMAX2-RV64I-NEXT: vadd.vv v8, v8, v10
2091 ; LMULMAX2-RV64I-NEXT: lui a1, 61681
2092 ; LMULMAX2-RV64I-NEXT: addi a1, a1, -241
2093 ; LMULMAX2-RV64I-NEXT: vand.vx v8, v8, a1
2094 ; LMULMAX2-RV64I-NEXT: lui a1, 4112
2095 ; LMULMAX2-RV64I-NEXT: addi a1, a1, 257
2096 ; LMULMAX2-RV64I-NEXT: vmul.vx v8, v8, a1
2097 ; LMULMAX2-RV64I-NEXT: vsrl.vi v8, v8, 24
2098 ; LMULMAX2-RV64I-NEXT: vse32.v v8, (a0)
2099 ; LMULMAX2-RV64I-NEXT: ret
2101 ; LMULMAX2-RV32F-LABEL: ctlz_zero_undef_v8i32:
2102 ; LMULMAX2-RV32F: # %bb.0:
2103 ; LMULMAX2-RV32F-NEXT: vsetivli zero, 8, e32, m2, ta, ma
2104 ; LMULMAX2-RV32F-NEXT: vle32.v v8, (a0)
2105 ; LMULMAX2-RV32F-NEXT: fsrmi a1, 1
2106 ; LMULMAX2-RV32F-NEXT: vfcvt.f.xu.v v8, v8
2107 ; LMULMAX2-RV32F-NEXT: fsrm a1
2108 ; LMULMAX2-RV32F-NEXT: vsrl.vi v8, v8, 23
2109 ; LMULMAX2-RV32F-NEXT: li a1, 158
2110 ; LMULMAX2-RV32F-NEXT: vrsub.vx v8, v8, a1
2111 ; LMULMAX2-RV32F-NEXT: vse32.v v8, (a0)
2112 ; LMULMAX2-RV32F-NEXT: ret
2114 ; LMULMAX2-RV64F-LABEL: ctlz_zero_undef_v8i32:
2115 ; LMULMAX2-RV64F: # %bb.0:
2116 ; LMULMAX2-RV64F-NEXT: vsetivli zero, 8, e32, m2, ta, ma
2117 ; LMULMAX2-RV64F-NEXT: vle32.v v8, (a0)
2118 ; LMULMAX2-RV64F-NEXT: fsrmi a1, 1
2119 ; LMULMAX2-RV64F-NEXT: vfcvt.f.xu.v v8, v8
2120 ; LMULMAX2-RV64F-NEXT: fsrm a1
2121 ; LMULMAX2-RV64F-NEXT: vsrl.vi v8, v8, 23
2122 ; LMULMAX2-RV64F-NEXT: li a1, 158
2123 ; LMULMAX2-RV64F-NEXT: vrsub.vx v8, v8, a1
2124 ; LMULMAX2-RV64F-NEXT: vse32.v v8, (a0)
2125 ; LMULMAX2-RV64F-NEXT: ret
2127 ; LMULMAX2-RV32D-LABEL: ctlz_zero_undef_v8i32:
2128 ; LMULMAX2-RV32D: # %bb.0:
2129 ; LMULMAX2-RV32D-NEXT: vsetivli zero, 8, e32, m2, ta, ma
2130 ; LMULMAX2-RV32D-NEXT: vle32.v v8, (a0)
2131 ; LMULMAX2-RV32D-NEXT: fsrmi a1, 1
2132 ; LMULMAX2-RV32D-NEXT: vfcvt.f.xu.v v8, v8
2133 ; LMULMAX2-RV32D-NEXT: fsrm a1
2134 ; LMULMAX2-RV32D-NEXT: vsrl.vi v8, v8, 23
2135 ; LMULMAX2-RV32D-NEXT: li a1, 158
2136 ; LMULMAX2-RV32D-NEXT: vrsub.vx v8, v8, a1
2137 ; LMULMAX2-RV32D-NEXT: vse32.v v8, (a0)
2138 ; LMULMAX2-RV32D-NEXT: ret
2140 ; LMULMAX2-RV64D-LABEL: ctlz_zero_undef_v8i32:
2141 ; LMULMAX2-RV64D: # %bb.0:
2142 ; LMULMAX2-RV64D-NEXT: vsetivli zero, 8, e32, m2, ta, ma
2143 ; LMULMAX2-RV64D-NEXT: vle32.v v8, (a0)
2144 ; LMULMAX2-RV64D-NEXT: fsrmi a1, 1
2145 ; LMULMAX2-RV64D-NEXT: vfcvt.f.xu.v v8, v8
2146 ; LMULMAX2-RV64D-NEXT: fsrm a1
2147 ; LMULMAX2-RV64D-NEXT: vsrl.vi v8, v8, 23
2148 ; LMULMAX2-RV64D-NEXT: li a1, 158
2149 ; LMULMAX2-RV64D-NEXT: vrsub.vx v8, v8, a1
2150 ; LMULMAX2-RV64D-NEXT: vse32.v v8, (a0)
2151 ; LMULMAX2-RV64D-NEXT: ret
2153 ; LMULMAX8-LABEL: ctlz_zero_undef_v8i32:
2154 ; LMULMAX8: # %bb.0:
2155 ; LMULMAX8-NEXT: vsetivli zero, 8, e32, m2, ta, ma
2156 ; LMULMAX8-NEXT: vle32.v v8, (a0)
2157 ; LMULMAX8-NEXT: vfwcvt.f.xu.v v12, v8
2158 ; LMULMAX8-NEXT: li a1, 52
2159 ; LMULMAX8-NEXT: vnsrl.wx v8, v12, a1
2160 ; LMULMAX8-NEXT: li a1, 1054
2161 ; LMULMAX8-NEXT: vrsub.vx v8, v8, a1
2162 ; LMULMAX8-NEXT: vse32.v v8, (a0)
2163 ; LMULMAX8-NEXT: ret
2165 ; ZVBB-LABEL: ctlz_zero_undef_v8i32:
2167 ; ZVBB-NEXT: vsetivli zero, 8, e32, m2, ta, ma
2168 ; ZVBB-NEXT: vle32.v v8, (a0)
2169 ; ZVBB-NEXT: vclz.v v8, v8
2170 ; ZVBB-NEXT: vse32.v v8, (a0)
2172 %a = load <8 x i32>, ptr %x
2173 %b = load <8 x i32>, ptr %y
2174 %c = call <8 x i32> @llvm.ctlz.v8i32(<8 x i32> %a, i1 true)
2175 store <8 x i32> %c, ptr %x
2179 define void @ctlz_zero_undef_v4i64(ptr %x, ptr %y) nounwind {
2180 ; LMULMAX2-RV32I-LABEL: ctlz_zero_undef_v4i64:
2181 ; LMULMAX2-RV32I: # %bb.0:
2182 ; LMULMAX2-RV32I-NEXT: vsetivli zero, 4, e64, m2, ta, ma
2183 ; LMULMAX2-RV32I-NEXT: vle64.v v8, (a0)
2184 ; LMULMAX2-RV32I-NEXT: vsrl.vi v10, v8, 1
2185 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v10
2186 ; LMULMAX2-RV32I-NEXT: vsrl.vi v10, v8, 2
2187 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v10
2188 ; LMULMAX2-RV32I-NEXT: vsrl.vi v10, v8, 4
2189 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v10
2190 ; LMULMAX2-RV32I-NEXT: vsrl.vi v10, v8, 8
2191 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v10
2192 ; LMULMAX2-RV32I-NEXT: vsrl.vi v10, v8, 16
2193 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v10
2194 ; LMULMAX2-RV32I-NEXT: li a1, 32
2195 ; LMULMAX2-RV32I-NEXT: vsrl.vx v10, v8, a1
2196 ; LMULMAX2-RV32I-NEXT: vor.vv v8, v8, v10
2197 ; LMULMAX2-RV32I-NEXT: vnot.v v8, v8
2198 ; LMULMAX2-RV32I-NEXT: vsrl.vi v10, v8, 1
2199 ; LMULMAX2-RV32I-NEXT: lui a1, 349525
2200 ; LMULMAX2-RV32I-NEXT: addi a1, a1, 1365
2201 ; LMULMAX2-RV32I-NEXT: vsetvli a2, zero, e32, m2, ta, ma
2202 ; LMULMAX2-RV32I-NEXT: vmv.v.x v12, a1
2203 ; LMULMAX2-RV32I-NEXT: vsetivli zero, 4, e64, m2, ta, ma
2204 ; LMULMAX2-RV32I-NEXT: vand.vv v10, v10, v12
2205 ; LMULMAX2-RV32I-NEXT: vsub.vv v8, v8, v10
2206 ; LMULMAX2-RV32I-NEXT: lui a1, 209715
2207 ; LMULMAX2-RV32I-NEXT: addi a1, a1, 819
2208 ; LMULMAX2-RV32I-NEXT: vsetvli a2, zero, e32, m2, ta, ma
2209 ; LMULMAX2-RV32I-NEXT: vmv.v.x v10, a1
2210 ; LMULMAX2-RV32I-NEXT: vsetivli zero, 4, e64, m2, ta, ma
2211 ; LMULMAX2-RV32I-NEXT: vand.vv v12, v8, v10
2212 ; LMULMAX2-RV32I-NEXT: vsrl.vi v8, v8, 2
2213 ; LMULMAX2-RV32I-NEXT: vand.vv v8, v8, v10
2214 ; LMULMAX2-RV32I-NEXT: vadd.vv v8, v12, v8
2215 ; LMULMAX2-RV32I-NEXT: vsrl.vi v10, v8, 4
2216 ; LMULMAX2-RV32I-NEXT: vadd.vv v8, v8, v10
2217 ; LMULMAX2-RV32I-NEXT: lui a1, 61681
2218 ; LMULMAX2-RV32I-NEXT: addi a1, a1, -241
2219 ; LMULMAX2-RV32I-NEXT: vsetvli a2, zero, e32, m2, ta, ma
2220 ; LMULMAX2-RV32I-NEXT: vmv.v.x v10, a1
2221 ; LMULMAX2-RV32I-NEXT: vsetivli zero, 4, e64, m2, ta, ma
2222 ; LMULMAX2-RV32I-NEXT: vand.vv v8, v8, v10
2223 ; LMULMAX2-RV32I-NEXT: lui a1, 4112
2224 ; LMULMAX2-RV32I-NEXT: addi a1, a1, 257
2225 ; LMULMAX2-RV32I-NEXT: vsetvli a2, zero, e32, m2, ta, ma
2226 ; LMULMAX2-RV32I-NEXT: vmv.v.x v10, a1
2227 ; LMULMAX2-RV32I-NEXT: vsetivli zero, 4, e64, m2, ta, ma
2228 ; LMULMAX2-RV32I-NEXT: vmul.vv v8, v8, v10
2229 ; LMULMAX2-RV32I-NEXT: li a1, 56
2230 ; LMULMAX2-RV32I-NEXT: vsrl.vx v8, v8, a1
2231 ; LMULMAX2-RV32I-NEXT: vse64.v v8, (a0)
2232 ; LMULMAX2-RV32I-NEXT: ret
2234 ; LMULMAX2-RV64I-LABEL: ctlz_zero_undef_v4i64:
2235 ; LMULMAX2-RV64I: # %bb.0:
2236 ; LMULMAX2-RV64I-NEXT: vsetivli zero, 4, e64, m2, ta, ma
2237 ; LMULMAX2-RV64I-NEXT: vle64.v v8, (a0)
2238 ; LMULMAX2-RV64I-NEXT: vsrl.vi v10, v8, 1
2239 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v10
2240 ; LMULMAX2-RV64I-NEXT: vsrl.vi v10, v8, 2
2241 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v10
2242 ; LMULMAX2-RV64I-NEXT: vsrl.vi v10, v8, 4
2243 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v10
2244 ; LMULMAX2-RV64I-NEXT: vsrl.vi v10, v8, 8
2245 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v10
2246 ; LMULMAX2-RV64I-NEXT: vsrl.vi v10, v8, 16
2247 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v10
2248 ; LMULMAX2-RV64I-NEXT: li a1, 32
2249 ; LMULMAX2-RV64I-NEXT: vsrl.vx v10, v8, a1
2250 ; LMULMAX2-RV64I-NEXT: vor.vv v8, v8, v10
2251 ; LMULMAX2-RV64I-NEXT: vnot.v v8, v8
2252 ; LMULMAX2-RV64I-NEXT: vsrl.vi v10, v8, 1
2253 ; LMULMAX2-RV64I-NEXT: lui a1, 349525
2254 ; LMULMAX2-RV64I-NEXT: addiw a1, a1, 1365
2255 ; LMULMAX2-RV64I-NEXT: slli a2, a1, 32
2256 ; LMULMAX2-RV64I-NEXT: add a1, a1, a2
2257 ; LMULMAX2-RV64I-NEXT: vand.vx v10, v10, a1
2258 ; LMULMAX2-RV64I-NEXT: vsub.vv v8, v8, v10
2259 ; LMULMAX2-RV64I-NEXT: lui a1, 209715
2260 ; LMULMAX2-RV64I-NEXT: addiw a1, a1, 819
2261 ; LMULMAX2-RV64I-NEXT: slli a2, a1, 32
2262 ; LMULMAX2-RV64I-NEXT: add a1, a1, a2
2263 ; LMULMAX2-RV64I-NEXT: vand.vx v10, v8, a1
2264 ; LMULMAX2-RV64I-NEXT: vsrl.vi v8, v8, 2
2265 ; LMULMAX2-RV64I-NEXT: vand.vx v8, v8, a1
2266 ; LMULMAX2-RV64I-NEXT: vadd.vv v8, v10, v8
2267 ; LMULMAX2-RV64I-NEXT: vsrl.vi v10, v8, 4
2268 ; LMULMAX2-RV64I-NEXT: vadd.vv v8, v8, v10
2269 ; LMULMAX2-RV64I-NEXT: lui a1, 61681
2270 ; LMULMAX2-RV64I-NEXT: addiw a1, a1, -241
2271 ; LMULMAX2-RV64I-NEXT: slli a2, a1, 32
2272 ; LMULMAX2-RV64I-NEXT: add a1, a1, a2
2273 ; LMULMAX2-RV64I-NEXT: vand.vx v8, v8, a1
2274 ; LMULMAX2-RV64I-NEXT: lui a1, 4112
2275 ; LMULMAX2-RV64I-NEXT: addiw a1, a1, 257
2276 ; LMULMAX2-RV64I-NEXT: slli a2, a1, 32
2277 ; LMULMAX2-RV64I-NEXT: add a1, a1, a2
2278 ; LMULMAX2-RV64I-NEXT: vmul.vx v8, v8, a1
2279 ; LMULMAX2-RV64I-NEXT: li a1, 56
2280 ; LMULMAX2-RV64I-NEXT: vsrl.vx v8, v8, a1
2281 ; LMULMAX2-RV64I-NEXT: vse64.v v8, (a0)
2282 ; LMULMAX2-RV64I-NEXT: ret
2284 ; LMULMAX2-RV32F-LABEL: ctlz_zero_undef_v4i64:
2285 ; LMULMAX2-RV32F: # %bb.0:
2286 ; LMULMAX2-RV32F-NEXT: vsetivli zero, 4, e64, m2, ta, ma
2287 ; LMULMAX2-RV32F-NEXT: vle64.v v8, (a0)
2288 ; LMULMAX2-RV32F-NEXT: li a1, 190
2289 ; LMULMAX2-RV32F-NEXT: vmv.v.x v10, a1
2290 ; LMULMAX2-RV32F-NEXT: vsetvli zero, zero, e32, m1, ta, ma
2291 ; LMULMAX2-RV32F-NEXT: fsrmi a1, 1
2292 ; LMULMAX2-RV32F-NEXT: vfncvt.f.xu.w v12, v8
2293 ; LMULMAX2-RV32F-NEXT: fsrm a1
2294 ; LMULMAX2-RV32F-NEXT: vsrl.vi v8, v12, 23
2295 ; LMULMAX2-RV32F-NEXT: vwsubu.wv v10, v10, v8
2296 ; LMULMAX2-RV32F-NEXT: vse64.v v10, (a0)
2297 ; LMULMAX2-RV32F-NEXT: ret
2299 ; LMULMAX2-RV64F-LABEL: ctlz_zero_undef_v4i64:
2300 ; LMULMAX2-RV64F: # %bb.0:
2301 ; LMULMAX2-RV64F-NEXT: vsetivli zero, 4, e32, m1, ta, ma
2302 ; LMULMAX2-RV64F-NEXT: vle64.v v8, (a0)
2303 ; LMULMAX2-RV64F-NEXT: li a1, 190
2304 ; LMULMAX2-RV64F-NEXT: vmv.v.x v10, a1
2305 ; LMULMAX2-RV64F-NEXT: fsrmi a1, 1
2306 ; LMULMAX2-RV64F-NEXT: vfncvt.f.xu.w v11, v8
2307 ; LMULMAX2-RV64F-NEXT: fsrm a1
2308 ; LMULMAX2-RV64F-NEXT: vsrl.vi v8, v11, 23
2309 ; LMULMAX2-RV64F-NEXT: vwsubu.vv v12, v10, v8
2310 ; LMULMAX2-RV64F-NEXT: vse64.v v12, (a0)
2311 ; LMULMAX2-RV64F-NEXT: ret
2313 ; LMULMAX2-RV32D-LABEL: ctlz_zero_undef_v4i64:
2314 ; LMULMAX2-RV32D: # %bb.0:
2315 ; LMULMAX2-RV32D-NEXT: vsetivli zero, 4, e64, m2, ta, ma
2316 ; LMULMAX2-RV32D-NEXT: vle64.v v8, (a0)
2317 ; LMULMAX2-RV32D-NEXT: fsrmi a1, 1
2318 ; LMULMAX2-RV32D-NEXT: vfcvt.f.xu.v v8, v8
2319 ; LMULMAX2-RV32D-NEXT: fsrm a1
2320 ; LMULMAX2-RV32D-NEXT: li a1, 52
2321 ; LMULMAX2-RV32D-NEXT: vsrl.vx v8, v8, a1
2322 ; LMULMAX2-RV32D-NEXT: li a1, 1086
2323 ; LMULMAX2-RV32D-NEXT: vrsub.vx v8, v8, a1
2324 ; LMULMAX2-RV32D-NEXT: vse64.v v8, (a0)
2325 ; LMULMAX2-RV32D-NEXT: ret
2327 ; LMULMAX2-RV64D-LABEL: ctlz_zero_undef_v4i64:
2328 ; LMULMAX2-RV64D: # %bb.0:
2329 ; LMULMAX2-RV64D-NEXT: vsetivli zero, 4, e64, m2, ta, ma
2330 ; LMULMAX2-RV64D-NEXT: vle64.v v8, (a0)
2331 ; LMULMAX2-RV64D-NEXT: fsrmi a1, 1
2332 ; LMULMAX2-RV64D-NEXT: vfcvt.f.xu.v v8, v8
2333 ; LMULMAX2-RV64D-NEXT: fsrm a1
2334 ; LMULMAX2-RV64D-NEXT: li a1, 52
2335 ; LMULMAX2-RV64D-NEXT: vsrl.vx v8, v8, a1
2336 ; LMULMAX2-RV64D-NEXT: li a1, 1086
2337 ; LMULMAX2-RV64D-NEXT: vrsub.vx v8, v8, a1
2338 ; LMULMAX2-RV64D-NEXT: vse64.v v8, (a0)
2339 ; LMULMAX2-RV64D-NEXT: ret
2341 ; LMULMAX8-LABEL: ctlz_zero_undef_v4i64:
2342 ; LMULMAX8: # %bb.0:
2343 ; LMULMAX8-NEXT: vsetivli zero, 4, e64, m2, ta, ma
2344 ; LMULMAX8-NEXT: vle64.v v8, (a0)
2345 ; LMULMAX8-NEXT: fsrmi a1, 1
2346 ; LMULMAX8-NEXT: vfcvt.f.xu.v v8, v8
2347 ; LMULMAX8-NEXT: fsrm a1
2348 ; LMULMAX8-NEXT: li a1, 52
2349 ; LMULMAX8-NEXT: vsrl.vx v8, v8, a1
2350 ; LMULMAX8-NEXT: li a1, 1086
2351 ; LMULMAX8-NEXT: vrsub.vx v8, v8, a1
2352 ; LMULMAX8-NEXT: vse64.v v8, (a0)
2353 ; LMULMAX8-NEXT: ret
2355 ; ZVBB-LABEL: ctlz_zero_undef_v4i64:
2357 ; ZVBB-NEXT: vsetivli zero, 4, e64, m2, ta, ma
2358 ; ZVBB-NEXT: vle64.v v8, (a0)
2359 ; ZVBB-NEXT: vclz.v v8, v8
2360 ; ZVBB-NEXT: vse64.v v8, (a0)
2362 %a = load <4 x i64>, ptr %x
2363 %b = load <4 x i64>, ptr %y
2364 %c = call <4 x i64> @llvm.ctlz.v4i64(<4 x i64> %a, i1 true)
2365 store <4 x i64> %c, ptr %x
2368 ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
2369 ; LMULMAX1-RV32: {{.*}}
2370 ; LMULMAX1-RV64: {{.*}}
2371 ; LMULMAX2-RV32: {{.*}}
2372 ; LMULMAX2-RV64: {{.*}}