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