Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / CodeGen / AArch64 / sve-vector-shift-ops.c
blobd6b7f76508741f28a3a39703f2123e4fe783c711
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: -disable-O0-optnone \
4 // RUN: -emit-llvm -o - %s | opt -S -passes=sroa | FileCheck %s
6 // REQUIRES: aarch64-registered-target
8 #include <arm_sve.h>
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]]
15 svint8_t lshift_i8(svint8_t a, svint8_t b) {
16 return a << b;
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]]
24 svint8_t rshift_i8(svint8_t a, svint8_t b) {
25 return a >> b;
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]]
33 svuint8_t lshift_u8(svuint8_t a, svuint8_t b) {
34 return a << b;
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]]
42 svuint8_t rshift_u8(svuint8_t a, svuint8_t b) {
43 return a >> b;
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]]
51 svint16_t lshift_i16(svint16_t a, svint16_t b) {
52 return a << b;
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]]
60 svint16_t rshift_i16(svint16_t a, svint16_t b) {
61 return a >> b;
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]]
69 svuint16_t lshift_u16(svuint16_t a, svuint16_t b) {
70 return a << b;
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]]
78 svuint16_t rshift_u16(svuint16_t a, svuint16_t b) {
79 return a >> b;
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]]
87 svint32_t lshift_i32(svint32_t a, svint32_t b) {
88 return a << b;
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]]
96 svint32_t rshift_i32(svint32_t a, svint32_t b) {
97 return a >> b;
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]]
105 svuint32_t lshift_u32(svuint32_t a, svuint32_t b) {
106 return a << b;
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]]
114 svuint32_t rshift_u32(svuint32_t a, svuint32_t b) {
115 return a >> b;
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]]
123 svint64_t lshift_i64(svint64_t a, svint64_t b) {
124 return a << b;
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]]
132 svint64_t rshift_i64(svint64_t a, svint64_t b) {
133 return a >> b;
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]]
141 svuint64_t lshift_u64(svuint64_t a, svuint64_t b) {
142 return a << b;
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]]
150 svuint64_t rshift_u64(svuint64_t a, svuint64_t b) {
151 return a >> b;
154 // CHECK-LABEL: @lshift_i8_rsplat(
155 // CHECK-NEXT: entry:
156 // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 16 x i8> poison, i8 [[B:%.*]], i64 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]]
161 svint8_t lshift_i8_rsplat(svint8_t a, int8_t b) {
162 return a << b;
165 // CHECK-LABEL: @lshift_i8_lsplat(
166 // CHECK-NEXT: entry:
167 // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 16 x i8> poison, i8 [[B:%.*]], i64 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]]
172 svint8_t lshift_i8_lsplat(svint8_t a, int8_t b) {
173 return b << a;
176 // CHECK-LABEL: @rshift_i8_rsplat(
177 // CHECK-NEXT: entry:
178 // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 16 x i8> poison, i8 [[B:%.*]], i64 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]]
183 svint8_t rshift_i8_rsplat(svint8_t a, int8_t b) {
184 return a >> b;
187 // CHECK-LABEL: @rshift_i8_lsplat(
188 // CHECK-NEXT: entry:
189 // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 16 x i8> poison, i8 [[B:%.*]], i64 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]]
194 svint8_t rshift_i8_lsplat(svint8_t a, int8_t b) {
195 return b >> a;
198 // CHECK-LABEL: @lshift_u8_rsplat(
199 // CHECK-NEXT: entry:
200 // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 16 x i8> poison, i8 [[B:%.*]], i64 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]]
205 svuint8_t lshift_u8_rsplat(svuint8_t a, uint8_t b) {
206 return a << b;
209 // CHECK-LABEL: @lshift_u8_lsplat(
210 // CHECK-NEXT: entry:
211 // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 16 x i8> poison, i8 [[B:%.*]], i64 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]]
216 svuint8_t lshift_u8_lsplat(svuint8_t a, uint8_t b) {
217 return b << a;
220 // CHECK-LABEL: @rshift_u8_rsplat(
221 // CHECK-NEXT: entry:
222 // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 16 x i8> poison, i8 [[B:%.*]], i64 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]]
227 svuint8_t rshift_u8_rsplat(svuint8_t a, uint8_t b) {
228 return a >> b;
231 // CHECK-LABEL: @rshift_u8_lsplat(
232 // CHECK-NEXT: entry:
233 // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 16 x i8> poison, i8 [[B:%.*]], i64 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]]
238 svuint8_t rshift_u8_lsplat(svuint8_t a, uint8_t b) {
239 return b >> a;
242 // CHECK-LABEL: @lshift_i16_rsplat(
243 // CHECK-NEXT: entry:
244 // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 8 x i16> poison, i16 [[B:%.*]], i64 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]]
249 svint16_t lshift_i16_rsplat(svint16_t a, int16_t b) {
250 return a << b;
253 // CHECK-LABEL: @lshift_i16_lsplat(
254 // CHECK-NEXT: entry:
255 // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 8 x i16> poison, i16 [[B:%.*]], i64 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]]
260 svint16_t lshift_i16_lsplat(svint16_t a, int16_t b) {
261 return b << a;
264 // CHECK-LABEL: @rshift_i16_rsplat(
265 // CHECK-NEXT: entry:
266 // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 8 x i16> poison, i16 [[B:%.*]], i64 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]]
271 svint16_t rshift_i16_rsplat(svint16_t a, int16_t b) {
272 return a >> b;
275 // CHECK-LABEL: @rshift_i16_lsplat(
276 // CHECK-NEXT: entry:
277 // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 8 x i16> poison, i16 [[B:%.*]], i64 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]]
282 svint16_t rshift_i16_lsplat(svint16_t a, int16_t b) {
283 return b >> a;
286 // CHECK-LABEL: @lshift_u16_rsplat(
287 // CHECK-NEXT: entry:
288 // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 8 x i16> poison, i16 [[B:%.*]], i64 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]]
293 svuint16_t lshift_u16_rsplat(svuint16_t a, uint16_t b) {
294 return a << b;
297 // CHECK-LABEL: @lshift_u16_lsplat(
298 // CHECK-NEXT: entry:
299 // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 8 x i16> poison, i16 [[B:%.*]], i64 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]]
304 svuint16_t lshift_u16_lsplat(svuint16_t a, uint16_t b) {
305 return b << a;
308 // CHECK-LABEL: @rshift_u16_rsplat(
309 // CHECK-NEXT: entry:
310 // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 8 x i16> poison, i16 [[B:%.*]], i64 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]]
315 svuint16_t rshift_u16_rsplat(svuint16_t a, uint16_t b) {
316 return a >> b;
319 // CHECK-LABEL: @rshift_u16_lsplat(
320 // CHECK-NEXT: entry:
321 // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 8 x i16> poison, i16 [[B:%.*]], i64 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]]
326 svuint16_t rshift_u16_lsplat(svuint16_t a, uint16_t b) {
327 return b >> a;
330 // CHECK-LABEL: @lshift_i32_rsplat(
331 // CHECK-NEXT: entry:
332 // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[B:%.*]], i64 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]]
337 svint32_t lshift_i32_rsplat(svint32_t a, int32_t b) {
338 return a << b;
341 // CHECK-LABEL: @lshift_i32_lsplat(
342 // CHECK-NEXT: entry:
343 // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[B:%.*]], i64 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]]
348 svint32_t lshift_i32_lsplat(svint32_t a, int32_t b) {
349 return b << a;
352 // CHECK-LABEL: @rshift_i32_rsplat(
353 // CHECK-NEXT: entry:
354 // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[B:%.*]], i64 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]]
359 svint32_t rshift_i32_rsplat(svint32_t a, int32_t b) {
360 return a >> b;
363 // CHECK-LABEL: @rshift_i32_lsplat(
364 // CHECK-NEXT: entry:
365 // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[B:%.*]], i64 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]]
370 svint32_t rshift_i32_lsplat(svint32_t a, int32_t b) {
371 return b >> a;
374 // CHECK-LABEL: @lshift_u32_rsplat(
375 // CHECK-NEXT: entry:
376 // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[B:%.*]], i64 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]]
381 svuint32_t lshift_u32_rsplat(svuint32_t a, uint32_t b) {
382 return a << b;
385 // CHECK-LABEL: @lshift_u32_lsplat(
386 // CHECK-NEXT: entry:
387 // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[B:%.*]], i64 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]]
392 svuint32_t lshift_u32_lsplat(svuint32_t a, uint32_t b) {
393 return b << a;
396 // CHECK-LABEL: @rshift_u32_rsplat(
397 // CHECK-NEXT: entry:
398 // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[B:%.*]], i64 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]]
403 svuint32_t rshift_u32_rsplat(svuint32_t a, uint32_t b) {
404 return a >> b;
407 // CHECK-LABEL: @rshift_u32_lsplat(
408 // CHECK-NEXT: entry:
409 // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[B:%.*]], i64 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]]
414 svuint32_t rshift_u32_lsplat(svuint32_t a, uint32_t b) {
415 return b >> a;
418 // CHECK-LABEL: @lshift_i64_rsplat(
419 // CHECK-NEXT: entry:
420 // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 2 x i64> poison, i64 [[B:%.*]], i64 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]]
425 svint64_t lshift_i64_rsplat(svint64_t a, int64_t b) {
426 return a << b;
429 // CHECK-LABEL: @lshift_i64_lsplat(
430 // CHECK-NEXT: entry:
431 // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 2 x i64> poison, i64 [[B:%.*]], i64 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]]
436 svint64_t lshift_i64_lsplat(svint64_t a, int64_t b) {
437 return b << a;
440 // CHECK-LABEL: @rshift_i64_rsplat(
441 // CHECK-NEXT: entry:
442 // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 2 x i64> poison, i64 [[B:%.*]], i64 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]]
447 svint64_t rshift_i64_rsplat(svint64_t a, int64_t b) {
448 return a >> b;
451 // CHECK-LABEL: @rshift_i64_lsplat(
452 // CHECK-NEXT: entry:
453 // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 2 x i64> poison, i64 [[B:%.*]], i64 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]]
458 svint64_t rshift_i64_lsplat(svint64_t a, int64_t b) {
459 return b >> a;
462 // CHECK-LABEL: @lshift_u64_rsplat(
463 // CHECK-NEXT: entry:
464 // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 2 x i64> poison, i64 [[B:%.*]], i64 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]]
469 svuint64_t lshift_u64_rsplat(svuint64_t a, uint64_t b) {
470 return a << b;
473 // CHECK-LABEL: @lshift_u64_lsplat(
474 // CHECK-NEXT: entry:
475 // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 2 x i64> poison, i64 [[B:%.*]], i64 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]]
480 svuint64_t lshift_u64_lsplat(svuint64_t a, uint64_t b) {
481 return b << a;
484 // CHECK-LABEL: @rshift_u64_rsplat(
485 // CHECK-NEXT: entry:
486 // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 2 x i64> poison, i64 [[B:%.*]], i64 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]]
491 svuint64_t rshift_u64_rsplat(svuint64_t a, uint64_t b) {
492 return a >> b;
495 // CHECK-LABEL: @rshift_u64_lsplat(
496 // CHECK-NEXT: entry:
497 // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 2 x i64> poison, i64 [[B:%.*]], i64 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]]
502 svuint64_t rshift_u64_lsplat(svuint64_t a, uint64_t b) {
503 return b >> a;