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 <vscale x 8 x i8> @vaaddu_vv_nxv8i8_floor(<vscale x 8 x i8> %x, <vscale x 8 x i8> %y) {
6 ; CHECK-LABEL: vaaddu_vv_nxv8i8_floor:
8 ; CHECK-NEXT: csrwi vxrm, 2
9 ; CHECK-NEXT: vsetvli a0, zero, e8, m1, ta, ma
10 ; CHECK-NEXT: vaaddu.vv v8, v8, v9
12 %xzv = zext <vscale x 8 x i8> %x to <vscale x 8 x i16>
13 %yzv = zext <vscale x 8 x i8> %y to <vscale x 8 x i16>
14 %add = add nuw nsw <vscale x 8 x i16> %xzv, %yzv
15 %div = lshr <vscale x 8 x i16> %add, splat (i16 1)
16 %ret = trunc <vscale x 8 x i16> %div to <vscale x 8 x i8>
17 ret <vscale x 8 x i8> %ret
20 define <vscale x 8 x i8> @vaaddu_vx_nxv8i8_floor(<vscale x 8 x i8> %x, i8 %y) {
21 ; CHECK-LABEL: vaaddu_vx_nxv8i8_floor:
23 ; CHECK-NEXT: csrwi vxrm, 2
24 ; CHECK-NEXT: vsetvli a1, zero, e8, m1, ta, ma
25 ; CHECK-NEXT: vaaddu.vx v8, v8, a0
27 %xzv = zext <vscale x 8 x i8> %x to <vscale x 8 x i16>
28 %yhead = insertelement <vscale x 8 x i8> poison, i8 %y, i32 0
29 %ysplat = shufflevector <vscale x 8 x i8> %yhead, <vscale x 8 x i8> poison, <vscale x 8 x i32> zeroinitializer
30 %yzv = zext <vscale x 8 x i8> %ysplat to <vscale x 8 x i16>
31 %add = add nuw nsw <vscale x 8 x i16> %xzv, %yzv
32 %div = lshr <vscale x 8 x i16> %add, splat (i16 1)
33 %ret = trunc <vscale x 8 x i16> %div to <vscale x 8 x i8>
34 ret <vscale x 8 x i8> %ret
37 define <vscale x 8 x i8> @vaaddu_vv_nxv8i8_floor_sexti16(<vscale x 8 x i8> %x, <vscale x 8 x i8> %y) {
38 ; CHECK-LABEL: vaaddu_vv_nxv8i8_floor_sexti16:
40 ; CHECK-NEXT: csrwi vxrm, 2
41 ; CHECK-NEXT: vsetvli a0, zero, e8, m1, ta, ma
42 ; CHECK-NEXT: vaadd.vv v8, v8, v9
44 %xzv = sext <vscale x 8 x i8> %x to <vscale x 8 x i16>
45 %yzv = sext <vscale x 8 x i8> %y to <vscale x 8 x i16>
46 %add = add nuw nsw <vscale x 8 x i16> %xzv, %yzv
47 %div = lshr <vscale x 8 x i16> %add, splat (i16 1)
48 %ret = trunc <vscale x 8 x i16> %div to <vscale x 8 x i8>
49 ret <vscale x 8 x i8> %ret
52 define <vscale x 8 x i8> @vaaddu_vv_nxv8i8_floor_zexti32(<vscale x 8 x i8> %x, <vscale x 8 x i8> %y) {
53 ; CHECK-LABEL: vaaddu_vv_nxv8i8_floor_zexti32:
55 ; CHECK-NEXT: csrwi vxrm, 2
56 ; CHECK-NEXT: vsetvli a0, zero, e8, m1, ta, ma
57 ; CHECK-NEXT: vaaddu.vv v8, v8, v9
59 %xzv = zext <vscale x 8 x i8> %x to <vscale x 8 x i32>
60 %yzv = zext <vscale x 8 x i8> %y to <vscale x 8 x i32>
61 %add = add nuw nsw <vscale x 8 x i32> %xzv, %yzv
62 %div = lshr <vscale x 8 x i32> %add, splat (i32 1)
63 %ret = trunc <vscale x 8 x i32> %div to <vscale x 8 x i8>
64 ret <vscale x 8 x i8> %ret
67 define <vscale x 8 x i8> @vaaddu_vv_nxv8i8_floor_lshr2(<vscale x 8 x i8> %x, <vscale x 8 x i8> %y) {
68 ; CHECK-LABEL: vaaddu_vv_nxv8i8_floor_lshr2:
70 ; CHECK-NEXT: vsetvli a0, zero, e8, m1, ta, ma
71 ; CHECK-NEXT: vwaddu.vv v10, v8, v9
72 ; CHECK-NEXT: vnsrl.wi v8, v10, 2
74 %xzv = zext <vscale x 8 x i8> %x to <vscale x 8 x i16>
75 %yzv = zext <vscale x 8 x i8> %y to <vscale x 8 x i16>
76 %add = add nuw nsw <vscale x 8 x i16> %xzv, %yzv
77 %div = lshr <vscale x 8 x i16> %add, splat (i16 2)
78 %ret = trunc <vscale x 8 x i16> %div to <vscale x 8 x i8>
79 ret <vscale x 8 x i8> %ret
82 define <vscale x 8 x i16> @vaaddu_vv_nxv8i16_floor(<vscale x 8 x i16> %x, <vscale x 8 x i16> %y) {
83 ; CHECK-LABEL: vaaddu_vv_nxv8i16_floor:
85 ; CHECK-NEXT: csrwi vxrm, 2
86 ; CHECK-NEXT: vsetvli a0, zero, e16, m2, ta, ma
87 ; CHECK-NEXT: vaaddu.vv v8, v8, v10
89 %xzv = zext <vscale x 8 x i16> %x to <vscale x 8 x i32>
90 %yzv = zext <vscale x 8 x i16> %y to <vscale x 8 x i32>
91 %add = add nuw nsw <vscale x 8 x i32> %xzv, %yzv
92 %div = lshr <vscale x 8 x i32> %add, splat (i32 1)
93 %ret = trunc <vscale x 8 x i32> %div to <vscale x 8 x i16>
94 ret <vscale x 8 x i16> %ret
97 define <vscale x 8 x i16> @vaaddu_vx_nxv8i16_floor(<vscale x 8 x i16> %x, i16 %y) {
98 ; CHECK-LABEL: vaaddu_vx_nxv8i16_floor:
100 ; CHECK-NEXT: csrwi vxrm, 2
101 ; CHECK-NEXT: vsetvli a1, zero, e16, m2, ta, ma
102 ; CHECK-NEXT: vaaddu.vx v8, v8, a0
104 %xzv = zext <vscale x 8 x i16> %x to <vscale x 8 x i32>
105 %yhead = insertelement <vscale x 8 x i16> poison, i16 %y, i16 0
106 %ysplat = shufflevector <vscale x 8 x i16> %yhead, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
107 %yzv = zext <vscale x 8 x i16> %ysplat to <vscale x 8 x i32>
108 %add = add nuw nsw <vscale x 8 x i32> %xzv, %yzv
109 %div = lshr <vscale x 8 x i32> %add, splat (i32 1)
110 %ret = trunc <vscale x 8 x i32> %div to <vscale x 8 x i16>
111 ret <vscale x 8 x i16> %ret
114 define <vscale x 8 x i32> @vaaddu_vv_nxv8i32_floor(<vscale x 8 x i32> %x, <vscale x 8 x i32> %y) {
115 ; CHECK-LABEL: vaaddu_vv_nxv8i32_floor:
117 ; CHECK-NEXT: csrwi vxrm, 2
118 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
119 ; CHECK-NEXT: vaaddu.vv v8, v8, v12
121 %xzv = zext <vscale x 8 x i32> %x to <vscale x 8 x i64>
122 %yzv = zext <vscale x 8 x i32> %y to <vscale x 8 x i64>
123 %add = add nuw nsw <vscale x 8 x i64> %xzv, %yzv
124 %div = lshr <vscale x 8 x i64> %add, splat (i64 1)
125 %ret = trunc <vscale x 8 x i64> %div to <vscale x 8 x i32>
126 ret <vscale x 8 x i32> %ret
129 define <vscale x 8 x i32> @vaaddu_vx_nxv8i32_floor(<vscale x 8 x i32> %x, i32 %y) {
130 ; CHECK-LABEL: vaaddu_vx_nxv8i32_floor:
132 ; CHECK-NEXT: csrwi vxrm, 2
133 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma
134 ; CHECK-NEXT: vaaddu.vx v8, v8, a0
136 %xzv = zext <vscale x 8 x i32> %x to <vscale x 8 x i64>
137 %yhead = insertelement <vscale x 8 x i32> poison, i32 %y, i32 0
138 %ysplat = shufflevector <vscale x 8 x i32> %yhead, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
139 %yzv = zext <vscale x 8 x i32> %ysplat to <vscale x 8 x i64>
140 %add = add nuw nsw <vscale x 8 x i64> %xzv, %yzv
141 %div = lshr <vscale x 8 x i64> %add, splat (i64 1)
142 %ret = trunc <vscale x 8 x i64> %div to <vscale x 8 x i32>
143 ret <vscale x 8 x i32> %ret
146 define <vscale x 8 x i64> @vaaddu_vv_nxv8i64_floor(<vscale x 8 x i64> %x, <vscale x 8 x i64> %y) {
147 ; CHECK-LABEL: vaaddu_vv_nxv8i64_floor:
149 ; CHECK-NEXT: csrwi vxrm, 2
150 ; CHECK-NEXT: vsetvli a0, zero, e64, m8, ta, ma
151 ; CHECK-NEXT: vaaddu.vv v8, v8, v16
153 %xzv = zext <vscale x 8 x i64> %x to <vscale x 8 x i128>
154 %yzv = zext <vscale x 8 x i64> %y to <vscale x 8 x i128>
155 %add = add nuw nsw <vscale x 8 x i128> %xzv, %yzv
156 %div = lshr <vscale x 8 x i128> %add, splat (i128 1)
157 %ret = trunc <vscale x 8 x i128> %div to <vscale x 8 x i64>
158 ret <vscale x 8 x i64> %ret
161 define <vscale x 8 x i64> @vaaddu_vx_nxv8i64_floor(<vscale x 8 x i64> %x, i64 %y) {
162 ; RV32-LABEL: vaaddu_vx_nxv8i64_floor:
164 ; RV32-NEXT: addi sp, sp, -16
165 ; RV32-NEXT: .cfi_def_cfa_offset 16
166 ; RV32-NEXT: sw a1, 12(sp)
167 ; RV32-NEXT: sw a0, 8(sp)
168 ; RV32-NEXT: addi a0, sp, 8
169 ; RV32-NEXT: vsetvli a1, zero, e64, m8, ta, ma
170 ; RV32-NEXT: vlse64.v v16, (a0), zero
171 ; RV32-NEXT: csrwi vxrm, 2
172 ; RV32-NEXT: vaaddu.vv v8, v8, v16
173 ; RV32-NEXT: addi sp, sp, 16
176 ; RV64-LABEL: vaaddu_vx_nxv8i64_floor:
178 ; RV64-NEXT: csrwi vxrm, 2
179 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, ma
180 ; RV64-NEXT: vaaddu.vx v8, v8, a0
182 %xzv = zext <vscale x 8 x i64> %x to <vscale x 8 x i128>
183 %yhead = insertelement <vscale x 8 x i64> poison, i64 %y, i64 0
184 %ysplat = shufflevector <vscale x 8 x i64> %yhead, <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer
185 %yzv = zext <vscale x 8 x i64> %ysplat to <vscale x 8 x i128>
186 %add = add nuw nsw <vscale x 8 x i128> %xzv, %yzv
187 %div = lshr <vscale x 8 x i128> %add, splat (i128 1)
188 %ret = trunc <vscale x 8 x i128> %div to <vscale x 8 x i64>
189 ret <vscale x 8 x i64> %ret
192 define <vscale x 8 x i8> @vaaddu_vv_nxv8i8_ceil(<vscale x 8 x i8> %x, <vscale x 8 x i8> %y) {
193 ; CHECK-LABEL: vaaddu_vv_nxv8i8_ceil:
195 ; CHECK-NEXT: csrwi vxrm, 0
196 ; CHECK-NEXT: vsetvli a0, zero, e8, m1, ta, ma
197 ; CHECK-NEXT: vaaddu.vv v8, v8, v9
199 %xzv = zext <vscale x 8 x i8> %x to <vscale x 8 x i16>
200 %yzv = zext <vscale x 8 x i8> %y to <vscale x 8 x i16>
201 %add = add nuw nsw <vscale x 8 x i16> %xzv, %yzv
202 %add1 = add nuw nsw <vscale x 8 x i16> %add, splat (i16 1)
203 %div = lshr <vscale x 8 x i16> %add1, splat (i16 1)
204 %ret = trunc <vscale x 8 x i16> %div to <vscale x 8 x i8>
205 ret <vscale x 8 x i8> %ret
208 define <vscale x 8 x i8> @vaaddu_vx_nxv8i8_ceil(<vscale x 8 x i8> %x, i8 %y) {
209 ; CHECK-LABEL: vaaddu_vx_nxv8i8_ceil:
211 ; CHECK-NEXT: csrwi vxrm, 0
212 ; CHECK-NEXT: vsetvli a1, zero, e8, m1, ta, ma
213 ; CHECK-NEXT: vaaddu.vx v8, v8, a0
215 %xzv = zext <vscale x 8 x i8> %x to <vscale x 8 x i16>
216 %yhead = insertelement <vscale x 8 x i8> poison, i8 %y, i32 0
217 %ysplat = shufflevector <vscale x 8 x i8> %yhead, <vscale x 8 x i8> poison, <vscale x 8 x i32> zeroinitializer
218 %yzv = zext <vscale x 8 x i8> %ysplat to <vscale x 8 x i16>
219 %add = add nuw nsw <vscale x 8 x i16> %xzv, %yzv
220 %add1 = add nuw nsw <vscale x 8 x i16> %add, splat (i16 1)
221 %div = lshr <vscale x 8 x i16> %add1, splat (i16 1)
222 %ret = trunc <vscale x 8 x i16> %div to <vscale x 8 x i8>
223 ret <vscale x 8 x i8> %ret
226 define <vscale x 8 x i8> @vaaddu_vv_nxv8i8_ceil_sexti16(<vscale x 8 x i8> %x, <vscale x 8 x i8> %y) {
227 ; CHECK-LABEL: vaaddu_vv_nxv8i8_ceil_sexti16:
229 ; CHECK-NEXT: csrwi vxrm, 0
230 ; CHECK-NEXT: vsetvli a0, zero, e8, m1, ta, ma
231 ; CHECK-NEXT: vaadd.vv v8, v8, v9
233 %xzv = sext <vscale x 8 x i8> %x to <vscale x 8 x i16>
234 %yzv = sext <vscale x 8 x i8> %y to <vscale x 8 x i16>
235 %add = add nuw nsw <vscale x 8 x i16> %xzv, %yzv
236 %add1 = add nuw nsw <vscale x 8 x i16> %add, splat (i16 1)
237 %div = lshr <vscale x 8 x i16> %add1, splat (i16 1)
238 %ret = trunc <vscale x 8 x i16> %div to <vscale x 8 x i8>
239 ret <vscale x 8 x i8> %ret
242 define <vscale x 8 x i8> @vaaddu_vv_nxv8i8_ceil_zexti32(<vscale x 8 x i8> %x, <vscale x 8 x i8> %y) {
243 ; CHECK-LABEL: vaaddu_vv_nxv8i8_ceil_zexti32:
245 ; CHECK-NEXT: csrwi vxrm, 0
246 ; CHECK-NEXT: vsetvli a0, zero, e8, m1, ta, ma
247 ; CHECK-NEXT: vaaddu.vv v8, v8, v9
249 %xzv = zext <vscale x 8 x i8> %x to <vscale x 8 x i32>
250 %yzv = zext <vscale x 8 x i8> %y to <vscale x 8 x i32>
251 %add = add nuw nsw <vscale x 8 x i32> %xzv, %yzv
252 %add1 = add nuw nsw <vscale x 8 x i32> %add, splat (i32 1)
253 %div = lshr <vscale x 8 x i32> %add1, splat (i32 1)
254 %ret = trunc <vscale x 8 x i32> %div to <vscale x 8 x i8>
255 ret <vscale x 8 x i8> %ret
258 define <vscale x 8 x i8> @vaaddu_vv_nxv8i8_ceil_lshr2(<vscale x 8 x i8> %x, <vscale x 8 x i8> %y) {
259 ; CHECK-LABEL: vaaddu_vv_nxv8i8_ceil_lshr2:
261 ; CHECK-NEXT: vsetvli a0, zero, e8, m1, ta, ma
262 ; CHECK-NEXT: vwaddu.vv v10, v8, v9
263 ; CHECK-NEXT: vsetvli zero, zero, e16, m2, ta, ma
264 ; CHECK-NEXT: vadd.vi v10, v10, 2
265 ; CHECK-NEXT: vsetvli zero, zero, e8, m1, ta, ma
266 ; CHECK-NEXT: vnsrl.wi v8, v10, 2
268 %xzv = zext <vscale x 8 x i8> %x to <vscale x 8 x i16>
269 %yzv = zext <vscale x 8 x i8> %y to <vscale x 8 x i16>
270 %add = add nuw nsw <vscale x 8 x i16> %xzv, %yzv
271 %add1 = add nuw nsw <vscale x 8 x i16> %add, splat (i16 2)
272 %div = lshr <vscale x 8 x i16> %add1, splat (i16 2)
273 %ret = trunc <vscale x 8 x i16> %div to <vscale x 8 x i8>
274 ret <vscale x 8 x i8> %ret
277 define <vscale x 8 x i8> @vaaddu_vv_nxv8i8_ceil_add2(<vscale x 8 x i8> %x, <vscale x 8 x i8> %y) {
278 ; CHECK-LABEL: vaaddu_vv_nxv8i8_ceil_add2:
280 ; CHECK-NEXT: vsetvli a0, zero, e8, m1, ta, ma
281 ; CHECK-NEXT: vwaddu.vv v10, v8, v9
282 ; CHECK-NEXT: vsetvli zero, zero, e16, m2, ta, ma
283 ; CHECK-NEXT: vadd.vi v10, v10, 2
284 ; CHECK-NEXT: vsetvli zero, zero, e8, m1, ta, ma
285 ; CHECK-NEXT: vnsrl.wi v8, v10, 2
287 %xzv = zext <vscale x 8 x i8> %x to <vscale x 8 x i16>
288 %yzv = zext <vscale x 8 x i8> %y to <vscale x 8 x i16>
289 %add = add nuw nsw <vscale x 8 x i16> %xzv, %yzv
290 %add2 = add nuw nsw <vscale x 8 x i16> %add, splat (i16 2)
291 %div = lshr <vscale x 8 x i16> %add2, splat (i16 2)
292 %ret = trunc <vscale x 8 x i16> %div to <vscale x 8 x i8>
293 ret <vscale x 8 x i8> %ret
296 define <vscale x 8 x i16> @vaaddu_vv_nxv8i16_ceil(<vscale x 8 x i16> %x, <vscale x 8 x i16> %y) {
297 ; CHECK-LABEL: vaaddu_vv_nxv8i16_ceil:
299 ; CHECK-NEXT: csrwi vxrm, 0
300 ; CHECK-NEXT: vsetvli a0, zero, e16, m2, ta, ma
301 ; CHECK-NEXT: vaaddu.vv v8, v8, v10
303 %xzv = zext <vscale x 8 x i16> %x to <vscale x 8 x i32>
304 %yzv = zext <vscale x 8 x i16> %y to <vscale x 8 x i32>
305 %add = add nuw nsw <vscale x 8 x i32> %xzv, %yzv
306 %add1 = add nuw nsw <vscale x 8 x i32> %add, splat (i32 1)
307 %div = lshr <vscale x 8 x i32> %add1, splat (i32 1)
308 %ret = trunc <vscale x 8 x i32> %div to <vscale x 8 x i16>
309 ret <vscale x 8 x i16> %ret
312 define <vscale x 8 x i16> @vaaddu_vx_nxv8i16_ceil(<vscale x 8 x i16> %x, i16 %y) {
313 ; CHECK-LABEL: vaaddu_vx_nxv8i16_ceil:
315 ; CHECK-NEXT: csrwi vxrm, 0
316 ; CHECK-NEXT: vsetvli a1, zero, e16, m2, ta, ma
317 ; CHECK-NEXT: vaaddu.vx v8, v8, a0
319 %xzv = zext <vscale x 8 x i16> %x to <vscale x 8 x i32>
320 %yhead = insertelement <vscale x 8 x i16> poison, i16 %y, i16 0
321 %ysplat = shufflevector <vscale x 8 x i16> %yhead, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
322 %yzv = zext <vscale x 8 x i16> %ysplat to <vscale x 8 x i32>
323 %add = add nuw nsw <vscale x 8 x i32> %xzv, %yzv
324 %add1 = add nuw nsw <vscale x 8 x i32> %add, splat (i32 1)
325 %div = lshr <vscale x 8 x i32> %add1, splat (i32 1)
326 %ret = trunc <vscale x 8 x i32> %div to <vscale x 8 x i16>
327 ret <vscale x 8 x i16> %ret
330 define <vscale x 8 x i32> @vaaddu_vv_nxv8i32_ceil(<vscale x 8 x i32> %x, <vscale x 8 x i32> %y) {
331 ; CHECK-LABEL: vaaddu_vv_nxv8i32_ceil:
333 ; CHECK-NEXT: csrwi vxrm, 0
334 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
335 ; CHECK-NEXT: vaaddu.vv v8, v8, v12
337 %xzv = zext <vscale x 8 x i32> %x to <vscale x 8 x i64>
338 %yzv = zext <vscale x 8 x i32> %y to <vscale x 8 x i64>
339 %add = add nuw nsw <vscale x 8 x i64> %xzv, %yzv
340 %add1 = add nuw nsw <vscale x 8 x i64> %add, splat (i64 1)
341 %div = lshr <vscale x 8 x i64> %add1, splat (i64 1)
342 %ret = trunc <vscale x 8 x i64> %div to <vscale x 8 x i32>
343 ret <vscale x 8 x i32> %ret
346 define <vscale x 8 x i32> @vaaddu_vx_nxv8i32_ceil(<vscale x 8 x i32> %x, i32 %y) {
347 ; CHECK-LABEL: vaaddu_vx_nxv8i32_ceil:
349 ; CHECK-NEXT: csrwi vxrm, 0
350 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma
351 ; CHECK-NEXT: vaaddu.vx v8, v8, a0
353 %xzv = zext <vscale x 8 x i32> %x to <vscale x 8 x i64>
354 %yhead = insertelement <vscale x 8 x i32> poison, i32 %y, i32 0
355 %ysplat = shufflevector <vscale x 8 x i32> %yhead, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
356 %yzv = zext <vscale x 8 x i32> %ysplat to <vscale x 8 x i64>
357 %add = add nuw nsw <vscale x 8 x i64> %xzv, %yzv
358 %add1 = add nuw nsw <vscale x 8 x i64> %add, splat (i64 1)
359 %div = lshr <vscale x 8 x i64> %add1, splat (i64 1)
360 %ret = trunc <vscale x 8 x i64> %div to <vscale x 8 x i32>
361 ret <vscale x 8 x i32> %ret
364 define <vscale x 8 x i64> @vaaddu_vv_nxv8i64_ceil(<vscale x 8 x i64> %x, <vscale x 8 x i64> %y) {
365 ; CHECK-LABEL: vaaddu_vv_nxv8i64_ceil:
367 ; CHECK-NEXT: csrwi vxrm, 0
368 ; CHECK-NEXT: vsetvli a0, zero, e64, m8, ta, ma
369 ; CHECK-NEXT: vaaddu.vv v8, v8, v16
371 %xzv = zext <vscale x 8 x i64> %x to <vscale x 8 x i128>
372 %yzv = zext <vscale x 8 x i64> %y to <vscale x 8 x i128>
373 %add = add nuw nsw <vscale x 8 x i128> %xzv, %yzv
374 %add1 = add nuw nsw <vscale x 8 x i128> %add, splat (i128 1)
375 %div = lshr <vscale x 8 x i128> %add1, splat (i128 1)
376 %ret = trunc <vscale x 8 x i128> %div to <vscale x 8 x i64>
377 ret <vscale x 8 x i64> %ret
380 define <vscale x 8 x i64> @vaaddu_vx_nxv8i64_ceil(<vscale x 8 x i64> %x, i64 %y) {
381 ; RV32-LABEL: vaaddu_vx_nxv8i64_ceil:
383 ; RV32-NEXT: addi sp, sp, -16
384 ; RV32-NEXT: .cfi_def_cfa_offset 16
385 ; RV32-NEXT: sw a1, 12(sp)
386 ; RV32-NEXT: sw a0, 8(sp)
387 ; RV32-NEXT: addi a0, sp, 8
388 ; RV32-NEXT: vsetvli a1, zero, e64, m8, ta, ma
389 ; RV32-NEXT: vlse64.v v16, (a0), zero
390 ; RV32-NEXT: csrwi vxrm, 0
391 ; RV32-NEXT: vaaddu.vv v8, v8, v16
392 ; RV32-NEXT: addi sp, sp, 16
395 ; RV64-LABEL: vaaddu_vx_nxv8i64_ceil:
397 ; RV64-NEXT: csrwi vxrm, 0
398 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, ma
399 ; RV64-NEXT: vaaddu.vx v8, v8, a0
401 %xzv = zext <vscale x 8 x i64> %x to <vscale x 8 x i128>
402 %yhead = insertelement <vscale x 8 x i64> poison, i64 %y, i64 0
403 %ysplat = shufflevector <vscale x 8 x i64> %yhead, <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer
404 %yzv = zext <vscale x 8 x i64> %ysplat to <vscale x 8 x i128>
405 %add = add nuw nsw <vscale x 8 x i128> %xzv, %yzv
406 %add1 = add nuw nsw <vscale x 8 x i128> %add, splat (i128 1)
407 %div = lshr <vscale x 8 x i128> %add1, splat (i128 1)
408 %ret = trunc <vscale x 8 x i128> %div to <vscale x 8 x i64>
409 ret <vscale x 8 x i64> %ret