xref: /llvm-project/clang/test/CodeGen/AArch64/sve-vector-arith-ops.c (revision 207e5ccceec8d3cc3f32723e78f2a142bc61b07d)
1*207e5cccSFangrui Song // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2*207e5cccSFangrui Song // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve \
3*207e5cccSFangrui Song // RUN: -disable-O0-optnone \
4*207e5cccSFangrui Song // RUN:  -emit-llvm -o - %s | opt -S -passes=sroa | FileCheck %s
5*207e5cccSFangrui Song 
6*207e5cccSFangrui Song // REQUIRES: aarch64-registered-target
7*207e5cccSFangrui Song 
8*207e5cccSFangrui Song #include <arm_sve.h>
9*207e5cccSFangrui Song 
10*207e5cccSFangrui Song // ADDITION
11*207e5cccSFangrui Song 
12*207e5cccSFangrui Song // CHECK-LABEL: @add_i8(
13*207e5cccSFangrui Song // CHECK-NEXT:  entry:
14*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = add <vscale x 16 x i8> [[A:%.*]], [[B:%.*]]
15*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[ADD]]
16*207e5cccSFangrui Song //
17*207e5cccSFangrui Song svint8_t add_i8(svint8_t a, svint8_t b) {
18*207e5cccSFangrui Song   return a + b;
19*207e5cccSFangrui Song }
20*207e5cccSFangrui Song 
21*207e5cccSFangrui Song // CHECK-LABEL: @add_i16(
22*207e5cccSFangrui Song // CHECK-NEXT:  entry:
23*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = add <vscale x 8 x i16> [[A:%.*]], [[B:%.*]]
24*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[ADD]]
25*207e5cccSFangrui Song //
26*207e5cccSFangrui Song svint16_t add_i16(svint16_t a, svint16_t b) {
27*207e5cccSFangrui Song   return a + b;
28*207e5cccSFangrui Song }
29*207e5cccSFangrui Song 
30*207e5cccSFangrui Song // CHECK-LABEL: @add_i32(
31*207e5cccSFangrui Song // CHECK-NEXT:  entry:
32*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = add <vscale x 4 x i32> [[A:%.*]], [[B:%.*]]
33*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[ADD]]
34*207e5cccSFangrui Song //
35*207e5cccSFangrui Song svint32_t add_i32(svint32_t a, svint32_t b) {
36*207e5cccSFangrui Song   return a + b;
37*207e5cccSFangrui Song }
38*207e5cccSFangrui Song 
39*207e5cccSFangrui Song // CHECK-LABEL: @add_i64(
40*207e5cccSFangrui Song // CHECK-NEXT:  entry:
41*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = add <vscale x 2 x i64> [[A:%.*]], [[B:%.*]]
42*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[ADD]]
43*207e5cccSFangrui Song //
44*207e5cccSFangrui Song svint64_t add_i64(svint64_t a, svint64_t b) {
45*207e5cccSFangrui Song   return a + b;
46*207e5cccSFangrui Song }
47*207e5cccSFangrui Song 
48*207e5cccSFangrui Song // CHECK-LABEL: @add_u8(
49*207e5cccSFangrui Song // CHECK-NEXT:  entry:
50*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = add <vscale x 16 x i8> [[A:%.*]], [[B:%.*]]
51*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[ADD]]
52*207e5cccSFangrui Song //
53*207e5cccSFangrui Song svuint8_t add_u8(svuint8_t a, svuint8_t b) {
54*207e5cccSFangrui Song   return a + b;
55*207e5cccSFangrui Song }
56*207e5cccSFangrui Song 
57*207e5cccSFangrui Song // CHECK-LABEL: @add_u16(
58*207e5cccSFangrui Song // CHECK-NEXT:  entry:
59*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = add <vscale x 8 x i16> [[A:%.*]], [[B:%.*]]
60*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[ADD]]
61*207e5cccSFangrui Song //
62*207e5cccSFangrui Song svuint16_t add_u16(svuint16_t a, svuint16_t b) {
63*207e5cccSFangrui Song   return a + b;
64*207e5cccSFangrui Song }
65*207e5cccSFangrui Song 
66*207e5cccSFangrui Song // CHECK-LABEL: @add_u32(
67*207e5cccSFangrui Song // CHECK-NEXT:  entry:
68*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = add <vscale x 4 x i32> [[A:%.*]], [[B:%.*]]
69*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[ADD]]
70*207e5cccSFangrui Song //
71*207e5cccSFangrui Song svuint32_t add_u32(svuint32_t a, svuint32_t b) {
72*207e5cccSFangrui Song   return a + b;
73*207e5cccSFangrui Song }
74*207e5cccSFangrui Song 
75*207e5cccSFangrui Song // CHECK-LABEL: @add_u64(
76*207e5cccSFangrui Song // CHECK-NEXT:  entry:
77*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = add <vscale x 2 x i64> [[A:%.*]], [[B:%.*]]
78*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[ADD]]
79*207e5cccSFangrui Song //
80*207e5cccSFangrui Song svuint64_t add_u64(svuint64_t a, svuint64_t b) {
81*207e5cccSFangrui Song   return a + b;
82*207e5cccSFangrui Song }
83*207e5cccSFangrui Song 
84*207e5cccSFangrui Song // CHECK-LABEL: @add_f16(
85*207e5cccSFangrui Song // CHECK-NEXT:  entry:
86*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = fadd <vscale x 8 x half> [[A:%.*]], [[B:%.*]]
87*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x half> [[ADD]]
88*207e5cccSFangrui Song //
89*207e5cccSFangrui Song svfloat16_t add_f16(svfloat16_t a, svfloat16_t b) {
90*207e5cccSFangrui Song   return a + b;
91*207e5cccSFangrui Song }
92*207e5cccSFangrui Song 
93*207e5cccSFangrui Song // CHECK-LABEL: @add_f32(
94*207e5cccSFangrui Song // CHECK-NEXT:  entry:
95*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = fadd <vscale x 4 x float> [[A:%.*]], [[B:%.*]]
96*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x float> [[ADD]]
97*207e5cccSFangrui Song //
98*207e5cccSFangrui Song svfloat32_t add_f32(svfloat32_t a, svfloat32_t b) {
99*207e5cccSFangrui Song   return a + b;
100*207e5cccSFangrui Song }
101*207e5cccSFangrui Song 
102*207e5cccSFangrui Song // CHECK-LABEL: @add_f64(
103*207e5cccSFangrui Song // CHECK-NEXT:  entry:
104*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = fadd <vscale x 2 x double> [[A:%.*]], [[B:%.*]]
105*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x double> [[ADD]]
106*207e5cccSFangrui Song //
107*207e5cccSFangrui Song svfloat64_t add_f64(svfloat64_t a, svfloat64_t b) {
108*207e5cccSFangrui Song   return a + b;
109*207e5cccSFangrui Song }
110*207e5cccSFangrui Song 
111*207e5cccSFangrui Song // CHECK-LABEL: @add_inplace_i8(
112*207e5cccSFangrui Song // CHECK-NEXT:  entry:
113*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = add <vscale x 16 x i8> [[A:%.*]], [[B:%.*]]
114*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[ADD]]
115*207e5cccSFangrui Song //
116*207e5cccSFangrui Song svint8_t add_inplace_i8(svint8_t a, svint8_t b) {
117*207e5cccSFangrui Song   return a += b;
118*207e5cccSFangrui Song }
119*207e5cccSFangrui Song 
120*207e5cccSFangrui Song // CHECK-LABEL: @add_inplace_i16(
121*207e5cccSFangrui Song // CHECK-NEXT:  entry:
122*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = add <vscale x 8 x i16> [[A:%.*]], [[B:%.*]]
123*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[ADD]]
124*207e5cccSFangrui Song //
125*207e5cccSFangrui Song svint16_t add_inplace_i16(svint16_t a, svint16_t b) {
126*207e5cccSFangrui Song   return a += b;
127*207e5cccSFangrui Song }
128*207e5cccSFangrui Song 
129*207e5cccSFangrui Song // CHECK-LABEL: @add_inplace_i32(
130*207e5cccSFangrui Song // CHECK-NEXT:  entry:
131*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = add <vscale x 4 x i32> [[A:%.*]], [[B:%.*]]
132*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[ADD]]
133*207e5cccSFangrui Song //
134*207e5cccSFangrui Song svint32_t add_inplace_i32(svint32_t a, svint32_t b) {
135*207e5cccSFangrui Song   return a += b;
136*207e5cccSFangrui Song }
137*207e5cccSFangrui Song 
138*207e5cccSFangrui Song // CHECK-LABEL: @add_inplace_i64(
139*207e5cccSFangrui Song // CHECK-NEXT:  entry:
140*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = add <vscale x 2 x i64> [[A:%.*]], [[B:%.*]]
141*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[ADD]]
142*207e5cccSFangrui Song //
143*207e5cccSFangrui Song svint64_t add_inplace_i64(svint64_t a, svint64_t b) {
144*207e5cccSFangrui Song   return a += b;
145*207e5cccSFangrui Song }
146*207e5cccSFangrui Song 
147*207e5cccSFangrui Song // CHECK-LABEL: @add_inplace_u8(
148*207e5cccSFangrui Song // CHECK-NEXT:  entry:
149*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = add <vscale x 16 x i8> [[A:%.*]], [[B:%.*]]
150*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[ADD]]
151*207e5cccSFangrui Song //
152*207e5cccSFangrui Song svuint8_t add_inplace_u8(svuint8_t a, svuint8_t b) {
153*207e5cccSFangrui Song   return a += b;
154*207e5cccSFangrui Song }
155*207e5cccSFangrui Song 
156*207e5cccSFangrui Song // CHECK-LABEL: @add_inplace_u16(
157*207e5cccSFangrui Song // CHECK-NEXT:  entry:
158*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = add <vscale x 8 x i16> [[A:%.*]], [[B:%.*]]
159*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[ADD]]
160*207e5cccSFangrui Song //
161*207e5cccSFangrui Song svuint16_t add_inplace_u16(svuint16_t a, svuint16_t b) {
162*207e5cccSFangrui Song   return a += b;
163*207e5cccSFangrui Song }
164*207e5cccSFangrui Song 
165*207e5cccSFangrui Song // CHECK-LABEL: @add_inplace_u32(
166*207e5cccSFangrui Song // CHECK-NEXT:  entry:
167*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = add <vscale x 4 x i32> [[A:%.*]], [[B:%.*]]
168*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[ADD]]
169*207e5cccSFangrui Song //
170*207e5cccSFangrui Song svuint32_t add_inplace_u32(svuint32_t a, svuint32_t b) {
171*207e5cccSFangrui Song   return a += b;
172*207e5cccSFangrui Song }
173*207e5cccSFangrui Song 
174*207e5cccSFangrui Song // CHECK-LABEL: @add_inplace_u64(
175*207e5cccSFangrui Song // CHECK-NEXT:  entry:
176*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = add <vscale x 2 x i64> [[A:%.*]], [[B:%.*]]
177*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[ADD]]
178*207e5cccSFangrui Song //
179*207e5cccSFangrui Song svuint64_t add_inplace_u64(svuint64_t a, svuint64_t b) {
180*207e5cccSFangrui Song   return a += b;
181*207e5cccSFangrui Song }
182*207e5cccSFangrui Song 
183*207e5cccSFangrui Song // CHECK-LABEL: @add_inplace_f16(
184*207e5cccSFangrui Song // CHECK-NEXT:  entry:
185*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = fadd <vscale x 8 x half> [[A:%.*]], [[B:%.*]]
186*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x half> [[ADD]]
187*207e5cccSFangrui Song //
188*207e5cccSFangrui Song svfloat16_t add_inplace_f16(svfloat16_t a, svfloat16_t b) {
189*207e5cccSFangrui Song   return a += b;
190*207e5cccSFangrui Song }
191*207e5cccSFangrui Song 
192*207e5cccSFangrui Song // CHECK-LABEL: @add_inplace_f32(
193*207e5cccSFangrui Song // CHECK-NEXT:  entry:
194*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = fadd <vscale x 4 x float> [[A:%.*]], [[B:%.*]]
195*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x float> [[ADD]]
196*207e5cccSFangrui Song //
197*207e5cccSFangrui Song svfloat32_t add_inplace_f32(svfloat32_t a, svfloat32_t b) {
198*207e5cccSFangrui Song   return a += b;
199*207e5cccSFangrui Song }
200*207e5cccSFangrui Song 
201*207e5cccSFangrui Song // CHECK-LABEL: @add_inplace_f64(
202*207e5cccSFangrui Song // CHECK-NEXT:  entry:
203*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = fadd <vscale x 2 x double> [[A:%.*]], [[B:%.*]]
204*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x double> [[ADD]]
205*207e5cccSFangrui Song //
206*207e5cccSFangrui Song svfloat64_t add_inplace_f64(svfloat64_t a, svfloat64_t b) {
207*207e5cccSFangrui Song   return a += b;
208*207e5cccSFangrui Song }
209*207e5cccSFangrui Song 
210*207e5cccSFangrui Song // CHECK-LABEL: @add_scalar_i8(
211*207e5cccSFangrui Song // CHECK-NEXT:  entry:
212*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 16 x i8> poison, i8 [[B:%.*]], i64 0
213*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 16 x i8> [[SPLAT_SPLATINSERT]], <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
214*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = add <vscale x 16 x i8> [[A:%.*]], [[SPLAT_SPLAT]]
215*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[ADD]]
216*207e5cccSFangrui Song //
217*207e5cccSFangrui Song svint8_t add_scalar_i8(svint8_t a, int8_t b) {
218*207e5cccSFangrui Song   return a + b;
219*207e5cccSFangrui Song }
220*207e5cccSFangrui Song 
221*207e5cccSFangrui Song // CHECK-LABEL: @add_scalar_i16(
222*207e5cccSFangrui Song // CHECK-NEXT:  entry:
223*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 8 x i16> poison, i16 [[B:%.*]], i64 0
224*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 8 x i16> [[SPLAT_SPLATINSERT]], <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
225*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = add <vscale x 8 x i16> [[A:%.*]], [[SPLAT_SPLAT]]
226*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[ADD]]
227*207e5cccSFangrui Song //
228*207e5cccSFangrui Song svint16_t add_scalar_i16(svint16_t a, int16_t b) {
229*207e5cccSFangrui Song   return a + b;
230*207e5cccSFangrui Song }
231*207e5cccSFangrui Song 
232*207e5cccSFangrui Song // CHECK-LABEL: @add_scalar_i32(
233*207e5cccSFangrui Song // CHECK-NEXT:  entry:
234*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[B:%.*]], i64 0
235*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 4 x i32> [[SPLAT_SPLATINSERT]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
236*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = add <vscale x 4 x i32> [[A:%.*]], [[SPLAT_SPLAT]]
237*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[ADD]]
238*207e5cccSFangrui Song //
239*207e5cccSFangrui Song svint32_t add_scalar_i32(svint32_t a, int32_t b) {
240*207e5cccSFangrui Song   return a + b;
241*207e5cccSFangrui Song }
242*207e5cccSFangrui Song 
243*207e5cccSFangrui Song // CHECK-LABEL: @add_scalar_i64(
244*207e5cccSFangrui Song // CHECK-NEXT:  entry:
245*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 2 x i64> poison, i64 [[B:%.*]], i64 0
246*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 2 x i64> [[SPLAT_SPLATINSERT]], <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
247*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = add <vscale x 2 x i64> [[A:%.*]], [[SPLAT_SPLAT]]
248*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[ADD]]
249*207e5cccSFangrui Song //
250*207e5cccSFangrui Song svint64_t add_scalar_i64(svint64_t a, int64_t b) {
251*207e5cccSFangrui Song   return a + b;
252*207e5cccSFangrui Song }
253*207e5cccSFangrui Song 
254*207e5cccSFangrui Song // CHECK-LABEL: @add_scalar_u8(
255*207e5cccSFangrui Song // CHECK-NEXT:  entry:
256*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 16 x i8> poison, i8 [[B:%.*]], i64 0
257*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 16 x i8> [[SPLAT_SPLATINSERT]], <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
258*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = add <vscale x 16 x i8> [[A:%.*]], [[SPLAT_SPLAT]]
259*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[ADD]]
260*207e5cccSFangrui Song //
261*207e5cccSFangrui Song svuint8_t add_scalar_u8(svuint8_t a, uint8_t b) {
262*207e5cccSFangrui Song   return a + b;
263*207e5cccSFangrui Song }
264*207e5cccSFangrui Song 
265*207e5cccSFangrui Song // CHECK-LABEL: @add_scalar_u16(
266*207e5cccSFangrui Song // CHECK-NEXT:  entry:
267*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 8 x i16> poison, i16 [[B:%.*]], i64 0
268*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 8 x i16> [[SPLAT_SPLATINSERT]], <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
269*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = add <vscale x 8 x i16> [[A:%.*]], [[SPLAT_SPLAT]]
270*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[ADD]]
271*207e5cccSFangrui Song //
272*207e5cccSFangrui Song svuint16_t add_scalar_u16(svuint16_t a, uint16_t b) {
273*207e5cccSFangrui Song   return a + b;
274*207e5cccSFangrui Song }
275*207e5cccSFangrui Song 
276*207e5cccSFangrui Song // CHECK-LABEL: @add_scalar_u32(
277*207e5cccSFangrui Song // CHECK-NEXT:  entry:
278*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[B:%.*]], i64 0
279*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 4 x i32> [[SPLAT_SPLATINSERT]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
280*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = add <vscale x 4 x i32> [[A:%.*]], [[SPLAT_SPLAT]]
281*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[ADD]]
282*207e5cccSFangrui Song //
283*207e5cccSFangrui Song svuint32_t add_scalar_u32(svuint32_t a, uint32_t b) {
284*207e5cccSFangrui Song   return a + b;
285*207e5cccSFangrui Song }
286*207e5cccSFangrui Song 
287*207e5cccSFangrui Song // CHECK-LABEL: @add_scalar_u64(
288*207e5cccSFangrui Song // CHECK-NEXT:  entry:
289*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 2 x i64> poison, i64 [[B:%.*]], i64 0
290*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 2 x i64> [[SPLAT_SPLATINSERT]], <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
291*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = add <vscale x 2 x i64> [[A:%.*]], [[SPLAT_SPLAT]]
292*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[ADD]]
293*207e5cccSFangrui Song //
294*207e5cccSFangrui Song svuint64_t add_scalar_u64(svuint64_t a, uint64_t b) {
295*207e5cccSFangrui Song   return a + b;
296*207e5cccSFangrui Song }
297*207e5cccSFangrui Song 
298*207e5cccSFangrui Song // CHECK-LABEL: @add_scalar_f16(
299*207e5cccSFangrui Song // CHECK-NEXT:  entry:
300*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 8 x half> poison, half [[B:%.*]], i64 0
301*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 8 x half> [[SPLAT_SPLATINSERT]], <vscale x 8 x half> poison, <vscale x 8 x i32> zeroinitializer
302*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = fadd <vscale x 8 x half> [[A:%.*]], [[SPLAT_SPLAT]]
303*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x half> [[ADD]]
304*207e5cccSFangrui Song //
305*207e5cccSFangrui Song svfloat16_t add_scalar_f16(svfloat16_t a, __fp16 b) {
306*207e5cccSFangrui Song   return a + b;
307*207e5cccSFangrui Song }
308*207e5cccSFangrui Song 
309*207e5cccSFangrui Song // CHECK-LABEL: @add_scalar_f32(
310*207e5cccSFangrui Song // CHECK-NEXT:  entry:
311*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 4 x float> poison, float [[B:%.*]], i64 0
312*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 4 x float> [[SPLAT_SPLATINSERT]], <vscale x 4 x float> poison, <vscale x 4 x i32> zeroinitializer
313*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = fadd <vscale x 4 x float> [[A:%.*]], [[SPLAT_SPLAT]]
314*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x float> [[ADD]]
315*207e5cccSFangrui Song //
316*207e5cccSFangrui Song svfloat32_t add_scalar_f32(svfloat32_t a, float b) {
317*207e5cccSFangrui Song   return a + b;
318*207e5cccSFangrui Song }
319*207e5cccSFangrui Song 
320*207e5cccSFangrui Song // CHECK-LABEL: @add_scalar_f64(
321*207e5cccSFangrui Song // CHECK-NEXT:  entry:
322*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 2 x double> poison, double [[B:%.*]], i64 0
323*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 2 x double> [[SPLAT_SPLATINSERT]], <vscale x 2 x double> poison, <vscale x 2 x i32> zeroinitializer
324*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = fadd <vscale x 2 x double> [[A:%.*]], [[SPLAT_SPLAT]]
325*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x double> [[ADD]]
326*207e5cccSFangrui Song //
327*207e5cccSFangrui Song svfloat64_t add_scalar_f64(svfloat64_t a, double b) {
328*207e5cccSFangrui Song   return a + b;
329*207e5cccSFangrui Song }
330*207e5cccSFangrui Song 
331*207e5cccSFangrui Song // CHECK-LABEL: @add_i8_i_lit(
332*207e5cccSFangrui Song // CHECK-NEXT:  entry:
333*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = add <vscale x 16 x i8> [[A:%.*]], zeroinitializer
334*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[ADD]]
335*207e5cccSFangrui Song //
336*207e5cccSFangrui Song svint8_t add_i8_i_lit(svint8_t a) {
337*207e5cccSFangrui Song   return a + 0;
338*207e5cccSFangrui Song }
339*207e5cccSFangrui Song 
340*207e5cccSFangrui Song // CHECK-LABEL: @add_i8_il_lit(
341*207e5cccSFangrui Song // CHECK-NEXT:  entry:
342*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = add <vscale x 16 x i8> [[A:%.*]], zeroinitializer
343*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[ADD]]
344*207e5cccSFangrui Song //
345*207e5cccSFangrui Song svint8_t add_i8_il_lit(svint8_t a) {
346*207e5cccSFangrui Song   return a + 0l;
347*207e5cccSFangrui Song }
348*207e5cccSFangrui Song 
349*207e5cccSFangrui Song // CHECK-LABEL: @add_i8_ill_lit(
350*207e5cccSFangrui Song // CHECK-NEXT:  entry:
351*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = add <vscale x 16 x i8> [[A:%.*]], zeroinitializer
352*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[ADD]]
353*207e5cccSFangrui Song //
354*207e5cccSFangrui Song svint8_t add_i8_ill_lit(svint8_t a) {
355*207e5cccSFangrui Song   return a + 0ll;
356*207e5cccSFangrui Song }
357*207e5cccSFangrui Song 
358*207e5cccSFangrui Song // CHECK-LABEL: @add_i8_u_lit(
359*207e5cccSFangrui Song // CHECK-NEXT:  entry:
360*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = add <vscale x 16 x i8> [[A:%.*]], zeroinitializer
361*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[ADD]]
362*207e5cccSFangrui Song //
363*207e5cccSFangrui Song svint8_t add_i8_u_lit(svint8_t a) {
364*207e5cccSFangrui Song   return a + 0u;
365*207e5cccSFangrui Song }
366*207e5cccSFangrui Song 
367*207e5cccSFangrui Song // CHECK-LABEL: @add_i8_ul_lit(
368*207e5cccSFangrui Song // CHECK-NEXT:  entry:
369*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = add <vscale x 16 x i8> [[A:%.*]], zeroinitializer
370*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[ADD]]
371*207e5cccSFangrui Song //
372*207e5cccSFangrui Song svint8_t add_i8_ul_lit(svint8_t a) {
373*207e5cccSFangrui Song   return a + 0ul;
374*207e5cccSFangrui Song }
375*207e5cccSFangrui Song 
376*207e5cccSFangrui Song // CHECK-LABEL: @add_i8_ull_lit(
377*207e5cccSFangrui Song // CHECK-NEXT:  entry:
378*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = add <vscale x 16 x i8> [[A:%.*]], zeroinitializer
379*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[ADD]]
380*207e5cccSFangrui Song //
381*207e5cccSFangrui Song svint8_t add_i8_ull_lit(svint8_t a) {
382*207e5cccSFangrui Song   return a + 0ull;
383*207e5cccSFangrui Song }
384*207e5cccSFangrui Song 
385*207e5cccSFangrui Song // CHECK-LABEL: @add_f64_i_lit(
386*207e5cccSFangrui Song // CHECK-NEXT:  entry:
387*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = fadd <vscale x 2 x double> [[A:%.*]], zeroinitializer
388*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x double> [[ADD]]
389*207e5cccSFangrui Song //
390*207e5cccSFangrui Song svfloat64_t add_f64_i_lit(svfloat64_t a) {
391*207e5cccSFangrui Song   return a + 0;
392*207e5cccSFangrui Song }
393*207e5cccSFangrui Song 
394*207e5cccSFangrui Song // CHECK-LABEL: @add_f64_il_lit(
395*207e5cccSFangrui Song // CHECK-NEXT:  entry:
396*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = fadd <vscale x 2 x double> [[A:%.*]], zeroinitializer
397*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x double> [[ADD]]
398*207e5cccSFangrui Song //
399*207e5cccSFangrui Song svfloat64_t add_f64_il_lit(svfloat64_t a) {
400*207e5cccSFangrui Song   return a + 0l;
401*207e5cccSFangrui Song }
402*207e5cccSFangrui Song 
403*207e5cccSFangrui Song // CHECK-LABEL: @add_f64_ill_lit(
404*207e5cccSFangrui Song // CHECK-NEXT:  entry:
405*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = fadd <vscale x 2 x double> [[A:%.*]], zeroinitializer
406*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x double> [[ADD]]
407*207e5cccSFangrui Song //
408*207e5cccSFangrui Song svfloat64_t add_f64_ill_lit(svfloat64_t a) {
409*207e5cccSFangrui Song   return a + 0ll;
410*207e5cccSFangrui Song }
411*207e5cccSFangrui Song 
412*207e5cccSFangrui Song // CHECK-LABEL: @add_f64_u_lit(
413*207e5cccSFangrui Song // CHECK-NEXT:  entry:
414*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = fadd <vscale x 2 x double> [[A:%.*]], zeroinitializer
415*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x double> [[ADD]]
416*207e5cccSFangrui Song //
417*207e5cccSFangrui Song svfloat64_t add_f64_u_lit(svfloat64_t a) {
418*207e5cccSFangrui Song   return a + 0u;
419*207e5cccSFangrui Song }
420*207e5cccSFangrui Song 
421*207e5cccSFangrui Song // CHECK-LABEL: @add_f64_ul_lit(
422*207e5cccSFangrui Song // CHECK-NEXT:  entry:
423*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = fadd <vscale x 2 x double> [[A:%.*]], zeroinitializer
424*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x double> [[ADD]]
425*207e5cccSFangrui Song //
426*207e5cccSFangrui Song svfloat64_t add_f64_ul_lit(svfloat64_t a) {
427*207e5cccSFangrui Song   return a + 0ul;
428*207e5cccSFangrui Song }
429*207e5cccSFangrui Song 
430*207e5cccSFangrui Song // CHECK-LABEL: @add_f64_ull_lit(
431*207e5cccSFangrui Song // CHECK-NEXT:  entry:
432*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = fadd <vscale x 2 x double> [[A:%.*]], zeroinitializer
433*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x double> [[ADD]]
434*207e5cccSFangrui Song //
435*207e5cccSFangrui Song svfloat64_t add_f64_ull_lit(svfloat64_t a) {
436*207e5cccSFangrui Song   return a + 0ull;
437*207e5cccSFangrui Song }
438*207e5cccSFangrui Song 
439*207e5cccSFangrui Song // CHECK-LABEL: @add_f64_f_lit(
440*207e5cccSFangrui Song // CHECK-NEXT:  entry:
441*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = fadd <vscale x 2 x double> [[A:%.*]], zeroinitializer
442*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x double> [[ADD]]
443*207e5cccSFangrui Song //
444*207e5cccSFangrui Song svfloat64_t add_f64_f_lit(svfloat64_t a) {
445*207e5cccSFangrui Song   return a + 0.f;
446*207e5cccSFangrui Song }
447*207e5cccSFangrui Song 
448*207e5cccSFangrui Song // CHECK-LABEL: @add_f64_d_lit(
449*207e5cccSFangrui Song // CHECK-NEXT:  entry:
450*207e5cccSFangrui Song // CHECK-NEXT:    [[ADD:%.*]] = fadd <vscale x 2 x double> [[A:%.*]], zeroinitializer
451*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x double> [[ADD]]
452*207e5cccSFangrui Song //
453*207e5cccSFangrui Song svfloat64_t add_f64_d_lit(svfloat64_t a) {
454*207e5cccSFangrui Song   return a + 0.;
455*207e5cccSFangrui Song }
456*207e5cccSFangrui Song 
457*207e5cccSFangrui Song // SUBTRACTION
458*207e5cccSFangrui Song 
459*207e5cccSFangrui Song // CHECK-LABEL: @sub_i8(
460*207e5cccSFangrui Song // CHECK-NEXT:  entry:
461*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = sub <vscale x 16 x i8> [[A:%.*]], [[B:%.*]]
462*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[SUB]]
463*207e5cccSFangrui Song //
464*207e5cccSFangrui Song svint8_t sub_i8(svint8_t a, svint8_t b) {
465*207e5cccSFangrui Song   return a - b;
466*207e5cccSFangrui Song }
467*207e5cccSFangrui Song 
468*207e5cccSFangrui Song // CHECK-LABEL: @sub_i16(
469*207e5cccSFangrui Song // CHECK-NEXT:  entry:
470*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = sub <vscale x 8 x i16> [[A:%.*]], [[B:%.*]]
471*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[SUB]]
472*207e5cccSFangrui Song //
473*207e5cccSFangrui Song svint16_t sub_i16(svint16_t a, svint16_t b) {
474*207e5cccSFangrui Song   return a - b;
475*207e5cccSFangrui Song }
476*207e5cccSFangrui Song 
477*207e5cccSFangrui Song // CHECK-LABEL: @sub_i32(
478*207e5cccSFangrui Song // CHECK-NEXT:  entry:
479*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = sub <vscale x 4 x i32> [[A:%.*]], [[B:%.*]]
480*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[SUB]]
481*207e5cccSFangrui Song //
482*207e5cccSFangrui Song svint32_t sub_i32(svint32_t a, svint32_t b) {
483*207e5cccSFangrui Song   return a - b;
484*207e5cccSFangrui Song }
485*207e5cccSFangrui Song 
486*207e5cccSFangrui Song // CHECK-LABEL: @sub_i64(
487*207e5cccSFangrui Song // CHECK-NEXT:  entry:
488*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = sub <vscale x 2 x i64> [[A:%.*]], [[B:%.*]]
489*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[SUB]]
490*207e5cccSFangrui Song //
491*207e5cccSFangrui Song svint64_t sub_i64(svint64_t a, svint64_t b) {
492*207e5cccSFangrui Song   return a - b;
493*207e5cccSFangrui Song }
494*207e5cccSFangrui Song 
495*207e5cccSFangrui Song // CHECK-LABEL: @sub_u8(
496*207e5cccSFangrui Song // CHECK-NEXT:  entry:
497*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = sub <vscale x 16 x i8> [[A:%.*]], [[B:%.*]]
498*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[SUB]]
499*207e5cccSFangrui Song //
500*207e5cccSFangrui Song svuint8_t sub_u8(svuint8_t a, svuint8_t b) {
501*207e5cccSFangrui Song   return a - b;
502*207e5cccSFangrui Song }
503*207e5cccSFangrui Song 
504*207e5cccSFangrui Song // CHECK-LABEL: @sub_u16(
505*207e5cccSFangrui Song // CHECK-NEXT:  entry:
506*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = sub <vscale x 8 x i16> [[A:%.*]], [[B:%.*]]
507*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[SUB]]
508*207e5cccSFangrui Song //
509*207e5cccSFangrui Song svuint16_t sub_u16(svuint16_t a, svuint16_t b) {
510*207e5cccSFangrui Song   return a - b;
511*207e5cccSFangrui Song }
512*207e5cccSFangrui Song 
513*207e5cccSFangrui Song // CHECK-LABEL: @sub_u32(
514*207e5cccSFangrui Song // CHECK-NEXT:  entry:
515*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = sub <vscale x 4 x i32> [[A:%.*]], [[B:%.*]]
516*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[SUB]]
517*207e5cccSFangrui Song //
518*207e5cccSFangrui Song svuint32_t sub_u32(svuint32_t a, svuint32_t b) {
519*207e5cccSFangrui Song   return a - b;
520*207e5cccSFangrui Song }
521*207e5cccSFangrui Song 
522*207e5cccSFangrui Song // CHECK-LABEL: @sub_u64(
523*207e5cccSFangrui Song // CHECK-NEXT:  entry:
524*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = sub <vscale x 2 x i64> [[A:%.*]], [[B:%.*]]
525*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[SUB]]
526*207e5cccSFangrui Song //
527*207e5cccSFangrui Song svuint64_t sub_u64(svuint64_t a, svuint64_t b) {
528*207e5cccSFangrui Song   return a - b;
529*207e5cccSFangrui Song }
530*207e5cccSFangrui Song 
531*207e5cccSFangrui Song // CHECK-LABEL: @sub_f16(
532*207e5cccSFangrui Song // CHECK-NEXT:  entry:
533*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = fsub <vscale x 8 x half> [[A:%.*]], [[B:%.*]]
534*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x half> [[SUB]]
535*207e5cccSFangrui Song //
536*207e5cccSFangrui Song svfloat16_t sub_f16(svfloat16_t a, svfloat16_t b) {
537*207e5cccSFangrui Song   return a - b;
538*207e5cccSFangrui Song }
539*207e5cccSFangrui Song 
540*207e5cccSFangrui Song // CHECK-LABEL: @sub_f32(
541*207e5cccSFangrui Song // CHECK-NEXT:  entry:
542*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = fsub <vscale x 4 x float> [[A:%.*]], [[B:%.*]]
543*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x float> [[SUB]]
544*207e5cccSFangrui Song //
545*207e5cccSFangrui Song svfloat32_t sub_f32(svfloat32_t a, svfloat32_t b) {
546*207e5cccSFangrui Song   return a - b;
547*207e5cccSFangrui Song }
548*207e5cccSFangrui Song 
549*207e5cccSFangrui Song // CHECK-LABEL: @sub_f64(
550*207e5cccSFangrui Song // CHECK-NEXT:  entry:
551*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = fsub <vscale x 2 x double> [[A:%.*]], [[B:%.*]]
552*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x double> [[SUB]]
553*207e5cccSFangrui Song //
554*207e5cccSFangrui Song svfloat64_t sub_f64(svfloat64_t a, svfloat64_t b) {
555*207e5cccSFangrui Song   return a - b;
556*207e5cccSFangrui Song }
557*207e5cccSFangrui Song 
558*207e5cccSFangrui Song // CHECK-LABEL: @sub_inplace_i8(
559*207e5cccSFangrui Song // CHECK-NEXT:  entry:
560*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = sub <vscale x 16 x i8> [[A:%.*]], [[B:%.*]]
561*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[SUB]]
562*207e5cccSFangrui Song //
563*207e5cccSFangrui Song svint8_t sub_inplace_i8(svint8_t a, svint8_t b) {
564*207e5cccSFangrui Song   return a - b;
565*207e5cccSFangrui Song }
566*207e5cccSFangrui Song 
567*207e5cccSFangrui Song // CHECK-LABEL: @sub_inplace_i16(
568*207e5cccSFangrui Song // CHECK-NEXT:  entry:
569*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = sub <vscale x 8 x i16> [[A:%.*]], [[B:%.*]]
570*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[SUB]]
571*207e5cccSFangrui Song //
572*207e5cccSFangrui Song svint16_t sub_inplace_i16(svint16_t a, svint16_t b) {
573*207e5cccSFangrui Song   return a - b;
574*207e5cccSFangrui Song }
575*207e5cccSFangrui Song 
576*207e5cccSFangrui Song // CHECK-LABEL: @sub_inplace_i32(
577*207e5cccSFangrui Song // CHECK-NEXT:  entry:
578*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = sub <vscale x 4 x i32> [[A:%.*]], [[B:%.*]]
579*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[SUB]]
580*207e5cccSFangrui Song //
581*207e5cccSFangrui Song svint32_t sub_inplace_i32(svint32_t a, svint32_t b) {
582*207e5cccSFangrui Song   return a - b;
583*207e5cccSFangrui Song }
584*207e5cccSFangrui Song 
585*207e5cccSFangrui Song // CHECK-LABEL: @sub_inplace_i64(
586*207e5cccSFangrui Song // CHECK-NEXT:  entry:
587*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = sub <vscale x 2 x i64> [[A:%.*]], [[B:%.*]]
588*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[SUB]]
589*207e5cccSFangrui Song //
590*207e5cccSFangrui Song svint64_t sub_inplace_i64(svint64_t a, svint64_t b) {
591*207e5cccSFangrui Song   return a - b;
592*207e5cccSFangrui Song }
593*207e5cccSFangrui Song 
594*207e5cccSFangrui Song // CHECK-LABEL: @sub_inplace_u8(
595*207e5cccSFangrui Song // CHECK-NEXT:  entry:
596*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = sub <vscale x 16 x i8> [[A:%.*]], [[B:%.*]]
597*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[SUB]]
598*207e5cccSFangrui Song //
599*207e5cccSFangrui Song svuint8_t sub_inplace_u8(svuint8_t a, svuint8_t b) {
600*207e5cccSFangrui Song   return a - b;
601*207e5cccSFangrui Song }
602*207e5cccSFangrui Song 
603*207e5cccSFangrui Song // CHECK-LABEL: @sub_inplace_u16(
604*207e5cccSFangrui Song // CHECK-NEXT:  entry:
605*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = sub <vscale x 8 x i16> [[A:%.*]], [[B:%.*]]
606*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[SUB]]
607*207e5cccSFangrui Song //
608*207e5cccSFangrui Song svuint16_t sub_inplace_u16(svuint16_t a, svuint16_t b) {
609*207e5cccSFangrui Song   return a - b;
610*207e5cccSFangrui Song }
611*207e5cccSFangrui Song 
612*207e5cccSFangrui Song // CHECK-LABEL: @sub_inplace_u32(
613*207e5cccSFangrui Song // CHECK-NEXT:  entry:
614*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = sub <vscale x 4 x i32> [[A:%.*]], [[B:%.*]]
615*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[SUB]]
616*207e5cccSFangrui Song //
617*207e5cccSFangrui Song svuint32_t sub_inplace_u32(svuint32_t a, svuint32_t b) {
618*207e5cccSFangrui Song   return a - b;
619*207e5cccSFangrui Song }
620*207e5cccSFangrui Song 
621*207e5cccSFangrui Song // CHECK-LABEL: @sub_inplace_u64(
622*207e5cccSFangrui Song // CHECK-NEXT:  entry:
623*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = sub <vscale x 2 x i64> [[A:%.*]], [[B:%.*]]
624*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[SUB]]
625*207e5cccSFangrui Song //
626*207e5cccSFangrui Song svuint64_t sub_inplace_u64(svuint64_t a, svuint64_t b) {
627*207e5cccSFangrui Song   return a - b;
628*207e5cccSFangrui Song }
629*207e5cccSFangrui Song 
630*207e5cccSFangrui Song // CHECK-LABEL: @sub_inplace_f16(
631*207e5cccSFangrui Song // CHECK-NEXT:  entry:
632*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = fsub <vscale x 8 x half> [[A:%.*]], [[B:%.*]]
633*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x half> [[SUB]]
634*207e5cccSFangrui Song //
635*207e5cccSFangrui Song svfloat16_t sub_inplace_f16(svfloat16_t a, svfloat16_t b) {
636*207e5cccSFangrui Song   return a - b;
637*207e5cccSFangrui Song }
638*207e5cccSFangrui Song 
639*207e5cccSFangrui Song // CHECK-LABEL: @sub_inplace_f32(
640*207e5cccSFangrui Song // CHECK-NEXT:  entry:
641*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = fsub <vscale x 4 x float> [[A:%.*]], [[B:%.*]]
642*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x float> [[SUB]]
643*207e5cccSFangrui Song //
644*207e5cccSFangrui Song svfloat32_t sub_inplace_f32(svfloat32_t a, svfloat32_t b) {
645*207e5cccSFangrui Song   return a - b;
646*207e5cccSFangrui Song }
647*207e5cccSFangrui Song 
648*207e5cccSFangrui Song // CHECK-LABEL: @sub_inplace_f64(
649*207e5cccSFangrui Song // CHECK-NEXT:  entry:
650*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = fsub <vscale x 2 x double> [[A:%.*]], [[B:%.*]]
651*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x double> [[SUB]]
652*207e5cccSFangrui Song //
653*207e5cccSFangrui Song svfloat64_t sub_inplace_f64(svfloat64_t a, svfloat64_t b) {
654*207e5cccSFangrui Song   return a - b;
655*207e5cccSFangrui Song }
656*207e5cccSFangrui Song 
657*207e5cccSFangrui Song // CHECK-LABEL: @sub_scalar_i8(
658*207e5cccSFangrui Song // CHECK-NEXT:  entry:
659*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 16 x i8> poison, i8 [[B:%.*]], i64 0
660*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 16 x i8> [[SPLAT_SPLATINSERT]], <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
661*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = sub <vscale x 16 x i8> [[A:%.*]], [[SPLAT_SPLAT]]
662*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[SUB]]
663*207e5cccSFangrui Song //
664*207e5cccSFangrui Song svint8_t sub_scalar_i8(svint8_t a, int8_t b) {
665*207e5cccSFangrui Song   return a - b;
666*207e5cccSFangrui Song }
667*207e5cccSFangrui Song 
668*207e5cccSFangrui Song // CHECK-LABEL: @sub_scalar_i16(
669*207e5cccSFangrui Song // CHECK-NEXT:  entry:
670*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 8 x i16> poison, i16 [[B:%.*]], i64 0
671*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 8 x i16> [[SPLAT_SPLATINSERT]], <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
672*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = sub <vscale x 8 x i16> [[A:%.*]], [[SPLAT_SPLAT]]
673*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[SUB]]
674*207e5cccSFangrui Song //
675*207e5cccSFangrui Song svint16_t sub_scalar_i16(svint16_t a, int16_t b) {
676*207e5cccSFangrui Song   return a - b;
677*207e5cccSFangrui Song }
678*207e5cccSFangrui Song 
679*207e5cccSFangrui Song // CHECK-LABEL: @sub_scalar_i32(
680*207e5cccSFangrui Song // CHECK-NEXT:  entry:
681*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[B:%.*]], i64 0
682*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 4 x i32> [[SPLAT_SPLATINSERT]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
683*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = sub <vscale x 4 x i32> [[A:%.*]], [[SPLAT_SPLAT]]
684*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[SUB]]
685*207e5cccSFangrui Song //
686*207e5cccSFangrui Song svint32_t sub_scalar_i32(svint32_t a, int32_t b) {
687*207e5cccSFangrui Song   return a - b;
688*207e5cccSFangrui Song }
689*207e5cccSFangrui Song 
690*207e5cccSFangrui Song // CHECK-LABEL: @sub_scalar_i64(
691*207e5cccSFangrui Song // CHECK-NEXT:  entry:
692*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 2 x i64> poison, i64 [[B:%.*]], i64 0
693*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 2 x i64> [[SPLAT_SPLATINSERT]], <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
694*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = sub <vscale x 2 x i64> [[A:%.*]], [[SPLAT_SPLAT]]
695*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[SUB]]
696*207e5cccSFangrui Song //
697*207e5cccSFangrui Song svint64_t sub_scalar_i64(svint64_t a, int64_t b) {
698*207e5cccSFangrui Song   return a - b;
699*207e5cccSFangrui Song }
700*207e5cccSFangrui Song 
701*207e5cccSFangrui Song // CHECK-LABEL: @sub_scalar_u8(
702*207e5cccSFangrui Song // CHECK-NEXT:  entry:
703*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 16 x i8> poison, i8 [[B:%.*]], i64 0
704*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 16 x i8> [[SPLAT_SPLATINSERT]], <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
705*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = sub <vscale x 16 x i8> [[A:%.*]], [[SPLAT_SPLAT]]
706*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[SUB]]
707*207e5cccSFangrui Song //
708*207e5cccSFangrui Song svuint8_t sub_scalar_u8(svuint8_t a, uint8_t b) {
709*207e5cccSFangrui Song   return a - b;
710*207e5cccSFangrui Song }
711*207e5cccSFangrui Song 
712*207e5cccSFangrui Song // CHECK-LABEL: @sub_scalar_u16(
713*207e5cccSFangrui Song // CHECK-NEXT:  entry:
714*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 8 x i16> poison, i16 [[B:%.*]], i64 0
715*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 8 x i16> [[SPLAT_SPLATINSERT]], <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
716*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = sub <vscale x 8 x i16> [[A:%.*]], [[SPLAT_SPLAT]]
717*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[SUB]]
718*207e5cccSFangrui Song //
719*207e5cccSFangrui Song svuint16_t sub_scalar_u16(svuint16_t a, uint16_t b) {
720*207e5cccSFangrui Song   return a - b;
721*207e5cccSFangrui Song }
722*207e5cccSFangrui Song 
723*207e5cccSFangrui Song // CHECK-LABEL: @sub_scalar_u32(
724*207e5cccSFangrui Song // CHECK-NEXT:  entry:
725*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[B:%.*]], i64 0
726*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 4 x i32> [[SPLAT_SPLATINSERT]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
727*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = sub <vscale x 4 x i32> [[A:%.*]], [[SPLAT_SPLAT]]
728*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[SUB]]
729*207e5cccSFangrui Song //
730*207e5cccSFangrui Song svuint32_t sub_scalar_u32(svuint32_t a, uint32_t b) {
731*207e5cccSFangrui Song   return a - b;
732*207e5cccSFangrui Song }
733*207e5cccSFangrui Song 
734*207e5cccSFangrui Song // CHECK-LABEL: @sub_scalar_u64(
735*207e5cccSFangrui Song // CHECK-NEXT:  entry:
736*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 2 x i64> poison, i64 [[B:%.*]], i64 0
737*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 2 x i64> [[SPLAT_SPLATINSERT]], <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
738*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = sub <vscale x 2 x i64> [[A:%.*]], [[SPLAT_SPLAT]]
739*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[SUB]]
740*207e5cccSFangrui Song //
741*207e5cccSFangrui Song svuint64_t sub_scalar_u64(svuint64_t a, uint64_t b) {
742*207e5cccSFangrui Song   return a - b;
743*207e5cccSFangrui Song }
744*207e5cccSFangrui Song 
745*207e5cccSFangrui Song // CHECK-LABEL: @sub_scalar_f16(
746*207e5cccSFangrui Song // CHECK-NEXT:  entry:
747*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 8 x half> poison, half [[B:%.*]], i64 0
748*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 8 x half> [[SPLAT_SPLATINSERT]], <vscale x 8 x half> poison, <vscale x 8 x i32> zeroinitializer
749*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = fsub <vscale x 8 x half> [[A:%.*]], [[SPLAT_SPLAT]]
750*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x half> [[SUB]]
751*207e5cccSFangrui Song //
752*207e5cccSFangrui Song svfloat16_t sub_scalar_f16(svfloat16_t a, __fp16 b) {
753*207e5cccSFangrui Song   return a - b;
754*207e5cccSFangrui Song }
755*207e5cccSFangrui Song 
756*207e5cccSFangrui Song // CHECK-LABEL: @sub_scalar_f32(
757*207e5cccSFangrui Song // CHECK-NEXT:  entry:
758*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 4 x float> poison, float [[B:%.*]], i64 0
759*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 4 x float> [[SPLAT_SPLATINSERT]], <vscale x 4 x float> poison, <vscale x 4 x i32> zeroinitializer
760*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = fsub <vscale x 4 x float> [[A:%.*]], [[SPLAT_SPLAT]]
761*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x float> [[SUB]]
762*207e5cccSFangrui Song //
763*207e5cccSFangrui Song svfloat32_t sub_scalar_f32(svfloat32_t a, float b) {
764*207e5cccSFangrui Song   return a - b;
765*207e5cccSFangrui Song }
766*207e5cccSFangrui Song 
767*207e5cccSFangrui Song // CHECK-LABEL: @sub_scalar_f64(
768*207e5cccSFangrui Song // CHECK-NEXT:  entry:
769*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 2 x double> poison, double [[B:%.*]], i64 0
770*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 2 x double> [[SPLAT_SPLATINSERT]], <vscale x 2 x double> poison, <vscale x 2 x i32> zeroinitializer
771*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = fsub <vscale x 2 x double> [[A:%.*]], [[SPLAT_SPLAT]]
772*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x double> [[SUB]]
773*207e5cccSFangrui Song //
774*207e5cccSFangrui Song svfloat64_t sub_scalar_f64(svfloat64_t a, double b) {
775*207e5cccSFangrui Song   return a - b;
776*207e5cccSFangrui Song }
777*207e5cccSFangrui Song 
778*207e5cccSFangrui Song // MULTIPLICATION
779*207e5cccSFangrui Song 
780*207e5cccSFangrui Song // CHECK-LABEL: @mul_i8(
781*207e5cccSFangrui Song // CHECK-NEXT:  entry:
782*207e5cccSFangrui Song // CHECK-NEXT:    [[MUL:%.*]] = mul <vscale x 16 x i8> [[A:%.*]], [[B:%.*]]
783*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[MUL]]
784*207e5cccSFangrui Song //
785*207e5cccSFangrui Song svint8_t mul_i8(svint8_t a, svint8_t b) {
786*207e5cccSFangrui Song   return a * b;
787*207e5cccSFangrui Song }
788*207e5cccSFangrui Song 
789*207e5cccSFangrui Song // CHECK-LABEL: @mul_i16(
790*207e5cccSFangrui Song // CHECK-NEXT:  entry:
791*207e5cccSFangrui Song // CHECK-NEXT:    [[MUL:%.*]] = mul <vscale x 8 x i16> [[A:%.*]], [[B:%.*]]
792*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[MUL]]
793*207e5cccSFangrui Song //
794*207e5cccSFangrui Song svint16_t mul_i16(svint16_t a, svint16_t b) {
795*207e5cccSFangrui Song   return a * b;
796*207e5cccSFangrui Song }
797*207e5cccSFangrui Song 
798*207e5cccSFangrui Song // CHECK-LABEL: @mul_i32(
799*207e5cccSFangrui Song // CHECK-NEXT:  entry:
800*207e5cccSFangrui Song // CHECK-NEXT:    [[MUL:%.*]] = mul <vscale x 4 x i32> [[A:%.*]], [[B:%.*]]
801*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[MUL]]
802*207e5cccSFangrui Song //
803*207e5cccSFangrui Song svint32_t mul_i32(svint32_t a, svint32_t b) {
804*207e5cccSFangrui Song   return a * b;
805*207e5cccSFangrui Song }
806*207e5cccSFangrui Song 
807*207e5cccSFangrui Song // CHECK-LABEL: @mul_i64(
808*207e5cccSFangrui Song // CHECK-NEXT:  entry:
809*207e5cccSFangrui Song // CHECK-NEXT:    [[MUL:%.*]] = mul <vscale x 2 x i64> [[A:%.*]], [[B:%.*]]
810*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[MUL]]
811*207e5cccSFangrui Song //
812*207e5cccSFangrui Song svint64_t mul_i64(svint64_t a, svint64_t b) {
813*207e5cccSFangrui Song   return a * b;
814*207e5cccSFangrui Song }
815*207e5cccSFangrui Song 
816*207e5cccSFangrui Song // CHECK-LABEL: @mul_u8(
817*207e5cccSFangrui Song // CHECK-NEXT:  entry:
818*207e5cccSFangrui Song // CHECK-NEXT:    [[MUL:%.*]] = mul <vscale x 16 x i8> [[A:%.*]], [[B:%.*]]
819*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[MUL]]
820*207e5cccSFangrui Song //
821*207e5cccSFangrui Song svuint8_t mul_u8(svuint8_t a, svuint8_t b) {
822*207e5cccSFangrui Song   return a * b;
823*207e5cccSFangrui Song }
824*207e5cccSFangrui Song 
825*207e5cccSFangrui Song // CHECK-LABEL: @mul_u16(
826*207e5cccSFangrui Song // CHECK-NEXT:  entry:
827*207e5cccSFangrui Song // CHECK-NEXT:    [[MUL:%.*]] = mul <vscale x 8 x i16> [[A:%.*]], [[B:%.*]]
828*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[MUL]]
829*207e5cccSFangrui Song //
830*207e5cccSFangrui Song svuint16_t mul_u16(svuint16_t a, svuint16_t b) {
831*207e5cccSFangrui Song   return a * b;
832*207e5cccSFangrui Song }
833*207e5cccSFangrui Song 
834*207e5cccSFangrui Song // CHECK-LABEL: @mul_u32(
835*207e5cccSFangrui Song // CHECK-NEXT:  entry:
836*207e5cccSFangrui Song // CHECK-NEXT:    [[MUL:%.*]] = mul <vscale x 4 x i32> [[A:%.*]], [[B:%.*]]
837*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[MUL]]
838*207e5cccSFangrui Song //
839*207e5cccSFangrui Song svuint32_t mul_u32(svuint32_t a, svuint32_t b) {
840*207e5cccSFangrui Song   return a * b;
841*207e5cccSFangrui Song }
842*207e5cccSFangrui Song 
843*207e5cccSFangrui Song // CHECK-LABEL: @mul_u64(
844*207e5cccSFangrui Song // CHECK-NEXT:  entry:
845*207e5cccSFangrui Song // CHECK-NEXT:    [[MUL:%.*]] = mul <vscale x 2 x i64> [[A:%.*]], [[B:%.*]]
846*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[MUL]]
847*207e5cccSFangrui Song //
848*207e5cccSFangrui Song svuint64_t mul_u64(svuint64_t a, svuint64_t b) {
849*207e5cccSFangrui Song   return a * b;
850*207e5cccSFangrui Song }
851*207e5cccSFangrui Song 
852*207e5cccSFangrui Song // CHECK-LABEL: @mul_f16(
853*207e5cccSFangrui Song // CHECK-NEXT:  entry:
854*207e5cccSFangrui Song // CHECK-NEXT:    [[MUL:%.*]] = fmul <vscale x 8 x half> [[A:%.*]], [[B:%.*]]
855*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x half> [[MUL]]
856*207e5cccSFangrui Song //
857*207e5cccSFangrui Song svfloat16_t mul_f16(svfloat16_t a, svfloat16_t b) {
858*207e5cccSFangrui Song   return a * b;
859*207e5cccSFangrui Song }
860*207e5cccSFangrui Song 
861*207e5cccSFangrui Song // CHECK-LABEL: @mul_f32(
862*207e5cccSFangrui Song // CHECK-NEXT:  entry:
863*207e5cccSFangrui Song // CHECK-NEXT:    [[MUL:%.*]] = fmul <vscale x 4 x float> [[A:%.*]], [[B:%.*]]
864*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x float> [[MUL]]
865*207e5cccSFangrui Song //
866*207e5cccSFangrui Song svfloat32_t mul_f32(svfloat32_t a, svfloat32_t b) {
867*207e5cccSFangrui Song   return a * b;
868*207e5cccSFangrui Song }
869*207e5cccSFangrui Song 
870*207e5cccSFangrui Song // CHECK-LABEL: @mul_f64(
871*207e5cccSFangrui Song // CHECK-NEXT:  entry:
872*207e5cccSFangrui Song // CHECK-NEXT:    [[MUL:%.*]] = fmul <vscale x 2 x double> [[A:%.*]], [[B:%.*]]
873*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x double> [[MUL]]
874*207e5cccSFangrui Song //
875*207e5cccSFangrui Song svfloat64_t mul_f64(svfloat64_t a, svfloat64_t b) {
876*207e5cccSFangrui Song   return a * b;
877*207e5cccSFangrui Song }
878*207e5cccSFangrui Song 
879*207e5cccSFangrui Song // CHECK-LABEL: @mul_inplace_i8(
880*207e5cccSFangrui Song // CHECK-NEXT:  entry:
881*207e5cccSFangrui Song // CHECK-NEXT:    [[MUL:%.*]] = mul <vscale x 16 x i8> [[A:%.*]], [[B:%.*]]
882*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[MUL]]
883*207e5cccSFangrui Song //
884*207e5cccSFangrui Song svint8_t mul_inplace_i8(svint8_t a, svint8_t b) {
885*207e5cccSFangrui Song   return a * b;
886*207e5cccSFangrui Song }
887*207e5cccSFangrui Song 
888*207e5cccSFangrui Song // CHECK-LABEL: @mul_inplace_i16(
889*207e5cccSFangrui Song // CHECK-NEXT:  entry:
890*207e5cccSFangrui Song // CHECK-NEXT:    [[MUL:%.*]] = mul <vscale x 8 x i16> [[A:%.*]], [[B:%.*]]
891*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[MUL]]
892*207e5cccSFangrui Song //
893*207e5cccSFangrui Song svint16_t mul_inplace_i16(svint16_t a, svint16_t b) {
894*207e5cccSFangrui Song   return a * b;
895*207e5cccSFangrui Song }
896*207e5cccSFangrui Song 
897*207e5cccSFangrui Song // CHECK-LABEL: @mul_inplace_i32(
898*207e5cccSFangrui Song // CHECK-NEXT:  entry:
899*207e5cccSFangrui Song // CHECK-NEXT:    [[MUL:%.*]] = mul <vscale x 4 x i32> [[A:%.*]], [[B:%.*]]
900*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[MUL]]
901*207e5cccSFangrui Song //
902*207e5cccSFangrui Song svint32_t mul_inplace_i32(svint32_t a, svint32_t b) {
903*207e5cccSFangrui Song   return a * b;
904*207e5cccSFangrui Song }
905*207e5cccSFangrui Song 
906*207e5cccSFangrui Song // CHECK-LABEL: @mul_inplace_i64(
907*207e5cccSFangrui Song // CHECK-NEXT:  entry:
908*207e5cccSFangrui Song // CHECK-NEXT:    [[MUL:%.*]] = mul <vscale x 2 x i64> [[A:%.*]], [[B:%.*]]
909*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[MUL]]
910*207e5cccSFangrui Song //
911*207e5cccSFangrui Song svint64_t mul_inplace_i64(svint64_t a, svint64_t b) {
912*207e5cccSFangrui Song   return a * b;
913*207e5cccSFangrui Song }
914*207e5cccSFangrui Song 
915*207e5cccSFangrui Song // CHECK-LABEL: @mul_inplace_u8(
916*207e5cccSFangrui Song // CHECK-NEXT:  entry:
917*207e5cccSFangrui Song // CHECK-NEXT:    [[MUL:%.*]] = mul <vscale x 16 x i8> [[A:%.*]], [[B:%.*]]
918*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[MUL]]
919*207e5cccSFangrui Song //
920*207e5cccSFangrui Song svuint8_t mul_inplace_u8(svuint8_t a, svuint8_t b) {
921*207e5cccSFangrui Song   return a * b;
922*207e5cccSFangrui Song }
923*207e5cccSFangrui Song 
924*207e5cccSFangrui Song // CHECK-LABEL: @mul_inplace_u16(
925*207e5cccSFangrui Song // CHECK-NEXT:  entry:
926*207e5cccSFangrui Song // CHECK-NEXT:    [[MUL:%.*]] = mul <vscale x 8 x i16> [[A:%.*]], [[B:%.*]]
927*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[MUL]]
928*207e5cccSFangrui Song //
929*207e5cccSFangrui Song svuint16_t mul_inplace_u16(svuint16_t a, svuint16_t b) {
930*207e5cccSFangrui Song   return a * b;
931*207e5cccSFangrui Song }
932*207e5cccSFangrui Song 
933*207e5cccSFangrui Song // CHECK-LABEL: @mul_inplace_u32(
934*207e5cccSFangrui Song // CHECK-NEXT:  entry:
935*207e5cccSFangrui Song // CHECK-NEXT:    [[MUL:%.*]] = mul <vscale x 4 x i32> [[A:%.*]], [[B:%.*]]
936*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[MUL]]
937*207e5cccSFangrui Song //
938*207e5cccSFangrui Song svuint32_t mul_inplace_u32(svuint32_t a, svuint32_t b) {
939*207e5cccSFangrui Song   return a * b;
940*207e5cccSFangrui Song }
941*207e5cccSFangrui Song 
942*207e5cccSFangrui Song // CHECK-LABEL: @mul_inplace_u64(
943*207e5cccSFangrui Song // CHECK-NEXT:  entry:
944*207e5cccSFangrui Song // CHECK-NEXT:    [[MUL:%.*]] = mul <vscale x 2 x i64> [[A:%.*]], [[B:%.*]]
945*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[MUL]]
946*207e5cccSFangrui Song //
947*207e5cccSFangrui Song svuint64_t mul_inplace_u64(svuint64_t a, svuint64_t b) {
948*207e5cccSFangrui Song   return a * b;
949*207e5cccSFangrui Song }
950*207e5cccSFangrui Song 
951*207e5cccSFangrui Song // CHECK-LABEL: @mul_inplace_f16(
952*207e5cccSFangrui Song // CHECK-NEXT:  entry:
953*207e5cccSFangrui Song // CHECK-NEXT:    [[MUL:%.*]] = fmul <vscale x 8 x half> [[A:%.*]], [[B:%.*]]
954*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x half> [[MUL]]
955*207e5cccSFangrui Song //
956*207e5cccSFangrui Song svfloat16_t mul_inplace_f16(svfloat16_t a, svfloat16_t b) {
957*207e5cccSFangrui Song   return a * b;
958*207e5cccSFangrui Song }
959*207e5cccSFangrui Song 
960*207e5cccSFangrui Song // CHECK-LABEL: @mul_inplace_f32(
961*207e5cccSFangrui Song // CHECK-NEXT:  entry:
962*207e5cccSFangrui Song // CHECK-NEXT:    [[MUL:%.*]] = fmul <vscale x 4 x float> [[A:%.*]], [[B:%.*]]
963*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x float> [[MUL]]
964*207e5cccSFangrui Song //
965*207e5cccSFangrui Song svfloat32_t mul_inplace_f32(svfloat32_t a, svfloat32_t b) {
966*207e5cccSFangrui Song   return a * b;
967*207e5cccSFangrui Song }
968*207e5cccSFangrui Song 
969*207e5cccSFangrui Song // CHECK-LABEL: @mul_inplace_f64(
970*207e5cccSFangrui Song // CHECK-NEXT:  entry:
971*207e5cccSFangrui Song // CHECK-NEXT:    [[MUL:%.*]] = fmul <vscale x 2 x double> [[A:%.*]], [[B:%.*]]
972*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x double> [[MUL]]
973*207e5cccSFangrui Song //
974*207e5cccSFangrui Song svfloat64_t mul_inplace_f64(svfloat64_t a, svfloat64_t b) {
975*207e5cccSFangrui Song   return a * b;
976*207e5cccSFangrui Song }
977*207e5cccSFangrui Song 
978*207e5cccSFangrui Song // CHECK-LABEL: @mul_scalar_i8(
979*207e5cccSFangrui Song // CHECK-NEXT:  entry:
980*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 16 x i8> poison, i8 [[B:%.*]], i64 0
981*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 16 x i8> [[SPLAT_SPLATINSERT]], <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
982*207e5cccSFangrui Song // CHECK-NEXT:    [[MUL:%.*]] = mul <vscale x 16 x i8> [[A:%.*]], [[SPLAT_SPLAT]]
983*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[MUL]]
984*207e5cccSFangrui Song //
985*207e5cccSFangrui Song svint8_t mul_scalar_i8(svint8_t a, int8_t b) {
986*207e5cccSFangrui Song   return a * b;
987*207e5cccSFangrui Song }
988*207e5cccSFangrui Song 
989*207e5cccSFangrui Song // CHECK-LABEL: @mul_scalar_i16(
990*207e5cccSFangrui Song // CHECK-NEXT:  entry:
991*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 8 x i16> poison, i16 [[B:%.*]], i64 0
992*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 8 x i16> [[SPLAT_SPLATINSERT]], <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
993*207e5cccSFangrui Song // CHECK-NEXT:    [[MUL:%.*]] = mul <vscale x 8 x i16> [[A:%.*]], [[SPLAT_SPLAT]]
994*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[MUL]]
995*207e5cccSFangrui Song //
996*207e5cccSFangrui Song svint16_t mul_scalar_i16(svint16_t a, int16_t b) {
997*207e5cccSFangrui Song   return a * b;
998*207e5cccSFangrui Song }
999*207e5cccSFangrui Song 
1000*207e5cccSFangrui Song // CHECK-LABEL: @mul_scalar_i32(
1001*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1002*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[B:%.*]], i64 0
1003*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 4 x i32> [[SPLAT_SPLATINSERT]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
1004*207e5cccSFangrui Song // CHECK-NEXT:    [[MUL:%.*]] = mul <vscale x 4 x i32> [[A:%.*]], [[SPLAT_SPLAT]]
1005*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[MUL]]
1006*207e5cccSFangrui Song //
1007*207e5cccSFangrui Song svint32_t mul_scalar_i32(svint32_t a, int32_t b) {
1008*207e5cccSFangrui Song   return a * b;
1009*207e5cccSFangrui Song }
1010*207e5cccSFangrui Song 
1011*207e5cccSFangrui Song // CHECK-LABEL: @mul_scalar_i64(
1012*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1013*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 2 x i64> poison, i64 [[B:%.*]], i64 0
1014*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 2 x i64> [[SPLAT_SPLATINSERT]], <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
1015*207e5cccSFangrui Song // CHECK-NEXT:    [[MUL:%.*]] = mul <vscale x 2 x i64> [[A:%.*]], [[SPLAT_SPLAT]]
1016*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[MUL]]
1017*207e5cccSFangrui Song //
1018*207e5cccSFangrui Song svint64_t mul_scalar_i64(svint64_t a, int64_t b) {
1019*207e5cccSFangrui Song   return a * b;
1020*207e5cccSFangrui Song }
1021*207e5cccSFangrui Song 
1022*207e5cccSFangrui Song // CHECK-LABEL: @mul_scalar_u8(
1023*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1024*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 16 x i8> poison, i8 [[B:%.*]], i64 0
1025*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 16 x i8> [[SPLAT_SPLATINSERT]], <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
1026*207e5cccSFangrui Song // CHECK-NEXT:    [[MUL:%.*]] = mul <vscale x 16 x i8> [[A:%.*]], [[SPLAT_SPLAT]]
1027*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[MUL]]
1028*207e5cccSFangrui Song //
1029*207e5cccSFangrui Song svuint8_t mul_scalar_u8(svuint8_t a, uint8_t b) {
1030*207e5cccSFangrui Song   return a * b;
1031*207e5cccSFangrui Song }
1032*207e5cccSFangrui Song 
1033*207e5cccSFangrui Song // CHECK-LABEL: @mul_scalar_u16(
1034*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1035*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 8 x i16> poison, i16 [[B:%.*]], i64 0
1036*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 8 x i16> [[SPLAT_SPLATINSERT]], <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
1037*207e5cccSFangrui Song // CHECK-NEXT:    [[MUL:%.*]] = mul <vscale x 8 x i16> [[A:%.*]], [[SPLAT_SPLAT]]
1038*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[MUL]]
1039*207e5cccSFangrui Song //
1040*207e5cccSFangrui Song svuint16_t mul_scalar_u16(svuint16_t a, uint16_t b) {
1041*207e5cccSFangrui Song   return a * b;
1042*207e5cccSFangrui Song }
1043*207e5cccSFangrui Song 
1044*207e5cccSFangrui Song // CHECK-LABEL: @mul_scalar_u32(
1045*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1046*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[B:%.*]], i64 0
1047*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 4 x i32> [[SPLAT_SPLATINSERT]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
1048*207e5cccSFangrui Song // CHECK-NEXT:    [[MUL:%.*]] = mul <vscale x 4 x i32> [[A:%.*]], [[SPLAT_SPLAT]]
1049*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[MUL]]
1050*207e5cccSFangrui Song //
1051*207e5cccSFangrui Song svuint32_t mul_scalar_u32(svuint32_t a, uint32_t b) {
1052*207e5cccSFangrui Song   return a * b;
1053*207e5cccSFangrui Song }
1054*207e5cccSFangrui Song 
1055*207e5cccSFangrui Song // CHECK-LABEL: @mul_scalar_u64(
1056*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1057*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 2 x i64> poison, i64 [[B:%.*]], i64 0
1058*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 2 x i64> [[SPLAT_SPLATINSERT]], <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
1059*207e5cccSFangrui Song // CHECK-NEXT:    [[MUL:%.*]] = mul <vscale x 2 x i64> [[A:%.*]], [[SPLAT_SPLAT]]
1060*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[MUL]]
1061*207e5cccSFangrui Song //
1062*207e5cccSFangrui Song svuint64_t mul_scalar_u64(svuint64_t a, uint64_t b) {
1063*207e5cccSFangrui Song   return a * b;
1064*207e5cccSFangrui Song }
1065*207e5cccSFangrui Song 
1066*207e5cccSFangrui Song // CHECK-LABEL: @mul_scalar_f16(
1067*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1068*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 8 x half> poison, half [[B:%.*]], i64 0
1069*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 8 x half> [[SPLAT_SPLATINSERT]], <vscale x 8 x half> poison, <vscale x 8 x i32> zeroinitializer
1070*207e5cccSFangrui Song // CHECK-NEXT:    [[MUL:%.*]] = fmul <vscale x 8 x half> [[A:%.*]], [[SPLAT_SPLAT]]
1071*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x half> [[MUL]]
1072*207e5cccSFangrui Song //
1073*207e5cccSFangrui Song svfloat16_t mul_scalar_f16(svfloat16_t a, __fp16 b) {
1074*207e5cccSFangrui Song   return a * b;
1075*207e5cccSFangrui Song }
1076*207e5cccSFangrui Song 
1077*207e5cccSFangrui Song // CHECK-LABEL: @mul_scalar_f32(
1078*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1079*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 4 x float> poison, float [[B:%.*]], i64 0
1080*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 4 x float> [[SPLAT_SPLATINSERT]], <vscale x 4 x float> poison, <vscale x 4 x i32> zeroinitializer
1081*207e5cccSFangrui Song // CHECK-NEXT:    [[MUL:%.*]] = fmul <vscale x 4 x float> [[A:%.*]], [[SPLAT_SPLAT]]
1082*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x float> [[MUL]]
1083*207e5cccSFangrui Song //
1084*207e5cccSFangrui Song svfloat32_t mul_scalar_f32(svfloat32_t a, float b) {
1085*207e5cccSFangrui Song   return a * b;
1086*207e5cccSFangrui Song }
1087*207e5cccSFangrui Song 
1088*207e5cccSFangrui Song // CHECK-LABEL: @mul_scalar_f64(
1089*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1090*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 2 x double> poison, double [[B:%.*]], i64 0
1091*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 2 x double> [[SPLAT_SPLATINSERT]], <vscale x 2 x double> poison, <vscale x 2 x i32> zeroinitializer
1092*207e5cccSFangrui Song // CHECK-NEXT:    [[MUL:%.*]] = fmul <vscale x 2 x double> [[A:%.*]], [[SPLAT_SPLAT]]
1093*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x double> [[MUL]]
1094*207e5cccSFangrui Song //
1095*207e5cccSFangrui Song svfloat64_t mul_scalar_f64(svfloat64_t a, double b) {
1096*207e5cccSFangrui Song   return a * b;
1097*207e5cccSFangrui Song }
1098*207e5cccSFangrui Song 
1099*207e5cccSFangrui Song // DIVISION
1100*207e5cccSFangrui Song 
1101*207e5cccSFangrui Song // CHECK-LABEL: @div_i8(
1102*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1103*207e5cccSFangrui Song // CHECK-NEXT:    [[DIV:%.*]] = sdiv <vscale x 16 x i8> [[A:%.*]], [[B:%.*]]
1104*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[DIV]]
1105*207e5cccSFangrui Song //
1106*207e5cccSFangrui Song svint8_t div_i8(svint8_t a, svint8_t b) {
1107*207e5cccSFangrui Song   return a / b;
1108*207e5cccSFangrui Song }
1109*207e5cccSFangrui Song 
1110*207e5cccSFangrui Song // CHECK-LABEL: @div_i16(
1111*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1112*207e5cccSFangrui Song // CHECK-NEXT:    [[DIV:%.*]] = sdiv <vscale x 8 x i16> [[A:%.*]], [[B:%.*]]
1113*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[DIV]]
1114*207e5cccSFangrui Song //
1115*207e5cccSFangrui Song svint16_t div_i16(svint16_t a, svint16_t b) {
1116*207e5cccSFangrui Song   return a / b;
1117*207e5cccSFangrui Song }
1118*207e5cccSFangrui Song 
1119*207e5cccSFangrui Song // CHECK-LABEL: @div_i32(
1120*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1121*207e5cccSFangrui Song // CHECK-NEXT:    [[DIV:%.*]] = sdiv <vscale x 4 x i32> [[A:%.*]], [[B:%.*]]
1122*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[DIV]]
1123*207e5cccSFangrui Song //
1124*207e5cccSFangrui Song svint32_t div_i32(svint32_t a, svint32_t b) {
1125*207e5cccSFangrui Song   return a / b;
1126*207e5cccSFangrui Song }
1127*207e5cccSFangrui Song 
1128*207e5cccSFangrui Song // CHECK-LABEL: @div_i64(
1129*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1130*207e5cccSFangrui Song // CHECK-NEXT:    [[DIV:%.*]] = sdiv <vscale x 2 x i64> [[A:%.*]], [[B:%.*]]
1131*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[DIV]]
1132*207e5cccSFangrui Song //
1133*207e5cccSFangrui Song svint64_t div_i64(svint64_t a, svint64_t b) {
1134*207e5cccSFangrui Song   return a / b;
1135*207e5cccSFangrui Song }
1136*207e5cccSFangrui Song 
1137*207e5cccSFangrui Song // CHECK-LABEL: @div_u8(
1138*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1139*207e5cccSFangrui Song // CHECK-NEXT:    [[DIV:%.*]] = udiv <vscale x 16 x i8> [[A:%.*]], [[B:%.*]]
1140*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[DIV]]
1141*207e5cccSFangrui Song //
1142*207e5cccSFangrui Song svuint8_t div_u8(svuint8_t a, svuint8_t b) {
1143*207e5cccSFangrui Song   return a / b;
1144*207e5cccSFangrui Song }
1145*207e5cccSFangrui Song 
1146*207e5cccSFangrui Song // CHECK-LABEL: @div_u16(
1147*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1148*207e5cccSFangrui Song // CHECK-NEXT:    [[DIV:%.*]] = udiv <vscale x 8 x i16> [[A:%.*]], [[B:%.*]]
1149*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[DIV]]
1150*207e5cccSFangrui Song //
1151*207e5cccSFangrui Song svuint16_t div_u16(svuint16_t a, svuint16_t b) {
1152*207e5cccSFangrui Song   return a / b;
1153*207e5cccSFangrui Song }
1154*207e5cccSFangrui Song 
1155*207e5cccSFangrui Song // CHECK-LABEL: @div_u32(
1156*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1157*207e5cccSFangrui Song // CHECK-NEXT:    [[DIV:%.*]] = udiv <vscale x 4 x i32> [[A:%.*]], [[B:%.*]]
1158*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[DIV]]
1159*207e5cccSFangrui Song //
1160*207e5cccSFangrui Song svuint32_t div_u32(svuint32_t a, svuint32_t b) {
1161*207e5cccSFangrui Song   return a / b;
1162*207e5cccSFangrui Song }
1163*207e5cccSFangrui Song 
1164*207e5cccSFangrui Song // CHECK-LABEL: @div_u64(
1165*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1166*207e5cccSFangrui Song // CHECK-NEXT:    [[DIV:%.*]] = udiv <vscale x 2 x i64> [[A:%.*]], [[B:%.*]]
1167*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[DIV]]
1168*207e5cccSFangrui Song //
1169*207e5cccSFangrui Song svuint64_t div_u64(svuint64_t a, svuint64_t b) {
1170*207e5cccSFangrui Song   return a / b;
1171*207e5cccSFangrui Song }
1172*207e5cccSFangrui Song 
1173*207e5cccSFangrui Song // CHECK-LABEL: @div_f16(
1174*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1175*207e5cccSFangrui Song // CHECK-NEXT:    [[DIV:%.*]] = fdiv <vscale x 8 x half> [[A:%.*]], [[B:%.*]]
1176*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x half> [[DIV]]
1177*207e5cccSFangrui Song //
1178*207e5cccSFangrui Song svfloat16_t div_f16(svfloat16_t a, svfloat16_t b) {
1179*207e5cccSFangrui Song   return a / b;
1180*207e5cccSFangrui Song }
1181*207e5cccSFangrui Song 
1182*207e5cccSFangrui Song // CHECK-LABEL: @div_f32(
1183*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1184*207e5cccSFangrui Song // CHECK-NEXT:    [[DIV:%.*]] = fdiv <vscale x 4 x float> [[A:%.*]], [[B:%.*]]
1185*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x float> [[DIV]]
1186*207e5cccSFangrui Song //
1187*207e5cccSFangrui Song svfloat32_t div_f32(svfloat32_t a, svfloat32_t b) {
1188*207e5cccSFangrui Song   return a / b;
1189*207e5cccSFangrui Song }
1190*207e5cccSFangrui Song 
1191*207e5cccSFangrui Song // CHECK-LABEL: @div_f64(
1192*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1193*207e5cccSFangrui Song // CHECK-NEXT:    [[DIV:%.*]] = fdiv <vscale x 2 x double> [[A:%.*]], [[B:%.*]]
1194*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x double> [[DIV]]
1195*207e5cccSFangrui Song //
1196*207e5cccSFangrui Song svfloat64_t div_f64(svfloat64_t a, svfloat64_t b) {
1197*207e5cccSFangrui Song   return a / b;
1198*207e5cccSFangrui Song }
1199*207e5cccSFangrui Song 
1200*207e5cccSFangrui Song // CHECK-LABEL: @div_inplace_i8(
1201*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1202*207e5cccSFangrui Song // CHECK-NEXT:    [[DIV:%.*]] = sdiv <vscale x 16 x i8> [[A:%.*]], [[B:%.*]]
1203*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[DIV]]
1204*207e5cccSFangrui Song //
1205*207e5cccSFangrui Song svint8_t div_inplace_i8(svint8_t a, svint8_t b) {
1206*207e5cccSFangrui Song   return a / b;
1207*207e5cccSFangrui Song }
1208*207e5cccSFangrui Song 
1209*207e5cccSFangrui Song // CHECK-LABEL: @div_inplace_i16(
1210*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1211*207e5cccSFangrui Song // CHECK-NEXT:    [[DIV:%.*]] = sdiv <vscale x 8 x i16> [[A:%.*]], [[B:%.*]]
1212*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[DIV]]
1213*207e5cccSFangrui Song //
1214*207e5cccSFangrui Song svint16_t div_inplace_i16(svint16_t a, svint16_t b) {
1215*207e5cccSFangrui Song   return a / b;
1216*207e5cccSFangrui Song }
1217*207e5cccSFangrui Song 
1218*207e5cccSFangrui Song // CHECK-LABEL: @div_inplace_i32(
1219*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1220*207e5cccSFangrui Song // CHECK-NEXT:    [[DIV:%.*]] = sdiv <vscale x 4 x i32> [[A:%.*]], [[B:%.*]]
1221*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[DIV]]
1222*207e5cccSFangrui Song //
1223*207e5cccSFangrui Song svint32_t div_inplace_i32(svint32_t a, svint32_t b) {
1224*207e5cccSFangrui Song   return a / b;
1225*207e5cccSFangrui Song }
1226*207e5cccSFangrui Song 
1227*207e5cccSFangrui Song // CHECK-LABEL: @div_inplace_i64(
1228*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1229*207e5cccSFangrui Song // CHECK-NEXT:    [[DIV:%.*]] = sdiv <vscale x 2 x i64> [[A:%.*]], [[B:%.*]]
1230*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[DIV]]
1231*207e5cccSFangrui Song //
1232*207e5cccSFangrui Song svint64_t div_inplace_i64(svint64_t a, svint64_t b) {
1233*207e5cccSFangrui Song   return a / b;
1234*207e5cccSFangrui Song }
1235*207e5cccSFangrui Song 
1236*207e5cccSFangrui Song // CHECK-LABEL: @div_inplace_u8(
1237*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1238*207e5cccSFangrui Song // CHECK-NEXT:    [[DIV:%.*]] = udiv <vscale x 16 x i8> [[A:%.*]], [[B:%.*]]
1239*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[DIV]]
1240*207e5cccSFangrui Song //
1241*207e5cccSFangrui Song svuint8_t div_inplace_u8(svuint8_t a, svuint8_t b) {
1242*207e5cccSFangrui Song   return a / b;
1243*207e5cccSFangrui Song }
1244*207e5cccSFangrui Song 
1245*207e5cccSFangrui Song // CHECK-LABEL: @div_inplace_u16(
1246*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1247*207e5cccSFangrui Song // CHECK-NEXT:    [[DIV:%.*]] = udiv <vscale x 8 x i16> [[A:%.*]], [[B:%.*]]
1248*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[DIV]]
1249*207e5cccSFangrui Song //
1250*207e5cccSFangrui Song svuint16_t div_inplace_u16(svuint16_t a, svuint16_t b) {
1251*207e5cccSFangrui Song   return a / b;
1252*207e5cccSFangrui Song }
1253*207e5cccSFangrui Song 
1254*207e5cccSFangrui Song // CHECK-LABEL: @div_inplace_u32(
1255*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1256*207e5cccSFangrui Song // CHECK-NEXT:    [[DIV:%.*]] = udiv <vscale x 4 x i32> [[A:%.*]], [[B:%.*]]
1257*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[DIV]]
1258*207e5cccSFangrui Song //
1259*207e5cccSFangrui Song svuint32_t div_inplace_u32(svuint32_t a, svuint32_t b) {
1260*207e5cccSFangrui Song   return a / b;
1261*207e5cccSFangrui Song }
1262*207e5cccSFangrui Song 
1263*207e5cccSFangrui Song // CHECK-LABEL: @div_inplace_u64(
1264*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1265*207e5cccSFangrui Song // CHECK-NEXT:    [[DIV:%.*]] = udiv <vscale x 2 x i64> [[A:%.*]], [[B:%.*]]
1266*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[DIV]]
1267*207e5cccSFangrui Song //
1268*207e5cccSFangrui Song svuint64_t div_inplace_u64(svuint64_t a, svuint64_t b) {
1269*207e5cccSFangrui Song   return a / b;
1270*207e5cccSFangrui Song }
1271*207e5cccSFangrui Song 
1272*207e5cccSFangrui Song // CHECK-LABEL: @div_inplace_f16(
1273*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1274*207e5cccSFangrui Song // CHECK-NEXT:    [[DIV:%.*]] = fdiv <vscale x 8 x half> [[A:%.*]], [[B:%.*]]
1275*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x half> [[DIV]]
1276*207e5cccSFangrui Song //
1277*207e5cccSFangrui Song svfloat16_t div_inplace_f16(svfloat16_t a, svfloat16_t b) {
1278*207e5cccSFangrui Song   return a / b;
1279*207e5cccSFangrui Song }
1280*207e5cccSFangrui Song 
1281*207e5cccSFangrui Song // CHECK-LABEL: @div_inplace_f32(
1282*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1283*207e5cccSFangrui Song // CHECK-NEXT:    [[DIV:%.*]] = fdiv <vscale x 4 x float> [[A:%.*]], [[B:%.*]]
1284*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x float> [[DIV]]
1285*207e5cccSFangrui Song //
1286*207e5cccSFangrui Song svfloat32_t div_inplace_f32(svfloat32_t a, svfloat32_t b) {
1287*207e5cccSFangrui Song   return a / b;
1288*207e5cccSFangrui Song }
1289*207e5cccSFangrui Song 
1290*207e5cccSFangrui Song // CHECK-LABEL: @div_inplace_f64(
1291*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1292*207e5cccSFangrui Song // CHECK-NEXT:    [[DIV:%.*]] = fdiv <vscale x 2 x double> [[A:%.*]], [[B:%.*]]
1293*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x double> [[DIV]]
1294*207e5cccSFangrui Song //
1295*207e5cccSFangrui Song svfloat64_t div_inplace_f64(svfloat64_t a, svfloat64_t b) {
1296*207e5cccSFangrui Song   return a / b;
1297*207e5cccSFangrui Song }
1298*207e5cccSFangrui Song 
1299*207e5cccSFangrui Song // CHECK-LABEL: @div_scalar_i8(
1300*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1301*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 16 x i8> poison, i8 [[B:%.*]], i64 0
1302*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 16 x i8> [[SPLAT_SPLATINSERT]], <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
1303*207e5cccSFangrui Song // CHECK-NEXT:    [[DIV:%.*]] = sdiv <vscale x 16 x i8> [[A:%.*]], [[SPLAT_SPLAT]]
1304*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[DIV]]
1305*207e5cccSFangrui Song //
1306*207e5cccSFangrui Song svint8_t div_scalar_i8(svint8_t a, int8_t b) {
1307*207e5cccSFangrui Song   return a / b;
1308*207e5cccSFangrui Song }
1309*207e5cccSFangrui Song 
1310*207e5cccSFangrui Song // CHECK-LABEL: @div_scalar_i16(
1311*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1312*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 8 x i16> poison, i16 [[B:%.*]], i64 0
1313*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 8 x i16> [[SPLAT_SPLATINSERT]], <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
1314*207e5cccSFangrui Song // CHECK-NEXT:    [[DIV:%.*]] = sdiv <vscale x 8 x i16> [[A:%.*]], [[SPLAT_SPLAT]]
1315*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[DIV]]
1316*207e5cccSFangrui Song //
1317*207e5cccSFangrui Song svint16_t div_scalar_i16(svint16_t a, int16_t b) {
1318*207e5cccSFangrui Song   return a / b;
1319*207e5cccSFangrui Song }
1320*207e5cccSFangrui Song 
1321*207e5cccSFangrui Song // CHECK-LABEL: @div_scalar_i32(
1322*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1323*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[B:%.*]], i64 0
1324*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 4 x i32> [[SPLAT_SPLATINSERT]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
1325*207e5cccSFangrui Song // CHECK-NEXT:    [[DIV:%.*]] = sdiv <vscale x 4 x i32> [[A:%.*]], [[SPLAT_SPLAT]]
1326*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[DIV]]
1327*207e5cccSFangrui Song //
1328*207e5cccSFangrui Song svint32_t div_scalar_i32(svint32_t a, int32_t b) {
1329*207e5cccSFangrui Song   return a / b;
1330*207e5cccSFangrui Song }
1331*207e5cccSFangrui Song 
1332*207e5cccSFangrui Song // CHECK-LABEL: @div_scalar_i64(
1333*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1334*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 2 x i64> poison, i64 [[B:%.*]], i64 0
1335*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 2 x i64> [[SPLAT_SPLATINSERT]], <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
1336*207e5cccSFangrui Song // CHECK-NEXT:    [[DIV:%.*]] = sdiv <vscale x 2 x i64> [[A:%.*]], [[SPLAT_SPLAT]]
1337*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[DIV]]
1338*207e5cccSFangrui Song //
1339*207e5cccSFangrui Song svint64_t div_scalar_i64(svint64_t a, int64_t b) {
1340*207e5cccSFangrui Song   return a / b;
1341*207e5cccSFangrui Song }
1342*207e5cccSFangrui Song 
1343*207e5cccSFangrui Song // CHECK-LABEL: @div_scalar_u8(
1344*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1345*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 16 x i8> poison, i8 [[B:%.*]], i64 0
1346*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 16 x i8> [[SPLAT_SPLATINSERT]], <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
1347*207e5cccSFangrui Song // CHECK-NEXT:    [[DIV:%.*]] = udiv <vscale x 16 x i8> [[A:%.*]], [[SPLAT_SPLAT]]
1348*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[DIV]]
1349*207e5cccSFangrui Song //
1350*207e5cccSFangrui Song svuint8_t div_scalar_u8(svuint8_t a, uint8_t b) {
1351*207e5cccSFangrui Song   return a / b;
1352*207e5cccSFangrui Song }
1353*207e5cccSFangrui Song 
1354*207e5cccSFangrui Song // CHECK-LABEL: @div_scalar_u16(
1355*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1356*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 8 x i16> poison, i16 [[B:%.*]], i64 0
1357*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 8 x i16> [[SPLAT_SPLATINSERT]], <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
1358*207e5cccSFangrui Song // CHECK-NEXT:    [[DIV:%.*]] = udiv <vscale x 8 x i16> [[A:%.*]], [[SPLAT_SPLAT]]
1359*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[DIV]]
1360*207e5cccSFangrui Song //
1361*207e5cccSFangrui Song svuint16_t div_scalar_u16(svuint16_t a, uint16_t b) {
1362*207e5cccSFangrui Song   return a / b;
1363*207e5cccSFangrui Song }
1364*207e5cccSFangrui Song 
1365*207e5cccSFangrui Song // CHECK-LABEL: @div_scalar_u32(
1366*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1367*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[B:%.*]], i64 0
1368*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 4 x i32> [[SPLAT_SPLATINSERT]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
1369*207e5cccSFangrui Song // CHECK-NEXT:    [[DIV:%.*]] = udiv <vscale x 4 x i32> [[A:%.*]], [[SPLAT_SPLAT]]
1370*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[DIV]]
1371*207e5cccSFangrui Song //
1372*207e5cccSFangrui Song svuint32_t div_scalar_u32(svuint32_t a, uint32_t b) {
1373*207e5cccSFangrui Song   return a / b;
1374*207e5cccSFangrui Song }
1375*207e5cccSFangrui Song 
1376*207e5cccSFangrui Song // CHECK-LABEL: @div_scalar_u64(
1377*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1378*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 2 x i64> poison, i64 [[B:%.*]], i64 0
1379*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 2 x i64> [[SPLAT_SPLATINSERT]], <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
1380*207e5cccSFangrui Song // CHECK-NEXT:    [[DIV:%.*]] = udiv <vscale x 2 x i64> [[A:%.*]], [[SPLAT_SPLAT]]
1381*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[DIV]]
1382*207e5cccSFangrui Song //
1383*207e5cccSFangrui Song svuint64_t div_scalar_u64(svuint64_t a, uint64_t b) {
1384*207e5cccSFangrui Song   return a / b;
1385*207e5cccSFangrui Song }
1386*207e5cccSFangrui Song 
1387*207e5cccSFangrui Song // CHECK-LABEL: @div_scalar_f16(
1388*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1389*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 8 x half> poison, half [[B:%.*]], i64 0
1390*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 8 x half> [[SPLAT_SPLATINSERT]], <vscale x 8 x half> poison, <vscale x 8 x i32> zeroinitializer
1391*207e5cccSFangrui Song // CHECK-NEXT:    [[DIV:%.*]] = fdiv <vscale x 8 x half> [[A:%.*]], [[SPLAT_SPLAT]]
1392*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x half> [[DIV]]
1393*207e5cccSFangrui Song //
1394*207e5cccSFangrui Song svfloat16_t div_scalar_f16(svfloat16_t a, __fp16 b) {
1395*207e5cccSFangrui Song   return a / b;
1396*207e5cccSFangrui Song }
1397*207e5cccSFangrui Song 
1398*207e5cccSFangrui Song // CHECK-LABEL: @div_scalar_f32(
1399*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1400*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 4 x float> poison, float [[B:%.*]], i64 0
1401*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 4 x float> [[SPLAT_SPLATINSERT]], <vscale x 4 x float> poison, <vscale x 4 x i32> zeroinitializer
1402*207e5cccSFangrui Song // CHECK-NEXT:    [[DIV:%.*]] = fdiv <vscale x 4 x float> [[A:%.*]], [[SPLAT_SPLAT]]
1403*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x float> [[DIV]]
1404*207e5cccSFangrui Song //
1405*207e5cccSFangrui Song svfloat32_t div_scalar_f32(svfloat32_t a, float b) {
1406*207e5cccSFangrui Song   return a / b;
1407*207e5cccSFangrui Song }
1408*207e5cccSFangrui Song 
1409*207e5cccSFangrui Song // CHECK-LABEL: @div_scalar_f64(
1410*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1411*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 2 x double> poison, double [[B:%.*]], i64 0
1412*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 2 x double> [[SPLAT_SPLATINSERT]], <vscale x 2 x double> poison, <vscale x 2 x i32> zeroinitializer
1413*207e5cccSFangrui Song // CHECK-NEXT:    [[DIV:%.*]] = fdiv <vscale x 2 x double> [[A:%.*]], [[SPLAT_SPLAT]]
1414*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x double> [[DIV]]
1415*207e5cccSFangrui Song //
1416*207e5cccSFangrui Song svfloat64_t div_scalar_f64(svfloat64_t a, double b) {
1417*207e5cccSFangrui Song   return a / b;
1418*207e5cccSFangrui Song }
1419*207e5cccSFangrui Song 
1420*207e5cccSFangrui Song // REMAINDER
1421*207e5cccSFangrui Song 
1422*207e5cccSFangrui Song // CHECK-LABEL: @rem_i8(
1423*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1424*207e5cccSFangrui Song // CHECK-NEXT:    [[REM:%.*]] = srem <vscale x 16 x i8> [[A:%.*]], [[B:%.*]]
1425*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[REM]]
1426*207e5cccSFangrui Song //
1427*207e5cccSFangrui Song svint8_t rem_i8(svint8_t a, svint8_t b) {
1428*207e5cccSFangrui Song   return a % b;
1429*207e5cccSFangrui Song }
1430*207e5cccSFangrui Song 
1431*207e5cccSFangrui Song // CHECK-LABEL: @rem_i16(
1432*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1433*207e5cccSFangrui Song // CHECK-NEXT:    [[REM:%.*]] = srem <vscale x 8 x i16> [[A:%.*]], [[B:%.*]]
1434*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[REM]]
1435*207e5cccSFangrui Song //
1436*207e5cccSFangrui Song svint16_t rem_i16(svint16_t a, svint16_t b) {
1437*207e5cccSFangrui Song   return a % b;
1438*207e5cccSFangrui Song }
1439*207e5cccSFangrui Song 
1440*207e5cccSFangrui Song // CHECK-LABEL: @rem_i32(
1441*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1442*207e5cccSFangrui Song // CHECK-NEXT:    [[REM:%.*]] = srem <vscale x 4 x i32> [[A:%.*]], [[B:%.*]]
1443*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[REM]]
1444*207e5cccSFangrui Song //
1445*207e5cccSFangrui Song svint32_t rem_i32(svint32_t a, svint32_t b) {
1446*207e5cccSFangrui Song   return a % b;
1447*207e5cccSFangrui Song }
1448*207e5cccSFangrui Song 
1449*207e5cccSFangrui Song // CHECK-LABEL: @rem_i64(
1450*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1451*207e5cccSFangrui Song // CHECK-NEXT:    [[REM:%.*]] = srem <vscale x 2 x i64> [[A:%.*]], [[B:%.*]]
1452*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[REM]]
1453*207e5cccSFangrui Song //
1454*207e5cccSFangrui Song svint64_t rem_i64(svint64_t a, svint64_t b) {
1455*207e5cccSFangrui Song   return a % b;
1456*207e5cccSFangrui Song }
1457*207e5cccSFangrui Song 
1458*207e5cccSFangrui Song // CHECK-LABEL: @rem_u8(
1459*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1460*207e5cccSFangrui Song // CHECK-NEXT:    [[REM:%.*]] = urem <vscale x 16 x i8> [[A:%.*]], [[B:%.*]]
1461*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[REM]]
1462*207e5cccSFangrui Song //
1463*207e5cccSFangrui Song svuint8_t rem_u8(svuint8_t a, svuint8_t b) {
1464*207e5cccSFangrui Song   return a % b;
1465*207e5cccSFangrui Song }
1466*207e5cccSFangrui Song 
1467*207e5cccSFangrui Song // CHECK-LABEL: @rem_u16(
1468*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1469*207e5cccSFangrui Song // CHECK-NEXT:    [[REM:%.*]] = urem <vscale x 8 x i16> [[A:%.*]], [[B:%.*]]
1470*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[REM]]
1471*207e5cccSFangrui Song //
1472*207e5cccSFangrui Song svuint16_t rem_u16(svuint16_t a, svuint16_t b) {
1473*207e5cccSFangrui Song   return a % b;
1474*207e5cccSFangrui Song }
1475*207e5cccSFangrui Song 
1476*207e5cccSFangrui Song // CHECK-LABEL: @rem_u32(
1477*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1478*207e5cccSFangrui Song // CHECK-NEXT:    [[REM:%.*]] = urem <vscale x 4 x i32> [[A:%.*]], [[B:%.*]]
1479*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[REM]]
1480*207e5cccSFangrui Song //
1481*207e5cccSFangrui Song svuint32_t rem_u32(svuint32_t a, svuint32_t b) {
1482*207e5cccSFangrui Song   return a % b;
1483*207e5cccSFangrui Song }
1484*207e5cccSFangrui Song 
1485*207e5cccSFangrui Song // CHECK-LABEL: @rem_u64(
1486*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1487*207e5cccSFangrui Song // CHECK-NEXT:    [[REM:%.*]] = urem <vscale x 2 x i64> [[A:%.*]], [[B:%.*]]
1488*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[REM]]
1489*207e5cccSFangrui Song //
1490*207e5cccSFangrui Song svuint64_t rem_u64(svuint64_t a, svuint64_t b) {
1491*207e5cccSFangrui Song   return a % b;
1492*207e5cccSFangrui Song }
1493*207e5cccSFangrui Song 
1494*207e5cccSFangrui Song // CHECK-LABEL: @rem_inplace_i8(
1495*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1496*207e5cccSFangrui Song // CHECK-NEXT:    [[REM:%.*]] = srem <vscale x 16 x i8> [[A:%.*]], [[B:%.*]]
1497*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[REM]]
1498*207e5cccSFangrui Song //
1499*207e5cccSFangrui Song svint8_t rem_inplace_i8(svint8_t a, svint8_t b) {
1500*207e5cccSFangrui Song   return a % b;
1501*207e5cccSFangrui Song }
1502*207e5cccSFangrui Song 
1503*207e5cccSFangrui Song // CHECK-LABEL: @rem_inplace_i16(
1504*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1505*207e5cccSFangrui Song // CHECK-NEXT:    [[REM:%.*]] = srem <vscale x 8 x i16> [[A:%.*]], [[B:%.*]]
1506*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[REM]]
1507*207e5cccSFangrui Song //
1508*207e5cccSFangrui Song svint16_t rem_inplace_i16(svint16_t a, svint16_t b) {
1509*207e5cccSFangrui Song   return a % b;
1510*207e5cccSFangrui Song }
1511*207e5cccSFangrui Song 
1512*207e5cccSFangrui Song // CHECK-LABEL: @rem_inplace_i32(
1513*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1514*207e5cccSFangrui Song // CHECK-NEXT:    [[REM:%.*]] = srem <vscale x 4 x i32> [[A:%.*]], [[B:%.*]]
1515*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[REM]]
1516*207e5cccSFangrui Song //
1517*207e5cccSFangrui Song svint32_t rem_inplace_i32(svint32_t a, svint32_t b) {
1518*207e5cccSFangrui Song   return a % b;
1519*207e5cccSFangrui Song }
1520*207e5cccSFangrui Song 
1521*207e5cccSFangrui Song // CHECK-LABEL: @rem_inplace_i64(
1522*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1523*207e5cccSFangrui Song // CHECK-NEXT:    [[REM:%.*]] = srem <vscale x 2 x i64> [[A:%.*]], [[B:%.*]]
1524*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[REM]]
1525*207e5cccSFangrui Song //
1526*207e5cccSFangrui Song svint64_t rem_inplace_i64(svint64_t a, svint64_t b) {
1527*207e5cccSFangrui Song   return a % b;
1528*207e5cccSFangrui Song }
1529*207e5cccSFangrui Song 
1530*207e5cccSFangrui Song // CHECK-LABEL: @rem_inplace_u8(
1531*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1532*207e5cccSFangrui Song // CHECK-NEXT:    [[REM:%.*]] = urem <vscale x 16 x i8> [[A:%.*]], [[B:%.*]]
1533*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[REM]]
1534*207e5cccSFangrui Song //
1535*207e5cccSFangrui Song svuint8_t rem_inplace_u8(svuint8_t a, svuint8_t b) {
1536*207e5cccSFangrui Song   return a % b;
1537*207e5cccSFangrui Song }
1538*207e5cccSFangrui Song 
1539*207e5cccSFangrui Song // CHECK-LABEL: @rem_inplace_u16(
1540*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1541*207e5cccSFangrui Song // CHECK-NEXT:    [[REM:%.*]] = urem <vscale x 8 x i16> [[A:%.*]], [[B:%.*]]
1542*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[REM]]
1543*207e5cccSFangrui Song //
1544*207e5cccSFangrui Song svuint16_t rem_inplace_u16(svuint16_t a, svuint16_t b) {
1545*207e5cccSFangrui Song   return a % b;
1546*207e5cccSFangrui Song }
1547*207e5cccSFangrui Song 
1548*207e5cccSFangrui Song // CHECK-LABEL: @rem_inplace_u32(
1549*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1550*207e5cccSFangrui Song // CHECK-NEXT:    [[REM:%.*]] = urem <vscale x 4 x i32> [[A:%.*]], [[B:%.*]]
1551*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[REM]]
1552*207e5cccSFangrui Song //
1553*207e5cccSFangrui Song svuint32_t rem_inplace_u32(svuint32_t a, svuint32_t b) {
1554*207e5cccSFangrui Song   return a % b;
1555*207e5cccSFangrui Song }
1556*207e5cccSFangrui Song 
1557*207e5cccSFangrui Song // CHECK-LABEL: @rem_inplace_u64(
1558*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1559*207e5cccSFangrui Song // CHECK-NEXT:    [[REM:%.*]] = urem <vscale x 2 x i64> [[A:%.*]], [[B:%.*]]
1560*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[REM]]
1561*207e5cccSFangrui Song //
1562*207e5cccSFangrui Song svuint64_t rem_inplace_u64(svuint64_t a, svuint64_t b) {
1563*207e5cccSFangrui Song   return a % b;
1564*207e5cccSFangrui Song }
1565*207e5cccSFangrui Song 
1566*207e5cccSFangrui Song // CHECK-LABEL: @rem_scalar_i8(
1567*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1568*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 16 x i8> poison, i8 [[B:%.*]], i64 0
1569*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 16 x i8> [[SPLAT_SPLATINSERT]], <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
1570*207e5cccSFangrui Song // CHECK-NEXT:    [[REM:%.*]] = srem <vscale x 16 x i8> [[A:%.*]], [[SPLAT_SPLAT]]
1571*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[REM]]
1572*207e5cccSFangrui Song //
1573*207e5cccSFangrui Song svint8_t rem_scalar_i8(svint8_t a, int8_t b) {
1574*207e5cccSFangrui Song   return a % b;
1575*207e5cccSFangrui Song }
1576*207e5cccSFangrui Song 
1577*207e5cccSFangrui Song // CHECK-LABEL: @rem_scalar_i16(
1578*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1579*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 8 x i16> poison, i16 [[B:%.*]], i64 0
1580*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 8 x i16> [[SPLAT_SPLATINSERT]], <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
1581*207e5cccSFangrui Song // CHECK-NEXT:    [[REM:%.*]] = srem <vscale x 8 x i16> [[A:%.*]], [[SPLAT_SPLAT]]
1582*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[REM]]
1583*207e5cccSFangrui Song //
1584*207e5cccSFangrui Song svint16_t rem_scalar_i16(svint16_t a, int16_t b) {
1585*207e5cccSFangrui Song   return a % b;
1586*207e5cccSFangrui Song }
1587*207e5cccSFangrui Song 
1588*207e5cccSFangrui Song // CHECK-LABEL: @rem_scalar_i32(
1589*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1590*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[B:%.*]], i64 0
1591*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 4 x i32> [[SPLAT_SPLATINSERT]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
1592*207e5cccSFangrui Song // CHECK-NEXT:    [[REM:%.*]] = srem <vscale x 4 x i32> [[A:%.*]], [[SPLAT_SPLAT]]
1593*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[REM]]
1594*207e5cccSFangrui Song //
1595*207e5cccSFangrui Song svint32_t rem_scalar_i32(svint32_t a, int32_t b) {
1596*207e5cccSFangrui Song   return a % b;
1597*207e5cccSFangrui Song }
1598*207e5cccSFangrui Song 
1599*207e5cccSFangrui Song // CHECK-LABEL: @rem_scalar_i64(
1600*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1601*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 2 x i64> poison, i64 [[B:%.*]], i64 0
1602*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 2 x i64> [[SPLAT_SPLATINSERT]], <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
1603*207e5cccSFangrui Song // CHECK-NEXT:    [[REM:%.*]] = srem <vscale x 2 x i64> [[A:%.*]], [[SPLAT_SPLAT]]
1604*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[REM]]
1605*207e5cccSFangrui Song //
1606*207e5cccSFangrui Song svint64_t rem_scalar_i64(svint64_t a, int64_t b) {
1607*207e5cccSFangrui Song   return a % b;
1608*207e5cccSFangrui Song }
1609*207e5cccSFangrui Song 
1610*207e5cccSFangrui Song // CHECK-LABEL: @rem_scalar_u8(
1611*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1612*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 16 x i8> poison, i8 [[B:%.*]], i64 0
1613*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 16 x i8> [[SPLAT_SPLATINSERT]], <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
1614*207e5cccSFangrui Song // CHECK-NEXT:    [[REM:%.*]] = urem <vscale x 16 x i8> [[A:%.*]], [[SPLAT_SPLAT]]
1615*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[REM]]
1616*207e5cccSFangrui Song //
1617*207e5cccSFangrui Song svuint8_t rem_scalar_u8(svuint8_t a, uint8_t b) {
1618*207e5cccSFangrui Song   return a % b;
1619*207e5cccSFangrui Song }
1620*207e5cccSFangrui Song 
1621*207e5cccSFangrui Song // CHECK-LABEL: @rem_scalar_u16(
1622*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1623*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 8 x i16> poison, i16 [[B:%.*]], i64 0
1624*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 8 x i16> [[SPLAT_SPLATINSERT]], <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
1625*207e5cccSFangrui Song // CHECK-NEXT:    [[REM:%.*]] = urem <vscale x 8 x i16> [[A:%.*]], [[SPLAT_SPLAT]]
1626*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[REM]]
1627*207e5cccSFangrui Song //
1628*207e5cccSFangrui Song svuint16_t rem_scalar_u16(svuint16_t a, uint16_t b) {
1629*207e5cccSFangrui Song   return a % b;
1630*207e5cccSFangrui Song }
1631*207e5cccSFangrui Song 
1632*207e5cccSFangrui Song // CHECK-LABEL: @rem_scalar_u32(
1633*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1634*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[B:%.*]], i64 0
1635*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 4 x i32> [[SPLAT_SPLATINSERT]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
1636*207e5cccSFangrui Song // CHECK-NEXT:    [[REM:%.*]] = urem <vscale x 4 x i32> [[A:%.*]], [[SPLAT_SPLAT]]
1637*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[REM]]
1638*207e5cccSFangrui Song //
1639*207e5cccSFangrui Song svuint32_t rem_scalar_u32(svuint32_t a, uint32_t b) {
1640*207e5cccSFangrui Song   return a % b;
1641*207e5cccSFangrui Song }
1642*207e5cccSFangrui Song 
1643*207e5cccSFangrui Song // CHECK-LABEL: @rem_scalar_u64(
1644*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1645*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLATINSERT:%.*]] = insertelement <vscale x 2 x i64> poison, i64 [[B:%.*]], i64 0
1646*207e5cccSFangrui Song // CHECK-NEXT:    [[SPLAT_SPLAT:%.*]] = shufflevector <vscale x 2 x i64> [[SPLAT_SPLATINSERT]], <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
1647*207e5cccSFangrui Song // CHECK-NEXT:    [[REM:%.*]] = urem <vscale x 2 x i64> [[A:%.*]], [[SPLAT_SPLAT]]
1648*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[REM]]
1649*207e5cccSFangrui Song //
1650*207e5cccSFangrui Song svuint64_t rem_scalar_u64(svuint64_t a, uint64_t b) {
1651*207e5cccSFangrui Song   return a % b;
1652*207e5cccSFangrui Song }
1653*207e5cccSFangrui Song 
1654*207e5cccSFangrui Song // UNARY PROMOTION
1655*207e5cccSFangrui Song 
1656*207e5cccSFangrui Song // CHECK-LABEL: @prom_i8(
1657*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1658*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[A:%.*]]
1659*207e5cccSFangrui Song //
1660*207e5cccSFangrui Song svint8_t prom_i8(svint8_t a) {
1661*207e5cccSFangrui Song   return +a;
1662*207e5cccSFangrui Song }
1663*207e5cccSFangrui Song 
1664*207e5cccSFangrui Song // CHECK-LABEL: @prom_i16(
1665*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1666*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[A:%.*]]
1667*207e5cccSFangrui Song //
1668*207e5cccSFangrui Song svint16_t prom_i16(svint16_t a) {
1669*207e5cccSFangrui Song   return +a;
1670*207e5cccSFangrui Song }
1671*207e5cccSFangrui Song 
1672*207e5cccSFangrui Song // CHECK-LABEL: @prom_i32(
1673*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1674*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[A:%.*]]
1675*207e5cccSFangrui Song //
1676*207e5cccSFangrui Song svint32_t prom_i32(svint32_t a) {
1677*207e5cccSFangrui Song   return +a;
1678*207e5cccSFangrui Song }
1679*207e5cccSFangrui Song 
1680*207e5cccSFangrui Song // CHECK-LABEL: @prom_i64(
1681*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1682*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[A:%.*]]
1683*207e5cccSFangrui Song //
1684*207e5cccSFangrui Song svint64_t prom_i64(svint64_t a) {
1685*207e5cccSFangrui Song   return +a;
1686*207e5cccSFangrui Song }
1687*207e5cccSFangrui Song 
1688*207e5cccSFangrui Song // CHECK-LABEL: @prom_u8(
1689*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1690*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[A:%.*]]
1691*207e5cccSFangrui Song //
1692*207e5cccSFangrui Song svuint8_t prom_u8(svuint8_t a) {
1693*207e5cccSFangrui Song   return +a;
1694*207e5cccSFangrui Song }
1695*207e5cccSFangrui Song 
1696*207e5cccSFangrui Song // CHECK-LABEL: @prom_u16(
1697*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1698*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[A:%.*]]
1699*207e5cccSFangrui Song //
1700*207e5cccSFangrui Song svuint16_t prom_u16(svuint16_t a) {
1701*207e5cccSFangrui Song   return +a;
1702*207e5cccSFangrui Song }
1703*207e5cccSFangrui Song 
1704*207e5cccSFangrui Song // CHECK-LABEL: @prom_u32(
1705*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1706*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[A:%.*]]
1707*207e5cccSFangrui Song //
1708*207e5cccSFangrui Song svuint32_t prom_u32(svuint32_t a) {
1709*207e5cccSFangrui Song   return +a;
1710*207e5cccSFangrui Song }
1711*207e5cccSFangrui Song 
1712*207e5cccSFangrui Song // CHECK-LABEL: @prom_u64(
1713*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1714*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[A:%.*]]
1715*207e5cccSFangrui Song //
1716*207e5cccSFangrui Song svuint64_t prom_u64(svuint64_t a) {
1717*207e5cccSFangrui Song   return +a;
1718*207e5cccSFangrui Song }
1719*207e5cccSFangrui Song 
1720*207e5cccSFangrui Song // UNARY NEGATION
1721*207e5cccSFangrui Song 
1722*207e5cccSFangrui Song // CHECK-LABEL: @neg_i8(
1723*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1724*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = sub <vscale x 16 x i8> zeroinitializer, [[A:%.*]]
1725*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[SUB]]
1726*207e5cccSFangrui Song //
1727*207e5cccSFangrui Song svint8_t neg_i8(svint8_t a) {
1728*207e5cccSFangrui Song   return -a;
1729*207e5cccSFangrui Song }
1730*207e5cccSFangrui Song 
1731*207e5cccSFangrui Song // CHECK-LABEL: @neg_i16(
1732*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1733*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = sub <vscale x 8 x i16> zeroinitializer, [[A:%.*]]
1734*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[SUB]]
1735*207e5cccSFangrui Song //
1736*207e5cccSFangrui Song svint16_t neg_i16(svint16_t a) {
1737*207e5cccSFangrui Song   return -a;
1738*207e5cccSFangrui Song }
1739*207e5cccSFangrui Song 
1740*207e5cccSFangrui Song // CHECK-LABEL: @neg_i32(
1741*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1742*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = sub <vscale x 4 x i32> zeroinitializer, [[A:%.*]]
1743*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[SUB]]
1744*207e5cccSFangrui Song //
1745*207e5cccSFangrui Song svint32_t neg_i32(svint32_t a) {
1746*207e5cccSFangrui Song   return -a;
1747*207e5cccSFangrui Song }
1748*207e5cccSFangrui Song 
1749*207e5cccSFangrui Song // CHECK-LABEL: @neg_i64(
1750*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1751*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = sub <vscale x 2 x i64> zeroinitializer, [[A:%.*]]
1752*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[SUB]]
1753*207e5cccSFangrui Song //
1754*207e5cccSFangrui Song svint64_t neg_i64(svint64_t a) {
1755*207e5cccSFangrui Song   return -a;
1756*207e5cccSFangrui Song }
1757*207e5cccSFangrui Song 
1758*207e5cccSFangrui Song // CHECK-LABEL: @neg_u8(
1759*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1760*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = sub <vscale x 16 x i8> zeroinitializer, [[A:%.*]]
1761*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i8> [[SUB]]
1762*207e5cccSFangrui Song //
1763*207e5cccSFangrui Song svuint8_t neg_u8(svuint8_t a) {
1764*207e5cccSFangrui Song   return -a;
1765*207e5cccSFangrui Song }
1766*207e5cccSFangrui Song 
1767*207e5cccSFangrui Song // CHECK-LABEL: @neg_u16(
1768*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1769*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = sub <vscale x 8 x i16> zeroinitializer, [[A:%.*]]
1770*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 8 x i16> [[SUB]]
1771*207e5cccSFangrui Song //
1772*207e5cccSFangrui Song svuint16_t neg_u16(svuint16_t a) {
1773*207e5cccSFangrui Song   return -a;
1774*207e5cccSFangrui Song }
1775*207e5cccSFangrui Song 
1776*207e5cccSFangrui Song // CHECK-LABEL: @neg_u32(
1777*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1778*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = sub <vscale x 4 x i32> zeroinitializer, [[A:%.*]]
1779*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 4 x i32> [[SUB]]
1780*207e5cccSFangrui Song //
1781*207e5cccSFangrui Song svuint32_t neg_u32(svuint32_t a) {
1782*207e5cccSFangrui Song   return -a;
1783*207e5cccSFangrui Song }
1784*207e5cccSFangrui Song 
1785*207e5cccSFangrui Song // CHECK-LABEL: @neg_u64(
1786*207e5cccSFangrui Song // CHECK-NEXT:  entry:
1787*207e5cccSFangrui Song // CHECK-NEXT:    [[SUB:%.*]] = sub <vscale x 2 x i64> zeroinitializer, [[A:%.*]]
1788*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 2 x i64> [[SUB]]
1789*207e5cccSFangrui Song //
1790*207e5cccSFangrui Song svuint64_t neg_u64(svuint64_t a) {
1791*207e5cccSFangrui Song   return -a;
1792*207e5cccSFangrui Song }
1793