1 // REQUIRES: aarch64-registered-target
2 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
3 // RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
4 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -o - %s >/dev/null 2>%t
5 // RUN: FileCheck --check-prefix=ASM --allow-empty %s <%t
6 
7 // If this check fails please read test/CodeGen/aarch64-sve-intrinsics/README for instructions on how to resolve it.
8 // ASM-NOT: warning
9 #include <arm_sve.h>
10 
11 #ifdef SVE_OVERLOADED_FORMS
12 // A simple used,unused... macro, long enough to represent any SVE builtin.
13 #define SVE_ACLE_FUNC(A1,A2_UNUSED,A3,A4_UNUSED) A1##A3
14 #else
15 #define SVE_ACLE_FUNC(A1,A2,A3,A4) A1##A2##A3##A4
16 #endif
17 
test_svdiv_s32_z(svbool_t pg,svint32_t op1,svint32_t op2)18 svint32_t test_svdiv_s32_z(svbool_t pg, svint32_t op1, svint32_t op2)
19 {
20   // CHECK-LABEL: test_svdiv_s32_z
21   // CHECK-DAG: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
22   // CHECK-DAG: %[[SEL:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.sel.nxv4i32(<vscale x 4 x i1> %[[PG]], <vscale x 4 x i32> %op1, <vscale x 4 x i32> zeroinitializer)
23   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.sdiv.nxv4i32(<vscale x 4 x i1> %[[PG]], <vscale x 4 x i32> %[[SEL]], <vscale x 4 x i32> %op2)
24   // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
25   return SVE_ACLE_FUNC(svdiv,_s32,_z,)(pg, op1, op2);
26 }
27 
test_svdiv_s64_z(svbool_t pg,svint64_t op1,svint64_t op2)28 svint64_t test_svdiv_s64_z(svbool_t pg, svint64_t op1, svint64_t op2)
29 {
30   // CHECK-LABEL: test_svdiv_s64_z
31   // CHECK-DAG: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
32   // CHECK-DAG: %[[SEL:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.sel.nxv2i64(<vscale x 2 x i1> %[[PG]], <vscale x 2 x i64> %op1, <vscale x 2 x i64> zeroinitializer)
33   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.sdiv.nxv2i64(<vscale x 2 x i1> %[[PG]], <vscale x 2 x i64> %[[SEL]], <vscale x 2 x i64> %op2)
34   // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
35   return SVE_ACLE_FUNC(svdiv,_s64,_z,)(pg, op1, op2);
36 }
37 
test_svdiv_u32_z(svbool_t pg,svuint32_t op1,svuint32_t op2)38 svuint32_t test_svdiv_u32_z(svbool_t pg, svuint32_t op1, svuint32_t op2)
39 {
40   // CHECK-LABEL: test_svdiv_u32_z
41   // CHECK-DAG: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
42   // CHECK-DAG: %[[SEL:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.sel.nxv4i32(<vscale x 4 x i1> %[[PG]], <vscale x 4 x i32> %op1, <vscale x 4 x i32> zeroinitializer)
43   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.udiv.nxv4i32(<vscale x 4 x i1> %[[PG]], <vscale x 4 x i32> %[[SEL]], <vscale x 4 x i32> %op2)
44   // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
45   return SVE_ACLE_FUNC(svdiv,_u32,_z,)(pg, op1, op2);
46 }
47 
test_svdiv_u64_z(svbool_t pg,svuint64_t op1,svuint64_t op2)48 svuint64_t test_svdiv_u64_z(svbool_t pg, svuint64_t op1, svuint64_t op2)
49 {
50   // CHECK-LABEL: test_svdiv_u64_z
51   // CHECK-DAG: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
52   // CHECK-DAG: %[[SEL:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.sel.nxv2i64(<vscale x 2 x i1> %[[PG]], <vscale x 2 x i64> %op1, <vscale x 2 x i64> zeroinitializer)
53   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.udiv.nxv2i64(<vscale x 2 x i1> %[[PG]], <vscale x 2 x i64> %[[SEL]], <vscale x 2 x i64> %op2)
54   // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
55   return SVE_ACLE_FUNC(svdiv,_u64,_z,)(pg, op1, op2);
56 }
57 
test_svdiv_s32_m(svbool_t pg,svint32_t op1,svint32_t op2)58 svint32_t test_svdiv_s32_m(svbool_t pg, svint32_t op1, svint32_t op2)
59 {
60   // CHECK-LABEL: test_svdiv_s32_m
61   // CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
62   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.sdiv.nxv4i32(<vscale x 4 x i1> %[[PG]], <vscale x 4 x i32> %op1, <vscale x 4 x i32> %op2)
63   // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
64   return SVE_ACLE_FUNC(svdiv,_s32,_m,)(pg, op1, op2);
65 }
66 
test_svdiv_s64_m(svbool_t pg,svint64_t op1,svint64_t op2)67 svint64_t test_svdiv_s64_m(svbool_t pg, svint64_t op1, svint64_t op2)
68 {
69   // CHECK-LABEL: test_svdiv_s64_m
70   // CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
71   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.sdiv.nxv2i64(<vscale x 2 x i1> %[[PG]], <vscale x 2 x i64> %op1, <vscale x 2 x i64> %op2)
72   // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
73   return SVE_ACLE_FUNC(svdiv,_s64,_m,)(pg, op1, op2);
74 }
75 
test_svdiv_u32_m(svbool_t pg,svuint32_t op1,svuint32_t op2)76 svuint32_t test_svdiv_u32_m(svbool_t pg, svuint32_t op1, svuint32_t op2)
77 {
78   // CHECK-LABEL: test_svdiv_u32_m
79   // CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
80   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.udiv.nxv4i32(<vscale x 4 x i1> %[[PG]], <vscale x 4 x i32> %op1, <vscale x 4 x i32> %op2)
81   // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
82   return SVE_ACLE_FUNC(svdiv,_u32,_m,)(pg, op1, op2);
83 }
84 
test_svdiv_u64_m(svbool_t pg,svuint64_t op1,svuint64_t op2)85 svuint64_t test_svdiv_u64_m(svbool_t pg, svuint64_t op1, svuint64_t op2)
86 {
87   // CHECK-LABEL: test_svdiv_u64_m
88   // CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
89   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.udiv.nxv2i64(<vscale x 2 x i1> %[[PG]], <vscale x 2 x i64> %op1, <vscale x 2 x i64> %op2)
90   // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
91   return SVE_ACLE_FUNC(svdiv,_u64,_m,)(pg, op1, op2);
92 }
93 
test_svdiv_s32_x(svbool_t pg,svint32_t op1,svint32_t op2)94 svint32_t test_svdiv_s32_x(svbool_t pg, svint32_t op1, svint32_t op2)
95 {
96   // CHECK-LABEL: test_svdiv_s32_x
97   // CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
98   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.sdiv.nxv4i32(<vscale x 4 x i1> %[[PG]], <vscale x 4 x i32> %op1, <vscale x 4 x i32> %op2)
99   // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
100   return SVE_ACLE_FUNC(svdiv,_s32,_x,)(pg, op1, op2);
101 }
102 
test_svdiv_s64_x(svbool_t pg,svint64_t op1,svint64_t op2)103 svint64_t test_svdiv_s64_x(svbool_t pg, svint64_t op1, svint64_t op2)
104 {
105   // CHECK-LABEL: test_svdiv_s64_x
106   // CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
107   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.sdiv.nxv2i64(<vscale x 2 x i1> %[[PG]], <vscale x 2 x i64> %op1, <vscale x 2 x i64> %op2)
108   // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
109   return SVE_ACLE_FUNC(svdiv,_s64,_x,)(pg, op1, op2);
110 }
111 
test_svdiv_u32_x(svbool_t pg,svuint32_t op1,svuint32_t op2)112 svuint32_t test_svdiv_u32_x(svbool_t pg, svuint32_t op1, svuint32_t op2)
113 {
114   // CHECK-LABEL: test_svdiv_u32_x
115   // CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
116   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.udiv.nxv4i32(<vscale x 4 x i1> %[[PG]], <vscale x 4 x i32> %op1, <vscale x 4 x i32> %op2)
117   // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
118   return SVE_ACLE_FUNC(svdiv,_u32,_x,)(pg, op1, op2);
119 }
120 
test_svdiv_u64_x(svbool_t pg,svuint64_t op1,svuint64_t op2)121 svuint64_t test_svdiv_u64_x(svbool_t pg, svuint64_t op1, svuint64_t op2)
122 {
123   // CHECK-LABEL: test_svdiv_u64_x
124   // CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
125   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.udiv.nxv2i64(<vscale x 2 x i1> %[[PG]], <vscale x 2 x i64> %op1, <vscale x 2 x i64> %op2)
126   // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
127   return SVE_ACLE_FUNC(svdiv,_u64,_x,)(pg, op1, op2);
128 }
129 
test_svdiv_n_s32_z(svbool_t pg,svint32_t op1,int32_t op2)130 svint32_t test_svdiv_n_s32_z(svbool_t pg, svint32_t op1, int32_t op2)
131 {
132   // CHECK-LABEL: test_svdiv_n_s32_z
133   // CHECK-DAG: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
134   // CHECK-DAG: %[[DUP:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.dup.x.nxv4i32(i32 %op2)
135   // CHECK-DAG: %[[SEL:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.sel.nxv4i32(<vscale x 4 x i1> %[[PG]], <vscale x 4 x i32> %op1, <vscale x 4 x i32> zeroinitializer)
136   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.sdiv.nxv4i32(<vscale x 4 x i1> %[[PG]], <vscale x 4 x i32> %[[SEL]], <vscale x 4 x i32> %[[DUP]])
137   // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
138   return SVE_ACLE_FUNC(svdiv,_n_s32,_z,)(pg, op1, op2);
139 }
140 
test_svdiv_n_s64_z(svbool_t pg,svint64_t op1,int64_t op2)141 svint64_t test_svdiv_n_s64_z(svbool_t pg, svint64_t op1, int64_t op2)
142 {
143   // CHECK-LABEL: test_svdiv_n_s64_z
144   // CHECK-DAG: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
145   // CHECK-DAG: %[[DUP:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.dup.x.nxv2i64(i64 %op2)
146   // CHECK-DAG: %[[SEL:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.sel.nxv2i64(<vscale x 2 x i1> %[[PG]], <vscale x 2 x i64> %op1, <vscale x 2 x i64> zeroinitializer)
147   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.sdiv.nxv2i64(<vscale x 2 x i1> %[[PG]], <vscale x 2 x i64> %[[SEL]], <vscale x 2 x i64> %[[DUP]])
148   // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
149   return SVE_ACLE_FUNC(svdiv,_n_s64,_z,)(pg, op1, op2);
150 }
151 
test_svdiv_n_u32_z(svbool_t pg,svuint32_t op1,uint32_t op2)152 svuint32_t test_svdiv_n_u32_z(svbool_t pg, svuint32_t op1, uint32_t op2)
153 {
154   // CHECK-LABEL: test_svdiv_n_u32_z
155   // CHECK-DAG: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
156   // CHECK-DAG: %[[DUP:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.dup.x.nxv4i32(i32 %op2)
157   // CHECK-DAG: %[[SEL:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.sel.nxv4i32(<vscale x 4 x i1> %[[PG]], <vscale x 4 x i32> %op1, <vscale x 4 x i32> zeroinitializer)
158   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.udiv.nxv4i32(<vscale x 4 x i1> %[[PG]], <vscale x 4 x i32> %[[SEL]], <vscale x 4 x i32> %[[DUP]])
159   // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
160   return SVE_ACLE_FUNC(svdiv,_n_u32,_z,)(pg, op1, op2);
161 }
162 
test_svdiv_n_u64_z(svbool_t pg,svuint64_t op1,uint64_t op2)163 svuint64_t test_svdiv_n_u64_z(svbool_t pg, svuint64_t op1, uint64_t op2)
164 {
165   // CHECK-LABEL: test_svdiv_n_u64_z
166   // CHECK-DAG: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
167   // CHECK-DAG: %[[DUP:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.dup.x.nxv2i64(i64 %op2)
168   // CHECK-DAG: %[[SEL:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.sel.nxv2i64(<vscale x 2 x i1> %[[PG]], <vscale x 2 x i64> %op1, <vscale x 2 x i64> zeroinitializer)
169   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.udiv.nxv2i64(<vscale x 2 x i1> %[[PG]], <vscale x 2 x i64> %[[SEL]], <vscale x 2 x i64> %[[DUP]])
170   // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
171   return SVE_ACLE_FUNC(svdiv,_n_u64,_z,)(pg, op1, op2);
172 }
173 
test_svdiv_n_s32_m(svbool_t pg,svint32_t op1,int32_t op2)174 svint32_t test_svdiv_n_s32_m(svbool_t pg, svint32_t op1, int32_t op2)
175 {
176   // CHECK-LABEL: test_svdiv_n_s32_m
177   // CHECK-DAG: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
178   // CHECK-DAG: %[[DUP:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.dup.x.nxv4i32(i32 %op2)
179   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.sdiv.nxv4i32(<vscale x 4 x i1> %[[PG]], <vscale x 4 x i32> %op1, <vscale x 4 x i32> %[[DUP]])
180   // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
181   return SVE_ACLE_FUNC(svdiv,_n_s32,_m,)(pg, op1, op2);
182 }
183 
test_svdiv_n_s64_m(svbool_t pg,svint64_t op1,int64_t op2)184 svint64_t test_svdiv_n_s64_m(svbool_t pg, svint64_t op1, int64_t op2)
185 {
186   // CHECK-LABEL: test_svdiv_n_s64_m
187   // CHECK-DAG: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
188   // CHECK-DAG: %[[DUP:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.dup.x.nxv2i64(i64 %op2)
189   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.sdiv.nxv2i64(<vscale x 2 x i1> %[[PG]], <vscale x 2 x i64> %op1, <vscale x 2 x i64> %[[DUP]])
190   // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
191   return SVE_ACLE_FUNC(svdiv,_n_s64,_m,)(pg, op1, op2);
192 }
193 
test_svdiv_n_u32_m(svbool_t pg,svuint32_t op1,uint32_t op2)194 svuint32_t test_svdiv_n_u32_m(svbool_t pg, svuint32_t op1, uint32_t op2)
195 {
196   // CHECK-LABEL: test_svdiv_n_u32_m
197   // CHECK-DAG: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
198   // CHECK-DAG: %[[DUP:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.dup.x.nxv4i32(i32 %op2)
199   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.udiv.nxv4i32(<vscale x 4 x i1> %[[PG]], <vscale x 4 x i32> %op1, <vscale x 4 x i32> %[[DUP]])
200   // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
201   return SVE_ACLE_FUNC(svdiv,_n_u32,_m,)(pg, op1, op2);
202 }
203 
test_svdiv_n_u64_m(svbool_t pg,svuint64_t op1,uint64_t op2)204 svuint64_t test_svdiv_n_u64_m(svbool_t pg, svuint64_t op1, uint64_t op2)
205 {
206   // CHECK-LABEL: test_svdiv_n_u64_m
207   // CHECK-DAG: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
208   // CHECK-DAG: %[[DUP:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.dup.x.nxv2i64(i64 %op2)
209   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.udiv.nxv2i64(<vscale x 2 x i1> %[[PG]], <vscale x 2 x i64> %op1, <vscale x 2 x i64> %[[DUP]])
210   // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
211   return SVE_ACLE_FUNC(svdiv,_n_u64,_m,)(pg, op1, op2);
212 }
213 
test_svdiv_n_s32_x(svbool_t pg,svint32_t op1,int32_t op2)214 svint32_t test_svdiv_n_s32_x(svbool_t pg, svint32_t op1, int32_t op2)
215 {
216   // CHECK-LABEL: test_svdiv_n_s32_x
217   // CHECK-DAG: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
218   // CHECK-DAG: %[[DUP:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.dup.x.nxv4i32(i32 %op2)
219   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.sdiv.nxv4i32(<vscale x 4 x i1> %[[PG]], <vscale x 4 x i32> %op1, <vscale x 4 x i32> %[[DUP]])
220   // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
221   return SVE_ACLE_FUNC(svdiv,_n_s32,_x,)(pg, op1, op2);
222 }
223 
test_svdiv_n_s64_x(svbool_t pg,svint64_t op1,int64_t op2)224 svint64_t test_svdiv_n_s64_x(svbool_t pg, svint64_t op1, int64_t op2)
225 {
226   // CHECK-LABEL: test_svdiv_n_s64_x
227   // CHECK-DAG: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
228   // CHECK-DAG: %[[DUP:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.dup.x.nxv2i64(i64 %op2)
229   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.sdiv.nxv2i64(<vscale x 2 x i1> %[[PG]], <vscale x 2 x i64> %op1, <vscale x 2 x i64> %[[DUP]])
230   // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
231   return SVE_ACLE_FUNC(svdiv,_n_s64,_x,)(pg, op1, op2);
232 }
233 
test_svdiv_n_u32_x(svbool_t pg,svuint32_t op1,uint32_t op2)234 svuint32_t test_svdiv_n_u32_x(svbool_t pg, svuint32_t op1, uint32_t op2)
235 {
236   // CHECK-LABEL: test_svdiv_n_u32_x
237   // CHECK-DAG: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
238   // CHECK-DAG: %[[DUP:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.dup.x.nxv4i32(i32 %op2)
239   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.udiv.nxv4i32(<vscale x 4 x i1> %[[PG]], <vscale x 4 x i32> %op1, <vscale x 4 x i32> %[[DUP]])
240   // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
241   return SVE_ACLE_FUNC(svdiv,_n_u32,_x,)(pg, op1, op2);
242 }
243 
test_svdiv_n_u64_x(svbool_t pg,svuint64_t op1,uint64_t op2)244 svuint64_t test_svdiv_n_u64_x(svbool_t pg, svuint64_t op1, uint64_t op2)
245 {
246   // CHECK-LABEL: test_svdiv_n_u64_x
247   // CHECK-DAG: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
248   // CHECK-DAG: %[[DUP:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.dup.x.nxv2i64(i64 %op2)
249   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.udiv.nxv2i64(<vscale x 2 x i1> %[[PG]], <vscale x 2 x i64> %op1, <vscale x 2 x i64> %[[DUP]])
250   // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
251   return SVE_ACLE_FUNC(svdiv,_n_u64,_x,)(pg, op1, op2);
252 }
253 
test_svdiv_f16_z(svbool_t pg,svfloat16_t op1,svfloat16_t op2)254 svfloat16_t test_svdiv_f16_z(svbool_t pg, svfloat16_t op1, svfloat16_t op2)
255 {
256   // CHECK-LABEL: test_svdiv_f16_z
257   // CHECK-DAG: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
258   // CHECK-DAG: %[[SEL:.*]] = call <vscale x 8 x half> @llvm.aarch64.sve.sel.nxv8f16(<vscale x 8 x i1> %[[PG]], <vscale x 8 x half> %op1, <vscale x 8 x half> zeroinitializer)
259   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x half> @llvm.aarch64.sve.fdiv.nxv8f16(<vscale x 8 x i1> %[[PG]], <vscale x 8 x half> %[[SEL]], <vscale x 8 x half> %op2)
260   // CHECK: ret <vscale x 8 x half> %[[INTRINSIC]]
261   return SVE_ACLE_FUNC(svdiv,_f16,_z,)(pg, op1, op2);
262 }
263 
test_svdiv_f32_z(svbool_t pg,svfloat32_t op1,svfloat32_t op2)264 svfloat32_t test_svdiv_f32_z(svbool_t pg, svfloat32_t op1, svfloat32_t op2)
265 {
266   // CHECK-LABEL: test_svdiv_f32_z
267   // CHECK-DAG: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
268   // CHECK-DAG: %[[SEL:.*]] = call <vscale x 4 x float> @llvm.aarch64.sve.sel.nxv4f32(<vscale x 4 x i1> %[[PG]], <vscale x 4 x float> %op1, <vscale x 4 x float> zeroinitializer)
269   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x float> @llvm.aarch64.sve.fdiv.nxv4f32(<vscale x 4 x i1> %[[PG]], <vscale x 4 x float> %[[SEL]], <vscale x 4 x float> %op2)
270   // CHECK: ret <vscale x 4 x float> %[[INTRINSIC]]
271   return SVE_ACLE_FUNC(svdiv,_f32,_z,)(pg, op1, op2);
272 }
273 
test_svdiv_f64_z(svbool_t pg,svfloat64_t op1,svfloat64_t op2)274 svfloat64_t test_svdiv_f64_z(svbool_t pg, svfloat64_t op1, svfloat64_t op2)
275 {
276   // CHECK-LABEL: test_svdiv_f64_z
277   // CHECK-DAG: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
278   // CHECK-DAG: %[[SEL:.*]] = call <vscale x 2 x double> @llvm.aarch64.sve.sel.nxv2f64(<vscale x 2 x i1> %[[PG]], <vscale x 2 x double> %op1, <vscale x 2 x double> zeroinitializer)
279   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x double> @llvm.aarch64.sve.fdiv.nxv2f64(<vscale x 2 x i1> %[[PG]], <vscale x 2 x double> %[[SEL]], <vscale x 2 x double> %op2)
280   // CHECK: ret <vscale x 2 x double> %[[INTRINSIC]]
281   return SVE_ACLE_FUNC(svdiv,_f64,_z,)(pg, op1, op2);
282 }
283 
test_svdiv_f16_m(svbool_t pg,svfloat16_t op1,svfloat16_t op2)284 svfloat16_t test_svdiv_f16_m(svbool_t pg, svfloat16_t op1, svfloat16_t op2)
285 {
286   // CHECK-LABEL: test_svdiv_f16_m
287   // CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
288   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x half> @llvm.aarch64.sve.fdiv.nxv8f16(<vscale x 8 x i1> %[[PG]], <vscale x 8 x half> %op1, <vscale x 8 x half> %op2)
289   // CHECK: ret <vscale x 8 x half> %[[INTRINSIC]]
290   return SVE_ACLE_FUNC(svdiv,_f16,_m,)(pg, op1, op2);
291 }
292 
test_svdiv_f32_m(svbool_t pg,svfloat32_t op1,svfloat32_t op2)293 svfloat32_t test_svdiv_f32_m(svbool_t pg, svfloat32_t op1, svfloat32_t op2)
294 {
295   // CHECK-LABEL: test_svdiv_f32_m
296   // CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
297   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x float> @llvm.aarch64.sve.fdiv.nxv4f32(<vscale x 4 x i1> %[[PG]], <vscale x 4 x float> %op1, <vscale x 4 x float> %op2)
298   // CHECK: ret <vscale x 4 x float> %[[INTRINSIC]]
299   return SVE_ACLE_FUNC(svdiv,_f32,_m,)(pg, op1, op2);
300 }
301 
test_svdiv_f64_m(svbool_t pg,svfloat64_t op1,svfloat64_t op2)302 svfloat64_t test_svdiv_f64_m(svbool_t pg, svfloat64_t op1, svfloat64_t op2)
303 {
304   // CHECK-LABEL: test_svdiv_f64_m
305   // CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
306   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x double> @llvm.aarch64.sve.fdiv.nxv2f64(<vscale x 2 x i1> %[[PG]], <vscale x 2 x double> %op1, <vscale x 2 x double> %op2)
307   // CHECK: ret <vscale x 2 x double> %[[INTRINSIC]]
308   return SVE_ACLE_FUNC(svdiv,_f64,_m,)(pg, op1, op2);
309 }
310 
test_svdiv_f16_x(svbool_t pg,svfloat16_t op1,svfloat16_t op2)311 svfloat16_t test_svdiv_f16_x(svbool_t pg, svfloat16_t op1, svfloat16_t op2)
312 {
313   // CHECK-LABEL: test_svdiv_f16_x
314   // CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
315   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x half> @llvm.aarch64.sve.fdiv.nxv8f16(<vscale x 8 x i1> %[[PG]], <vscale x 8 x half> %op1, <vscale x 8 x half> %op2)
316   // CHECK: ret <vscale x 8 x half> %[[INTRINSIC]]
317   return SVE_ACLE_FUNC(svdiv,_f16,_x,)(pg, op1, op2);
318 }
319 
test_svdiv_f32_x(svbool_t pg,svfloat32_t op1,svfloat32_t op2)320 svfloat32_t test_svdiv_f32_x(svbool_t pg, svfloat32_t op1, svfloat32_t op2)
321 {
322   // CHECK-LABEL: test_svdiv_f32_x
323   // CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
324   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x float> @llvm.aarch64.sve.fdiv.nxv4f32(<vscale x 4 x i1> %[[PG]], <vscale x 4 x float> %op1, <vscale x 4 x float> %op2)
325   // CHECK: ret <vscale x 4 x float> %[[INTRINSIC]]
326   return SVE_ACLE_FUNC(svdiv,_f32,_x,)(pg, op1, op2);
327 }
328 
test_svdiv_f64_x(svbool_t pg,svfloat64_t op1,svfloat64_t op2)329 svfloat64_t test_svdiv_f64_x(svbool_t pg, svfloat64_t op1, svfloat64_t op2)
330 {
331   // CHECK-LABEL: test_svdiv_f64_x
332   // CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
333   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x double> @llvm.aarch64.sve.fdiv.nxv2f64(<vscale x 2 x i1> %[[PG]], <vscale x 2 x double> %op1, <vscale x 2 x double> %op2)
334   // CHECK: ret <vscale x 2 x double> %[[INTRINSIC]]
335   return SVE_ACLE_FUNC(svdiv,_f64,_x,)(pg, op1, op2);
336 }
337 
test_svdiv_n_f16_z(svbool_t pg,svfloat16_t op1,float16_t op2)338 svfloat16_t test_svdiv_n_f16_z(svbool_t pg, svfloat16_t op1, float16_t op2)
339 {
340   // CHECK-LABEL: test_svdiv_n_f16_z
341   // CHECK-DAG: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
342   // CHECK-DAG: %[[DUP:.*]] = call <vscale x 8 x half> @llvm.aarch64.sve.dup.x.nxv8f16(half %op2)
343   // CHECK-DAG: %[[SEL:.*]] = call <vscale x 8 x half> @llvm.aarch64.sve.sel.nxv8f16(<vscale x 8 x i1> %[[PG]], <vscale x 8 x half> %op1, <vscale x 8 x half> zeroinitializer)
344   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x half> @llvm.aarch64.sve.fdiv.nxv8f16(<vscale x 8 x i1> %[[PG]], <vscale x 8 x half> %[[SEL]], <vscale x 8 x half> %[[DUP]])
345   // CHECK: ret <vscale x 8 x half> %[[INTRINSIC]]
346   return SVE_ACLE_FUNC(svdiv,_n_f16,_z,)(pg, op1, op2);
347 }
348 
test_svdiv_n_f32_z(svbool_t pg,svfloat32_t op1,float32_t op2)349 svfloat32_t test_svdiv_n_f32_z(svbool_t pg, svfloat32_t op1, float32_t op2)
350 {
351   // CHECK-LABEL: test_svdiv_n_f32_z
352   // CHECK-DAG: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
353   // CHECK-DAG: %[[DUP:.*]] = call <vscale x 4 x float> @llvm.aarch64.sve.dup.x.nxv4f32(float %op2)
354   // CHECK-DAG: %[[SEL:.*]] = call <vscale x 4 x float> @llvm.aarch64.sve.sel.nxv4f32(<vscale x 4 x i1> %[[PG]], <vscale x 4 x float> %op1, <vscale x 4 x float> zeroinitializer)
355   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x float> @llvm.aarch64.sve.fdiv.nxv4f32(<vscale x 4 x i1> %[[PG]], <vscale x 4 x float> %[[SEL]], <vscale x 4 x float> %[[DUP]])
356   // CHECK: ret <vscale x 4 x float> %[[INTRINSIC]]
357   return SVE_ACLE_FUNC(svdiv,_n_f32,_z,)(pg, op1, op2);
358 }
359 
test_svdiv_n_f64_z(svbool_t pg,svfloat64_t op1,float64_t op2)360 svfloat64_t test_svdiv_n_f64_z(svbool_t pg, svfloat64_t op1, float64_t op2)
361 {
362   // CHECK-LABEL: test_svdiv_n_f64_z
363   // CHECK-DAG: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
364   // CHECK-DAG: %[[DUP:.*]] = call <vscale x 2 x double> @llvm.aarch64.sve.dup.x.nxv2f64(double %op2)
365   // CHECK-DAG: %[[SEL:.*]] = call <vscale x 2 x double> @llvm.aarch64.sve.sel.nxv2f64(<vscale x 2 x i1> %[[PG]], <vscale x 2 x double> %op1, <vscale x 2 x double> zeroinitializer)
366   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x double> @llvm.aarch64.sve.fdiv.nxv2f64(<vscale x 2 x i1> %[[PG]], <vscale x 2 x double> %[[SEL]], <vscale x 2 x double> %[[DUP]])
367   // CHECK: ret <vscale x 2 x double> %[[INTRINSIC]]
368   return SVE_ACLE_FUNC(svdiv,_n_f64,_z,)(pg, op1, op2);
369 }
370 
test_svdiv_n_f16_m(svbool_t pg,svfloat16_t op1,float16_t op2)371 svfloat16_t test_svdiv_n_f16_m(svbool_t pg, svfloat16_t op1, float16_t op2)
372 {
373   // CHECK-LABEL: test_svdiv_n_f16_m
374   // CHECK-DAG: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
375   // CHECK-DAG: %[[DUP:.*]] = call <vscale x 8 x half> @llvm.aarch64.sve.dup.x.nxv8f16(half %op2)
376   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x half> @llvm.aarch64.sve.fdiv.nxv8f16(<vscale x 8 x i1> %[[PG]], <vscale x 8 x half> %op1, <vscale x 8 x half> %[[DUP]])
377   // CHECK: ret <vscale x 8 x half> %[[INTRINSIC]]
378   return SVE_ACLE_FUNC(svdiv,_n_f16,_m,)(pg, op1, op2);
379 }
380 
test_svdiv_n_f32_m(svbool_t pg,svfloat32_t op1,float32_t op2)381 svfloat32_t test_svdiv_n_f32_m(svbool_t pg, svfloat32_t op1, float32_t op2)
382 {
383   // CHECK-LABEL: test_svdiv_n_f32_m
384   // CHECK-DAG: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
385   // CHECK-DAG: %[[DUP:.*]] = call <vscale x 4 x float> @llvm.aarch64.sve.dup.x.nxv4f32(float %op2)
386   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x float> @llvm.aarch64.sve.fdiv.nxv4f32(<vscale x 4 x i1> %[[PG]], <vscale x 4 x float> %op1, <vscale x 4 x float> %[[DUP]])
387   // CHECK: ret <vscale x 4 x float> %[[INTRINSIC]]
388   return SVE_ACLE_FUNC(svdiv,_n_f32,_m,)(pg, op1, op2);
389 }
390 
test_svdiv_n_f64_m(svbool_t pg,svfloat64_t op1,float64_t op2)391 svfloat64_t test_svdiv_n_f64_m(svbool_t pg, svfloat64_t op1, float64_t op2)
392 {
393   // CHECK-LABEL: test_svdiv_n_f64_m
394   // CHECK-DAG: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
395   // CHECK-DAG: %[[DUP:.*]] = call <vscale x 2 x double> @llvm.aarch64.sve.dup.x.nxv2f64(double %op2)
396   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x double> @llvm.aarch64.sve.fdiv.nxv2f64(<vscale x 2 x i1> %[[PG]], <vscale x 2 x double> %op1, <vscale x 2 x double> %[[DUP]])
397   // CHECK: ret <vscale x 2 x double> %[[INTRINSIC]]
398   return SVE_ACLE_FUNC(svdiv,_n_f64,_m,)(pg, op1, op2);
399 }
400 
test_svdiv_n_f16_x(svbool_t pg,svfloat16_t op1,float16_t op2)401 svfloat16_t test_svdiv_n_f16_x(svbool_t pg, svfloat16_t op1, float16_t op2)
402 {
403   // CHECK-LABEL: test_svdiv_n_f16_x
404   // CHECK-DAG: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
405   // CHECK-DAG: %[[DUP:.*]] = call <vscale x 8 x half> @llvm.aarch64.sve.dup.x.nxv8f16(half %op2)
406   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x half> @llvm.aarch64.sve.fdiv.nxv8f16(<vscale x 8 x i1> %[[PG]], <vscale x 8 x half> %op1, <vscale x 8 x half> %[[DUP]])
407   // CHECK: ret <vscale x 8 x half> %[[INTRINSIC]]
408   return SVE_ACLE_FUNC(svdiv,_n_f16,_x,)(pg, op1, op2);
409 }
410 
test_svdiv_n_f32_x(svbool_t pg,svfloat32_t op1,float32_t op2)411 svfloat32_t test_svdiv_n_f32_x(svbool_t pg, svfloat32_t op1, float32_t op2)
412 {
413   // CHECK-LABEL: test_svdiv_n_f32_x
414   // CHECK-DAG: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
415   // CHECK-DAG: %[[DUP:.*]] = call <vscale x 4 x float> @llvm.aarch64.sve.dup.x.nxv4f32(float %op2)
416   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x float> @llvm.aarch64.sve.fdiv.nxv4f32(<vscale x 4 x i1> %[[PG]], <vscale x 4 x float> %op1, <vscale x 4 x float> %[[DUP]])
417   // CHECK: ret <vscale x 4 x float> %[[INTRINSIC]]
418   return SVE_ACLE_FUNC(svdiv,_n_f32,_x,)(pg, op1, op2);
419 }
420 
test_svdiv_n_f64_x(svbool_t pg,svfloat64_t op1,float64_t op2)421 svfloat64_t test_svdiv_n_f64_x(svbool_t pg, svfloat64_t op1, float64_t op2)
422 {
423   // CHECK-LABEL: test_svdiv_n_f64_x
424   // CHECK-DAG: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
425   // CHECK-DAG: %[[DUP:.*]] = call <vscale x 2 x double> @llvm.aarch64.sve.dup.x.nxv2f64(double %op2)
426   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x double> @llvm.aarch64.sve.fdiv.nxv2f64(<vscale x 2 x i1> %[[PG]], <vscale x 2 x double> %op1, <vscale x 2 x double> %[[DUP]])
427   // CHECK: ret <vscale x 2 x double> %[[INTRINSIC]]
428   return SVE_ACLE_FUNC(svdiv,_n_f64,_x,)(pg, op1, op2);
429 }
430