1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
2 ; RUN: llc -mtriple=riscv32 -mattr=+v -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,RV32
3 ; RUN: llc -mtriple=riscv64 -mattr=+v -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,RV64
5 define <8 x i8> @vaaddu_vv_v8i8_floor(<8 x i8> %x, <8 x i8> %y) {
6 ; CHECK-LABEL: vaaddu_vv_v8i8_floor:
8 ; CHECK-NEXT: csrwi vxrm, 2
9 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
10 ; CHECK-NEXT: vaaddu.vv v8, v8, v9
12 %xzv = zext <8 x i8> %x to <8 x i16>
13 %yzv = zext <8 x i8> %y to <8 x i16>
14 %add = add nuw nsw <8 x i16> %xzv, %yzv
15 %div = lshr <8 x i16> %add, <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>
16 %ret = trunc <8 x i16> %div to <8 x i8>
20 define <8 x i8> @vaaddu_vx_v8i8_floor(<8 x i8> %x, i8 %y) {
21 ; CHECK-LABEL: vaaddu_vx_v8i8_floor:
23 ; CHECK-NEXT: csrwi vxrm, 2
24 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
25 ; CHECK-NEXT: vaaddu.vx v8, v8, a0
27 %xzv = zext <8 x i8> %x to <8 x i16>
28 %yhead = insertelement <8 x i8> poison, i8 %y, i32 0
29 %ysplat = shufflevector <8 x i8> %yhead, <8 x i8> poison, <8 x i32> zeroinitializer
30 %yzv = zext <8 x i8> %ysplat to <8 x i16>
31 %add = add nuw nsw <8 x i16> %xzv, %yzv
32 %div = lshr <8 x i16> %add, splat (i16 1)
33 %ret = trunc <8 x i16> %div to <8 x i8>
38 define <8 x i8> @vaaddu_vv_v8i8_floor_sexti16(<8 x i8> %x, <8 x i8> %y) {
39 ; CHECK-LABEL: vaaddu_vv_v8i8_floor_sexti16:
41 ; CHECK-NEXT: csrwi vxrm, 2
42 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
43 ; CHECK-NEXT: vaadd.vv v8, v8, v9
45 %xzv = sext <8 x i8> %x to <8 x i16>
46 %yzv = sext <8 x i8> %y to <8 x i16>
47 %add = add nuw nsw <8 x i16> %xzv, %yzv
48 %div = lshr <8 x i16> %add, <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>
49 %ret = trunc <8 x i16> %div to <8 x i8>
53 define <8 x i8> @vaaddu_vv_v8i8_floor_zexti32(<8 x i8> %x, <8 x i8> %y) {
54 ; CHECK-LABEL: vaaddu_vv_v8i8_floor_zexti32:
56 ; CHECK-NEXT: csrwi vxrm, 2
57 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
58 ; CHECK-NEXT: vaaddu.vv v8, v8, v9
60 %xzv = zext <8 x i8> %x to <8 x i32>
61 %yzv = zext <8 x i8> %y to <8 x i32>
62 %add = add nuw nsw <8 x i32> %xzv, %yzv
63 %div = lshr <8 x i32> %add, <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
64 %ret = trunc <8 x i32> %div to <8 x i8>
68 define <8 x i8> @vaaddu_vv_v8i8_floor_lshr2(<8 x i8> %x, <8 x i8> %y) {
69 ; CHECK-LABEL: vaaddu_vv_v8i8_floor_lshr2:
71 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
72 ; CHECK-NEXT: vwaddu.vv v10, v8, v9
73 ; CHECK-NEXT: vnsrl.wi v8, v10, 2
75 %xzv = zext <8 x i8> %x to <8 x i16>
76 %yzv = zext <8 x i8> %y to <8 x i16>
77 %add = add nuw nsw <8 x i16> %xzv, %yzv
78 %div = lshr <8 x i16> %add, <i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2>
79 %ret = trunc <8 x i16> %div to <8 x i8>
83 define <8 x i16> @vaaddu_vv_v8i16_floor(<8 x i16> %x, <8 x i16> %y) {
84 ; CHECK-LABEL: vaaddu_vv_v8i16_floor:
86 ; CHECK-NEXT: csrwi vxrm, 2
87 ; CHECK-NEXT: vsetivli zero, 8, e16, m1, ta, ma
88 ; CHECK-NEXT: vaaddu.vv v8, v8, v9
90 %xzv = zext <8 x i16> %x to <8 x i32>
91 %yzv = zext <8 x i16> %y to <8 x i32>
92 %add = add nuw nsw <8 x i32> %xzv, %yzv
93 %div = lshr <8 x i32> %add, <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
94 %ret = trunc <8 x i32> %div to <8 x i16>
98 define <8 x i16> @vaaddu_vx_v8i16_floor(<8 x i16> %x, i16 %y) {
99 ; CHECK-LABEL: vaaddu_vx_v8i16_floor:
101 ; CHECK-NEXT: csrwi vxrm, 2
102 ; CHECK-NEXT: vsetivli zero, 8, e16, m1, ta, ma
103 ; CHECK-NEXT: vaaddu.vx v8, v8, a0
105 %xzv = zext <8 x i16> %x to <8 x i32>
106 %yhead = insertelement <8 x i16> poison, i16 %y, i16 0
107 %ysplat = shufflevector <8 x i16> %yhead, <8 x i16> poison, <8 x i32> zeroinitializer
108 %yzv = zext <8 x i16> %ysplat to <8 x i32>
109 %add = add nuw nsw <8 x i32> %xzv, %yzv
110 %div = lshr <8 x i32> %add, splat (i32 1)
111 %ret = trunc <8 x i32> %div to <8 x i16>
115 define <8 x i32> @vaaddu_vv_v8i32_floor(<8 x i32> %x, <8 x i32> %y) {
116 ; CHECK-LABEL: vaaddu_vv_v8i32_floor:
118 ; CHECK-NEXT: csrwi vxrm, 2
119 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
120 ; CHECK-NEXT: vaaddu.vv v8, v8, v10
122 %xzv = zext <8 x i32> %x to <8 x i64>
123 %yzv = zext <8 x i32> %y to <8 x i64>
124 %add = add nuw nsw <8 x i64> %xzv, %yzv
125 %div = lshr <8 x i64> %add, <i64 1, i64 1, i64 1, i64 1, i64 1, i64 1, i64 1, i64 1>
126 %ret = trunc <8 x i64> %div to <8 x i32>
130 define <8 x i32> @vaaddu_vx_v8i32_floor(<8 x i32> %x, i32 %y) {
131 ; CHECK-LABEL: vaaddu_vx_v8i32_floor:
133 ; CHECK-NEXT: csrwi vxrm, 2
134 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
135 ; CHECK-NEXT: vaaddu.vx v8, v8, a0
137 %xzv = zext <8 x i32> %x to <8 x i64>
138 %yhead = insertelement <8 x i32> poison, i32 %y, i32 0
139 %ysplat = shufflevector <8 x i32> %yhead, <8 x i32> poison, <8 x i32> zeroinitializer
140 %yzv = zext <8 x i32> %ysplat to <8 x i64>
141 %add = add nuw nsw <8 x i64> %xzv, %yzv
142 %div = lshr <8 x i64> %add, splat (i64 1)
143 %ret = trunc <8 x i64> %div to <8 x i32>
147 define <8 x i64> @vaaddu_vv_v8i64_floor(<8 x i64> %x, <8 x i64> %y) {
148 ; CHECK-LABEL: vaaddu_vv_v8i64_floor:
150 ; CHECK-NEXT: csrwi vxrm, 2
151 ; CHECK-NEXT: vsetivli zero, 8, e64, m4, ta, ma
152 ; CHECK-NEXT: vaaddu.vv v8, v8, v12
154 %xzv = zext <8 x i64> %x to <8 x i128>
155 %yzv = zext <8 x i64> %y to <8 x i128>
156 %add = add nuw nsw <8 x i128> %xzv, %yzv
157 %div = lshr <8 x i128> %add, <i128 1, i128 1, i128 1, i128 1, i128 1, i128 1, i128 1, i128 1>
158 %ret = trunc <8 x i128> %div to <8 x i64>
162 define <8 x i1> @vaaddu_vv_v8i1_floor(<8 x i1> %x, <8 x i1> %y) {
163 ; CHECK-LABEL: vaaddu_vv_v8i1_floor:
165 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
166 ; CHECK-NEXT: vmv.v.i v9, 0
167 ; CHECK-NEXT: vmerge.vim v10, v9, 1, v0
168 ; CHECK-NEXT: vmv1r.v v0, v8
169 ; CHECK-NEXT: vmerge.vim v8, v9, 1, v0
170 ; CHECK-NEXT: csrwi vxrm, 2
171 ; CHECK-NEXT: vaaddu.vv v8, v10, v8
172 ; CHECK-NEXT: vand.vi v8, v8, 1
173 ; CHECK-NEXT: vmsne.vi v0, v8, 0
175 %xzv = zext <8 x i1> %x to <8 x i8>
176 %yzv = zext <8 x i1> %y to <8 x i8>
177 %add = add nuw nsw <8 x i8> %xzv, %yzv
178 %div = lshr <8 x i8> %add, <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>
179 %ret = trunc <8 x i8> %div to <8 x i1>
183 define <8 x i64> @vaaddu_vx_v8i64_floor(<8 x i64> %x, i64 %y) {
184 ; RV32-LABEL: vaaddu_vx_v8i64_floor:
186 ; RV32-NEXT: addi sp, sp, -16
187 ; RV32-NEXT: .cfi_def_cfa_offset 16
188 ; RV32-NEXT: sw a1, 12(sp)
189 ; RV32-NEXT: sw a0, 8(sp)
190 ; RV32-NEXT: addi a0, sp, 8
191 ; RV32-NEXT: vsetivli zero, 8, e64, m4, ta, ma
192 ; RV32-NEXT: vlse64.v v12, (a0), zero
193 ; RV32-NEXT: csrwi vxrm, 2
194 ; RV32-NEXT: vaaddu.vv v8, v8, v12
195 ; RV32-NEXT: addi sp, sp, 16
198 ; RV64-LABEL: vaaddu_vx_v8i64_floor:
200 ; RV64-NEXT: csrwi vxrm, 2
201 ; RV64-NEXT: vsetivli zero, 8, e64, m4, ta, ma
202 ; RV64-NEXT: vaaddu.vx v8, v8, a0
204 %xzv = zext <8 x i64> %x to <8 x i128>
205 %yhead = insertelement <8 x i64> poison, i64 %y, i64 0
206 %ysplat = shufflevector <8 x i64> %yhead, <8 x i64> poison, <8 x i32> zeroinitializer
207 %yzv = zext <8 x i64> %ysplat to <8 x i128>
208 %add = add nuw nsw <8 x i128> %xzv, %yzv
209 %div = lshr <8 x i128> %add, splat (i128 1)
210 %ret = trunc <8 x i128> %div to <8 x i64>
214 define <8 x i8> @vaaddu_vv_v8i8_ceil(<8 x i8> %x, <8 x i8> %y) {
215 ; CHECK-LABEL: vaaddu_vv_v8i8_ceil:
217 ; CHECK-NEXT: csrwi vxrm, 0
218 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
219 ; CHECK-NEXT: vaaddu.vv v8, v8, v9
221 %xzv = zext <8 x i8> %x to <8 x i16>
222 %yzv = zext <8 x i8> %y to <8 x i16>
223 %add = add nuw nsw <8 x i16> %xzv, %yzv
224 %add1 = add nuw nsw <8 x i16> %add, <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>
225 %div = lshr <8 x i16> %add1, <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>
226 %ret = trunc <8 x i16> %div to <8 x i8>
230 define <8 x i8> @vaaddu_vx_v8i8_ceil(<8 x i8> %x, i8 %y) {
231 ; CHECK-LABEL: vaaddu_vx_v8i8_ceil:
233 ; CHECK-NEXT: csrwi vxrm, 0
234 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
235 ; CHECK-NEXT: vaaddu.vx v8, v8, a0
237 %xzv = zext <8 x i8> %x to <8 x i16>
238 %yhead = insertelement <8 x i8> poison, i8 %y, i32 0
239 %ysplat = shufflevector <8 x i8> %yhead, <8 x i8> poison, <8 x i32> zeroinitializer
240 %yzv = zext <8 x i8> %ysplat to <8 x i16>
241 %add = add nuw nsw <8 x i16> %xzv, %yzv
242 %add1 = add nuw nsw <8 x i16> %add, <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>
243 %div = lshr <8 x i16> %add1, splat (i16 1)
244 %ret = trunc <8 x i16> %div to <8 x i8>
248 define <8 x i8> @vaaddu_vv_v8i8_ceil_sexti16(<8 x i8> %x, <8 x i8> %y) {
249 ; CHECK-LABEL: vaaddu_vv_v8i8_ceil_sexti16:
251 ; CHECK-NEXT: csrwi vxrm, 0
252 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
253 ; CHECK-NEXT: vaadd.vv v8, v8, v9
255 %xzv = sext <8 x i8> %x to <8 x i16>
256 %yzv = sext <8 x i8> %y to <8 x i16>
257 %add = add nuw nsw <8 x i16> %xzv, %yzv
258 %add1 = add nuw nsw <8 x i16> %add, <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>
259 %div = lshr <8 x i16> %add1, <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>
260 %ret = trunc <8 x i16> %div to <8 x i8>
264 define <8 x i8> @vaaddu_vv_v8i8_ceil_zexti32(<8 x i8> %x, <8 x i8> %y) {
265 ; CHECK-LABEL: vaaddu_vv_v8i8_ceil_zexti32:
267 ; CHECK-NEXT: csrwi vxrm, 0
268 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
269 ; CHECK-NEXT: vaaddu.vv v8, v8, v9
271 %xzv = zext <8 x i8> %x to <8 x i32>
272 %yzv = zext <8 x i8> %y to <8 x i32>
273 %add = add nuw nsw <8 x i32> %xzv, %yzv
274 %add1 = add nuw nsw <8 x i32> %add, <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
275 %div = lshr <8 x i32> %add1, <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
276 %ret = trunc <8 x i32> %div to <8 x i8>
280 define <8 x i8> @vaaddu_vv_v8i8_ceil_lshr2(<8 x i8> %x, <8 x i8> %y) {
281 ; CHECK-LABEL: vaaddu_vv_v8i8_ceil_lshr2:
283 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
284 ; CHECK-NEXT: vwaddu.vv v10, v8, v9
285 ; CHECK-NEXT: vsetvli zero, zero, e16, m1, ta, ma
286 ; CHECK-NEXT: vadd.vi v8, v10, 2
287 ; CHECK-NEXT: vsetvli zero, zero, e8, mf2, ta, ma
288 ; CHECK-NEXT: vnsrl.wi v8, v8, 2
290 %xzv = zext <8 x i8> %x to <8 x i16>
291 %yzv = zext <8 x i8> %y to <8 x i16>
292 %add = add nuw nsw <8 x i16> %xzv, %yzv
293 %add1 = add nuw nsw <8 x i16> %add, <i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2>
294 %div = lshr <8 x i16> %add1, <i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2>
295 %ret = trunc <8 x i16> %div to <8 x i8>
299 define <8 x i8> @vaaddu_vv_v8i8_ceil_add2(<8 x i8> %x, <8 x i8> %y) {
300 ; CHECK-LABEL: vaaddu_vv_v8i8_ceil_add2:
302 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
303 ; CHECK-NEXT: vwaddu.vv v10, v8, v9
304 ; CHECK-NEXT: li a0, 2
305 ; CHECK-NEXT: csrwi vxrm, 2
306 ; CHECK-NEXT: vsetvli zero, zero, e16, m1, ta, ma
307 ; CHECK-NEXT: vaaddu.vx v8, v10, a0
308 ; CHECK-NEXT: vsetvli zero, zero, e8, mf2, ta, ma
309 ; CHECK-NEXT: vnsrl.wi v8, v8, 0
311 %xzv = zext <8 x i8> %x to <8 x i16>
312 %yzv = zext <8 x i8> %y to <8 x i16>
313 %add = add nuw nsw <8 x i16> %xzv, %yzv
314 %add1 = add nuw nsw <8 x i16> %add, <i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2>
315 %div = lshr <8 x i16> %add1, <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>
316 %ret = trunc <8 x i16> %div to <8 x i8>
320 define <8 x i16> @vaaddu_vv_v8i16_ceil(<8 x i16> %x, <8 x i16> %y) {
321 ; CHECK-LABEL: vaaddu_vv_v8i16_ceil:
323 ; CHECK-NEXT: csrwi vxrm, 0
324 ; CHECK-NEXT: vsetivli zero, 8, e16, m1, ta, ma
325 ; CHECK-NEXT: vaaddu.vv v8, v8, v9
327 %xzv = zext <8 x i16> %x to <8 x i32>
328 %yzv = zext <8 x i16> %y to <8 x i32>
329 %add = add nuw nsw <8 x i32> %xzv, %yzv
330 %add1 = add nuw nsw <8 x i32> %add, <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
331 %div = lshr <8 x i32> %add1, <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
332 %ret = trunc <8 x i32> %div to <8 x i16>
336 define <8 x i16> @vaaddu_vx_v8i16_ceil(<8 x i16> %x, i16 %y) {
337 ; CHECK-LABEL: vaaddu_vx_v8i16_ceil:
339 ; CHECK-NEXT: csrwi vxrm, 0
340 ; CHECK-NEXT: vsetivli zero, 8, e16, m1, ta, ma
341 ; CHECK-NEXT: vaaddu.vx v8, v8, a0
343 %xzv = zext <8 x i16> %x to <8 x i32>
344 %yhead = insertelement <8 x i16> poison, i16 %y, i16 0
345 %ysplat = shufflevector <8 x i16> %yhead, <8 x i16> poison, <8 x i32> zeroinitializer
346 %yzv = zext <8 x i16> %ysplat to <8 x i32>
347 %add = add nuw nsw <8 x i32> %xzv, %yzv
348 %add1 = add nuw nsw <8 x i32> %add, <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
349 %div = lshr <8 x i32> %add1, splat (i32 1)
350 %ret = trunc <8 x i32> %div to <8 x i16>
354 define <8 x i32> @vaaddu_vv_v8i32_ceil(<8 x i32> %x, <8 x i32> %y) {
355 ; CHECK-LABEL: vaaddu_vv_v8i32_ceil:
357 ; CHECK-NEXT: csrwi vxrm, 0
358 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
359 ; CHECK-NEXT: vaaddu.vv v8, v8, v10
361 %xzv = zext <8 x i32> %x to <8 x i64>
362 %yzv = zext <8 x i32> %y to <8 x i64>
363 %add = add nuw nsw <8 x i64> %xzv, %yzv
364 %add1 = add nuw nsw <8 x i64> %add, <i64 1, i64 1, i64 1, i64 1, i64 1, i64 1, i64 1, i64 1>
365 %div = lshr <8 x i64> %add1, <i64 1, i64 1, i64 1, i64 1, i64 1, i64 1, i64 1, i64 1>
366 %ret = trunc <8 x i64> %div to <8 x i32>
370 define <8 x i32> @vaaddu_vx_v8i32_ceil(<8 x i32> %x, i32 %y) {
371 ; CHECK-LABEL: vaaddu_vx_v8i32_ceil:
373 ; CHECK-NEXT: csrwi vxrm, 0
374 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
375 ; CHECK-NEXT: vaaddu.vx v8, v8, a0
377 %xzv = zext <8 x i32> %x to <8 x i64>
378 %yhead = insertelement <8 x i32> poison, i32 %y, i32 0
379 %ysplat = shufflevector <8 x i32> %yhead, <8 x i32> poison, <8 x i32> zeroinitializer
380 %yzv = zext <8 x i32> %ysplat to <8 x i64>
381 %add = add nuw nsw <8 x i64> %xzv, %yzv
382 %add1 = add nuw nsw <8 x i64> %add, <i64 1, i64 1, i64 1, i64 1, i64 1, i64 1, i64 1, i64 1>
383 %div = lshr <8 x i64> %add1, splat (i64 1)
384 %ret = trunc <8 x i64> %div to <8 x i32>
388 define <8 x i64> @vaaddu_vv_v8i64_ceil(<8 x i64> %x, <8 x i64> %y) {
389 ; CHECK-LABEL: vaaddu_vv_v8i64_ceil:
391 ; CHECK-NEXT: csrwi vxrm, 0
392 ; CHECK-NEXT: vsetivli zero, 8, e64, m4, ta, ma
393 ; CHECK-NEXT: vaaddu.vv v8, v8, v12
395 %xzv = zext <8 x i64> %x to <8 x i128>
396 %yzv = zext <8 x i64> %y to <8 x i128>
397 %add = add nuw nsw <8 x i128> %xzv, %yzv
398 %add1 = add nuw nsw <8 x i128> %add, <i128 1, i128 1, i128 1, i128 1, i128 1, i128 1, i128 1, i128 1>
399 %div = lshr <8 x i128> %add1, <i128 1, i128 1, i128 1, i128 1, i128 1, i128 1, i128 1, i128 1>
400 %ret = trunc <8 x i128> %div to <8 x i64>
404 define <8 x i1> @vaaddu_vv_v8i1_ceil(<8 x i1> %x, <8 x i1> %y) {
405 ; CHECK-LABEL: vaaddu_vv_v8i1_ceil:
407 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
408 ; CHECK-NEXT: vmv.v.i v9, 0
409 ; CHECK-NEXT: vmerge.vim v10, v9, 1, v0
410 ; CHECK-NEXT: vmv1r.v v0, v8
411 ; CHECK-NEXT: vmerge.vim v8, v9, 1, v0
412 ; CHECK-NEXT: csrwi vxrm, 0
413 ; CHECK-NEXT: vaaddu.vv v8, v10, v8
414 ; CHECK-NEXT: vand.vi v8, v8, 1
415 ; CHECK-NEXT: vmsne.vi v0, v8, 0
417 %xzv = zext <8 x i1> %x to <8 x i8>
418 %yzv = zext <8 x i1> %y to <8 x i8>
419 %add = add nuw nsw <8 x i8> %xzv, %yzv
420 %add1 = add nuw nsw <8 x i8> %add, <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>
421 %div = lshr <8 x i8> %add1, <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>
422 %ret = trunc <8 x i8> %div to <8 x i1>
426 define <8 x i64> @vaaddu_vx_v8i64_ceil(<8 x i64> %x, i64 %y) {
427 ; RV32-LABEL: vaaddu_vx_v8i64_ceil:
429 ; RV32-NEXT: addi sp, sp, -16
430 ; RV32-NEXT: .cfi_def_cfa_offset 16
431 ; RV32-NEXT: sw a1, 12(sp)
432 ; RV32-NEXT: sw a0, 8(sp)
433 ; RV32-NEXT: addi a0, sp, 8
434 ; RV32-NEXT: vsetivli zero, 8, e64, m4, ta, ma
435 ; RV32-NEXT: vlse64.v v12, (a0), zero
436 ; RV32-NEXT: csrwi vxrm, 0
437 ; RV32-NEXT: vaaddu.vv v8, v8, v12
438 ; RV32-NEXT: addi sp, sp, 16
441 ; RV64-LABEL: vaaddu_vx_v8i64_ceil:
443 ; RV64-NEXT: csrwi vxrm, 0
444 ; RV64-NEXT: vsetivli zero, 8, e64, m4, ta, ma
445 ; RV64-NEXT: vaaddu.vx v8, v8, a0
447 %xzv = zext <8 x i64> %x to <8 x i128>
448 %yhead = insertelement <8 x i64> poison, i64 %y, i64 0
449 %ysplat = shufflevector <8 x i64> %yhead, <8 x i64> poison, <8 x i32> zeroinitializer
450 %yzv = zext <8 x i64> %ysplat to <8 x i128>
451 %add = add nuw nsw <8 x i128> %xzv, %yzv
452 %add1 = add nuw nsw <8 x i128> %add, <i128 1, i128 1, i128 1, i128 1, i128 1, i128 1, i128 1, i128 1>
453 %div = lshr <8 x i128> %add1, splat (i128 1)
454 %ret = trunc <8 x i128> %div to <8 x i64>