xref: /llvm-project/clang/test/CodeGen/AArch64/sve-vector-shift-ops.c (revision 207e5ccceec8d3cc3f32723e78f2a142bc61b07d)
1*207e5cccSFangrui Song // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2*207e5cccSFangrui Song // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve \
3*207e5cccSFangrui Song // RUN: -disable-O0-optnone \
4*207e5cccSFangrui Song // RUN:  -emit-llvm -o - %s | opt -S -passes=sroa | FileCheck %s
5*207e5cccSFangrui Song 
6*207e5cccSFangrui Song // REQUIRES: aarch64-registered-target
7*207e5cccSFangrui Song 
8*207e5cccSFangrui Song #include <arm_sve.h>
9*207e5cccSFangrui Song 
10*207e5cccSFangrui Song // CHECK-LABEL: @lshift_i8(
11*207e5cccSFangrui Song // CHECK-NEXT:  entry:
12*207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <vscale x 16 x i8> [[A:%.*]], [[B:%.*]]
13*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[SHL]]
14*207e5cccSFangrui Song //
15*207e5cccSFangrui Song svint8_t lshift_i8(svint8_t a, svint8_t b) {
16*207e5cccSFangrui Song   return a << b;
17*207e5cccSFangrui Song }
18*207e5cccSFangrui Song 
19*207e5cccSFangrui Song // CHECK-LABEL: @rshift_i8(
20*207e5cccSFangrui Song // CHECK-NEXT:  entry:
21*207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = ashr <vscale x 16 x i8> [[A:%.*]], [[B:%.*]]
22*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[SHR]]
23*207e5cccSFangrui Song //
24*207e5cccSFangrui Song svint8_t rshift_i8(svint8_t a, svint8_t b) {
25*207e5cccSFangrui Song   return a >> b;
26*207e5cccSFangrui Song }
27*207e5cccSFangrui Song 
28*207e5cccSFangrui Song // CHECK-LABEL: @lshift_u8(
29*207e5cccSFangrui Song // CHECK-NEXT:  entry:
30*207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <vscale x 16 x i8> [[A:%.*]], [[B:%.*]]
31*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[SHL]]
32*207e5cccSFangrui Song //
33*207e5cccSFangrui Song svuint8_t lshift_u8(svuint8_t a, svuint8_t b) {
34*207e5cccSFangrui Song   return a << b;
35*207e5cccSFangrui Song }
36*207e5cccSFangrui Song 
37*207e5cccSFangrui Song // CHECK-LABEL: @rshift_u8(
38*207e5cccSFangrui Song // CHECK-NEXT:  entry:
39*207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = lshr <vscale x 16 x i8> [[A:%.*]], [[B:%.*]]
40*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[SHR]]
41*207e5cccSFangrui Song //
42*207e5cccSFangrui Song svuint8_t rshift_u8(svuint8_t a, svuint8_t b) {
43*207e5cccSFangrui Song   return a >> b;
44*207e5cccSFangrui Song }
45*207e5cccSFangrui Song 
46*207e5cccSFangrui Song // CHECK-LABEL: @lshift_i16(
47*207e5cccSFangrui Song // CHECK-NEXT:  entry:
48*207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <vscale x 8 x i16> [[A:%.*]], [[B:%.*]]
49*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[SHL]]
50*207e5cccSFangrui Song //
51*207e5cccSFangrui Song svint16_t lshift_i16(svint16_t a, svint16_t b) {
52*207e5cccSFangrui Song   return a << b;
53*207e5cccSFangrui Song }
54*207e5cccSFangrui Song 
55*207e5cccSFangrui Song // CHECK-LABEL: @rshift_i16(
56*207e5cccSFangrui Song // CHECK-NEXT:  entry:
57*207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = ashr <vscale x 8 x i16> [[A:%.*]], [[B:%.*]]
58*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[SHR]]
59*207e5cccSFangrui Song //
60*207e5cccSFangrui Song svint16_t rshift_i16(svint16_t a, svint16_t b) {
61*207e5cccSFangrui Song   return a >> b;
62*207e5cccSFangrui Song }
63*207e5cccSFangrui Song 
64*207e5cccSFangrui Song // CHECK-LABEL: @lshift_u16(
65*207e5cccSFangrui Song // CHECK-NEXT:  entry:
66*207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <vscale x 8 x i16> [[A:%.*]], [[B:%.*]]
67*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[SHL]]
68*207e5cccSFangrui Song //
69*207e5cccSFangrui Song svuint16_t lshift_u16(svuint16_t a, svuint16_t b) {
70*207e5cccSFangrui Song   return a << b;
71*207e5cccSFangrui Song }
72*207e5cccSFangrui Song 
73*207e5cccSFangrui Song // CHECK-LABEL: @rshift_u16(
74*207e5cccSFangrui Song // CHECK-NEXT:  entry:
75*207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = lshr <vscale x 8 x i16> [[A:%.*]], [[B:%.*]]
76*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[SHR]]
77*207e5cccSFangrui Song //
78*207e5cccSFangrui Song svuint16_t rshift_u16(svuint16_t a, svuint16_t b) {
79*207e5cccSFangrui Song   return a >> b;
80*207e5cccSFangrui Song }
81*207e5cccSFangrui Song 
82*207e5cccSFangrui Song // CHECK-LABEL: @lshift_i32(
83*207e5cccSFangrui Song // CHECK-NEXT:  entry:
84*207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <vscale x 4 x i32> [[A:%.*]], [[B:%.*]]
85*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[SHL]]
86*207e5cccSFangrui Song //
87*207e5cccSFangrui Song svint32_t lshift_i32(svint32_t a, svint32_t b) {
88*207e5cccSFangrui Song   return a << b;
89*207e5cccSFangrui Song }
90*207e5cccSFangrui Song 
91*207e5cccSFangrui Song // CHECK-LABEL: @rshift_i32(
92*207e5cccSFangrui Song // CHECK-NEXT:  entry:
93*207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = ashr <vscale x 4 x i32> [[A:%.*]], [[B:%.*]]
94*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[SHR]]
95*207e5cccSFangrui Song //
96*207e5cccSFangrui Song svint32_t rshift_i32(svint32_t a, svint32_t b) {
97*207e5cccSFangrui Song   return a >> b;
98*207e5cccSFangrui Song }
99*207e5cccSFangrui Song 
100*207e5cccSFangrui Song // CHECK-LABEL: @lshift_u32(
101*207e5cccSFangrui Song // CHECK-NEXT:  entry:
102*207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <vscale x 4 x i32> [[A:%.*]], [[B:%.*]]
103*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[SHL]]
104*207e5cccSFangrui Song //
105*207e5cccSFangrui Song svuint32_t lshift_u32(svuint32_t a, svuint32_t b) {
106*207e5cccSFangrui Song   return a << b;
107*207e5cccSFangrui Song }
108*207e5cccSFangrui Song 
109*207e5cccSFangrui Song // CHECK-LABEL: @rshift_u32(
110*207e5cccSFangrui Song // CHECK-NEXT:  entry:
111*207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = lshr <vscale x 4 x i32> [[A:%.*]], [[B:%.*]]
112*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[SHR]]
113*207e5cccSFangrui Song //
114*207e5cccSFangrui Song svuint32_t rshift_u32(svuint32_t a, svuint32_t b) {
115*207e5cccSFangrui Song   return a >> b;
116*207e5cccSFangrui Song }
117*207e5cccSFangrui Song 
118*207e5cccSFangrui Song // CHECK-LABEL: @lshift_i64(
119*207e5cccSFangrui Song // CHECK-NEXT:  entry:
120*207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <vscale x 2 x i64> [[A:%.*]], [[B:%.*]]
121*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[SHL]]
122*207e5cccSFangrui Song //
123*207e5cccSFangrui Song svint64_t lshift_i64(svint64_t a, svint64_t b) {
124*207e5cccSFangrui Song   return a << b;
125*207e5cccSFangrui Song }
126*207e5cccSFangrui Song 
127*207e5cccSFangrui Song // CHECK-LABEL: @rshift_i64(
128*207e5cccSFangrui Song // CHECK-NEXT:  entry:
129*207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = ashr <vscale x 2 x i64> [[A:%.*]], [[B:%.*]]
130*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[SHR]]
131*207e5cccSFangrui Song //
132*207e5cccSFangrui Song svint64_t rshift_i64(svint64_t a, svint64_t b) {
133*207e5cccSFangrui Song   return a >> b;
134*207e5cccSFangrui Song }
135*207e5cccSFangrui Song 
136*207e5cccSFangrui Song // CHECK-LABEL: @lshift_u64(
137*207e5cccSFangrui Song // CHECK-NEXT:  entry:
138*207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <vscale x 2 x i64> [[A:%.*]], [[B:%.*]]
139*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[SHL]]
140*207e5cccSFangrui Song //
141*207e5cccSFangrui Song svuint64_t lshift_u64(svuint64_t a, svuint64_t b) {
142*207e5cccSFangrui Song   return a << b;
143*207e5cccSFangrui Song }
144*207e5cccSFangrui Song 
145*207e5cccSFangrui Song // CHECK-LABEL: @rshift_u64(
146*207e5cccSFangrui Song // CHECK-NEXT:  entry:
147*207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = lshr <vscale x 2 x i64> [[A:%.*]], [[B:%.*]]
148*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[SHR]]
149*207e5cccSFangrui Song //
150*207e5cccSFangrui Song svuint64_t rshift_u64(svuint64_t a, svuint64_t b) {
151*207e5cccSFangrui Song   return a >> b;
152*207e5cccSFangrui Song }
153*207e5cccSFangrui Song 
154*207e5cccSFangrui Song // CHECK-LABEL: @lshift_i8_rsplat(
155*207e5cccSFangrui Song // CHECK-NEXT:  entry:
156*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 16 x i8> poison, i8 [[B:%.*]], i64 0
157*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 16 x i8> [[SPLAT_SPLATINSERT]], <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
158*207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <vscale x 16 x i8> [[A:%.*]], [[SPLAT_SPLAT]]
159*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[SHL]]
160*207e5cccSFangrui Song //
161*207e5cccSFangrui Song svint8_t lshift_i8_rsplat(svint8_t a, int8_t b) {
162*207e5cccSFangrui Song   return a << b;
163*207e5cccSFangrui Song }
164*207e5cccSFangrui Song 
165*207e5cccSFangrui Song // CHECK-LABEL: @lshift_i8_lsplat(
166*207e5cccSFangrui Song // CHECK-NEXT:  entry:
167*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 16 x i8> poison, i8 [[B:%.*]], i64 0
168*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 16 x i8> [[SPLAT_SPLATINSERT]], <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
169*207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <vscale x 16 x i8> [[SPLAT_SPLAT]], [[A:%.*]]
170*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[SHL]]
171*207e5cccSFangrui Song //
172*207e5cccSFangrui Song svint8_t lshift_i8_lsplat(svint8_t a, int8_t b) {
173*207e5cccSFangrui Song   return b << a;
174*207e5cccSFangrui Song }
175*207e5cccSFangrui Song 
176*207e5cccSFangrui Song // CHECK-LABEL: @rshift_i8_rsplat(
177*207e5cccSFangrui Song // CHECK-NEXT:  entry:
178*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 16 x i8> poison, i8 [[B:%.*]], i64 0
179*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 16 x i8> [[SPLAT_SPLATINSERT]], <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
180*207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = ashr <vscale x 16 x i8> [[A:%.*]], [[SPLAT_SPLAT]]
181*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[SHR]]
182*207e5cccSFangrui Song //
183*207e5cccSFangrui Song svint8_t rshift_i8_rsplat(svint8_t a, int8_t b) {
184*207e5cccSFangrui Song   return a >> b;
185*207e5cccSFangrui Song }
186*207e5cccSFangrui Song 
187*207e5cccSFangrui Song // CHECK-LABEL: @rshift_i8_lsplat(
188*207e5cccSFangrui Song // CHECK-NEXT:  entry:
189*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 16 x i8> poison, i8 [[B:%.*]], i64 0
190*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 16 x i8> [[SPLAT_SPLATINSERT]], <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
191*207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = ashr <vscale x 16 x i8> [[SPLAT_SPLAT]], [[A:%.*]]
192*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[SHR]]
193*207e5cccSFangrui Song //
194*207e5cccSFangrui Song svint8_t rshift_i8_lsplat(svint8_t a, int8_t b) {
195*207e5cccSFangrui Song   return b >> a;
196*207e5cccSFangrui Song }
197*207e5cccSFangrui Song 
198*207e5cccSFangrui Song // CHECK-LABEL: @lshift_u8_rsplat(
199*207e5cccSFangrui Song // CHECK-NEXT:  entry:
200*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 16 x i8> poison, i8 [[B:%.*]], i64 0
201*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 16 x i8> [[SPLAT_SPLATINSERT]], <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
202*207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <vscale x 16 x i8> [[A:%.*]], [[SPLAT_SPLAT]]
203*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[SHL]]
204*207e5cccSFangrui Song //
205*207e5cccSFangrui Song svuint8_t lshift_u8_rsplat(svuint8_t a, uint8_t b) {
206*207e5cccSFangrui Song   return a << b;
207*207e5cccSFangrui Song }
208*207e5cccSFangrui Song 
209*207e5cccSFangrui Song // CHECK-LABEL: @lshift_u8_lsplat(
210*207e5cccSFangrui Song // CHECK-NEXT:  entry:
211*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 16 x i8> poison, i8 [[B:%.*]], i64 0
212*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 16 x i8> [[SPLAT_SPLATINSERT]], <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
213*207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <vscale x 16 x i8> [[SPLAT_SPLAT]], [[A:%.*]]
214*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[SHL]]
215*207e5cccSFangrui Song //
216*207e5cccSFangrui Song svuint8_t lshift_u8_lsplat(svuint8_t a, uint8_t b) {
217*207e5cccSFangrui Song   return b << a;
218*207e5cccSFangrui Song }
219*207e5cccSFangrui Song 
220*207e5cccSFangrui Song // CHECK-LABEL: @rshift_u8_rsplat(
221*207e5cccSFangrui Song // CHECK-NEXT:  entry:
222*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 16 x i8> poison, i8 [[B:%.*]], i64 0
223*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 16 x i8> [[SPLAT_SPLATINSERT]], <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
224*207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = lshr <vscale x 16 x i8> [[A:%.*]], [[SPLAT_SPLAT]]
225*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[SHR]]
226*207e5cccSFangrui Song //
227*207e5cccSFangrui Song svuint8_t rshift_u8_rsplat(svuint8_t a, uint8_t b) {
228*207e5cccSFangrui Song   return a >> b;
229*207e5cccSFangrui Song }
230*207e5cccSFangrui Song 
231*207e5cccSFangrui Song // CHECK-LABEL: @rshift_u8_lsplat(
232*207e5cccSFangrui Song // CHECK-NEXT:  entry:
233*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 16 x i8> poison, i8 [[B:%.*]], i64 0
234*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 16 x i8> [[SPLAT_SPLATINSERT]], <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
235*207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = lshr <vscale x 16 x i8> [[SPLAT_SPLAT]], [[A:%.*]]
236*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[SHR]]
237*207e5cccSFangrui Song //
238*207e5cccSFangrui Song svuint8_t rshift_u8_lsplat(svuint8_t a, uint8_t b) {
239*207e5cccSFangrui Song   return b >> a;
240*207e5cccSFangrui Song }
241*207e5cccSFangrui Song 
242*207e5cccSFangrui Song // CHECK-LABEL: @lshift_i16_rsplat(
243*207e5cccSFangrui Song // CHECK-NEXT:  entry:
244*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 8 x i16> poison, i16 [[B:%.*]], i64 0
245*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 8 x i16> [[SPLAT_SPLATINSERT]], <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
246*207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <vscale x 8 x i16> [[A:%.*]], [[SPLAT_SPLAT]]
247*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[SHL]]
248*207e5cccSFangrui Song //
249*207e5cccSFangrui Song svint16_t lshift_i16_rsplat(svint16_t a, int16_t b) {
250*207e5cccSFangrui Song   return a << b;
251*207e5cccSFangrui Song }
252*207e5cccSFangrui Song 
253*207e5cccSFangrui Song // CHECK-LABEL: @lshift_i16_lsplat(
254*207e5cccSFangrui Song // CHECK-NEXT:  entry:
255*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 8 x i16> poison, i16 [[B:%.*]], i64 0
256*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 8 x i16> [[SPLAT_SPLATINSERT]], <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
257*207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <vscale x 8 x i16> [[SPLAT_SPLAT]], [[A:%.*]]
258*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[SHL]]
259*207e5cccSFangrui Song //
260*207e5cccSFangrui Song svint16_t lshift_i16_lsplat(svint16_t a, int16_t b) {
261*207e5cccSFangrui Song   return b << a;
262*207e5cccSFangrui Song }
263*207e5cccSFangrui Song 
264*207e5cccSFangrui Song // CHECK-LABEL: @rshift_i16_rsplat(
265*207e5cccSFangrui Song // CHECK-NEXT:  entry:
266*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 8 x i16> poison, i16 [[B:%.*]], i64 0
267*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 8 x i16> [[SPLAT_SPLATINSERT]], <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
268*207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = ashr <vscale x 8 x i16> [[A:%.*]], [[SPLAT_SPLAT]]
269*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[SHR]]
270*207e5cccSFangrui Song //
271*207e5cccSFangrui Song svint16_t rshift_i16_rsplat(svint16_t a, int16_t b) {
272*207e5cccSFangrui Song   return a >> b;
273*207e5cccSFangrui Song }
274*207e5cccSFangrui Song 
275*207e5cccSFangrui Song // CHECK-LABEL: @rshift_i16_lsplat(
276*207e5cccSFangrui Song // CHECK-NEXT:  entry:
277*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 8 x i16> poison, i16 [[B:%.*]], i64 0
278*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 8 x i16> [[SPLAT_SPLATINSERT]], <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
279*207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = ashr <vscale x 8 x i16> [[SPLAT_SPLAT]], [[A:%.*]]
280*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[SHR]]
281*207e5cccSFangrui Song //
282*207e5cccSFangrui Song svint16_t rshift_i16_lsplat(svint16_t a, int16_t b) {
283*207e5cccSFangrui Song   return b >> a;
284*207e5cccSFangrui Song }
285*207e5cccSFangrui Song 
286*207e5cccSFangrui Song // CHECK-LABEL: @lshift_u16_rsplat(
287*207e5cccSFangrui Song // CHECK-NEXT:  entry:
288*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 8 x i16> poison, i16 [[B:%.*]], i64 0
289*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 8 x i16> [[SPLAT_SPLATINSERT]], <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
290*207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <vscale x 8 x i16> [[A:%.*]], [[SPLAT_SPLAT]]
291*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[SHL]]
292*207e5cccSFangrui Song //
293*207e5cccSFangrui Song svuint16_t lshift_u16_rsplat(svuint16_t a, uint16_t b) {
294*207e5cccSFangrui Song   return a << b;
295*207e5cccSFangrui Song }
296*207e5cccSFangrui Song 
297*207e5cccSFangrui Song // CHECK-LABEL: @lshift_u16_lsplat(
298*207e5cccSFangrui Song // CHECK-NEXT:  entry:
299*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 8 x i16> poison, i16 [[B:%.*]], i64 0
300*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 8 x i16> [[SPLAT_SPLATINSERT]], <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
301*207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <vscale x 8 x i16> [[SPLAT_SPLAT]], [[A:%.*]]
302*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[SHL]]
303*207e5cccSFangrui Song //
304*207e5cccSFangrui Song svuint16_t lshift_u16_lsplat(svuint16_t a, uint16_t b) {
305*207e5cccSFangrui Song   return b << a;
306*207e5cccSFangrui Song }
307*207e5cccSFangrui Song 
308*207e5cccSFangrui Song // CHECK-LABEL: @rshift_u16_rsplat(
309*207e5cccSFangrui Song // CHECK-NEXT:  entry:
310*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 8 x i16> poison, i16 [[B:%.*]], i64 0
311*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 8 x i16> [[SPLAT_SPLATINSERT]], <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
312*207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = lshr <vscale x 8 x i16> [[A:%.*]], [[SPLAT_SPLAT]]
313*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[SHR]]
314*207e5cccSFangrui Song //
315*207e5cccSFangrui Song svuint16_t rshift_u16_rsplat(svuint16_t a, uint16_t b) {
316*207e5cccSFangrui Song   return a >> b;
317*207e5cccSFangrui Song }
318*207e5cccSFangrui Song 
319*207e5cccSFangrui Song // CHECK-LABEL: @rshift_u16_lsplat(
320*207e5cccSFangrui Song // CHECK-NEXT:  entry:
321*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 8 x i16> poison, i16 [[B:%.*]], i64 0
322*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 8 x i16> [[SPLAT_SPLATINSERT]], <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
323*207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = lshr <vscale x 8 x i16> [[SPLAT_SPLAT]], [[A:%.*]]
324*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[SHR]]
325*207e5cccSFangrui Song //
326*207e5cccSFangrui Song svuint16_t rshift_u16_lsplat(svuint16_t a, uint16_t b) {
327*207e5cccSFangrui Song   return b >> a;
328*207e5cccSFangrui Song }
329*207e5cccSFangrui Song 
330*207e5cccSFangrui Song // CHECK-LABEL: @lshift_i32_rsplat(
331*207e5cccSFangrui Song // CHECK-NEXT:  entry:
332*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[B:%.*]], i64 0
333*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 4 x i32> [[SPLAT_SPLATINSERT]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
334*207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <vscale x 4 x i32> [[A:%.*]], [[SPLAT_SPLAT]]
335*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[SHL]]
336*207e5cccSFangrui Song //
337*207e5cccSFangrui Song svint32_t lshift_i32_rsplat(svint32_t a, int32_t b) {
338*207e5cccSFangrui Song   return a << b;
339*207e5cccSFangrui Song }
340*207e5cccSFangrui Song 
341*207e5cccSFangrui Song // CHECK-LABEL: @lshift_i32_lsplat(
342*207e5cccSFangrui Song // CHECK-NEXT:  entry:
343*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[B:%.*]], i64 0
344*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 4 x i32> [[SPLAT_SPLATINSERT]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
345*207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <vscale x 4 x i32> [[SPLAT_SPLAT]], [[A:%.*]]
346*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[SHL]]
347*207e5cccSFangrui Song //
348*207e5cccSFangrui Song svint32_t lshift_i32_lsplat(svint32_t a, int32_t b) {
349*207e5cccSFangrui Song   return b << a;
350*207e5cccSFangrui Song }
351*207e5cccSFangrui Song 
352*207e5cccSFangrui Song // CHECK-LABEL: @rshift_i32_rsplat(
353*207e5cccSFangrui Song // CHECK-NEXT:  entry:
354*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[B:%.*]], i64 0
355*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 4 x i32> [[SPLAT_SPLATINSERT]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
356*207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = ashr <vscale x 4 x i32> [[A:%.*]], [[SPLAT_SPLAT]]
357*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[SHR]]
358*207e5cccSFangrui Song //
359*207e5cccSFangrui Song svint32_t rshift_i32_rsplat(svint32_t a, int32_t b) {
360*207e5cccSFangrui Song   return a >> b;
361*207e5cccSFangrui Song }
362*207e5cccSFangrui Song 
363*207e5cccSFangrui Song // CHECK-LABEL: @rshift_i32_lsplat(
364*207e5cccSFangrui Song // CHECK-NEXT:  entry:
365*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[B:%.*]], i64 0
366*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 4 x i32> [[SPLAT_SPLATINSERT]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
367*207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = ashr <vscale x 4 x i32> [[SPLAT_SPLAT]], [[A:%.*]]
368*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[SHR]]
369*207e5cccSFangrui Song //
370*207e5cccSFangrui Song svint32_t rshift_i32_lsplat(svint32_t a, int32_t b) {
371*207e5cccSFangrui Song   return b >> a;
372*207e5cccSFangrui Song }
373*207e5cccSFangrui Song 
374*207e5cccSFangrui Song // CHECK-LABEL: @lshift_u32_rsplat(
375*207e5cccSFangrui Song // CHECK-NEXT:  entry:
376*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[B:%.*]], i64 0
377*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 4 x i32> [[SPLAT_SPLATINSERT]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
378*207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <vscale x 4 x i32> [[A:%.*]], [[SPLAT_SPLAT]]
379*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[SHL]]
380*207e5cccSFangrui Song //
381*207e5cccSFangrui Song svuint32_t lshift_u32_rsplat(svuint32_t a, uint32_t b) {
382*207e5cccSFangrui Song   return a << b;
383*207e5cccSFangrui Song }
384*207e5cccSFangrui Song 
385*207e5cccSFangrui Song // CHECK-LABEL: @lshift_u32_lsplat(
386*207e5cccSFangrui Song // CHECK-NEXT:  entry:
387*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[B:%.*]], i64 0
388*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 4 x i32> [[SPLAT_SPLATINSERT]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
389*207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <vscale x 4 x i32> [[SPLAT_SPLAT]], [[A:%.*]]
390*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[SHL]]
391*207e5cccSFangrui Song //
392*207e5cccSFangrui Song svuint32_t lshift_u32_lsplat(svuint32_t a, uint32_t b) {
393*207e5cccSFangrui Song   return b << a;
394*207e5cccSFangrui Song }
395*207e5cccSFangrui Song 
396*207e5cccSFangrui Song // CHECK-LABEL: @rshift_u32_rsplat(
397*207e5cccSFangrui Song // CHECK-NEXT:  entry:
398*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[B:%.*]], i64 0
399*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 4 x i32> [[SPLAT_SPLATINSERT]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
400*207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = lshr <vscale x 4 x i32> [[A:%.*]], [[SPLAT_SPLAT]]
401*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[SHR]]
402*207e5cccSFangrui Song //
403*207e5cccSFangrui Song svuint32_t rshift_u32_rsplat(svuint32_t a, uint32_t b) {
404*207e5cccSFangrui Song   return a >> b;
405*207e5cccSFangrui Song }
406*207e5cccSFangrui Song 
407*207e5cccSFangrui Song // CHECK-LABEL: @rshift_u32_lsplat(
408*207e5cccSFangrui Song // CHECK-NEXT:  entry:
409*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[B:%.*]], i64 0
410*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 4 x i32> [[SPLAT_SPLATINSERT]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
411*207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = lshr <vscale x 4 x i32> [[SPLAT_SPLAT]], [[A:%.*]]
412*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[SHR]]
413*207e5cccSFangrui Song //
414*207e5cccSFangrui Song svuint32_t rshift_u32_lsplat(svuint32_t a, uint32_t b) {
415*207e5cccSFangrui Song   return b >> a;
416*207e5cccSFangrui Song }
417*207e5cccSFangrui Song 
418*207e5cccSFangrui Song // CHECK-LABEL: @lshift_i64_rsplat(
419*207e5cccSFangrui Song // CHECK-NEXT:  entry:
420*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 2 x i64> poison, i64 [[B:%.*]], i64 0
421*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 2 x i64> [[SPLAT_SPLATINSERT]], <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
422*207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <vscale x 2 x i64> [[A:%.*]], [[SPLAT_SPLAT]]
423*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[SHL]]
424*207e5cccSFangrui Song //
425*207e5cccSFangrui Song svint64_t lshift_i64_rsplat(svint64_t a, int64_t b) {
426*207e5cccSFangrui Song   return a << b;
427*207e5cccSFangrui Song }
428*207e5cccSFangrui Song 
429*207e5cccSFangrui Song // CHECK-LABEL: @lshift_i64_lsplat(
430*207e5cccSFangrui Song // CHECK-NEXT:  entry:
431*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 2 x i64> poison, i64 [[B:%.*]], i64 0
432*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 2 x i64> [[SPLAT_SPLATINSERT]], <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
433*207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <vscale x 2 x i64> [[SPLAT_SPLAT]], [[A:%.*]]
434*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[SHL]]
435*207e5cccSFangrui Song //
436*207e5cccSFangrui Song svint64_t lshift_i64_lsplat(svint64_t a, int64_t b) {
437*207e5cccSFangrui Song   return b << a;
438*207e5cccSFangrui Song }
439*207e5cccSFangrui Song 
440*207e5cccSFangrui Song // CHECK-LABEL: @rshift_i64_rsplat(
441*207e5cccSFangrui Song // CHECK-NEXT:  entry:
442*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 2 x i64> poison, i64 [[B:%.*]], i64 0
443*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 2 x i64> [[SPLAT_SPLATINSERT]], <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
444*207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = ashr <vscale x 2 x i64> [[A:%.*]], [[SPLAT_SPLAT]]
445*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[SHR]]
446*207e5cccSFangrui Song //
447*207e5cccSFangrui Song svint64_t rshift_i64_rsplat(svint64_t a, int64_t b) {
448*207e5cccSFangrui Song   return a >> b;
449*207e5cccSFangrui Song }
450*207e5cccSFangrui Song 
451*207e5cccSFangrui Song // CHECK-LABEL: @rshift_i64_lsplat(
452*207e5cccSFangrui Song // CHECK-NEXT:  entry:
453*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 2 x i64> poison, i64 [[B:%.*]], i64 0
454*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 2 x i64> [[SPLAT_SPLATINSERT]], <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
455*207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = ashr <vscale x 2 x i64> [[SPLAT_SPLAT]], [[A:%.*]]
456*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[SHR]]
457*207e5cccSFangrui Song //
458*207e5cccSFangrui Song svint64_t rshift_i64_lsplat(svint64_t a, int64_t b) {
459*207e5cccSFangrui Song   return b >> a;
460*207e5cccSFangrui Song }
461*207e5cccSFangrui Song 
462*207e5cccSFangrui Song // CHECK-LABEL: @lshift_u64_rsplat(
463*207e5cccSFangrui Song // CHECK-NEXT:  entry:
464*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 2 x i64> poison, i64 [[B:%.*]], i64 0
465*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 2 x i64> [[SPLAT_SPLATINSERT]], <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
466*207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <vscale x 2 x i64> [[A:%.*]], [[SPLAT_SPLAT]]
467*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[SHL]]
468*207e5cccSFangrui Song //
469*207e5cccSFangrui Song svuint64_t lshift_u64_rsplat(svuint64_t a, uint64_t b) {
470*207e5cccSFangrui Song   return a << b;
471*207e5cccSFangrui Song }
472*207e5cccSFangrui Song 
473*207e5cccSFangrui Song // CHECK-LABEL: @lshift_u64_lsplat(
474*207e5cccSFangrui Song // CHECK-NEXT:  entry:
475*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 2 x i64> poison, i64 [[B:%.*]], i64 0
476*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 2 x i64> [[SPLAT_SPLATINSERT]], <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
477*207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <vscale x 2 x i64> [[SPLAT_SPLAT]], [[A:%.*]]
478*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[SHL]]
479*207e5cccSFangrui Song //
480*207e5cccSFangrui Song svuint64_t lshift_u64_lsplat(svuint64_t a, uint64_t b) {
481*207e5cccSFangrui Song   return b << a;
482*207e5cccSFangrui Song }
483*207e5cccSFangrui Song 
484*207e5cccSFangrui Song // CHECK-LABEL: @rshift_u64_rsplat(
485*207e5cccSFangrui Song // CHECK-NEXT:  entry:
486*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 2 x i64> poison, i64 [[B:%.*]], i64 0
487*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 2 x i64> [[SPLAT_SPLATINSERT]], <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
488*207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = lshr <vscale x 2 x i64> [[A:%.*]], [[SPLAT_SPLAT]]
489*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[SHR]]
490*207e5cccSFangrui Song //
491*207e5cccSFangrui Song svuint64_t rshift_u64_rsplat(svuint64_t a, uint64_t b) {
492*207e5cccSFangrui Song   return a >> b;
493*207e5cccSFangrui Song }
494*207e5cccSFangrui Song 
495*207e5cccSFangrui Song // CHECK-LABEL: @rshift_u64_lsplat(
496*207e5cccSFangrui Song // CHECK-NEXT:  entry:
497*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 2 x i64> poison, i64 [[B:%.*]], i64 0
498*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 2 x i64> [[SPLAT_SPLATINSERT]], <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
499*207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = lshr <vscale x 2 x i64> [[SPLAT_SPLAT]], [[A:%.*]]
500*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[SHR]]
501*207e5cccSFangrui Song //
502*207e5cccSFangrui Song svuint64_t rshift_u64_lsplat(svuint64_t a, uint64_t b) {
503*207e5cccSFangrui Song   return b >> a;
504*207e5cccSFangrui Song }
505