1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple aarch64-none-linux-gnu -mattr=+sve | FileCheck %s
4 define <vscale x 2 x i16> @dupsext_v2i8_v2i16(i8 %src, <vscale x 2 x i16> %b) {
5 ; CHECK-LABEL: dupsext_v2i8_v2i16:
6 ; CHECK: // %bb.0: // %entry
7 ; CHECK-NEXT: sxtb w8, w0
8 ; CHECK-NEXT: ptrue p0.d
9 ; CHECK-NEXT: mov z1.d, x8
10 ; CHECK-NEXT: mul z0.d, p0/m, z0.d, z1.d
13 %in = sext i8 %src to i16
14 %broadcast.splatinsert = insertelement <vscale x 2 x i16> undef, i16 %in, i16 0
15 %broadcast.splat = shufflevector <vscale x 2 x i16> %broadcast.splatinsert, <vscale x 2 x i16> undef, <vscale x 2 x i32> zeroinitializer
16 %out = mul nsw <vscale x 2 x i16> %broadcast.splat, %b
17 ret <vscale x 2 x i16> %out
20 define <vscale x 4 x i16> @dupsext_v4i8_v4i16(i8 %src, <vscale x 4 x i16> %b) {
21 ; CHECK-LABEL: dupsext_v4i8_v4i16:
22 ; CHECK: // %bb.0: // %entry
23 ; CHECK-NEXT: sxtb w8, w0
24 ; CHECK-NEXT: ptrue p0.s
25 ; CHECK-NEXT: mov z1.s, w8
26 ; CHECK-NEXT: mul z0.s, p0/m, z0.s, z1.s
29 %in = sext i8 %src to i16
30 %broadcast.splatinsert = insertelement <vscale x 4 x i16> undef, i16 %in, i16 0
31 %broadcast.splat = shufflevector <vscale x 4 x i16> %broadcast.splatinsert, <vscale x 4 x i16> undef, <vscale x 4 x i32> zeroinitializer
32 %out = mul nsw <vscale x 4 x i16> %broadcast.splat, %b
33 ret <vscale x 4 x i16> %out
36 define <vscale x 8 x i16> @dupsext_v8i8_v8i16(i8 %src, <vscale x 8 x i16> %b) {
37 ; CHECK-LABEL: dupsext_v8i8_v8i16:
38 ; CHECK: // %bb.0: // %entry
39 ; CHECK-NEXT: sxtb w8, w0
40 ; CHECK-NEXT: ptrue p0.h
41 ; CHECK-NEXT: mov z1.h, w8
42 ; CHECK-NEXT: mul z0.h, p0/m, z0.h, z1.h
45 %in = sext i8 %src to i16
46 %broadcast.splatinsert = insertelement <vscale x 8 x i16> undef, i16 %in, i16 0
47 %broadcast.splat = shufflevector <vscale x 8 x i16> %broadcast.splatinsert, <vscale x 8 x i16> undef, <vscale x 8 x i32> zeroinitializer
48 %out = mul nsw <vscale x 8 x i16> %broadcast.splat, %b
49 ret <vscale x 8 x i16> %out
52 define <vscale x 2 x i32> @dupsext_v2i8_v2i32(i8 %src, <vscale x 2 x i32> %b) {
53 ; CHECK-LABEL: dupsext_v2i8_v2i32:
54 ; CHECK: // %bb.0: // %entry
55 ; CHECK-NEXT: sxtb w8, w0
56 ; CHECK-NEXT: ptrue p0.d
57 ; CHECK-NEXT: mov z1.d, x8
58 ; CHECK-NEXT: mul z0.d, p0/m, z0.d, z1.d
61 %in = sext i8 %src to i32
62 %broadcast.splatinsert = insertelement <vscale x 2 x i32> undef, i32 %in, i32 0
63 %broadcast.splat = shufflevector <vscale x 2 x i32> %broadcast.splatinsert, <vscale x 2 x i32> undef, <vscale x 2 x i32> zeroinitializer
64 %out = mul nsw <vscale x 2 x i32> %broadcast.splat, %b
65 ret <vscale x 2 x i32> %out
68 define <vscale x 4 x i32> @dupsext_v4i8_v4i32(i8 %src, <vscale x 4 x i32> %b) {
69 ; CHECK-LABEL: dupsext_v4i8_v4i32:
70 ; CHECK: // %bb.0: // %entry
71 ; CHECK-NEXT: sxtb w8, w0
72 ; CHECK-NEXT: ptrue p0.s
73 ; CHECK-NEXT: mov z1.s, w8
74 ; CHECK-NEXT: mul z0.s, p0/m, z0.s, z1.s
77 %in = sext i8 %src to i32
78 %broadcast.splatinsert = insertelement <vscale x 4 x i32> undef, i32 %in, i32 0
79 %broadcast.splat = shufflevector <vscale x 4 x i32> %broadcast.splatinsert, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer
80 %out = mul nsw <vscale x 4 x i32> %broadcast.splat, %b
81 ret <vscale x 4 x i32> %out
84 define <vscale x 2 x i64> @dupsext_v2i8_v2i64(i8 %src, <vscale x 2 x i64> %b) {
85 ; CHECK-LABEL: dupsext_v2i8_v2i64:
86 ; CHECK: // %bb.0: // %entry
87 ; CHECK-NEXT: // kill: def $w0 killed $w0 def $x0
88 ; CHECK-NEXT: sxtb x8, w0
89 ; CHECK-NEXT: ptrue p0.d
90 ; CHECK-NEXT: mov z1.d, x8
91 ; CHECK-NEXT: mul z0.d, p0/m, z0.d, z1.d
94 %in = sext i8 %src to i64
95 %broadcast.splatinsert = insertelement <vscale x 2 x i64> undef, i64 %in, i64 0
96 %broadcast.splat = shufflevector <vscale x 2 x i64> %broadcast.splatinsert, <vscale x 2 x i64> undef, <vscale x 2 x i32> zeroinitializer
97 %out = mul nsw <vscale x 2 x i64> %broadcast.splat, %b
98 ret <vscale x 2 x i64> %out
101 define <vscale x 2 x i32> @dupsext_v2i16_v2i32(i16 %src, <vscale x 2 x i32> %b) {
102 ; CHECK-LABEL: dupsext_v2i16_v2i32:
103 ; CHECK: // %bb.0: // %entry
104 ; CHECK-NEXT: sxth w8, w0
105 ; CHECK-NEXT: ptrue p0.d
106 ; CHECK-NEXT: mov z1.d, x8
107 ; CHECK-NEXT: mul z0.d, p0/m, z0.d, z1.d
110 %in = sext i16 %src to i32
111 %broadcast.splatinsert = insertelement <vscale x 2 x i32> undef, i32 %in, i32 0
112 %broadcast.splat = shufflevector <vscale x 2 x i32> %broadcast.splatinsert, <vscale x 2 x i32> undef, <vscale x 2 x i32> zeroinitializer
113 %out = mul nsw <vscale x 2 x i32> %broadcast.splat, %b
114 ret <vscale x 2 x i32> %out
117 define <vscale x 4 x i32> @dupsext_v4i16_v4i32(i16 %src, <vscale x 4 x i32> %b) {
118 ; CHECK-LABEL: dupsext_v4i16_v4i32:
119 ; CHECK: // %bb.0: // %entry
120 ; CHECK-NEXT: sxth w8, w0
121 ; CHECK-NEXT: ptrue p0.s
122 ; CHECK-NEXT: mov z1.s, w8
123 ; CHECK-NEXT: mul z0.s, p0/m, z0.s, z1.s
126 %in = sext i16 %src to i32
127 %broadcast.splatinsert = insertelement <vscale x 4 x i32> undef, i32 %in, i32 0
128 %broadcast.splat = shufflevector <vscale x 4 x i32> %broadcast.splatinsert, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer
129 %out = mul nsw <vscale x 4 x i32> %broadcast.splat, %b
130 ret <vscale x 4 x i32> %out
133 define <vscale x 2 x i64> @dupsext_v2i16_v2i64(i16 %src, <vscale x 2 x i64> %b) {
134 ; CHECK-LABEL: dupsext_v2i16_v2i64:
135 ; CHECK: // %bb.0: // %entry
136 ; CHECK-NEXT: // kill: def $w0 killed $w0 def $x0
137 ; CHECK-NEXT: sxth x8, w0
138 ; CHECK-NEXT: ptrue p0.d
139 ; CHECK-NEXT: mov z1.d, x8
140 ; CHECK-NEXT: mul z0.d, p0/m, z0.d, z1.d
143 %in = sext i16 %src to i64
144 %broadcast.splatinsert = insertelement <vscale x 2 x i64> undef, i64 %in, i64 0
145 %broadcast.splat = shufflevector <vscale x 2 x i64> %broadcast.splatinsert, <vscale x 2 x i64> undef, <vscale x 2 x i32> zeroinitializer
146 %out = mul nsw <vscale x 2 x i64> %broadcast.splat, %b
147 ret <vscale x 2 x i64> %out
150 define <vscale x 2 x i64> @dupsext_v2i32_v2i64(i32 %src, <vscale x 2 x i64> %b) {
151 ; CHECK-LABEL: dupsext_v2i32_v2i64:
152 ; CHECK: // %bb.0: // %entry
153 ; CHECK-NEXT: // kill: def $w0 killed $w0 def $x0
154 ; CHECK-NEXT: sxtw x8, w0
155 ; CHECK-NEXT: ptrue p0.d
156 ; CHECK-NEXT: mov z1.d, x8
157 ; CHECK-NEXT: mul z0.d, p0/m, z0.d, z1.d
160 %in = sext i32 %src to i64
161 %broadcast.splatinsert = insertelement <vscale x 2 x i64> undef, i64 %in, i64 0
162 %broadcast.splat = shufflevector <vscale x 2 x i64> %broadcast.splatinsert, <vscale x 2 x i64> undef, <vscale x 2 x i32> zeroinitializer
163 %out = mul nsw <vscale x 2 x i64> %broadcast.splat, %b
164 ret <vscale x 2 x i64> %out
167 define <vscale x 2 x i16> @dupzext_v2i8_v2i16(i8 %src, <vscale x 2 x i16> %b) {
168 ; CHECK-LABEL: dupzext_v2i8_v2i16:
169 ; CHECK: // %bb.0: // %entry
170 ; CHECK-NEXT: and w8, w0, #0xff
171 ; CHECK-NEXT: ptrue p0.d
172 ; CHECK-NEXT: mov z1.d, x8
173 ; CHECK-NEXT: mul z0.d, p0/m, z0.d, z1.d
176 %in = zext i8 %src to i16
177 %broadcast.splatinsert = insertelement <vscale x 2 x i16> undef, i16 %in, i16 0
178 %broadcast.splat = shufflevector <vscale x 2 x i16> %broadcast.splatinsert, <vscale x 2 x i16> undef, <vscale x 2 x i32> zeroinitializer
179 %out = mul nuw <vscale x 2 x i16> %broadcast.splat, %b
180 ret <vscale x 2 x i16> %out
183 define <vscale x 4 x i16> @dupzext_v4i8_v4i16(i8 %src, <vscale x 4 x i16> %b) {
184 ; CHECK-LABEL: dupzext_v4i8_v4i16:
185 ; CHECK: // %bb.0: // %entry
186 ; CHECK-NEXT: and w8, w0, #0xff
187 ; CHECK-NEXT: ptrue p0.s
188 ; CHECK-NEXT: mov z1.s, w8
189 ; CHECK-NEXT: mul z0.s, p0/m, z0.s, z1.s
192 %in = zext i8 %src to i16
193 %broadcast.splatinsert = insertelement <vscale x 4 x i16> undef, i16 %in, i16 0
194 %broadcast.splat = shufflevector <vscale x 4 x i16> %broadcast.splatinsert, <vscale x 4 x i16> undef, <vscale x 4 x i32> zeroinitializer
195 %out = mul nuw <vscale x 4 x i16> %broadcast.splat, %b
196 ret <vscale x 4 x i16> %out
199 define <vscale x 8 x i16> @dupzext_v8i8_v8i16(i8 %src, <vscale x 8 x i16> %b) {
200 ; CHECK-LABEL: dupzext_v8i8_v8i16:
201 ; CHECK: // %bb.0: // %entry
202 ; CHECK-NEXT: and w8, w0, #0xff
203 ; CHECK-NEXT: ptrue p0.h
204 ; CHECK-NEXT: mov z1.h, w8
205 ; CHECK-NEXT: mul z0.h, p0/m, z0.h, z1.h
208 %in = zext i8 %src to i16
209 %broadcast.splatinsert = insertelement <vscale x 8 x i16> undef, i16 %in, i16 0
210 %broadcast.splat = shufflevector <vscale x 8 x i16> %broadcast.splatinsert, <vscale x 8 x i16> undef, <vscale x 8 x i32> zeroinitializer
211 %out = mul nuw <vscale x 8 x i16> %broadcast.splat, %b
212 ret <vscale x 8 x i16> %out
215 define <vscale x 2 x i32> @dupzext_v2i8_v2i32(i8 %src, <vscale x 2 x i32> %b) {
216 ; CHECK-LABEL: dupzext_v2i8_v2i32:
217 ; CHECK: // %bb.0: // %entry
218 ; CHECK-NEXT: and w8, w0, #0xff
219 ; CHECK-NEXT: ptrue p0.d
220 ; CHECK-NEXT: mov z1.d, x8
221 ; CHECK-NEXT: mul z0.d, p0/m, z0.d, z1.d
224 %in = zext i8 %src to i32
225 %broadcast.splatinsert = insertelement <vscale x 2 x i32> undef, i32 %in, i32 0
226 %broadcast.splat = shufflevector <vscale x 2 x i32> %broadcast.splatinsert, <vscale x 2 x i32> undef, <vscale x 2 x i32> zeroinitializer
227 %out = mul nuw <vscale x 2 x i32> %broadcast.splat, %b
228 ret <vscale x 2 x i32> %out
231 define <vscale x 4 x i32> @dupzext_v4i8_v4i32(i8 %src, <vscale x 4 x i32> %b) {
232 ; CHECK-LABEL: dupzext_v4i8_v4i32:
233 ; CHECK: // %bb.0: // %entry
234 ; CHECK-NEXT: and w8, w0, #0xff
235 ; CHECK-NEXT: ptrue p0.s
236 ; CHECK-NEXT: mov z1.s, w8
237 ; CHECK-NEXT: mul z0.s, p0/m, z0.s, z1.s
240 %in = zext i8 %src to i32
241 %broadcast.splatinsert = insertelement <vscale x 4 x i32> undef, i32 %in, i32 0
242 %broadcast.splat = shufflevector <vscale x 4 x i32> %broadcast.splatinsert, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer
243 %out = mul nuw <vscale x 4 x i32> %broadcast.splat, %b
244 ret <vscale x 4 x i32> %out
247 define <vscale x 2 x i64> @dupzext_v2i8_v2i64(i8 %src, <vscale x 2 x i64> %b) {
248 ; CHECK-LABEL: dupzext_v2i8_v2i64:
249 ; CHECK: // %bb.0: // %entry
250 ; CHECK-NEXT: // kill: def $w0 killed $w0 def $x0
251 ; CHECK-NEXT: and x8, x0, #0xff
252 ; CHECK-NEXT: ptrue p0.d
253 ; CHECK-NEXT: mov z1.d, x8
254 ; CHECK-NEXT: mul z0.d, p0/m, z0.d, z1.d
257 %in = zext i8 %src to i64
258 %broadcast.splatinsert = insertelement <vscale x 2 x i64> undef, i64 %in, i64 0
259 %broadcast.splat = shufflevector <vscale x 2 x i64> %broadcast.splatinsert, <vscale x 2 x i64> undef, <vscale x 2 x i32> zeroinitializer
260 %out = mul nuw <vscale x 2 x i64> %broadcast.splat, %b
261 ret <vscale x 2 x i64> %out
264 define <vscale x 2 x i32> @dupzext_v2i16_v2i32(i16 %src, <vscale x 2 x i32> %b) {
265 ; CHECK-LABEL: dupzext_v2i16_v2i32:
266 ; CHECK: // %bb.0: // %entry
267 ; CHECK-NEXT: and w8, w0, #0xffff
268 ; CHECK-NEXT: ptrue p0.d
269 ; CHECK-NEXT: mov z1.d, x8
270 ; CHECK-NEXT: mul z0.d, p0/m, z0.d, z1.d
273 %in = zext i16 %src to i32
274 %broadcast.splatinsert = insertelement <vscale x 2 x i32> undef, i32 %in, i32 0
275 %broadcast.splat = shufflevector <vscale x 2 x i32> %broadcast.splatinsert, <vscale x 2 x i32> undef, <vscale x 2 x i32> zeroinitializer
276 %out = mul nuw <vscale x 2 x i32> %broadcast.splat, %b
277 ret <vscale x 2 x i32> %out
280 define <vscale x 4 x i32> @dupzext_v4i16_v4i32(i16 %src, <vscale x 4 x i32> %b) {
281 ; CHECK-LABEL: dupzext_v4i16_v4i32:
282 ; CHECK: // %bb.0: // %entry
283 ; CHECK-NEXT: and w8, w0, #0xffff
284 ; CHECK-NEXT: ptrue p0.s
285 ; CHECK-NEXT: mov z1.s, w8
286 ; CHECK-NEXT: mul z0.s, p0/m, z0.s, z1.s
289 %in = zext i16 %src to i32
290 %broadcast.splatinsert = insertelement <vscale x 4 x i32> undef, i32 %in, i32 0
291 %broadcast.splat = shufflevector <vscale x 4 x i32> %broadcast.splatinsert, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer
292 %out = mul nuw <vscale x 4 x i32> %broadcast.splat, %b
293 ret <vscale x 4 x i32> %out
296 define <vscale x 2 x i64> @dupzext_v2i16_v2i64(i16 %src, <vscale x 2 x i64> %b) {
297 ; CHECK-LABEL: dupzext_v2i16_v2i64:
298 ; CHECK: // %bb.0: // %entry
299 ; CHECK-NEXT: // kill: def $w0 killed $w0 def $x0
300 ; CHECK-NEXT: and x8, x0, #0xffff
301 ; CHECK-NEXT: ptrue p0.d
302 ; CHECK-NEXT: mov z1.d, x8
303 ; CHECK-NEXT: mul z0.d, p0/m, z0.d, z1.d
306 %in = zext i16 %src to i64
307 %broadcast.splatinsert = insertelement <vscale x 2 x i64> undef, i64 %in, i64 0
308 %broadcast.splat = shufflevector <vscale x 2 x i64> %broadcast.splatinsert, <vscale x 2 x i64> undef, <vscale x 2 x i32> zeroinitializer
309 %out = mul nuw <vscale x 2 x i64> %broadcast.splat, %b
310 ret <vscale x 2 x i64> %out
313 define <vscale x 2 x i64> @dupzext_v2i32_v2i64(i32 %src, <vscale x 2 x i64> %b) {
314 ; CHECK-LABEL: dupzext_v2i32_v2i64:
315 ; CHECK: // %bb.0: // %entry
316 ; CHECK-NEXT: mov w8, w0
317 ; CHECK-NEXT: ptrue p0.d
318 ; CHECK-NEXT: mov z1.d, x8
319 ; CHECK-NEXT: mul z0.d, p0/m, z0.d, z1.d
322 %in = zext i32 %src to i64
323 %broadcast.splatinsert = insertelement <vscale x 2 x i64> undef, i64 %in, i64 0
324 %broadcast.splat = shufflevector <vscale x 2 x i64> %broadcast.splatinsert, <vscale x 2 x i64> undef, <vscale x 2 x i32> zeroinitializer
325 %out = mul nuw <vscale x 2 x i64> %broadcast.splat, %b
326 ret <vscale x 2 x i64> %out