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: vsetvli a0, zero, e8, m1, ta, ma
9 ; CHECK-NEXT: csrwi vxrm, 2
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 %one = insertelement <vscale x 8 x i16> poison, i16 1, i32 0
16 %splat = shufflevector <vscale x 8 x i16> %one, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
17 %div = lshr <vscale x 8 x i16> %add, %splat
18 %ret = trunc <vscale x 8 x i16> %div to <vscale x 8 x i8>
19 ret <vscale x 8 x i8> %ret
22 define <vscale x 8 x i8> @vaaddu_vx_nxv8i8_floor(<vscale x 8 x i8> %x, i8 %y) {
23 ; CHECK-LABEL: vaaddu_vx_nxv8i8_floor:
25 ; CHECK-NEXT: vsetvli a1, zero, e8, m1, ta, ma
26 ; CHECK-NEXT: csrwi vxrm, 2
27 ; CHECK-NEXT: vaaddu.vx v8, v8, a0
29 %xzv = zext <vscale x 8 x i8> %x to <vscale x 8 x i16>
30 %yhead = insertelement <vscale x 8 x i8> poison, i8 %y, i32 0
31 %ysplat = shufflevector <vscale x 8 x i8> %yhead, <vscale x 8 x i8> poison, <vscale x 8 x i32> zeroinitializer
32 %yzv = zext <vscale x 8 x i8> %ysplat to <vscale x 8 x i16>
33 %add = add nuw nsw <vscale x 8 x i16> %xzv, %yzv
34 %one = insertelement <vscale x 8 x i16> poison, i16 1, i32 0
35 %splat = shufflevector <vscale x 8 x i16> %one, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
36 %div = lshr <vscale x 8 x i16> %add, %splat
37 %ret = trunc <vscale x 8 x i16> %div to <vscale x 8 x i8>
38 ret <vscale x 8 x i8> %ret
41 define <vscale x 8 x i8> @vaaddu_vv_nxv8i8_floor_sexti16(<vscale x 8 x i8> %x, <vscale x 8 x i8> %y) {
42 ; CHECK-LABEL: vaaddu_vv_nxv8i8_floor_sexti16:
44 ; CHECK-NEXT: vsetvli a0, zero, e8, m1, ta, ma
45 ; CHECK-NEXT: vwadd.vv v10, v8, v9
46 ; CHECK-NEXT: vnsrl.wi v8, v10, 1
48 %xzv = sext <vscale x 8 x i8> %x to <vscale x 8 x i16>
49 %yzv = sext <vscale x 8 x i8> %y to <vscale x 8 x i16>
50 %add = add nuw nsw <vscale x 8 x i16> %xzv, %yzv
51 %one = insertelement <vscale x 8 x i16> poison, i16 1, i32 0
52 %splat = shufflevector <vscale x 8 x i16> %one, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
53 %div = lshr <vscale x 8 x i16> %add, %splat
54 %ret = trunc <vscale x 8 x i16> %div to <vscale x 8 x i8>
55 ret <vscale x 8 x i8> %ret
58 define <vscale x 8 x i8> @vaaddu_vv_nxv8i8_floor_zexti32(<vscale x 8 x i8> %x, <vscale x 8 x i8> %y) {
59 ; CHECK-LABEL: vaaddu_vv_nxv8i8_floor_zexti32:
61 ; CHECK-NEXT: vsetvli a0, zero, e8, m1, ta, ma
62 ; CHECK-NEXT: csrwi vxrm, 2
63 ; CHECK-NEXT: vaaddu.vv v8, v8, v9
65 %xzv = zext <vscale x 8 x i8> %x to <vscale x 8 x i32>
66 %yzv = zext <vscale x 8 x i8> %y to <vscale x 8 x i32>
67 %add = add nuw nsw <vscale x 8 x i32> %xzv, %yzv
68 %one = insertelement <vscale x 8 x i32> poison, i32 1, i32 0
69 %splat = shufflevector <vscale x 8 x i32> %one, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
70 %div = lshr <vscale x 8 x i32> %add, %splat
71 %ret = trunc <vscale x 8 x i32> %div to <vscale x 8 x i8>
72 ret <vscale x 8 x i8> %ret
75 define <vscale x 8 x i8> @vaaddu_vv_nxv8i8_floor_lshr2(<vscale x 8 x i8> %x, <vscale x 8 x i8> %y) {
76 ; CHECK-LABEL: vaaddu_vv_nxv8i8_floor_lshr2:
78 ; CHECK-NEXT: vsetvli a0, zero, e8, m1, ta, ma
79 ; CHECK-NEXT: vwaddu.vv v10, v8, v9
80 ; CHECK-NEXT: vnsrl.wi v8, v10, 2
82 %xzv = zext <vscale x 8 x i8> %x to <vscale x 8 x i16>
83 %yzv = zext <vscale x 8 x i8> %y to <vscale x 8 x i16>
84 %add = add nuw nsw <vscale x 8 x i16> %xzv, %yzv
85 %one = insertelement <vscale x 8 x i16> poison, i16 2, i32 0
86 %splat = shufflevector <vscale x 8 x i16> %one, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
87 %div = lshr <vscale x 8 x i16> %add, %splat
88 %ret = trunc <vscale x 8 x i16> %div to <vscale x 8 x i8>
89 ret <vscale x 8 x i8> %ret
92 define <vscale x 8 x i16> @vaaddu_vv_nxv8i16_floor(<vscale x 8 x i16> %x, <vscale x 8 x i16> %y) {
93 ; CHECK-LABEL: vaaddu_vv_nxv8i16_floor:
95 ; CHECK-NEXT: vsetvli a0, zero, e16, m2, ta, ma
96 ; CHECK-NEXT: csrwi vxrm, 2
97 ; CHECK-NEXT: vaaddu.vv v8, v8, v10
99 %xzv = zext <vscale x 8 x i16> %x to <vscale x 8 x i32>
100 %yzv = zext <vscale x 8 x i16> %y to <vscale x 8 x i32>
101 %add = add nuw nsw <vscale x 8 x i32> %xzv, %yzv
102 %one = insertelement <vscale x 8 x i32> poison, i32 1, i32 0
103 %splat = shufflevector <vscale x 8 x i32> %one, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
104 %div = lshr <vscale x 8 x i32> %add, %splat
105 %ret = trunc <vscale x 8 x i32> %div to <vscale x 8 x i16>
106 ret <vscale x 8 x i16> %ret
109 define <vscale x 8 x i16> @vaaddu_vx_nxv8i16_floor(<vscale x 8 x i16> %x, i16 %y) {
110 ; CHECK-LABEL: vaaddu_vx_nxv8i16_floor:
112 ; CHECK-NEXT: vsetvli a1, zero, e16, m2, ta, ma
113 ; CHECK-NEXT: csrwi vxrm, 2
114 ; CHECK-NEXT: vaaddu.vx v8, v8, a0
116 %xzv = zext <vscale x 8 x i16> %x to <vscale x 8 x i32>
117 %yhead = insertelement <vscale x 8 x i16> poison, i16 %y, i16 0
118 %ysplat = shufflevector <vscale x 8 x i16> %yhead, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
119 %yzv = zext <vscale x 8 x i16> %ysplat to <vscale x 8 x i32>
120 %add = add nuw nsw <vscale x 8 x i32> %xzv, %yzv
121 %one = insertelement <vscale x 8 x i32> poison, i32 1, i32 0
122 %splat = shufflevector <vscale x 8 x i32> %one, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
123 %div = lshr <vscale x 8 x i32> %add, %splat
124 %ret = trunc <vscale x 8 x i32> %div to <vscale x 8 x i16>
125 ret <vscale x 8 x i16> %ret
128 define <vscale x 8 x i32> @vaaddu_vv_nxv8i32_floor(<vscale x 8 x i32> %x, <vscale x 8 x i32> %y) {
129 ; CHECK-LABEL: vaaddu_vv_nxv8i32_floor:
131 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
132 ; CHECK-NEXT: csrwi vxrm, 2
133 ; CHECK-NEXT: vaaddu.vv v8, v8, v12
135 %xzv = zext <vscale x 8 x i32> %x to <vscale x 8 x i64>
136 %yzv = zext <vscale x 8 x i32> %y to <vscale x 8 x i64>
137 %add = add nuw nsw <vscale x 8 x i64> %xzv, %yzv
138 %one = insertelement <vscale x 8 x i64> poison, i64 1, i64 0
139 %splat = shufflevector <vscale x 8 x i64> %one, <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer
140 %div = lshr <vscale x 8 x i64> %add, %splat
141 %ret = trunc <vscale x 8 x i64> %div to <vscale x 8 x i32>
142 ret <vscale x 8 x i32> %ret
145 define <vscale x 8 x i32> @vaaddu_vx_nxv8i32_floor(<vscale x 8 x i32> %x, i32 %y) {
146 ; CHECK-LABEL: vaaddu_vx_nxv8i32_floor:
148 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma
149 ; CHECK-NEXT: csrwi vxrm, 2
150 ; CHECK-NEXT: vaaddu.vx v8, v8, a0
152 %xzv = zext <vscale x 8 x i32> %x to <vscale x 8 x i64>
153 %yhead = insertelement <vscale x 8 x i32> poison, i32 %y, i32 0
154 %ysplat = shufflevector <vscale x 8 x i32> %yhead, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
155 %yzv = zext <vscale x 8 x i32> %ysplat to <vscale x 8 x i64>
156 %add = add nuw nsw <vscale x 8 x i64> %xzv, %yzv
157 %one = insertelement <vscale x 8 x i64> poison, i64 1, i64 0
158 %splat = shufflevector <vscale x 8 x i64> %one, <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer
159 %div = lshr <vscale x 8 x i64> %add, %splat
160 %ret = trunc <vscale x 8 x i64> %div to <vscale x 8 x i32>
161 ret <vscale x 8 x i32> %ret
164 define <vscale x 8 x i64> @vaaddu_vv_nxv8i64_floor(<vscale x 8 x i64> %x, <vscale x 8 x i64> %y) {
165 ; CHECK-LABEL: vaaddu_vv_nxv8i64_floor:
167 ; CHECK-NEXT: vsetvli a0, zero, e64, m8, ta, ma
168 ; CHECK-NEXT: csrwi vxrm, 2
169 ; CHECK-NEXT: vaaddu.vv v8, v8, v16
171 %xzv = zext <vscale x 8 x i64> %x to <vscale x 8 x i128>
172 %yzv = zext <vscale x 8 x i64> %y to <vscale x 8 x i128>
173 %add = add nuw nsw <vscale x 8 x i128> %xzv, %yzv
174 %one = insertelement <vscale x 8 x i128> poison, i128 1, i128 0
175 %splat = shufflevector <vscale x 8 x i128> %one, <vscale x 8 x i128> poison, <vscale x 8 x i32> zeroinitializer
176 %div = lshr <vscale x 8 x i128> %add, %splat
177 %ret = trunc <vscale x 8 x i128> %div to <vscale x 8 x i64>
178 ret <vscale x 8 x i64> %ret
181 define <vscale x 8 x i64> @vaaddu_vx_nxv8i64_floor(<vscale x 8 x i64> %x, i64 %y) {
182 ; RV32-LABEL: vaaddu_vx_nxv8i64_floor:
184 ; RV32-NEXT: addi sp, sp, -16
185 ; RV32-NEXT: .cfi_def_cfa_offset 16
186 ; RV32-NEXT: sw a1, 12(sp)
187 ; RV32-NEXT: sw a0, 8(sp)
188 ; RV32-NEXT: addi a0, sp, 8
189 ; RV32-NEXT: vsetvli a1, zero, e64, m8, ta, ma
190 ; RV32-NEXT: vlse64.v v16, (a0), zero
191 ; RV32-NEXT: csrwi vxrm, 2
192 ; RV32-NEXT: vaaddu.vv v8, v8, v16
193 ; RV32-NEXT: addi sp, sp, 16
196 ; RV64-LABEL: vaaddu_vx_nxv8i64_floor:
198 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, ma
199 ; RV64-NEXT: csrwi vxrm, 2
200 ; RV64-NEXT: vaaddu.vx v8, v8, a0
202 %xzv = zext <vscale x 8 x i64> %x to <vscale x 8 x i128>
203 %yhead = insertelement <vscale x 8 x i64> poison, i64 %y, i64 0
204 %ysplat = shufflevector <vscale x 8 x i64> %yhead, <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer
205 %yzv = zext <vscale x 8 x i64> %ysplat to <vscale x 8 x i128>
206 %add = add nuw nsw <vscale x 8 x i128> %xzv, %yzv
207 %one = insertelement <vscale x 8 x i128> poison, i128 1, i128 0
208 %splat = shufflevector <vscale x 8 x i128> %one, <vscale x 8 x i128> poison, <vscale x 8 x i32> zeroinitializer
209 %div = lshr <vscale x 8 x i128> %add, %splat
210 %ret = trunc <vscale x 8 x i128> %div to <vscale x 8 x i64>
211 ret <vscale x 8 x i64> %ret
214 define <vscale x 8 x i8> @vaaddu_vv_nxv8i8_ceil(<vscale x 8 x i8> %x, <vscale x 8 x i8> %y) {
215 ; CHECK-LABEL: vaaddu_vv_nxv8i8_ceil:
217 ; CHECK-NEXT: vsetvli a0, zero, e8, m1, ta, ma
218 ; CHECK-NEXT: csrwi vxrm, 0
219 ; CHECK-NEXT: vaaddu.vv v8, v8, v9
221 %xzv = zext <vscale x 8 x i8> %x to <vscale x 8 x i16>
222 %yzv = zext <vscale x 8 x i8> %y to <vscale x 8 x i16>
223 %add = add nuw nsw <vscale x 8 x i16> %xzv, %yzv
224 %one = insertelement <vscale x 8 x i16> poison, i16 1, i32 0
225 %splat = shufflevector <vscale x 8 x i16> %one, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
226 %add1 = add nuw nsw <vscale x 8 x i16> %add, %splat
227 %div = lshr <vscale x 8 x i16> %add1, %splat
228 %ret = trunc <vscale x 8 x i16> %div to <vscale x 8 x i8>
229 ret <vscale x 8 x i8> %ret
232 define <vscale x 8 x i8> @vaaddu_vx_nxv8i8_ceil(<vscale x 8 x i8> %x, i8 %y) {
233 ; CHECK-LABEL: vaaddu_vx_nxv8i8_ceil:
235 ; CHECK-NEXT: vsetvli a1, zero, e8, m1, ta, ma
236 ; CHECK-NEXT: csrwi vxrm, 0
237 ; CHECK-NEXT: vaaddu.vx v8, v8, a0
239 %xzv = zext <vscale x 8 x i8> %x to <vscale x 8 x i16>
240 %yhead = insertelement <vscale x 8 x i8> poison, i8 %y, i32 0
241 %ysplat = shufflevector <vscale x 8 x i8> %yhead, <vscale x 8 x i8> poison, <vscale x 8 x i32> zeroinitializer
242 %yzv = zext <vscale x 8 x i8> %ysplat to <vscale x 8 x i16>
243 %add = add nuw nsw <vscale x 8 x i16> %xzv, %yzv
244 %one = insertelement <vscale x 8 x i16> poison, i16 1, i32 0
245 %splat = shufflevector <vscale x 8 x i16> %one, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
246 %add1 = add nuw nsw <vscale x 8 x i16> %add, %splat
247 %div = lshr <vscale x 8 x i16> %add1, %splat
248 %ret = trunc <vscale x 8 x i16> %div to <vscale x 8 x i8>
249 ret <vscale x 8 x i8> %ret
252 define <vscale x 8 x i8> @vaaddu_vv_nxv8i8_ceil_sexti16(<vscale x 8 x i8> %x, <vscale x 8 x i8> %y) {
253 ; CHECK-LABEL: vaaddu_vv_nxv8i8_ceil_sexti16:
255 ; CHECK-NEXT: vsetvli a0, zero, e8, m1, ta, ma
256 ; CHECK-NEXT: vwadd.vv v10, v8, v9
257 ; CHECK-NEXT: vsetvli zero, zero, e16, m2, ta, ma
258 ; CHECK-NEXT: vadd.vi v10, v10, 1
259 ; CHECK-NEXT: vsetvli zero, zero, e8, m1, ta, ma
260 ; CHECK-NEXT: vnsrl.wi v8, v10, 1
262 %xzv = sext <vscale x 8 x i8> %x to <vscale x 8 x i16>
263 %yzv = sext <vscale x 8 x i8> %y to <vscale x 8 x i16>
264 %add = add nuw nsw <vscale x 8 x i16> %xzv, %yzv
265 %one = insertelement <vscale x 8 x i16> poison, i16 1, i32 0
266 %splat = shufflevector <vscale x 8 x i16> %one, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
267 %add1 = add nuw nsw <vscale x 8 x i16> %add, %splat
268 %div = lshr <vscale x 8 x i16> %add1, %splat
269 %ret = trunc <vscale x 8 x i16> %div to <vscale x 8 x i8>
270 ret <vscale x 8 x i8> %ret
273 define <vscale x 8 x i8> @vaaddu_vv_nxv8i8_ceil_zexti32(<vscale x 8 x i8> %x, <vscale x 8 x i8> %y) {
274 ; CHECK-LABEL: vaaddu_vv_nxv8i8_ceil_zexti32:
276 ; CHECK-NEXT: vsetvli a0, zero, e8, m1, ta, ma
277 ; CHECK-NEXT: csrwi vxrm, 0
278 ; CHECK-NEXT: vaaddu.vv v8, v8, v9
280 %xzv = zext <vscale x 8 x i8> %x to <vscale x 8 x i32>
281 %yzv = zext <vscale x 8 x i8> %y to <vscale x 8 x i32>
282 %add = add nuw nsw <vscale x 8 x i32> %xzv, %yzv
283 %one = insertelement <vscale x 8 x i32> poison, i32 1, i32 0
284 %splat = shufflevector <vscale x 8 x i32> %one, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
285 %add1 = add nuw nsw <vscale x 8 x i32> %add, %splat
286 %div = lshr <vscale x 8 x i32> %add1, %splat
287 %ret = trunc <vscale x 8 x i32> %div to <vscale x 8 x i8>
288 ret <vscale x 8 x i8> %ret
291 define <vscale x 8 x i8> @vaaddu_vv_nxv8i8_ceil_lshr2(<vscale x 8 x i8> %x, <vscale x 8 x i8> %y) {
292 ; CHECK-LABEL: vaaddu_vv_nxv8i8_ceil_lshr2:
294 ; CHECK-NEXT: vsetvli a0, zero, e8, m1, ta, ma
295 ; CHECK-NEXT: vwaddu.vv v10, v8, v9
296 ; CHECK-NEXT: vsetvli zero, zero, e16, m2, ta, ma
297 ; CHECK-NEXT: vadd.vi v10, v10, 2
298 ; CHECK-NEXT: vsetvli zero, zero, e8, m1, ta, ma
299 ; CHECK-NEXT: vnsrl.wi v8, v10, 2
301 %xzv = zext <vscale x 8 x i8> %x to <vscale x 8 x i16>
302 %yzv = zext <vscale x 8 x i8> %y to <vscale x 8 x i16>
303 %add = add nuw nsw <vscale x 8 x i16> %xzv, %yzv
304 %one = insertelement <vscale x 8 x i16> poison, i16 2, i32 0
305 %splat = shufflevector <vscale x 8 x i16> %one, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
306 %add1 = add nuw nsw <vscale x 8 x i16> %add, %splat
307 %div = lshr <vscale x 8 x i16> %add1, %splat
308 %ret = trunc <vscale x 8 x i16> %div to <vscale x 8 x i8>
309 ret <vscale x 8 x i8> %ret
312 define <vscale x 8 x i8> @vaaddu_vv_nxv8i8_ceil_add2(<vscale x 8 x i8> %x, <vscale x 8 x i8> %y) {
313 ; CHECK-LABEL: vaaddu_vv_nxv8i8_ceil_add2:
315 ; CHECK-NEXT: vsetvli a0, zero, e8, m1, ta, ma
316 ; CHECK-NEXT: vwaddu.vv v10, v8, v9
317 ; CHECK-NEXT: vsetvli zero, zero, e16, m2, ta, ma
318 ; CHECK-NEXT: vadd.vi v10, v10, 2
319 ; CHECK-NEXT: vsetvli zero, zero, e8, m1, ta, ma
320 ; CHECK-NEXT: vnsrl.wi v8, v10, 2
322 %xzv = zext <vscale x 8 x i8> %x to <vscale x 8 x i16>
323 %yzv = zext <vscale x 8 x i8> %y to <vscale x 8 x i16>
324 %add = add nuw nsw <vscale x 8 x i16> %xzv, %yzv
325 %one = insertelement <vscale x 8 x i16> poison, i16 2, i32 0
326 %splat1 = shufflevector <vscale x 8 x i16> %one, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
327 %two = insertelement <vscale x 8 x i16> poison, i16 2, i32 0
328 %splat2 = shufflevector <vscale x 8 x i16> %two, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
329 %add2 = add nuw nsw <vscale x 8 x i16> %add, %splat2
330 %div = lshr <vscale x 8 x i16> %add2, %splat1
331 %ret = trunc <vscale x 8 x i16> %div to <vscale x 8 x i8>
332 ret <vscale x 8 x i8> %ret
335 define <vscale x 8 x i16> @vaaddu_vv_nxv8i16_ceil(<vscale x 8 x i16> %x, <vscale x 8 x i16> %y) {
336 ; CHECK-LABEL: vaaddu_vv_nxv8i16_ceil:
338 ; CHECK-NEXT: vsetvli a0, zero, e16, m2, ta, ma
339 ; CHECK-NEXT: csrwi vxrm, 0
340 ; CHECK-NEXT: vaaddu.vv v8, v8, v10
342 %xzv = zext <vscale x 8 x i16> %x to <vscale x 8 x i32>
343 %yzv = zext <vscale x 8 x i16> %y to <vscale x 8 x i32>
344 %add = add nuw nsw <vscale x 8 x i32> %xzv, %yzv
345 %one = insertelement <vscale x 8 x i32> poison, i32 1, i32 0
346 %splat = shufflevector <vscale x 8 x i32> %one, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
347 %add1 = add nuw nsw <vscale x 8 x i32> %add, %splat
348 %div = lshr <vscale x 8 x i32> %add1, %splat
349 %ret = trunc <vscale x 8 x i32> %div to <vscale x 8 x i16>
350 ret <vscale x 8 x i16> %ret
353 define <vscale x 8 x i16> @vaaddu_vx_nxv8i16_ceil(<vscale x 8 x i16> %x, i16 %y) {
354 ; CHECK-LABEL: vaaddu_vx_nxv8i16_ceil:
356 ; CHECK-NEXT: vsetvli a1, zero, e16, m2, ta, ma
357 ; CHECK-NEXT: csrwi vxrm, 0
358 ; CHECK-NEXT: vaaddu.vx v8, v8, a0
360 %xzv = zext <vscale x 8 x i16> %x to <vscale x 8 x i32>
361 %yhead = insertelement <vscale x 8 x i16> poison, i16 %y, i16 0
362 %ysplat = shufflevector <vscale x 8 x i16> %yhead, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
363 %yzv = zext <vscale x 8 x i16> %ysplat to <vscale x 8 x i32>
364 %add = add nuw nsw <vscale x 8 x i32> %xzv, %yzv
365 %one = insertelement <vscale x 8 x i32> poison, i32 1, i32 0
366 %splat = shufflevector <vscale x 8 x i32> %one, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
367 %add1 = add nuw nsw <vscale x 8 x i32> %add, %splat
368 %div = lshr <vscale x 8 x i32> %add1, %splat
369 %ret = trunc <vscale x 8 x i32> %div to <vscale x 8 x i16>
370 ret <vscale x 8 x i16> %ret
373 define <vscale x 8 x i32> @vaaddu_vv_nxv8i32_ceil(<vscale x 8 x i32> %x, <vscale x 8 x i32> %y) {
374 ; CHECK-LABEL: vaaddu_vv_nxv8i32_ceil:
376 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
377 ; CHECK-NEXT: csrwi vxrm, 0
378 ; CHECK-NEXT: vaaddu.vv v8, v8, v12
380 %xzv = zext <vscale x 8 x i32> %x to <vscale x 8 x i64>
381 %yzv = zext <vscale x 8 x i32> %y to <vscale x 8 x i64>
382 %add = add nuw nsw <vscale x 8 x i64> %xzv, %yzv
383 %one = insertelement <vscale x 8 x i64> poison, i64 1, i64 0
384 %splat = shufflevector <vscale x 8 x i64> %one, <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer
385 %add1 = add nuw nsw <vscale x 8 x i64> %add, %splat
386 %div = lshr <vscale x 8 x i64> %add1, %splat
387 %ret = trunc <vscale x 8 x i64> %div to <vscale x 8 x i32>
388 ret <vscale x 8 x i32> %ret
391 define <vscale x 8 x i32> @vaaddu_vx_nxv8i32_ceil(<vscale x 8 x i32> %x, i32 %y) {
392 ; CHECK-LABEL: vaaddu_vx_nxv8i32_ceil:
394 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma
395 ; CHECK-NEXT: csrwi vxrm, 0
396 ; CHECK-NEXT: vaaddu.vx v8, v8, a0
398 %xzv = zext <vscale x 8 x i32> %x to <vscale x 8 x i64>
399 %yhead = insertelement <vscale x 8 x i32> poison, i32 %y, i32 0
400 %ysplat = shufflevector <vscale x 8 x i32> %yhead, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
401 %yzv = zext <vscale x 8 x i32> %ysplat to <vscale x 8 x i64>
402 %add = add nuw nsw <vscale x 8 x i64> %xzv, %yzv
403 %one = insertelement <vscale x 8 x i64> poison, i64 1, i64 0
404 %splat = shufflevector <vscale x 8 x i64> %one, <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer
405 %add1 = add nuw nsw <vscale x 8 x i64> %add, %splat
406 %div = lshr <vscale x 8 x i64> %add1, %splat
407 %ret = trunc <vscale x 8 x i64> %div to <vscale x 8 x i32>
408 ret <vscale x 8 x i32> %ret
411 define <vscale x 8 x i64> @vaaddu_vv_nxv8i64_ceil(<vscale x 8 x i64> %x, <vscale x 8 x i64> %y) {
412 ; CHECK-LABEL: vaaddu_vv_nxv8i64_ceil:
414 ; CHECK-NEXT: vsetvli a0, zero, e64, m8, ta, ma
415 ; CHECK-NEXT: csrwi vxrm, 0
416 ; CHECK-NEXT: vaaddu.vv v8, v8, v16
418 %xzv = zext <vscale x 8 x i64> %x to <vscale x 8 x i128>
419 %yzv = zext <vscale x 8 x i64> %y to <vscale x 8 x i128>
420 %add = add nuw nsw <vscale x 8 x i128> %xzv, %yzv
421 %one = insertelement <vscale x 8 x i128> poison, i128 1, i128 0
422 %splat = shufflevector <vscale x 8 x i128> %one, <vscale x 8 x i128> poison, <vscale x 8 x i32> zeroinitializer
423 %add1 = add nuw nsw <vscale x 8 x i128> %add, %splat
424 %div = lshr <vscale x 8 x i128> %add1, %splat
425 %ret = trunc <vscale x 8 x i128> %div to <vscale x 8 x i64>
426 ret <vscale x 8 x i64> %ret
429 define <vscale x 8 x i64> @vaaddu_vx_nxv8i64_ceil(<vscale x 8 x i64> %x, i64 %y) {
430 ; RV32-LABEL: vaaddu_vx_nxv8i64_ceil:
432 ; RV32-NEXT: addi sp, sp, -16
433 ; RV32-NEXT: .cfi_def_cfa_offset 16
434 ; RV32-NEXT: sw a1, 12(sp)
435 ; RV32-NEXT: sw a0, 8(sp)
436 ; RV32-NEXT: addi a0, sp, 8
437 ; RV32-NEXT: vsetvli a1, zero, e64, m8, ta, ma
438 ; RV32-NEXT: vlse64.v v16, (a0), zero
439 ; RV32-NEXT: csrwi vxrm, 0
440 ; RV32-NEXT: vaaddu.vv v8, v8, v16
441 ; RV32-NEXT: addi sp, sp, 16
444 ; RV64-LABEL: vaaddu_vx_nxv8i64_ceil:
446 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, ma
447 ; RV64-NEXT: csrwi vxrm, 0
448 ; RV64-NEXT: vaaddu.vx v8, v8, a0
450 %xzv = zext <vscale x 8 x i64> %x to <vscale x 8 x i128>
451 %yhead = insertelement <vscale x 8 x i64> poison, i64 %y, i64 0
452 %ysplat = shufflevector <vscale x 8 x i64> %yhead, <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer
453 %yzv = zext <vscale x 8 x i64> %ysplat to <vscale x 8 x i128>
454 %add = add nuw nsw <vscale x 8 x i128> %xzv, %yzv
455 %one = insertelement <vscale x 8 x i128> poison, i128 1, i128 0
456 %splat = shufflevector <vscale x 8 x i128> %one, <vscale x 8 x i128> poison, <vscale x 8 x i32> zeroinitializer
457 %add1 = add nuw nsw <vscale x 8 x i128> %add, %splat
458 %div = lshr <vscale x 8 x i128> %add1, %splat
459 %ret = trunc <vscale x 8 x i128> %div to <vscale x 8 x i64>
460 ret <vscale x 8 x i64> %ret