xref: /llvm-project/clang/test/CodeGen/AArch64/sve-vls-shift-ops.c (revision 98e747ba56b2f8b51a7c797a3f379d02c545c42b)
1207e5cccSFangrui Song // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2207e5cccSFangrui Song // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve \
3207e5cccSFangrui Song // RUN: -disable-O0-optnone -mvscale-min=4 -mvscale-max=4 \
4207e5cccSFangrui Song // RUN:  -emit-llvm -o - %s | opt -S -passes=sroa | FileCheck %s
5207e5cccSFangrui Song 
6207e5cccSFangrui Song // REQUIRES: aarch64-registered-target
7207e5cccSFangrui Song 
8207e5cccSFangrui Song #include <arm_sve.h>
9207e5cccSFangrui Song 
10207e5cccSFangrui Song #define N 512
11207e5cccSFangrui Song 
12207e5cccSFangrui Song typedef svint8_t fixed_int8_t __attribute__((arm_sve_vector_bits(N)));
13207e5cccSFangrui Song typedef svint16_t fixed_int16_t __attribute__((arm_sve_vector_bits(N)));
14207e5cccSFangrui Song typedef svint32_t fixed_int32_t __attribute__((arm_sve_vector_bits(N)));
15207e5cccSFangrui Song typedef svint64_t fixed_int64_t __attribute__((arm_sve_vector_bits(N)));
16207e5cccSFangrui Song 
17207e5cccSFangrui Song typedef svuint8_t fixed_uint8_t __attribute__((arm_sve_vector_bits(N)));
18207e5cccSFangrui Song typedef svuint16_t fixed_uint16_t __attribute__((arm_sve_vector_bits(N)));
19207e5cccSFangrui Song typedef svuint32_t fixed_uint32_t __attribute__((arm_sve_vector_bits(N)));
20207e5cccSFangrui Song typedef svuint64_t fixed_uint64_t __attribute__((arm_sve_vector_bits(N)));
21207e5cccSFangrui Song 
22207e5cccSFangrui Song typedef svfloat16_t fixed_float16_t __attribute__((arm_sve_vector_bits(N)));
23207e5cccSFangrui Song typedef svfloat32_t fixed_float32_t __attribute__((arm_sve_vector_bits(N)));
24207e5cccSFangrui Song typedef svfloat64_t fixed_float64_t __attribute__((arm_sve_vector_bits(N)));
25207e5cccSFangrui Song 
26207e5cccSFangrui Song typedef svbool_t fixed_bool_t __attribute__((arm_sve_vector_bits(N)));
27207e5cccSFangrui Song 
28207e5cccSFangrui Song // CHECK-LABEL: @lshift_i8(
29207e5cccSFangrui Song // CHECK-NEXT:  entry:
30207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0)
31207e5cccSFangrui Song // CHECK-NEXT:    [[B:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[B_COERCE:%.*]], i64 0)
32207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <64 x i8> [[A]], [[B]]
33*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[SHL]], i64 0)
34207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[CASTSCALABLESVE]]
35207e5cccSFangrui Song //
36207e5cccSFangrui Song fixed_int8_t lshift_i8(fixed_int8_t a, fixed_int8_t b) {
37207e5cccSFangrui Song   return a << b;
38207e5cccSFangrui Song }
39207e5cccSFangrui Song 
40207e5cccSFangrui Song // CHECK-LABEL: @rshift_i8(
41207e5cccSFangrui Song // CHECK-NEXT:  entry:
42207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0)
43207e5cccSFangrui Song // CHECK-NEXT:    [[B:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[B_COERCE:%.*]], i64 0)
44207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = ashr <64 x i8> [[A]], [[B]]
45*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[SHR]], i64 0)
46207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[CASTSCALABLESVE]]
47207e5cccSFangrui Song //
48207e5cccSFangrui Song fixed_int8_t rshift_i8(fixed_int8_t a, fixed_int8_t b) {
49207e5cccSFangrui Song   return a >> b;
50207e5cccSFangrui Song }
51207e5cccSFangrui Song 
52207e5cccSFangrui Song // CHECK-LABEL: @lshift_u8(
53207e5cccSFangrui Song // CHECK-NEXT:  entry:
54207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0)
55207e5cccSFangrui Song // CHECK-NEXT:    [[B:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[B_COERCE:%.*]], i64 0)
56207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <64 x i8> [[A]], [[B]]
57*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[SHL]], i64 0)
58207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[CASTSCALABLESVE]]
59207e5cccSFangrui Song //
60207e5cccSFangrui Song fixed_uint8_t lshift_u8(fixed_uint8_t a, fixed_uint8_t b) {
61207e5cccSFangrui Song   return a << b;
62207e5cccSFangrui Song }
63207e5cccSFangrui Song 
64207e5cccSFangrui Song // CHECK-LABEL: @rshift_u8(
65207e5cccSFangrui Song // CHECK-NEXT:  entry:
66207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0)
67207e5cccSFangrui Song // CHECK-NEXT:    [[B:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[B_COERCE:%.*]], i64 0)
68207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = lshr <64 x i8> [[A]], [[B]]
69*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[SHR]], i64 0)
70207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[CASTSCALABLESVE]]
71207e5cccSFangrui Song //
72207e5cccSFangrui Song fixed_uint8_t rshift_u8(fixed_uint8_t a, fixed_uint8_t b) {
73207e5cccSFangrui Song   return a >> b;
74207e5cccSFangrui Song }
75207e5cccSFangrui Song 
76207e5cccSFangrui Song // CHECK-LABEL: @lshift_i16(
77207e5cccSFangrui Song // CHECK-NEXT:  entry:
78207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0)
79207e5cccSFangrui Song // CHECK-NEXT:    [[B:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[B_COERCE:%.*]], i64 0)
80207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <32 x i16> [[A]], [[B]]
81*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[SHL]], i64 0)
82207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[CASTSCALABLESVE]]
83207e5cccSFangrui Song //
84207e5cccSFangrui Song fixed_int16_t lshift_i16(fixed_int16_t a, fixed_int16_t b) {
85207e5cccSFangrui Song   return a << b;
86207e5cccSFangrui Song }
87207e5cccSFangrui Song 
88207e5cccSFangrui Song // CHECK-LABEL: @rshift_i16(
89207e5cccSFangrui Song // CHECK-NEXT:  entry:
90207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0)
91207e5cccSFangrui Song // CHECK-NEXT:    [[B:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[B_COERCE:%.*]], i64 0)
92207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = ashr <32 x i16> [[A]], [[B]]
93*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[SHR]], i64 0)
94207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[CASTSCALABLESVE]]
95207e5cccSFangrui Song //
96207e5cccSFangrui Song fixed_int16_t rshift_i16(fixed_int16_t a, fixed_int16_t b) {
97207e5cccSFangrui Song   return a >> b;
98207e5cccSFangrui Song }
99207e5cccSFangrui Song 
100207e5cccSFangrui Song // CHECK-LABEL: @lshift_u16(
101207e5cccSFangrui Song // CHECK-NEXT:  entry:
102207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0)
103207e5cccSFangrui Song // CHECK-NEXT:    [[B:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[B_COERCE:%.*]], i64 0)
104207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <32 x i16> [[A]], [[B]]
105*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[SHL]], i64 0)
106207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[CASTSCALABLESVE]]
107207e5cccSFangrui Song //
108207e5cccSFangrui Song fixed_uint16_t lshift_u16(fixed_uint16_t a, fixed_uint16_t b) {
109207e5cccSFangrui Song   return a << b;
110207e5cccSFangrui Song }
111207e5cccSFangrui Song 
112207e5cccSFangrui Song // CHECK-LABEL: @rshift_u16(
113207e5cccSFangrui Song // CHECK-NEXT:  entry:
114207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0)
115207e5cccSFangrui Song // CHECK-NEXT:    [[B:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[B_COERCE:%.*]], i64 0)
116207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = lshr <32 x i16> [[A]], [[B]]
117*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[SHR]], i64 0)
118207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[CASTSCALABLESVE]]
119207e5cccSFangrui Song //
120207e5cccSFangrui Song fixed_uint16_t rshift_u16(fixed_uint16_t a, fixed_uint16_t b) {
121207e5cccSFangrui Song   return a >> b;
122207e5cccSFangrui Song }
123207e5cccSFangrui Song 
124207e5cccSFangrui Song // CHECK-LABEL: @lshift_i32(
125207e5cccSFangrui Song // CHECK-NEXT:  entry:
126207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0)
127207e5cccSFangrui Song // CHECK-NEXT:    [[B:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[B_COERCE:%.*]], i64 0)
128207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <16 x i32> [[A]], [[B]]
129*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[SHL]], i64 0)
130207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[CASTSCALABLESVE]]
131207e5cccSFangrui Song //
132207e5cccSFangrui Song fixed_int32_t lshift_i32(fixed_int32_t a, fixed_int32_t b) {
133207e5cccSFangrui Song   return a << b;
134207e5cccSFangrui Song }
135207e5cccSFangrui Song 
136207e5cccSFangrui Song // CHECK-LABEL: @rshift_i32(
137207e5cccSFangrui Song // CHECK-NEXT:  entry:
138207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0)
139207e5cccSFangrui Song // CHECK-NEXT:    [[B:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[B_COERCE:%.*]], i64 0)
140207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = ashr <16 x i32> [[A]], [[B]]
141*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[SHR]], i64 0)
142207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[CASTSCALABLESVE]]
143207e5cccSFangrui Song //
144207e5cccSFangrui Song fixed_int32_t rshift_i32(fixed_int32_t a, fixed_int32_t b) {
145207e5cccSFangrui Song   return a >> b;
146207e5cccSFangrui Song }
147207e5cccSFangrui Song 
148207e5cccSFangrui Song // CHECK-LABEL: @lshift_u32(
149207e5cccSFangrui Song // CHECK-NEXT:  entry:
150207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0)
151207e5cccSFangrui Song // CHECK-NEXT:    [[B:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[B_COERCE:%.*]], i64 0)
152207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <16 x i32> [[A]], [[B]]
153*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[SHL]], i64 0)
154207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[CASTSCALABLESVE]]
155207e5cccSFangrui Song //
156207e5cccSFangrui Song fixed_uint32_t lshift_u32(fixed_uint32_t a, fixed_uint32_t b) {
157207e5cccSFangrui Song   return a << b;
158207e5cccSFangrui Song }
159207e5cccSFangrui Song 
160207e5cccSFangrui Song // CHECK-LABEL: @rshift_u32(
161207e5cccSFangrui Song // CHECK-NEXT:  entry:
162207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0)
163207e5cccSFangrui Song // CHECK-NEXT:    [[B:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[B_COERCE:%.*]], i64 0)
164207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = lshr <16 x i32> [[A]], [[B]]
165*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[SHR]], i64 0)
166207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[CASTSCALABLESVE]]
167207e5cccSFangrui Song //
168207e5cccSFangrui Song fixed_uint32_t rshift_u32(fixed_uint32_t a, fixed_uint32_t b) {
169207e5cccSFangrui Song   return a >> b;
170207e5cccSFangrui Song }
171207e5cccSFangrui Song 
172207e5cccSFangrui Song // CHECK-LABEL: @lshift_i64(
173207e5cccSFangrui Song // CHECK-NEXT:  entry:
174207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0)
175207e5cccSFangrui Song // CHECK-NEXT:    [[B:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[B_COERCE:%.*]], i64 0)
176207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <8 x i64> [[A]], [[B]]
177*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[SHL]], i64 0)
178207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[CASTSCALABLESVE]]
179207e5cccSFangrui Song //
180207e5cccSFangrui Song fixed_int64_t lshift_i64(fixed_int64_t a, fixed_int64_t b) {
181207e5cccSFangrui Song   return a << b;
182207e5cccSFangrui Song }
183207e5cccSFangrui Song 
184207e5cccSFangrui Song // CHECK-LABEL: @rshift_i64(
185207e5cccSFangrui Song // CHECK-NEXT:  entry:
186207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0)
187207e5cccSFangrui Song // CHECK-NEXT:    [[B:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[B_COERCE:%.*]], i64 0)
188207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = ashr <8 x i64> [[A]], [[B]]
189*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[SHR]], i64 0)
190207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[CASTSCALABLESVE]]
191207e5cccSFangrui Song //
192207e5cccSFangrui Song fixed_int64_t rshift_i64(fixed_int64_t a, fixed_int64_t b) {
193207e5cccSFangrui Song   return a >> b;
194207e5cccSFangrui Song }
195207e5cccSFangrui Song 
196207e5cccSFangrui Song // CHECK-LABEL: @lshift_u64(
197207e5cccSFangrui Song // CHECK-NEXT:  entry:
198207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0)
199207e5cccSFangrui Song // CHECK-NEXT:    [[B:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[B_COERCE:%.*]], i64 0)
200207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <8 x i64> [[A]], [[B]]
201*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[SHL]], i64 0)
202207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[CASTSCALABLESVE]]
203207e5cccSFangrui Song //
204207e5cccSFangrui Song fixed_uint64_t lshift_u64(fixed_uint64_t a, fixed_uint64_t b) {
205207e5cccSFangrui Song   return a << b;
206207e5cccSFangrui Song }
207207e5cccSFangrui Song 
208207e5cccSFangrui Song // CHECK-LABEL: @rshift_u64(
209207e5cccSFangrui Song // CHECK-NEXT:  entry:
210207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0)
211207e5cccSFangrui Song // CHECK-NEXT:    [[B:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[B_COERCE:%.*]], i64 0)
212207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = lshr <8 x i64> [[A]], [[B]]
213*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[SHR]], i64 0)
214207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[CASTSCALABLESVE]]
215207e5cccSFangrui Song //
216207e5cccSFangrui Song fixed_uint64_t rshift_u64(fixed_uint64_t a, fixed_uint64_t b) {
217207e5cccSFangrui Song   return a >> b;
218207e5cccSFangrui Song }
219207e5cccSFangrui Song 
220207e5cccSFangrui Song // CHECK-LABEL: @lshift_i8_rsplat(
221207e5cccSFangrui Song // CHECK-NEXT:  entry:
222207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0)
223207e5cccSFangrui Song // CHECK-NEXT:    [[CONV:%.*]] = sext i8 [[B:%.*]] to i32
224207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <64 x i32> poison, i32 [[CONV]], i64 0
225207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <64 x i32> [[SPLAT_SPLATINSERT]], <64 x i32> poison, <64 x i32> zeroinitializer
226207e5cccSFangrui Song // CHECK-NEXT:    [[SH_PROM:%.*]] = trunc <64 x i32> [[SPLAT_SPLAT]] to <64 x i8>
227207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <64 x i8> [[A]], [[SH_PROM]]
228*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[SHL]], i64 0)
229207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[CASTSCALABLESVE]]
230207e5cccSFangrui Song //
231207e5cccSFangrui Song fixed_int8_t lshift_i8_rsplat(fixed_int8_t a, int8_t b) {
232207e5cccSFangrui Song   return a << b;
233207e5cccSFangrui Song }
234207e5cccSFangrui Song 
235207e5cccSFangrui Song // CHECK-LABEL: @lshift_i8_lsplat(
236207e5cccSFangrui Song // CHECK-NEXT:  entry:
237207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0)
238207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <64 x i8> poison, i8 [[B:%.*]], i64 0
239207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <64 x i8> [[SPLAT_SPLATINSERT]], <64 x i8> poison, <64 x i32> zeroinitializer
240207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <64 x i8> [[SPLAT_SPLAT]], [[A]]
241*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[SHL]], i64 0)
242207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[CASTSCALABLESVE]]
243207e5cccSFangrui Song //
244207e5cccSFangrui Song fixed_int8_t lshift_i8_lsplat(fixed_int8_t a, int8_t b) {
245207e5cccSFangrui Song   return b << a;
246207e5cccSFangrui Song }
247207e5cccSFangrui Song 
248207e5cccSFangrui Song // CHECK-LABEL: @rshift_i8_rsplat(
249207e5cccSFangrui Song // CHECK-NEXT:  entry:
250207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0)
251207e5cccSFangrui Song // CHECK-NEXT:    [[CONV:%.*]] = sext i8 [[B:%.*]] to i32
252207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <64 x i32> poison, i32 [[CONV]], i64 0
253207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <64 x i32> [[SPLAT_SPLATINSERT]], <64 x i32> poison, <64 x i32> zeroinitializer
254207e5cccSFangrui Song // CHECK-NEXT:    [[SH_PROM:%.*]] = trunc <64 x i32> [[SPLAT_SPLAT]] to <64 x i8>
255207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = ashr <64 x i8> [[A]], [[SH_PROM]]
256*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[SHR]], i64 0)
257207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[CASTSCALABLESVE]]
258207e5cccSFangrui Song //
259207e5cccSFangrui Song fixed_int8_t rshift_i8_rsplat(fixed_int8_t a, int8_t b) {
260207e5cccSFangrui Song   return a >> b;
261207e5cccSFangrui Song }
262207e5cccSFangrui Song 
263207e5cccSFangrui Song // CHECK-LABEL: @rshift_i8_lsplat(
264207e5cccSFangrui Song // CHECK-NEXT:  entry:
265207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0)
266207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <64 x i8> poison, i8 [[B:%.*]], i64 0
267207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <64 x i8> [[SPLAT_SPLATINSERT]], <64 x i8> poison, <64 x i32> zeroinitializer
268207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = ashr <64 x i8> [[SPLAT_SPLAT]], [[A]]
269*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[SHR]], i64 0)
270207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[CASTSCALABLESVE]]
271207e5cccSFangrui Song //
272207e5cccSFangrui Song fixed_int8_t rshift_i8_lsplat(fixed_int8_t a, int8_t b) {
273207e5cccSFangrui Song   return b >> a;
274207e5cccSFangrui Song }
275207e5cccSFangrui Song 
276207e5cccSFangrui Song // CHECK-LABEL: @lshift_u8_rsplat(
277207e5cccSFangrui Song // CHECK-NEXT:  entry:
278207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0)
279207e5cccSFangrui Song // CHECK-NEXT:    [[CONV:%.*]] = zext i8 [[B:%.*]] to i32
280207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <64 x i32> poison, i32 [[CONV]], i64 0
281207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <64 x i32> [[SPLAT_SPLATINSERT]], <64 x i32> poison, <64 x i32> zeroinitializer
282207e5cccSFangrui Song // CHECK-NEXT:    [[SH_PROM:%.*]] = trunc <64 x i32> [[SPLAT_SPLAT]] to <64 x i8>
283207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <64 x i8> [[A]], [[SH_PROM]]
284*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[SHL]], i64 0)
285207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[CASTSCALABLESVE]]
286207e5cccSFangrui Song //
287207e5cccSFangrui Song fixed_uint8_t lshift_u8_rsplat(fixed_uint8_t a, uint8_t b) {
288207e5cccSFangrui Song   return a << b;
289207e5cccSFangrui Song }
290207e5cccSFangrui Song 
291207e5cccSFangrui Song // CHECK-LABEL: @lshift_u8_lsplat(
292207e5cccSFangrui Song // CHECK-NEXT:  entry:
293207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0)
294207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <64 x i8> poison, i8 [[B:%.*]], i64 0
295207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <64 x i8> [[SPLAT_SPLATINSERT]], <64 x i8> poison, <64 x i32> zeroinitializer
296207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <64 x i8> [[SPLAT_SPLAT]], [[A]]
297*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[SHL]], i64 0)
298207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[CASTSCALABLESVE]]
299207e5cccSFangrui Song //
300207e5cccSFangrui Song fixed_uint8_t lshift_u8_lsplat(fixed_uint8_t a, uint8_t b) {
301207e5cccSFangrui Song   return b << a;
302207e5cccSFangrui Song }
303207e5cccSFangrui Song 
304207e5cccSFangrui Song // CHECK-LABEL: @rshift_u8_rsplat(
305207e5cccSFangrui Song // CHECK-NEXT:  entry:
306207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0)
307207e5cccSFangrui Song // CHECK-NEXT:    [[CONV:%.*]] = zext i8 [[B:%.*]] to i32
308207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <64 x i32> poison, i32 [[CONV]], i64 0
309207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <64 x i32> [[SPLAT_SPLATINSERT]], <64 x i32> poison, <64 x i32> zeroinitializer
310207e5cccSFangrui Song // CHECK-NEXT:    [[SH_PROM:%.*]] = trunc <64 x i32> [[SPLAT_SPLAT]] to <64 x i8>
311207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = lshr <64 x i8> [[A]], [[SH_PROM]]
312*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[SHR]], i64 0)
313207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[CASTSCALABLESVE]]
314207e5cccSFangrui Song //
315207e5cccSFangrui Song fixed_uint8_t rshift_u8_rsplat(fixed_uint8_t a, uint8_t b) {
316207e5cccSFangrui Song   return a >> b;
317207e5cccSFangrui Song }
318207e5cccSFangrui Song 
319207e5cccSFangrui Song // CHECK-LABEL: @rshift_u8_lsplat(
320207e5cccSFangrui Song // CHECK-NEXT:  entry:
321207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0)
322207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <64 x i8> poison, i8 [[B:%.*]], i64 0
323207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <64 x i8> [[SPLAT_SPLATINSERT]], <64 x i8> poison, <64 x i32> zeroinitializer
324207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = lshr <64 x i8> [[SPLAT_SPLAT]], [[A]]
325*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[SHR]], i64 0)
326207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[CASTSCALABLESVE]]
327207e5cccSFangrui Song //
328207e5cccSFangrui Song fixed_uint8_t rshift_u8_lsplat(fixed_uint8_t a, uint8_t b) {
329207e5cccSFangrui Song   return b >> a;
330207e5cccSFangrui Song }
331207e5cccSFangrui Song 
332207e5cccSFangrui Song // CHECK-LABEL: @lshift_i16_rsplat(
333207e5cccSFangrui Song // CHECK-NEXT:  entry:
334207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0)
335207e5cccSFangrui Song // CHECK-NEXT:    [[CONV:%.*]] = sext i16 [[B:%.*]] to i32
336207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <32 x i32> poison, i32 [[CONV]], i64 0
337207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <32 x i32> [[SPLAT_SPLATINSERT]], <32 x i32> poison, <32 x i32> zeroinitializer
338207e5cccSFangrui Song // CHECK-NEXT:    [[SH_PROM:%.*]] = trunc <32 x i32> [[SPLAT_SPLAT]] to <32 x i16>
339207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <32 x i16> [[A]], [[SH_PROM]]
340*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[SHL]], i64 0)
341207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[CASTSCALABLESVE]]
342207e5cccSFangrui Song //
343207e5cccSFangrui Song fixed_int16_t lshift_i16_rsplat(fixed_int16_t a, int16_t b) {
344207e5cccSFangrui Song   return a << b;
345207e5cccSFangrui Song }
346207e5cccSFangrui Song 
347207e5cccSFangrui Song // CHECK-LABEL: @lshift_i16_lsplat(
348207e5cccSFangrui Song // CHECK-NEXT:  entry:
349207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0)
350207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <32 x i16> poison, i16 [[B:%.*]], i64 0
351207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <32 x i16> [[SPLAT_SPLATINSERT]], <32 x i16> poison, <32 x i32> zeroinitializer
352207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <32 x i16> [[SPLAT_SPLAT]], [[A]]
353*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[SHL]], i64 0)
354207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[CASTSCALABLESVE]]
355207e5cccSFangrui Song //
356207e5cccSFangrui Song fixed_int16_t lshift_i16_lsplat(fixed_int16_t a, int16_t b) {
357207e5cccSFangrui Song   return b << a;
358207e5cccSFangrui Song }
359207e5cccSFangrui Song 
360207e5cccSFangrui Song // CHECK-LABEL: @rshift_i16_rsplat(
361207e5cccSFangrui Song // CHECK-NEXT:  entry:
362207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0)
363207e5cccSFangrui Song // CHECK-NEXT:    [[CONV:%.*]] = sext i16 [[B:%.*]] to i32
364207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <32 x i32> poison, i32 [[CONV]], i64 0
365207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <32 x i32> [[SPLAT_SPLATINSERT]], <32 x i32> poison, <32 x i32> zeroinitializer
366207e5cccSFangrui Song // CHECK-NEXT:    [[SH_PROM:%.*]] = trunc <32 x i32> [[SPLAT_SPLAT]] to <32 x i16>
367207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = ashr <32 x i16> [[A]], [[SH_PROM]]
368*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[SHR]], i64 0)
369207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[CASTSCALABLESVE]]
370207e5cccSFangrui Song //
371207e5cccSFangrui Song fixed_int16_t rshift_i16_rsplat(fixed_int16_t a, int16_t b) {
372207e5cccSFangrui Song   return a >> b;
373207e5cccSFangrui Song }
374207e5cccSFangrui Song 
375207e5cccSFangrui Song // CHECK-LABEL: @rshift_i16_lsplat(
376207e5cccSFangrui Song // CHECK-NEXT:  entry:
377207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0)
378207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <32 x i16> poison, i16 [[B:%.*]], i64 0
379207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <32 x i16> [[SPLAT_SPLATINSERT]], <32 x i16> poison, <32 x i32> zeroinitializer
380207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = ashr <32 x i16> [[SPLAT_SPLAT]], [[A]]
381*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[SHR]], i64 0)
382207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[CASTSCALABLESVE]]
383207e5cccSFangrui Song //
384207e5cccSFangrui Song fixed_int16_t rshift_i16_lsplat(fixed_int16_t a, int16_t b) {
385207e5cccSFangrui Song   return b >> a;
386207e5cccSFangrui Song }
387207e5cccSFangrui Song 
388207e5cccSFangrui Song // CHECK-LABEL: @lshift_u16_rsplat(
389207e5cccSFangrui Song // CHECK-NEXT:  entry:
390207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0)
391207e5cccSFangrui Song // CHECK-NEXT:    [[CONV:%.*]] = zext i16 [[B:%.*]] to i32
392207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <32 x i32> poison, i32 [[CONV]], i64 0
393207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <32 x i32> [[SPLAT_SPLATINSERT]], <32 x i32> poison, <32 x i32> zeroinitializer
394207e5cccSFangrui Song // CHECK-NEXT:    [[SH_PROM:%.*]] = trunc <32 x i32> [[SPLAT_SPLAT]] to <32 x i16>
395207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <32 x i16> [[A]], [[SH_PROM]]
396*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[SHL]], i64 0)
397207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[CASTSCALABLESVE]]
398207e5cccSFangrui Song //
399207e5cccSFangrui Song fixed_uint16_t lshift_u16_rsplat(fixed_uint16_t a, uint16_t b) {
400207e5cccSFangrui Song   return a << b;
401207e5cccSFangrui Song }
402207e5cccSFangrui Song 
403207e5cccSFangrui Song // CHECK-LABEL: @lshift_u16_lsplat(
404207e5cccSFangrui Song // CHECK-NEXT:  entry:
405207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0)
406207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <32 x i16> poison, i16 [[B:%.*]], i64 0
407207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <32 x i16> [[SPLAT_SPLATINSERT]], <32 x i16> poison, <32 x i32> zeroinitializer
408207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <32 x i16> [[SPLAT_SPLAT]], [[A]]
409*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[SHL]], i64 0)
410207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[CASTSCALABLESVE]]
411207e5cccSFangrui Song //
412207e5cccSFangrui Song fixed_uint16_t lshift_u16_lsplat(fixed_uint16_t a, uint16_t b) {
413207e5cccSFangrui Song   return b << a;
414207e5cccSFangrui Song }
415207e5cccSFangrui Song 
416207e5cccSFangrui Song // CHECK-LABEL: @rshift_u16_rsplat(
417207e5cccSFangrui Song // CHECK-NEXT:  entry:
418207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0)
419207e5cccSFangrui Song // CHECK-NEXT:    [[CONV:%.*]] = zext i16 [[B:%.*]] to i32
420207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <32 x i32> poison, i32 [[CONV]], i64 0
421207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <32 x i32> [[SPLAT_SPLATINSERT]], <32 x i32> poison, <32 x i32> zeroinitializer
422207e5cccSFangrui Song // CHECK-NEXT:    [[SH_PROM:%.*]] = trunc <32 x i32> [[SPLAT_SPLAT]] to <32 x i16>
423207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = lshr <32 x i16> [[A]], [[SH_PROM]]
424*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[SHR]], i64 0)
425207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[CASTSCALABLESVE]]
426207e5cccSFangrui Song //
427207e5cccSFangrui Song fixed_uint16_t rshift_u16_rsplat(fixed_uint16_t a, uint16_t b) {
428207e5cccSFangrui Song   return a >> b;
429207e5cccSFangrui Song }
430207e5cccSFangrui Song 
431207e5cccSFangrui Song // CHECK-LABEL: @rshift_u16_lsplat(
432207e5cccSFangrui Song // CHECK-NEXT:  entry:
433207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0)
434207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <32 x i16> poison, i16 [[B:%.*]], i64 0
435207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <32 x i16> [[SPLAT_SPLATINSERT]], <32 x i16> poison, <32 x i32> zeroinitializer
436207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = lshr <32 x i16> [[SPLAT_SPLAT]], [[A]]
437*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[SHR]], i64 0)
438207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[CASTSCALABLESVE]]
439207e5cccSFangrui Song //
440207e5cccSFangrui Song fixed_uint16_t rshift_u16_lsplat(fixed_uint16_t a, uint16_t b) {
441207e5cccSFangrui Song   return b >> a;
442207e5cccSFangrui Song }
443207e5cccSFangrui Song 
444207e5cccSFangrui Song // CHECK-LABEL: @lshift_i32_rsplat(
445207e5cccSFangrui Song // CHECK-NEXT:  entry:
446207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0)
447207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <16 x i32> poison, i32 [[B:%.*]], i64 0
448207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <16 x i32> [[SPLAT_SPLATINSERT]], <16 x i32> poison, <16 x i32> zeroinitializer
449207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <16 x i32> [[A]], [[SPLAT_SPLAT]]
450*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[SHL]], i64 0)
451207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[CASTSCALABLESVE]]
452207e5cccSFangrui Song //
453207e5cccSFangrui Song fixed_int32_t lshift_i32_rsplat(fixed_int32_t a, int32_t b) {
454207e5cccSFangrui Song   return a << b;
455207e5cccSFangrui Song }
456207e5cccSFangrui Song 
457207e5cccSFangrui Song // CHECK-LABEL: @lshift_i32_lsplat(
458207e5cccSFangrui Song // CHECK-NEXT:  entry:
459207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0)
460207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <16 x i32> poison, i32 [[B:%.*]], i64 0
461207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <16 x i32> [[SPLAT_SPLATINSERT]], <16 x i32> poison, <16 x i32> zeroinitializer
462207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <16 x i32> [[SPLAT_SPLAT]], [[A]]
463*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[SHL]], i64 0)
464207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[CASTSCALABLESVE]]
465207e5cccSFangrui Song //
466207e5cccSFangrui Song fixed_int32_t lshift_i32_lsplat(fixed_int32_t a, int32_t b) {
467207e5cccSFangrui Song   return b << a;
468207e5cccSFangrui Song }
469207e5cccSFangrui Song 
470207e5cccSFangrui Song // CHECK-LABEL: @rshift_i32_rsplat(
471207e5cccSFangrui Song // CHECK-NEXT:  entry:
472207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0)
473207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <16 x i32> poison, i32 [[B:%.*]], i64 0
474207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <16 x i32> [[SPLAT_SPLATINSERT]], <16 x i32> poison, <16 x i32> zeroinitializer
475207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = ashr <16 x i32> [[A]], [[SPLAT_SPLAT]]
476*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[SHR]], i64 0)
477207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[CASTSCALABLESVE]]
478207e5cccSFangrui Song //
479207e5cccSFangrui Song fixed_int32_t rshift_i32_rsplat(fixed_int32_t a, int32_t b) {
480207e5cccSFangrui Song   return a >> b;
481207e5cccSFangrui Song }
482207e5cccSFangrui Song 
483207e5cccSFangrui Song // CHECK-LABEL: @rshift_i32_lsplat(
484207e5cccSFangrui Song // CHECK-NEXT:  entry:
485207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0)
486207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <16 x i32> poison, i32 [[B:%.*]], i64 0
487207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <16 x i32> [[SPLAT_SPLATINSERT]], <16 x i32> poison, <16 x i32> zeroinitializer
488207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = ashr <16 x i32> [[SPLAT_SPLAT]], [[A]]
489*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[SHR]], i64 0)
490207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[CASTSCALABLESVE]]
491207e5cccSFangrui Song //
492207e5cccSFangrui Song fixed_int32_t rshift_i32_lsplat(fixed_int32_t a, int32_t b) {
493207e5cccSFangrui Song   return b >> a;
494207e5cccSFangrui Song }
495207e5cccSFangrui Song 
496207e5cccSFangrui Song // CHECK-LABEL: @lshift_u32_rsplat(
497207e5cccSFangrui Song // CHECK-NEXT:  entry:
498207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0)
499207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <16 x i32> poison, i32 [[B:%.*]], i64 0
500207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <16 x i32> [[SPLAT_SPLATINSERT]], <16 x i32> poison, <16 x i32> zeroinitializer
501207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <16 x i32> [[A]], [[SPLAT_SPLAT]]
502*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[SHL]], i64 0)
503207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[CASTSCALABLESVE]]
504207e5cccSFangrui Song //
505207e5cccSFangrui Song fixed_uint32_t lshift_u32_rsplat(fixed_uint32_t a, uint32_t b) {
506207e5cccSFangrui Song   return a << b;
507207e5cccSFangrui Song }
508207e5cccSFangrui Song 
509207e5cccSFangrui Song // CHECK-LABEL: @lshift_u32_lsplat(
510207e5cccSFangrui Song // CHECK-NEXT:  entry:
511207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0)
512207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <16 x i32> poison, i32 [[B:%.*]], i64 0
513207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <16 x i32> [[SPLAT_SPLATINSERT]], <16 x i32> poison, <16 x i32> zeroinitializer
514207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <16 x i32> [[SPLAT_SPLAT]], [[A]]
515*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[SHL]], i64 0)
516207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[CASTSCALABLESVE]]
517207e5cccSFangrui Song //
518207e5cccSFangrui Song fixed_uint32_t lshift_u32_lsplat(fixed_uint32_t a, uint32_t b) {
519207e5cccSFangrui Song   return b << a;
520207e5cccSFangrui Song }
521207e5cccSFangrui Song 
522207e5cccSFangrui Song // CHECK-LABEL: @rshift_u32_rsplat(
523207e5cccSFangrui Song // CHECK-NEXT:  entry:
524207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0)
525207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <16 x i32> poison, i32 [[B:%.*]], i64 0
526207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <16 x i32> [[SPLAT_SPLATINSERT]], <16 x i32> poison, <16 x i32> zeroinitializer
527207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = lshr <16 x i32> [[A]], [[SPLAT_SPLAT]]
528*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[SHR]], i64 0)
529207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[CASTSCALABLESVE]]
530207e5cccSFangrui Song //
531207e5cccSFangrui Song fixed_uint32_t rshift_u32_rsplat(fixed_uint32_t a, uint32_t b) {
532207e5cccSFangrui Song   return a >> b;
533207e5cccSFangrui Song }
534207e5cccSFangrui Song 
535207e5cccSFangrui Song // CHECK-LABEL: @rshift_u32_lsplat(
536207e5cccSFangrui Song // CHECK-NEXT:  entry:
537207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0)
538207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <16 x i32> poison, i32 [[B:%.*]], i64 0
539207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <16 x i32> [[SPLAT_SPLATINSERT]], <16 x i32> poison, <16 x i32> zeroinitializer
540207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = lshr <16 x i32> [[SPLAT_SPLAT]], [[A]]
541*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[SHR]], i64 0)
542207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[CASTSCALABLESVE]]
543207e5cccSFangrui Song //
544207e5cccSFangrui Song fixed_uint32_t rshift_u32_lsplat(fixed_uint32_t a, uint32_t b) {
545207e5cccSFangrui Song   return b >> a;
546207e5cccSFangrui Song }
547207e5cccSFangrui Song 
548207e5cccSFangrui Song // CHECK-LABEL: @lshift_i64_rsplat(
549207e5cccSFangrui Song // CHECK-NEXT:  entry:
550207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0)
551207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <8 x i64> poison, i64 [[B:%.*]], i64 0
552207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <8 x i64> [[SPLAT_SPLATINSERT]], <8 x i64> poison, <8 x i32> zeroinitializer
553207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <8 x i64> [[A]], [[SPLAT_SPLAT]]
554*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[SHL]], i64 0)
555207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[CASTSCALABLESVE]]
556207e5cccSFangrui Song //
557207e5cccSFangrui Song fixed_int64_t lshift_i64_rsplat(fixed_int64_t a, int64_t b) {
558207e5cccSFangrui Song   return a << b;
559207e5cccSFangrui Song }
560207e5cccSFangrui Song 
561207e5cccSFangrui Song // CHECK-LABEL: @lshift_i64_lsplat(
562207e5cccSFangrui Song // CHECK-NEXT:  entry:
563207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0)
564207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <8 x i64> poison, i64 [[B:%.*]], i64 0
565207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <8 x i64> [[SPLAT_SPLATINSERT]], <8 x i64> poison, <8 x i32> zeroinitializer
566207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <8 x i64> [[SPLAT_SPLAT]], [[A]]
567*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[SHL]], i64 0)
568207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[CASTSCALABLESVE]]
569207e5cccSFangrui Song //
570207e5cccSFangrui Song fixed_int64_t lshift_i64_lsplat(fixed_int64_t a, int64_t b) {
571207e5cccSFangrui Song   return b << a;
572207e5cccSFangrui Song }
573207e5cccSFangrui Song 
574207e5cccSFangrui Song // CHECK-LABEL: @rshift_i64_rsplat(
575207e5cccSFangrui Song // CHECK-NEXT:  entry:
576207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0)
577207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <8 x i64> poison, i64 [[B:%.*]], i64 0
578207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <8 x i64> [[SPLAT_SPLATINSERT]], <8 x i64> poison, <8 x i32> zeroinitializer
579207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = ashr <8 x i64> [[A]], [[SPLAT_SPLAT]]
580*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[SHR]], i64 0)
581207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[CASTSCALABLESVE]]
582207e5cccSFangrui Song //
583207e5cccSFangrui Song fixed_int64_t rshift_i64_rsplat(fixed_int64_t a, int64_t b) {
584207e5cccSFangrui Song   return a >> b;
585207e5cccSFangrui Song }
586207e5cccSFangrui Song 
587207e5cccSFangrui Song // CHECK-LABEL: @rshift_i64_lsplat(
588207e5cccSFangrui Song // CHECK-NEXT:  entry:
589207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0)
590207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <8 x i64> poison, i64 [[B:%.*]], i64 0
591207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <8 x i64> [[SPLAT_SPLATINSERT]], <8 x i64> poison, <8 x i32> zeroinitializer
592207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = ashr <8 x i64> [[SPLAT_SPLAT]], [[A]]
593*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[SHR]], i64 0)
594207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[CASTSCALABLESVE]]
595207e5cccSFangrui Song //
596207e5cccSFangrui Song fixed_int64_t rshift_i64_lsplat(fixed_int64_t a, int64_t b) {
597207e5cccSFangrui Song   return b >> a;
598207e5cccSFangrui Song }
599207e5cccSFangrui Song 
600207e5cccSFangrui Song // CHECK-LABEL: @lshift_u64_rsplat(
601207e5cccSFangrui Song // CHECK-NEXT:  entry:
602207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0)
603207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <8 x i64> poison, i64 [[B:%.*]], i64 0
604207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <8 x i64> [[SPLAT_SPLATINSERT]], <8 x i64> poison, <8 x i32> zeroinitializer
605207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <8 x i64> [[A]], [[SPLAT_SPLAT]]
606*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[SHL]], i64 0)
607207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[CASTSCALABLESVE]]
608207e5cccSFangrui Song //
609207e5cccSFangrui Song fixed_uint64_t lshift_u64_rsplat(fixed_uint64_t a, uint64_t b) {
610207e5cccSFangrui Song   return a << b;
611207e5cccSFangrui Song }
612207e5cccSFangrui Song 
613207e5cccSFangrui Song // CHECK-LABEL: @lshift_u64_lsplat(
614207e5cccSFangrui Song // CHECK-NEXT:  entry:
615207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0)
616207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <8 x i64> poison, i64 [[B:%.*]], i64 0
617207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <8 x i64> [[SPLAT_SPLATINSERT]], <8 x i64> poison, <8 x i32> zeroinitializer
618207e5cccSFangrui Song // CHECK-NEXT:    [[SHL:%.*]] = shl <8 x i64> [[SPLAT_SPLAT]], [[A]]
619*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[SHL]], i64 0)
620207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[CASTSCALABLESVE]]
621207e5cccSFangrui Song //
622207e5cccSFangrui Song fixed_uint64_t lshift_u64_lsplat(fixed_uint64_t a, uint64_t b) {
623207e5cccSFangrui Song   return b << a;
624207e5cccSFangrui Song }
625207e5cccSFangrui Song 
626207e5cccSFangrui Song // CHECK-LABEL: @rshift_u64_rsplat(
627207e5cccSFangrui Song // CHECK-NEXT:  entry:
628207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0)
629207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <8 x i64> poison, i64 [[B:%.*]], i64 0
630207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <8 x i64> [[SPLAT_SPLATINSERT]], <8 x i64> poison, <8 x i32> zeroinitializer
631207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = lshr <8 x i64> [[A]], [[SPLAT_SPLAT]]
632*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[SHR]], i64 0)
633207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[CASTSCALABLESVE]]
634207e5cccSFangrui Song //
635207e5cccSFangrui Song fixed_uint64_t rshift_u64_rsplat(fixed_uint64_t a, uint64_t b) {
636207e5cccSFangrui Song   return a >> b;
637207e5cccSFangrui Song }
638207e5cccSFangrui Song 
639207e5cccSFangrui Song // CHECK-LABEL: @rshift_u64_lsplat(
640207e5cccSFangrui Song // CHECK-NEXT:  entry:
641207e5cccSFangrui Song // CHECK-NEXT:    [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0)
642207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <8 x i64> poison, i64 [[B:%.*]], i64 0
643207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <8 x i64> [[SPLAT_SPLATINSERT]], <8 x i64> poison, <8 x i32> zeroinitializer
644207e5cccSFangrui Song // CHECK-NEXT:    [[SHR:%.*]] = lshr <8 x i64> [[SPLAT_SPLAT]], [[A]]
645*98e747baSPedro Lobo // CHECK-NEXT:    [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[SHR]], i64 0)
646207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[CASTSCALABLESVE]]
647207e5cccSFangrui Song //
648207e5cccSFangrui Song fixed_uint64_t rshift_u64_lsplat(fixed_uint64_t a, uint64_t b) {
649207e5cccSFangrui Song   return b >> a;
650207e5cccSFangrui Song }
651