1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
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 1 x i32> @vmulhu_vv_nxv1i32(<vscale x 1 x i32> %va, <vscale x 1 x i32> %vb) {
6 ; CHECK-LABEL: vmulhu_vv_nxv1i32:
8 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
9 ; CHECK-NEXT: vmulhu.vv v8, v9, v8
11 %vc = zext <vscale x 1 x i32> %vb to <vscale x 1 x i64>
12 %vd = zext <vscale x 1 x i32> %va to <vscale x 1 x i64>
13 %ve = mul <vscale x 1 x i64> %vc, %vd
14 %head = insertelement <vscale x 1 x i64> poison, i64 32, i32 0
15 %splat = shufflevector <vscale x 1 x i64> %head, <vscale x 1 x i64> poison, <vscale x 1 x i32> zeroinitializer
16 %vf = lshr <vscale x 1 x i64> %ve, %splat
17 %vg = trunc <vscale x 1 x i64> %vf to <vscale x 1 x i32>
18 ret <vscale x 1 x i32> %vg
21 define <vscale x 1 x i32> @vmulhu_vx_nxv1i32(<vscale x 1 x i32> %va, i32 %x) {
22 ; CHECK-LABEL: vmulhu_vx_nxv1i32:
24 ; CHECK-NEXT: vsetvli a1, zero, e32, mf2, ta, ma
25 ; CHECK-NEXT: vmulhu.vx v8, v8, a0
27 %head1 = insertelement <vscale x 1 x i32> poison, i32 %x, i32 0
28 %splat1 = shufflevector <vscale x 1 x i32> %head1, <vscale x 1 x i32> poison, <vscale x 1 x i32> zeroinitializer
29 %vb = zext <vscale x 1 x i32> %splat1 to <vscale x 1 x i64>
30 %vc = zext <vscale x 1 x i32> %va to <vscale x 1 x i64>
31 %vd = mul <vscale x 1 x i64> %vb, %vc
32 %head2 = insertelement <vscale x 1 x i64> poison, i64 32, i32 0
33 %splat2 = shufflevector <vscale x 1 x i64> %head2, <vscale x 1 x i64> poison, <vscale x 1 x i32> zeroinitializer
34 %ve = lshr <vscale x 1 x i64> %vd, %splat2
35 %vf = trunc <vscale x 1 x i64> %ve to <vscale x 1 x i32>
36 ret <vscale x 1 x i32> %vf
39 define <vscale x 1 x i32> @vmulhu_vi_nxv1i32_0(<vscale x 1 x i32> %va) {
40 ; CHECK-LABEL: vmulhu_vi_nxv1i32_0:
42 ; CHECK-NEXT: li a0, -7
43 ; CHECK-NEXT: vsetvli a1, zero, e32, mf2, ta, ma
44 ; CHECK-NEXT: vmulhu.vx v8, v8, a0
46 %head1 = insertelement <vscale x 1 x i32> poison, i32 -7, i32 0
47 %splat1 = shufflevector <vscale x 1 x i32> %head1, <vscale x 1 x i32> poison, <vscale x 1 x i32> zeroinitializer
48 %vb = zext <vscale x 1 x i32> %splat1 to <vscale x 1 x i64>
49 %vc = zext <vscale x 1 x i32> %va to <vscale x 1 x i64>
50 %vd = mul <vscale x 1 x i64> %vb, %vc
51 %head2 = insertelement <vscale x 1 x i64> poison, i64 32, i32 0
52 %splat2 = shufflevector <vscale x 1 x i64> %head2, <vscale x 1 x i64> poison, <vscale x 1 x i32> zeroinitializer
53 %ve = lshr <vscale x 1 x i64> %vd, %splat2
54 %vf = trunc <vscale x 1 x i64> %ve to <vscale x 1 x i32>
55 ret <vscale x 1 x i32> %vf
58 define <vscale x 1 x i32> @vmulhu_vi_nxv1i32_1(<vscale x 1 x i32> %va) {
59 ; RV32-LABEL: vmulhu_vi_nxv1i32_1:
61 ; RV32-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
62 ; RV32-NEXT: vsrl.vi v8, v8, 28
65 ; RV64-LABEL: vmulhu_vi_nxv1i32_1:
67 ; RV64-NEXT: li a0, 16
68 ; RV64-NEXT: vsetvli a1, zero, e32, mf2, ta, ma
69 ; RV64-NEXT: vmulhu.vx v8, v8, a0
71 %head1 = insertelement <vscale x 1 x i32> poison, i32 16, i32 0
72 %splat1 = shufflevector <vscale x 1 x i32> %head1, <vscale x 1 x i32> poison, <vscale x 1 x i32> zeroinitializer
73 %vb = zext <vscale x 1 x i32> %splat1 to <vscale x 1 x i64>
74 %vc = zext <vscale x 1 x i32> %va to <vscale x 1 x i64>
75 %vd = mul <vscale x 1 x i64> %vb, %vc
76 %head2 = insertelement <vscale x 1 x i64> poison, i64 32, i32 0
77 %splat2 = shufflevector <vscale x 1 x i64> %head2, <vscale x 1 x i64> poison, <vscale x 1 x i32> zeroinitializer
78 %ve = lshr <vscale x 1 x i64> %vd, %splat2
79 %vf = trunc <vscale x 1 x i64> %ve to <vscale x 1 x i32>
80 ret <vscale x 1 x i32> %vf
83 define <vscale x 2 x i32> @vmulhu_vv_nxv2i32(<vscale x 2 x i32> %va, <vscale x 2 x i32> %vb) {
84 ; CHECK-LABEL: vmulhu_vv_nxv2i32:
86 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
87 ; CHECK-NEXT: vmulhu.vv v8, v9, v8
89 %vc = zext <vscale x 2 x i32> %vb to <vscale x 2 x i64>
90 %vd = zext <vscale x 2 x i32> %va to <vscale x 2 x i64>
91 %ve = mul <vscale x 2 x i64> %vc, %vd
92 %head = insertelement <vscale x 2 x i64> poison, i64 32, i32 0
93 %splat = shufflevector <vscale x 2 x i64> %head, <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
94 %vf = lshr <vscale x 2 x i64> %ve, %splat
95 %vg = trunc <vscale x 2 x i64> %vf to <vscale x 2 x i32>
96 ret <vscale x 2 x i32> %vg
99 define <vscale x 2 x i32> @vmulhu_vx_nxv2i32(<vscale x 2 x i32> %va, i32 %x) {
100 ; CHECK-LABEL: vmulhu_vx_nxv2i32:
102 ; CHECK-NEXT: vsetvli a1, zero, e32, m1, ta, ma
103 ; CHECK-NEXT: vmulhu.vx v8, v8, a0
105 %head1 = insertelement <vscale x 2 x i32> poison, i32 %x, i32 0
106 %splat1 = shufflevector <vscale x 2 x i32> %head1, <vscale x 2 x i32> poison, <vscale x 2 x i32> zeroinitializer
107 %vb = zext <vscale x 2 x i32> %splat1 to <vscale x 2 x i64>
108 %vc = zext <vscale x 2 x i32> %va to <vscale x 2 x i64>
109 %vd = mul <vscale x 2 x i64> %vb, %vc
110 %head2 = insertelement <vscale x 2 x i64> poison, i64 32, i32 0
111 %splat2 = shufflevector <vscale x 2 x i64> %head2, <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
112 %ve = lshr <vscale x 2 x i64> %vd, %splat2
113 %vf = trunc <vscale x 2 x i64> %ve to <vscale x 2 x i32>
114 ret <vscale x 2 x i32> %vf
117 define <vscale x 2 x i32> @vmulhu_vi_nxv2i32_0(<vscale x 2 x i32> %va) {
118 ; CHECK-LABEL: vmulhu_vi_nxv2i32_0:
120 ; CHECK-NEXT: li a0, -7
121 ; CHECK-NEXT: vsetvli a1, zero, e32, m1, ta, ma
122 ; CHECK-NEXT: vmulhu.vx v8, v8, a0
124 %head1 = insertelement <vscale x 2 x i32> poison, i32 -7, i32 0
125 %splat1 = shufflevector <vscale x 2 x i32> %head1, <vscale x 2 x i32> poison, <vscale x 2 x i32> zeroinitializer
126 %vb = zext <vscale x 2 x i32> %splat1 to <vscale x 2 x i64>
127 %vc = zext <vscale x 2 x i32> %va to <vscale x 2 x i64>
128 %vd = mul <vscale x 2 x i64> %vb, %vc
129 %head2 = insertelement <vscale x 2 x i64> poison, i64 32, i32 0
130 %splat2 = shufflevector <vscale x 2 x i64> %head2, <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
131 %ve = lshr <vscale x 2 x i64> %vd, %splat2
132 %vf = trunc <vscale x 2 x i64> %ve to <vscale x 2 x i32>
133 ret <vscale x 2 x i32> %vf
136 define <vscale x 2 x i32> @vmulhu_vi_nxv2i32_1(<vscale x 2 x i32> %va) {
137 ; RV32-LABEL: vmulhu_vi_nxv2i32_1:
139 ; RV32-NEXT: vsetvli a0, zero, e32, m1, ta, ma
140 ; RV32-NEXT: vsrl.vi v8, v8, 28
143 ; RV64-LABEL: vmulhu_vi_nxv2i32_1:
145 ; RV64-NEXT: li a0, 16
146 ; RV64-NEXT: vsetvli a1, zero, e32, m1, ta, ma
147 ; RV64-NEXT: vmulhu.vx v8, v8, a0
149 %head1 = insertelement <vscale x 2 x i32> poison, i32 16, i32 0
150 %splat1 = shufflevector <vscale x 2 x i32> %head1, <vscale x 2 x i32> poison, <vscale x 2 x i32> zeroinitializer
151 %vb = zext <vscale x 2 x i32> %splat1 to <vscale x 2 x i64>
152 %vc = zext <vscale x 2 x i32> %va to <vscale x 2 x i64>
153 %vd = mul <vscale x 2 x i64> %vb, %vc
154 %head2 = insertelement <vscale x 2 x i64> poison, i64 32, i32 0
155 %splat2 = shufflevector <vscale x 2 x i64> %head2, <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
156 %ve = lshr <vscale x 2 x i64> %vd, %splat2
157 %vf = trunc <vscale x 2 x i64> %ve to <vscale x 2 x i32>
158 ret <vscale x 2 x i32> %vf
161 define <vscale x 4 x i32> @vmulhu_vv_nxv4i32(<vscale x 4 x i32> %va, <vscale x 4 x i32> %vb) {
162 ; CHECK-LABEL: vmulhu_vv_nxv4i32:
164 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
165 ; CHECK-NEXT: vmulhu.vv v8, v10, v8
167 %vc = zext <vscale x 4 x i32> %vb to <vscale x 4 x i64>
168 %vd = zext <vscale x 4 x i32> %va to <vscale x 4 x i64>
169 %ve = mul <vscale x 4 x i64> %vc, %vd
170 %head = insertelement <vscale x 4 x i64> poison, i64 32, i32 0
171 %splat = shufflevector <vscale x 4 x i64> %head, <vscale x 4 x i64> poison, <vscale x 4 x i32> zeroinitializer
172 %vf = lshr <vscale x 4 x i64> %ve, %splat
173 %vg = trunc <vscale x 4 x i64> %vf to <vscale x 4 x i32>
174 ret <vscale x 4 x i32> %vg
177 define <vscale x 4 x i32> @vmulhu_vx_nxv4i32(<vscale x 4 x i32> %va, i32 %x) {
178 ; CHECK-LABEL: vmulhu_vx_nxv4i32:
180 ; CHECK-NEXT: vsetvli a1, zero, e32, m2, ta, ma
181 ; CHECK-NEXT: vmulhu.vx v8, v8, a0
183 %head1 = insertelement <vscale x 4 x i32> poison, i32 %x, i32 0
184 %splat1 = shufflevector <vscale x 4 x i32> %head1, <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
185 %vb = zext <vscale x 4 x i32> %splat1 to <vscale x 4 x i64>
186 %vc = zext <vscale x 4 x i32> %va to <vscale x 4 x i64>
187 %vd = mul <vscale x 4 x i64> %vb, %vc
188 %head2 = insertelement <vscale x 4 x i64> poison, i64 32, i32 0
189 %splat2 = shufflevector <vscale x 4 x i64> %head2, <vscale x 4 x i64> poison, <vscale x 4 x i32> zeroinitializer
190 %ve = lshr <vscale x 4 x i64> %vd, %splat2
191 %vf = trunc <vscale x 4 x i64> %ve to <vscale x 4 x i32>
192 ret <vscale x 4 x i32> %vf
195 define <vscale x 4 x i32> @vmulhu_vi_nxv4i32_0(<vscale x 4 x i32> %va) {
196 ; CHECK-LABEL: vmulhu_vi_nxv4i32_0:
198 ; CHECK-NEXT: li a0, -7
199 ; CHECK-NEXT: vsetvli a1, zero, e32, m2, ta, ma
200 ; CHECK-NEXT: vmulhu.vx v8, v8, a0
202 %head1 = insertelement <vscale x 4 x i32> poison, i32 -7, i32 0
203 %splat1 = shufflevector <vscale x 4 x i32> %head1, <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
204 %vb = zext <vscale x 4 x i32> %splat1 to <vscale x 4 x i64>
205 %vc = zext <vscale x 4 x i32> %va to <vscale x 4 x i64>
206 %vd = mul <vscale x 4 x i64> %vb, %vc
207 %head2 = insertelement <vscale x 4 x i64> poison, i64 32, i32 0
208 %splat2 = shufflevector <vscale x 4 x i64> %head2, <vscale x 4 x i64> poison, <vscale x 4 x i32> zeroinitializer
209 %ve = lshr <vscale x 4 x i64> %vd, %splat2
210 %vf = trunc <vscale x 4 x i64> %ve to <vscale x 4 x i32>
211 ret <vscale x 4 x i32> %vf
214 define <vscale x 4 x i32> @vmulhu_vi_nxv4i32_1(<vscale x 4 x i32> %va) {
215 ; RV32-LABEL: vmulhu_vi_nxv4i32_1:
217 ; RV32-NEXT: vsetvli a0, zero, e32, m2, ta, ma
218 ; RV32-NEXT: vsrl.vi v8, v8, 28
221 ; RV64-LABEL: vmulhu_vi_nxv4i32_1:
223 ; RV64-NEXT: li a0, 16
224 ; RV64-NEXT: vsetvli a1, zero, e32, m2, ta, ma
225 ; RV64-NEXT: vmulhu.vx v8, v8, a0
227 %head1 = insertelement <vscale x 4 x i32> poison, i32 16, i32 0
228 %splat1 = shufflevector <vscale x 4 x i32> %head1, <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
229 %vb = zext <vscale x 4 x i32> %splat1 to <vscale x 4 x i64>
230 %vc = zext <vscale x 4 x i32> %va to <vscale x 4 x i64>
231 %vd = mul <vscale x 4 x i64> %vb, %vc
232 %head2 = insertelement <vscale x 4 x i64> poison, i64 32, i32 0
233 %splat2 = shufflevector <vscale x 4 x i64> %head2, <vscale x 4 x i64> poison, <vscale x 4 x i32> zeroinitializer
234 %ve = lshr <vscale x 4 x i64> %vd, %splat2
235 %vf = trunc <vscale x 4 x i64> %ve to <vscale x 4 x i32>
236 ret <vscale x 4 x i32> %vf
239 define <vscale x 8 x i32> @vmulhu_vv_nxv8i32(<vscale x 8 x i32> %va, <vscale x 8 x i32> %vb) {
240 ; CHECK-LABEL: vmulhu_vv_nxv8i32:
242 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
243 ; CHECK-NEXT: vmulhu.vv v8, v12, v8
245 %vc = zext <vscale x 8 x i32> %vb to <vscale x 8 x i64>
246 %vd = zext <vscale x 8 x i32> %va to <vscale x 8 x i64>
247 %ve = mul <vscale x 8 x i64> %vc, %vd
248 %head = insertelement <vscale x 8 x i64> poison, i64 32, i32 0
249 %splat = shufflevector <vscale x 8 x i64> %head, <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer
250 %vf = lshr <vscale x 8 x i64> %ve, %splat
251 %vg = trunc <vscale x 8 x i64> %vf to <vscale x 8 x i32>
252 ret <vscale x 8 x i32> %vg
255 define <vscale x 8 x i32> @vmulhu_vx_nxv8i32(<vscale x 8 x i32> %va, i32 %x) {
256 ; CHECK-LABEL: vmulhu_vx_nxv8i32:
258 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma
259 ; CHECK-NEXT: vmulhu.vx v8, v8, a0
261 %head1 = insertelement <vscale x 8 x i32> poison, i32 %x, i32 0
262 %splat1 = shufflevector <vscale x 8 x i32> %head1, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
263 %vb = zext <vscale x 8 x i32> %splat1 to <vscale x 8 x i64>
264 %vc = zext <vscale x 8 x i32> %va to <vscale x 8 x i64>
265 %vd = mul <vscale x 8 x i64> %vb, %vc
266 %head2 = insertelement <vscale x 8 x i64> poison, i64 32, i32 0
267 %splat2 = shufflevector <vscale x 8 x i64> %head2, <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer
268 %ve = lshr <vscale x 8 x i64> %vd, %splat2
269 %vf = trunc <vscale x 8 x i64> %ve to <vscale x 8 x i32>
270 ret <vscale x 8 x i32> %vf
273 define <vscale x 8 x i32> @vmulhu_vi_nxv8i32_0(<vscale x 8 x i32> %va) {
274 ; CHECK-LABEL: vmulhu_vi_nxv8i32_0:
276 ; CHECK-NEXT: li a0, -7
277 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma
278 ; CHECK-NEXT: vmulhu.vx v8, v8, a0
280 %head1 = insertelement <vscale x 8 x i32> poison, i32 -7, i32 0
281 %splat1 = shufflevector <vscale x 8 x i32> %head1, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
282 %vb = zext <vscale x 8 x i32> %splat1 to <vscale x 8 x i64>
283 %vc = zext <vscale x 8 x i32> %va to <vscale x 8 x i64>
284 %vd = mul <vscale x 8 x i64> %vb, %vc
285 %head2 = insertelement <vscale x 8 x i64> poison, i64 32, i32 0
286 %splat2 = shufflevector <vscale x 8 x i64> %head2, <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer
287 %ve = lshr <vscale x 8 x i64> %vd, %splat2
288 %vf = trunc <vscale x 8 x i64> %ve to <vscale x 8 x i32>
289 ret <vscale x 8 x i32> %vf
292 define <vscale x 8 x i32> @vmulhu_vi_nxv8i32_1(<vscale x 8 x i32> %va) {
293 ; RV32-LABEL: vmulhu_vi_nxv8i32_1:
295 ; RV32-NEXT: vsetvli a0, zero, e32, m4, ta, ma
296 ; RV32-NEXT: vsrl.vi v8, v8, 28
299 ; RV64-LABEL: vmulhu_vi_nxv8i32_1:
301 ; RV64-NEXT: li a0, 16
302 ; RV64-NEXT: vsetvli a1, zero, e32, m4, ta, ma
303 ; RV64-NEXT: vmulhu.vx v8, v8, a0
305 %head1 = insertelement <vscale x 8 x i32> poison, i32 16, i32 0
306 %splat1 = shufflevector <vscale x 8 x i32> %head1, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
307 %vb = zext <vscale x 8 x i32> %splat1 to <vscale x 8 x i64>
308 %vc = zext <vscale x 8 x i32> %va to <vscale x 8 x i64>
309 %vd = mul <vscale x 8 x i64> %vb, %vc
310 %head2 = insertelement <vscale x 8 x i64> poison, i64 32, i32 0
311 %splat2 = shufflevector <vscale x 8 x i64> %head2, <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer
312 %ve = lshr <vscale x 8 x i64> %vd, %splat2
313 %vf = trunc <vscale x 8 x i64> %ve to <vscale x 8 x i32>
314 ret <vscale x 8 x i32> %vf