xref: /llvm-project/llvm/test/CodeGen/AArch64/neon-shift-neg.ll (revision cc82f1290a1e2157a6c0530d78d8cc84d2b8553d)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=aarch64-none-linux-gnu -mattr=+neon,+sve | FileCheck %s
3
4define <2 x i64> @shr64x2(<2 x i64> %a, i64 %b) {
5; CHECK-LABEL: shr64x2:
6; CHECK:       // %bb.0: // %entry
7; CHECK-NEXT:    dup v1.2d, x0
8; CHECK-NEXT:    sshl v0.2d, v0.2d, v1.2d
9; CHECK-NEXT:    ret
10entry:
11  %sub = sub nsw i64 0, %b
12  %splat.splatinsert = insertelement <2 x i64> poison, i64 %sub, i32 0
13  %splat.splat = shufflevector <2 x i64> %splat.splatinsert, <2 x i64> poison, <2 x i32> zeroinitializer
14  %shr = ashr <2 x i64> %a, %splat.splat
15  ret <2 x i64> %shr
16}
17
18define <4 x i32> @shr32x4(<4 x i32> %a, i32 %b) {
19; CHECK-LABEL: shr32x4:
20; CHECK:       // %bb.0: // %entry
21; CHECK-NEXT:    dup v1.4s, w0
22; CHECK-NEXT:    sshl v0.4s, v0.4s, v1.4s
23; CHECK-NEXT:    ret
24entry:
25  %sub = sub nsw i32 0, %b
26  %splat.splatinsert = insertelement <4 x i32> poison, i32 %sub, i32 0
27  %splat.splat = shufflevector <4 x i32> %splat.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
28  %shr = ashr <4 x i32> %a, %splat.splat
29  ret <4 x i32> %shr
30}
31
32define <4 x i32> @shr32x4undef(<4 x i32> %a, i32 %b) {
33; CHECK-LABEL: shr32x4undef:
34; CHECK:       // %bb.0: // %entry
35; CHECK-NEXT:    dup v1.4s, w0
36; CHECK-NEXT:    sshl v0.4s, v0.4s, v1.4s
37; CHECK-NEXT:    ret
38entry:
39  %sub = sub nsw i32 0, %b
40  %splat.splatinsert = insertelement <4 x i32> poison, i32 %sub, i32 0
41  %splat.splat = shufflevector <4 x i32> %splat.splatinsert, <4 x i32> poison, <4 x i32> <i32 undef, i32 0, i32 0, i32 0>
42  %shr = ashr <4 x i32> %a, %splat.splat
43  ret <4 x i32> %shr
44}
45
46define <8 x i16> @shr16x8(<8 x i16> %a, i16 %b) {
47; CHECK-LABEL: shr16x8:
48; CHECK:       // %bb.0: // %entry
49; CHECK-NEXT:    dup v1.8h, w0
50; CHECK-NEXT:    sshl v0.8h, v0.8h, v1.8h
51; CHECK-NEXT:    ret
52entry:
53  %sub = sub i16 0, %b
54  %0 = insertelement <8 x i16> undef, i16 %sub, i32 0
55  %sh_prom = shufflevector <8 x i16> %0, <8 x i16> undef, <8 x i32> zeroinitializer
56  %shr = ashr <8 x i16> %a, %sh_prom
57  ret <8 x i16> %shr
58}
59
60define <16 x i8> @shr8x16(<16 x i8> %a, i8 %b) {
61; CHECK-LABEL: shr8x16:
62; CHECK:       // %bb.0: // %entry
63; CHECK-NEXT:    dup v1.16b, w0
64; CHECK-NEXT:    sshl v0.16b, v0.16b, v1.16b
65; CHECK-NEXT:    ret
66entry:
67  %sub = sub i8 0, %b
68  %0 = insertelement <16 x i8> undef, i8 %sub, i32 0
69  %sh_prom = shufflevector <16 x i8> %0, <16 x i8> undef, <16 x i32> zeroinitializer
70  %shr = ashr <16 x i8> %a, %sh_prom
71  ret <16 x i8> %shr
72}
73
74define <1 x i64> @shr64x1(<1 x i64> %a, i64 %b) {
75; CHECK-LABEL: shr64x1:
76; CHECK:       // %bb.0: // %entry
77; CHECK-NEXT:    fmov d1, x0
78; CHECK-NEXT:    sshl d0, d0, d1
79; CHECK-NEXT:    ret
80entry:
81  %sub = sub nsw i64 0, %b
82  %splat.splatinsert = insertelement <1 x i64> poison, i64 %sub, i32 0
83  %shr = ashr <1 x i64> %a, %splat.splatinsert
84  ret <1 x i64> %shr
85}
86
87define <2 x i32> @shr32x2(<2 x i32> %a, i32 %b) {
88; CHECK-LABEL: shr32x2:
89; CHECK:       // %bb.0: // %entry
90; CHECK-NEXT:    dup v1.2s, w0
91; CHECK-NEXT:    sshl v0.2s, v0.2s, v1.2s
92; CHECK-NEXT:    ret
93entry:
94  %sub = sub nsw i32 0, %b
95  %splat.splatinsert = insertelement <2 x i32> poison, i32 %sub, i32 0
96  %splat.splat = shufflevector <2 x i32> %splat.splatinsert, <2 x i32> poison, <2 x i32> zeroinitializer
97  %shr = ashr <2 x i32> %a, %splat.splat
98  ret <2 x i32> %shr
99}
100
101define <4 x i16> @shr16x4(<4 x i16> %a, i16 %b) {
102; CHECK-LABEL: shr16x4:
103; CHECK:       // %bb.0: // %entry
104; CHECK-NEXT:    dup v1.4h, w0
105; CHECK-NEXT:    sshl v0.4h, v0.4h, v1.4h
106; CHECK-NEXT:    ret
107entry:
108  %sub = sub i16 0, %b
109  %0 = insertelement <4 x i16> undef, i16 %sub, i32 0
110  %sh_prom = shufflevector <4 x i16> %0, <4 x i16> undef, <4 x i32> zeroinitializer
111  %shr = ashr <4 x i16> %a, %sh_prom
112  ret <4 x i16> %shr
113}
114
115define <8 x i8> @shr8x8(<8 x i8> %a, i8 %b) {
116; CHECK-LABEL: shr8x8:
117; CHECK:       // %bb.0: // %entry
118; CHECK-NEXT:    dup v1.8b, w0
119; CHECK-NEXT:    sshl v0.8b, v0.8b, v1.8b
120; CHECK-NEXT:    ret
121entry:
122  %sub = sub i8 0, %b
123  %0 = insertelement <8 x i8> undef, i8 %sub, i32 0
124  %sh_prom = shufflevector <8 x i8> %0, <8 x i8> undef, <8 x i32> zeroinitializer
125  %shr = ashr <8 x i8> %a, %sh_prom
126  ret <8 x i8> %shr
127}
128
129define <2 x i64> @lshr64x2(<2 x i64> %a, i64 %b) {
130; CHECK-LABEL: lshr64x2:
131; CHECK:       // %bb.0: // %entry
132; CHECK-NEXT:    dup v1.2d, x0
133; CHECK-NEXT:    ushl v0.2d, v0.2d, v1.2d
134; CHECK-NEXT:    ret
135entry:
136  %sub = sub nsw i64 0, %b
137  %splat.splatinsert = insertelement <2 x i64> poison, i64 %sub, i32 0
138  %splat.splat = shufflevector <2 x i64> %splat.splatinsert, <2 x i64> poison, <2 x i32> zeroinitializer
139  %shr = lshr <2 x i64> %a, %splat.splat
140  ret <2 x i64> %shr
141}
142
143define <4 x i32> @lshr32x4(<4 x i32> %a, i32 %b) {
144; CHECK-LABEL: lshr32x4:
145; CHECK:       // %bb.0: // %entry
146; CHECK-NEXT:    dup v1.4s, w0
147; CHECK-NEXT:    ushl v0.4s, v0.4s, v1.4s
148; CHECK-NEXT:    ret
149entry:
150  %sub = sub nsw i32 0, %b
151  %splat.splatinsert = insertelement <4 x i32> poison, i32 %sub, i32 0
152  %splat.splat = shufflevector <4 x i32> %splat.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
153  %shr = lshr <4 x i32> %a, %splat.splat
154  ret <4 x i32> %shr
155}
156
157define <4 x i32> @lshr32x4undef(<4 x i32> %a, i32 %b) {
158; CHECK-LABEL: lshr32x4undef:
159; CHECK:       // %bb.0: // %entry
160; CHECK-NEXT:    dup v1.4s, w0
161; CHECK-NEXT:    ushl v0.4s, v0.4s, v1.4s
162; CHECK-NEXT:    ret
163entry:
164  %sub = sub nsw i32 0, %b
165  %splat.splatinsert = insertelement <4 x i32> poison, i32 %sub, i32 0
166  %splat.splat = shufflevector <4 x i32> %splat.splatinsert, <4 x i32> poison, <4 x i32> <i32 undef, i32 0, i32 0, i32 0>
167  %shr = lshr <4 x i32> %a, %splat.splat
168  ret <4 x i32> %shr
169}
170
171define <8 x i16> @lshr16x8(<8 x i16> %a, i16 %b) {
172; CHECK-LABEL: lshr16x8:
173; CHECK:       // %bb.0: // %entry
174; CHECK-NEXT:    dup v1.8h, w0
175; CHECK-NEXT:    ushl v0.8h, v0.8h, v1.8h
176; CHECK-NEXT:    ret
177entry:
178  %sub = sub i16 0, %b
179  %0 = insertelement <8 x i16> undef, i16 %sub, i32 0
180  %sh_prom = shufflevector <8 x i16> %0, <8 x i16> undef, <8 x i32> zeroinitializer
181  %shr = lshr <8 x i16> %a, %sh_prom
182  ret <8 x i16> %shr
183}
184
185define <16 x i8> @lshr8x16(<16 x i8> %a, i8 %b) {
186; CHECK-LABEL: lshr8x16:
187; CHECK:       // %bb.0: // %entry
188; CHECK-NEXT:    dup v1.16b, w0
189; CHECK-NEXT:    ushl v0.16b, v0.16b, v1.16b
190; CHECK-NEXT:    ret
191entry:
192  %sub = sub i8 0, %b
193  %0 = insertelement <16 x i8> undef, i8 %sub, i32 0
194  %sh_prom = shufflevector <16 x i8> %0, <16 x i8> undef, <16 x i32> zeroinitializer
195  %shr = lshr <16 x i8> %a, %sh_prom
196  ret <16 x i8> %shr
197}
198
199define <1 x i64> @lshr64x1(<1 x i64> %a, i64 %b) {
200; CHECK-LABEL: lshr64x1:
201; CHECK:       // %bb.0: // %entry
202; CHECK-NEXT:    fmov d1, x0
203; CHECK-NEXT:    ushl d0, d0, d1
204; CHECK-NEXT:    ret
205entry:
206  %sub = sub nsw i64 0, %b
207  %splat.splatinsert = insertelement <1 x i64> poison, i64 %sub, i32 0
208  %shr = lshr <1 x i64> %a, %splat.splatinsert
209  ret <1 x i64> %shr
210}
211
212define <2 x i32> @lshr32x2(<2 x i32> %a, i32 %b) {
213; CHECK-LABEL: lshr32x2:
214; CHECK:       // %bb.0: // %entry
215; CHECK-NEXT:    dup v1.2s, w0
216; CHECK-NEXT:    ushl v0.2s, v0.2s, v1.2s
217; CHECK-NEXT:    ret
218entry:
219  %sub = sub nsw i32 0, %b
220  %splat.splatinsert = insertelement <2 x i32> poison, i32 %sub, i32 0
221  %splat.splat = shufflevector <2 x i32> %splat.splatinsert, <2 x i32> poison, <2 x i32> zeroinitializer
222  %shr = lshr <2 x i32> %a, %splat.splat
223  ret <2 x i32> %shr
224}
225
226define <4 x i16> @lshr16x4(<4 x i16> %a, i16 %b) {
227; CHECK-LABEL: lshr16x4:
228; CHECK:       // %bb.0: // %entry
229; CHECK-NEXT:    dup v1.4h, w0
230; CHECK-NEXT:    ushl v0.4h, v0.4h, v1.4h
231; CHECK-NEXT:    ret
232entry:
233  %sub = sub i16 0, %b
234  %0 = insertelement <4 x i16> undef, i16 %sub, i32 0
235  %sh_prom = shufflevector <4 x i16> %0, <4 x i16> undef, <4 x i32> zeroinitializer
236  %shr = lshr <4 x i16> %a, %sh_prom
237  ret <4 x i16> %shr
238}
239
240define <8 x i8> @lshr8x8(<8 x i8> %a, i8 %b) {
241; CHECK-LABEL: lshr8x8:
242; CHECK:       // %bb.0: // %entry
243; CHECK-NEXT:    dup v1.8b, w0
244; CHECK-NEXT:    ushl v0.8b, v0.8b, v1.8b
245; CHECK-NEXT:    ret
246entry:
247  %sub = sub i8 0, %b
248  %0 = insertelement <8 x i8> undef, i8 %sub, i32 0
249  %sh_prom = shufflevector <8 x i8> %0, <8 x i8> undef, <8 x i32> zeroinitializer
250  %shr = lshr <8 x i8> %a, %sh_prom
251  ret <8 x i8> %shr
252}
253
254define <2 x i64> @shl64x2(<2 x i64> %a, i64 %b) {
255; CHECK-LABEL: shl64x2:
256; CHECK:       // %bb.0: // %entry
257; CHECK-NEXT:    neg x8, x0
258; CHECK-NEXT:    dup v1.2d, x8
259; CHECK-NEXT:    ushl v0.2d, v0.2d, v1.2d
260; CHECK-NEXT:    ret
261entry:
262  %sub = sub nsw i64 0, %b
263  %splat.splatinsert = insertelement <2 x i64> poison, i64 %sub, i32 0
264  %splat.splat = shufflevector <2 x i64> %splat.splatinsert, <2 x i64> poison, <2 x i32> zeroinitializer
265  %shl = shl <2 x i64> %a, %splat.splat
266  ret <2 x i64> %shl
267}
268
269define <4 x i32> @shl32x4(<4 x i32> %a, i32 %b) {
270; CHECK-LABEL: shl32x4:
271; CHECK:       // %bb.0: // %entry
272; CHECK-NEXT:    neg w8, w0
273; CHECK-NEXT:    dup v1.4s, w8
274; CHECK-NEXT:    ushl v0.4s, v0.4s, v1.4s
275; CHECK-NEXT:    ret
276entry:
277  %sub = sub nsw i32 0, %b
278  %splat.splatinsert = insertelement <4 x i32> poison, i32 %sub, i32 0
279  %splat.splat = shufflevector <4 x i32> %splat.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
280  %shl = shl <4 x i32> %a, %splat.splat
281  ret <4 x i32> %shl
282}
283
284define <8 x i16> @shl16x8(<8 x i16> %a, i16 %b) {
285; CHECK-LABEL: shl16x8:
286; CHECK:       // %bb.0: // %entry
287; CHECK-NEXT:    neg w8, w0
288; CHECK-NEXT:    dup v1.8h, w8
289; CHECK-NEXT:    ushl v0.8h, v0.8h, v1.8h
290; CHECK-NEXT:    ret
291entry:
292  %sub = sub i16 0, %b
293  %0 = insertelement <8 x i16> undef, i16 %sub, i32 0
294  %sh_prom = shufflevector <8 x i16> %0, <8 x i16> undef, <8 x i32> zeroinitializer
295  %shl = shl <8 x i16> %a, %sh_prom
296  ret <8 x i16> %shl
297}
298
299define <16 x i8> @shl8x16(<16 x i8> %a, i8 %b) {
300; CHECK-LABEL: shl8x16:
301; CHECK:       // %bb.0: // %entry
302; CHECK-NEXT:    neg w8, w0
303; CHECK-NEXT:    dup v1.16b, w8
304; CHECK-NEXT:    ushl v0.16b, v0.16b, v1.16b
305; CHECK-NEXT:    ret
306entry:
307  %sub = sub i8 0, %b
308  %0 = insertelement <16 x i8> undef, i8 %sub, i32 0
309  %sh_prom = shufflevector <16 x i8> %0, <16 x i8> undef, <16 x i32> zeroinitializer
310  %shl = shl <16 x i8> %a, %sh_prom
311  ret <16 x i8> %shl
312}
313
314define <1 x i64> @shl64x1(<1 x i64> %a, i64 %b) {
315; CHECK-LABEL: shl64x1:
316; CHECK:       // %bb.0: // %entry
317; CHECK-NEXT:    neg x8, x0
318; CHECK-NEXT:    fmov d1, x8
319; CHECK-NEXT:    ushl d0, d0, d1
320; CHECK-NEXT:    ret
321entry:
322  %sub = sub nsw i64 0, %b
323  %splat.splatinsert = insertelement <1 x i64> poison, i64 %sub, i32 0
324  %shl = shl <1 x i64> %a, %splat.splatinsert
325  ret <1 x i64> %shl
326}
327
328define <2 x i32> @shl32x2(<2 x i32> %a, i32 %b) {
329; CHECK-LABEL: shl32x2:
330; CHECK:       // %bb.0: // %entry
331; CHECK-NEXT:    neg w8, w0
332; CHECK-NEXT:    dup v1.2s, w8
333; CHECK-NEXT:    ushl v0.2s, v0.2s, v1.2s
334; CHECK-NEXT:    ret
335entry:
336  %sub = sub nsw i32 0, %b
337  %splat.splatinsert = insertelement <2 x i32> poison, i32 %sub, i32 0
338  %splat.splat = shufflevector <2 x i32> %splat.splatinsert, <2 x i32> poison, <2 x i32> zeroinitializer
339  %shl = shl <2 x i32> %a, %splat.splat
340  ret <2 x i32> %shl
341}
342
343define <4 x i16> @shl16x4(<4 x i16> %a, i16 %b) {
344; CHECK-LABEL: shl16x4:
345; CHECK:       // %bb.0: // %entry
346; CHECK-NEXT:    neg w8, w0
347; CHECK-NEXT:    dup v1.4h, w8
348; CHECK-NEXT:    ushl v0.4h, v0.4h, v1.4h
349; CHECK-NEXT:    ret
350entry:
351  %sub = sub i16 0, %b
352  %0 = insertelement <4 x i16> undef, i16 %sub, i32 0
353  %sh_prom = shufflevector <4 x i16> %0, <4 x i16> undef, <4 x i32> zeroinitializer
354  %shl = shl <4 x i16> %a, %sh_prom
355  ret <4 x i16> %shl
356}
357
358define <8 x i8> @shl8x8(<8 x i8> %a, i8 %b) {
359; CHECK-LABEL: shl8x8:
360; CHECK:       // %bb.0: // %entry
361; CHECK-NEXT:    neg w8, w0
362; CHECK-NEXT:    dup v1.8b, w8
363; CHECK-NEXT:    ushl v0.8b, v0.8b, v1.8b
364; CHECK-NEXT:    ret
365entry:
366  %sub = sub i8 0, %b
367  %0 = insertelement <8 x i8> undef, i8 %sub, i32 0
368  %sh_prom = shufflevector <8 x i8> %0, <8 x i8> undef, <8 x i32> zeroinitializer
369  %shl = shl <8 x i8> %a, %sh_prom
370  ret <8 x i8> %shl
371}
372
373
374
375define <vscale x 2 x i64> @shrn64x2(<vscale x 2 x i64> %a, i64 %b) {
376; CHECK-LABEL: shrn64x2:
377; CHECK:       // %bb.0: // %entry
378; CHECK-NEXT:    neg x8, x0
379; CHECK-NEXT:    ptrue p0.d
380; CHECK-NEXT:    mov z1.d, x8
381; CHECK-NEXT:    asr z0.d, p0/m, z0.d, z1.d
382; CHECK-NEXT:    ret
383entry:
384  %sub = sub nsw i64 0, %b
385  %splat.splatinsert = insertelement <vscale x 2 x i64> poison, i64 %sub, i32 0
386  %splat.splat = shufflevector <vscale x 2 x i64> %splat.splatinsert, <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
387  %shr = ashr <vscale x 2 x i64> %a, %splat.splat
388  ret <vscale x 2 x i64> %shr
389}
390
391define <vscale x 4 x i32> @shrn32x4(<vscale x 4 x i32> %a, i32 %b) {
392; CHECK-LABEL: shrn32x4:
393; CHECK:       // %bb.0: // %entry
394; CHECK-NEXT:    neg w8, w0
395; CHECK-NEXT:    ptrue p0.s
396; CHECK-NEXT:    mov z1.s, w8
397; CHECK-NEXT:    asr z0.s, p0/m, z0.s, z1.s
398; CHECK-NEXT:    ret
399entry:
400  %sub = sub nsw i32 0, %b
401  %splat.splatinsert = insertelement <vscale x 4 x i32> poison, i32 %sub, i32 0
402  %splat.splat = shufflevector <vscale x 4 x i32> %splat.splatinsert, <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
403  %shr = ashr <vscale x 4 x i32> %a, %splat.splat
404  ret <vscale x 4 x i32> %shr
405}
406
407define <vscale x 8 x i16> @shrn16x8(<vscale x 8 x i16> %a, i16 %b) {
408; CHECK-LABEL: shrn16x8:
409; CHECK:       // %bb.0: // %entry
410; CHECK-NEXT:    neg w8, w0
411; CHECK-NEXT:    ptrue p0.h
412; CHECK-NEXT:    mov z1.h, w8
413; CHECK-NEXT:    asr z0.h, p0/m, z0.h, z1.h
414; CHECK-NEXT:    ret
415entry:
416  %sub = sub i16 0, %b
417  %0 = insertelement <vscale x 8 x i16> undef, i16 %sub, i32 0
418  %sh_prom = shufflevector <vscale x 8 x i16> %0, <vscale x 8 x i16> undef, <vscale x 8 x i32> zeroinitializer
419  %shr = ashr <vscale x 8 x i16> %a, %sh_prom
420  ret <vscale x 8 x i16> %shr
421}
422
423define <vscale x 16 x i8> @shrn8x16(<vscale x 16 x i8> %a, i8 %b) {
424; CHECK-LABEL: shrn8x16:
425; CHECK:       // %bb.0: // %entry
426; CHECK-NEXT:    neg w8, w0
427; CHECK-NEXT:    ptrue p0.b
428; CHECK-NEXT:    mov z1.b, w8
429; CHECK-NEXT:    asr z0.b, p0/m, z0.b, z1.b
430; CHECK-NEXT:    ret
431entry:
432  %sub = sub i8 0, %b
433  %0 = insertelement <vscale x 16 x i8> undef, i8 %sub, i32 0
434  %sh_prom = shufflevector <vscale x 16 x i8> %0, <vscale x 16 x i8> undef, <vscale x 16 x i32> zeroinitializer
435  %shr = ashr <vscale x 16 x i8> %a, %sh_prom
436  ret <vscale x 16 x i8> %shr
437}
438
439define <vscale x 2 x i64> @lshrn64x2(<vscale x 2 x i64> %a, i64 %b) {
440; CHECK-LABEL: lshrn64x2:
441; CHECK:       // %bb.0: // %entry
442; CHECK-NEXT:    neg x8, x0
443; CHECK-NEXT:    ptrue p0.d
444; CHECK-NEXT:    mov z1.d, x8
445; CHECK-NEXT:    lsr z0.d, p0/m, z0.d, z1.d
446; CHECK-NEXT:    ret
447entry:
448  %sub = sub nsw i64 0, %b
449  %splat.splatinsert = insertelement <vscale x 2 x i64> poison, i64 %sub, i32 0
450  %splat.splat = shufflevector <vscale x 2 x i64> %splat.splatinsert, <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
451  %shr = lshr <vscale x 2 x i64> %a, %splat.splat
452  ret <vscale x 2 x i64> %shr
453}
454
455define <vscale x 4 x i32> @lshrn32x4(<vscale x 4 x i32> %a, i32 %b) {
456; CHECK-LABEL: lshrn32x4:
457; CHECK:       // %bb.0: // %entry
458; CHECK-NEXT:    neg w8, w0
459; CHECK-NEXT:    ptrue p0.s
460; CHECK-NEXT:    mov z1.s, w8
461; CHECK-NEXT:    lsr z0.s, p0/m, z0.s, z1.s
462; CHECK-NEXT:    ret
463entry:
464  %sub = sub nsw i32 0, %b
465  %splat.splatinsert = insertelement <vscale x 4 x i32> poison, i32 %sub, i32 0
466  %splat.splat = shufflevector <vscale x 4 x i32> %splat.splatinsert, <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
467  %shr = lshr <vscale x 4 x i32> %a, %splat.splat
468  ret <vscale x 4 x i32> %shr
469}
470
471define <vscale x 8 x i16> @lshrn16x8(<vscale x 8 x i16> %a, i16 %b) {
472; CHECK-LABEL: lshrn16x8:
473; CHECK:       // %bb.0: // %entry
474; CHECK-NEXT:    neg w8, w0
475; CHECK-NEXT:    ptrue p0.h
476; CHECK-NEXT:    mov z1.h, w8
477; CHECK-NEXT:    lsr z0.h, p0/m, z0.h, z1.h
478; CHECK-NEXT:    ret
479entry:
480  %sub = sub i16 0, %b
481  %0 = insertelement <vscale x 8 x i16> undef, i16 %sub, i32 0
482  %sh_prom = shufflevector <vscale x 8 x i16> %0, <vscale x 8 x i16> undef, <vscale x 8 x i32> zeroinitializer
483  %shr = lshr <vscale x 8 x i16> %a, %sh_prom
484  ret <vscale x 8 x i16> %shr
485}
486
487define <vscale x 16 x i8> @lshrn8x16(<vscale x 16 x i8> %a, i8 %b) {
488; CHECK-LABEL: lshrn8x16:
489; CHECK:       // %bb.0: // %entry
490; CHECK-NEXT:    neg w8, w0
491; CHECK-NEXT:    ptrue p0.b
492; CHECK-NEXT:    mov z1.b, w8
493; CHECK-NEXT:    lsr z0.b, p0/m, z0.b, z1.b
494; CHECK-NEXT:    ret
495entry:
496  %sub = sub i8 0, %b
497  %0 = insertelement <vscale x 16 x i8> undef, i8 %sub, i32 0
498  %sh_prom = shufflevector <vscale x 16 x i8> %0, <vscale x 16 x i8> undef, <vscale x 16 x i32> zeroinitializer
499  %shr = lshr <vscale x 16 x i8> %a, %sh_prom
500  ret <vscale x 16 x i8> %shr
501}
502
503define <vscale x 2 x i64> @shln64x2(<vscale x 2 x i64> %a, i64 %b) {
504; CHECK-LABEL: shln64x2:
505; CHECK:       // %bb.0: // %entry
506; CHECK-NEXT:    neg x8, x0
507; CHECK-NEXT:    ptrue p0.d
508; CHECK-NEXT:    mov z1.d, x8
509; CHECK-NEXT:    lsl z0.d, p0/m, z0.d, z1.d
510; CHECK-NEXT:    ret
511entry:
512  %sub = sub nsw i64 0, %b
513  %splat.splatinsert = insertelement <vscale x 2 x i64> poison, i64 %sub, i32 0
514  %splat.splat = shufflevector <vscale x 2 x i64> %splat.splatinsert, <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
515  %shl = shl <vscale x 2 x i64> %a, %splat.splat
516  ret <vscale x 2 x i64> %shl
517}
518
519define <vscale x 4 x i32> @shln32x4(<vscale x 4 x i32> %a, i32 %b) {
520; CHECK-LABEL: shln32x4:
521; CHECK:       // %bb.0: // %entry
522; CHECK-NEXT:    neg w8, w0
523; CHECK-NEXT:    ptrue p0.s
524; CHECK-NEXT:    mov z1.s, w8
525; CHECK-NEXT:    lsl z0.s, p0/m, z0.s, z1.s
526; CHECK-NEXT:    ret
527entry:
528  %sub = sub nsw i32 0, %b
529  %splat.splatinsert = insertelement <vscale x 4 x i32> poison, i32 %sub, i32 0
530  %splat.splat = shufflevector <vscale x 4 x i32> %splat.splatinsert, <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
531  %shl = shl <vscale x 4 x i32> %a, %splat.splat
532  ret <vscale x 4 x i32> %shl
533}
534
535define <vscale x 8 x i16> @shln16x8(<vscale x 8 x i16> %a, i16 %b) {
536; CHECK-LABEL: shln16x8:
537; CHECK:       // %bb.0: // %entry
538; CHECK-NEXT:    neg w8, w0
539; CHECK-NEXT:    ptrue p0.h
540; CHECK-NEXT:    mov z1.h, w8
541; CHECK-NEXT:    lsl z0.h, p0/m, z0.h, z1.h
542; CHECK-NEXT:    ret
543entry:
544  %sub = sub i16 0, %b
545  %0 = insertelement <vscale x 8 x i16> undef, i16 %sub, i32 0
546  %sh_prom = shufflevector <vscale x 8 x i16> %0, <vscale x 8 x i16> undef, <vscale x 8 x i32> zeroinitializer
547  %shl = shl <vscale x 8 x i16> %a, %sh_prom
548  ret <vscale x 8 x i16> %shl
549}
550
551define <vscale x 16 x i8> @shln8x16(<vscale x 16 x i8> %a, i8 %b) {
552; CHECK-LABEL: shln8x16:
553; CHECK:       // %bb.0: // %entry
554; CHECK-NEXT:    neg w8, w0
555; CHECK-NEXT:    ptrue p0.b
556; CHECK-NEXT:    mov z1.b, w8
557; CHECK-NEXT:    lsl z0.b, p0/m, z0.b, z1.b
558; CHECK-NEXT:    ret
559entry:
560  %sub = sub i8 0, %b
561  %0 = insertelement <vscale x 16 x i8> undef, i8 %sub, i32 0
562  %sh_prom = shufflevector <vscale x 16 x i8> %0, <vscale x 16 x i8> undef, <vscale x 16 x i32> zeroinitializer
563  %shl = shl <vscale x 16 x i8> %a, %sh_prom
564  ret <vscale x 16 x i8> %shl
565}
566
567define <vscale x 16 x i8> @subsub(<vscale x 16 x i8> %a, i8 %b) {
568; CHECK-LABEL: subsub:
569; CHECK:       // %bb.0: // %entry
570; CHECK-NEXT:    mov z0.b, w0
571; CHECK-NEXT:    ret
572entry:
573  %sub = sub i8 0, %b
574  %0 = insertelement <vscale x 16 x i8> undef, i8 %sub, i32 0
575  %sh_prom = shufflevector <vscale x 16 x i8> %0, <vscale x 16 x i8> undef, <vscale x 16 x i32> zeroinitializer
576  %sub2 = sub <vscale x 16 x i8> zeroinitializer, %sh_prom
577  ret <vscale x 16 x i8> %sub2
578}
579