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 -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - -x c++ %s | FileCheck %s
4 // 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
5 // 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 - -x c++ %s | FileCheck %s
6 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -o - %s >/dev/null
7 #include <arm_sve.h>
8 
9 #ifdef SVE_OVERLOADED_FORMS
10 // A simple used,unused... macro, long enough to represent any SVE builtin.
11 #define SVE_ACLE_FUNC(A1,A2_UNUSED,A3,A4_UNUSED) A1##A3
12 #else
13 #define SVE_ACLE_FUNC(A1,A2,A3,A4) A1##A2##A3##A4
14 #endif
15 
test_svqincp_n_s32_b8(int32_t op,svbool_t pg)16 int32_t test_svqincp_n_s32_b8(int32_t op, svbool_t pg)
17 {
18   // CHECK-LABEL: test_svqincp_n_s32_b8
19   // CHECK: %[[INTRINSIC:.*]] = call i32 @llvm.aarch64.sve.sqincp.n32.nxv16i1(i32 %op, <vscale x 16 x i1> %pg)
20   // CHECK: ret i32 %[[INTRINSIC]]
21   return SVE_ACLE_FUNC(svqincp,_n_s32,_b8,)(op, pg);
22 }
23 
test_svqincp_n_s32_b16(int32_t op,svbool_t pg)24 int32_t test_svqincp_n_s32_b16(int32_t op, svbool_t pg)
25 {
26   // CHECK-LABEL: test_svqincp_n_s32_b16
27   // CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
28   // CHECK: %[[INTRINSIC:.*]] = call i32 @llvm.aarch64.sve.sqincp.n32.nxv8i1(i32 %op, <vscale x 8 x i1> %[[PG]])
29   // CHECK: ret i32 %[[INTRINSIC]]
30   return SVE_ACLE_FUNC(svqincp,_n_s32,_b16,)(op, pg);
31 }
32 
test_svqincp_n_s32_b32(int32_t op,svbool_t pg)33 int32_t test_svqincp_n_s32_b32(int32_t op, svbool_t pg)
34 {
35   // CHECK-LABEL: test_svqincp_n_s32_b32
36   // CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
37   // CHECK: %[[INTRINSIC:.*]] = call i32 @llvm.aarch64.sve.sqincp.n32.nxv4i1(i32 %op, <vscale x 4 x i1> %[[PG]])
38   // CHECK: ret i32 %[[INTRINSIC]]
39   return SVE_ACLE_FUNC(svqincp,_n_s32,_b32,)(op, pg);
40 }
41 
test_svqincp_n_s32_b64(int32_t op,svbool_t pg)42 int32_t test_svqincp_n_s32_b64(int32_t op, svbool_t pg)
43 {
44   // CHECK-LABEL: test_svqincp_n_s32_b64
45   // CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
46   // CHECK: %[[INTRINSIC:.*]] = call i32 @llvm.aarch64.sve.sqincp.n32.nxv2i1(i32 %op, <vscale x 2 x i1> %[[PG]])
47   // CHECK: ret i32 %[[INTRINSIC]]
48   return SVE_ACLE_FUNC(svqincp,_n_s32,_b64,)(op, pg);
49 }
50 
test_svqincp_n_s64_b8(int64_t op,svbool_t pg)51 int64_t test_svqincp_n_s64_b8(int64_t op, svbool_t pg)
52 {
53   // CHECK-LABEL: test_svqincp_n_s64_b8
54   // CHECK: %[[INTRINSIC:.*]] = call i64 @llvm.aarch64.sve.sqincp.n64.nxv16i1(i64 %op, <vscale x 16 x i1> %pg)
55   // CHECK: ret i64 %[[INTRINSIC]]
56   return SVE_ACLE_FUNC(svqincp,_n_s64,_b8,)(op, pg);
57 }
58 
test_svqincp_n_s64_b16(int64_t op,svbool_t pg)59 int64_t test_svqincp_n_s64_b16(int64_t op, svbool_t pg)
60 {
61   // CHECK-LABEL: test_svqincp_n_s64_b16
62   // CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
63   // CHECK: %[[INTRINSIC:.*]] = call i64 @llvm.aarch64.sve.sqincp.n64.nxv8i1(i64 %op, <vscale x 8 x i1> %[[PG]])
64   // CHECK: ret i64 %[[INTRINSIC]]
65   return SVE_ACLE_FUNC(svqincp,_n_s64,_b16,)(op, pg);
66 }
67 
test_svqincp_n_s64_b32(int64_t op,svbool_t pg)68 int64_t test_svqincp_n_s64_b32(int64_t op, svbool_t pg)
69 {
70   // CHECK-LABEL: test_svqincp_n_s64_b32
71   // CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
72   // CHECK: %[[INTRINSIC:.*]] = call i64 @llvm.aarch64.sve.sqincp.n64.nxv4i1(i64 %op, <vscale x 4 x i1> %[[PG]])
73   // CHECK: ret i64 %[[INTRINSIC]]
74   return SVE_ACLE_FUNC(svqincp,_n_s64,_b32,)(op, pg);
75 }
76 
test_svqincp_n_s64_b64(int64_t op,svbool_t pg)77 int64_t test_svqincp_n_s64_b64(int64_t op, svbool_t pg)
78 {
79   // CHECK-LABEL: test_svqincp_n_s64_b64
80   // CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
81   // CHECK: %[[INTRINSIC:.*]] = call i64 @llvm.aarch64.sve.sqincp.n64.nxv2i1(i64 %op, <vscale x 2 x i1> %[[PG]])
82   // CHECK: ret i64 %[[INTRINSIC]]
83   return SVE_ACLE_FUNC(svqincp,_n_s64,_b64,)(op, pg);
84 }
85 
test_svqincp_n_u32_b8(uint32_t op,svbool_t pg)86 uint32_t test_svqincp_n_u32_b8(uint32_t op, svbool_t pg)
87 {
88   // CHECK-LABEL: test_svqincp_n_u32_b8
89   // CHECK: %[[INTRINSIC:.*]] = call i32 @llvm.aarch64.sve.uqincp.n32.nxv16i1(i32 %op, <vscale x 16 x i1> %pg)
90   // CHECK: ret i32 %[[INTRINSIC]]
91   return SVE_ACLE_FUNC(svqincp,_n_u32,_b8,)(op, pg);
92 }
93 
test_svqincp_n_u32_b16(uint32_t op,svbool_t pg)94 uint32_t test_svqincp_n_u32_b16(uint32_t op, svbool_t pg)
95 {
96   // CHECK-LABEL: test_svqincp_n_u32_b16
97   // CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
98   // CHECK: %[[INTRINSIC:.*]] = call i32 @llvm.aarch64.sve.uqincp.n32.nxv8i1(i32 %op, <vscale x 8 x i1> %[[PG]])
99   // CHECK: ret i32 %[[INTRINSIC]]
100   return SVE_ACLE_FUNC(svqincp,_n_u32,_b16,)(op, pg);
101 }
102 
test_svqincp_n_u32_b32(uint32_t op,svbool_t pg)103 uint32_t test_svqincp_n_u32_b32(uint32_t op, svbool_t pg)
104 {
105   // CHECK-LABEL: test_svqincp_n_u32_b32
106   // CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
107   // CHECK: %[[INTRINSIC:.*]] = call i32 @llvm.aarch64.sve.uqincp.n32.nxv4i1(i32 %op, <vscale x 4 x i1> %[[PG]])
108   // CHECK: ret i32 %[[INTRINSIC]]
109   return SVE_ACLE_FUNC(svqincp,_n_u32,_b32,)(op, pg);
110 }
111 
test_svqincp_n_u32_b64(uint32_t op,svbool_t pg)112 uint32_t test_svqincp_n_u32_b64(uint32_t op, svbool_t pg)
113 {
114   // CHECK-LABEL: test_svqincp_n_u32_b64
115   // CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
116   // CHECK: %[[INTRINSIC:.*]] = call i32 @llvm.aarch64.sve.uqincp.n32.nxv2i1(i32 %op, <vscale x 2 x i1> %[[PG]])
117   // CHECK: ret i32 %[[INTRINSIC]]
118   return SVE_ACLE_FUNC(svqincp,_n_u32,_b64,)(op, pg);
119 }
120 
test_svqincp_n_u64_b8(uint64_t op,svbool_t pg)121 uint64_t test_svqincp_n_u64_b8(uint64_t op, svbool_t pg)
122 {
123   // CHECK-LABEL: test_svqincp_n_u64_b8
124   // CHECK: %[[INTRINSIC:.*]] = call i64 @llvm.aarch64.sve.uqincp.n64.nxv16i1(i64 %op, <vscale x 16 x i1> %pg)
125   // CHECK: ret i64 %[[INTRINSIC]]
126   return SVE_ACLE_FUNC(svqincp,_n_u64,_b8,)(op, pg);
127 }
128 
test_svqincp_n_u64_b16(uint64_t op,svbool_t pg)129 uint64_t test_svqincp_n_u64_b16(uint64_t op, svbool_t pg)
130 {
131   // CHECK-LABEL: test_svqincp_n_u64_b16
132   // CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
133   // CHECK: %[[INTRINSIC:.*]] = call i64 @llvm.aarch64.sve.uqincp.n64.nxv8i1(i64 %op, <vscale x 8 x i1> %[[PG]])
134   // CHECK: ret i64 %[[INTRINSIC]]
135   return SVE_ACLE_FUNC(svqincp,_n_u64,_b16,)(op, pg);
136 }
137 
test_svqincp_n_u64_b32(uint64_t op,svbool_t pg)138 uint64_t test_svqincp_n_u64_b32(uint64_t op, svbool_t pg)
139 {
140   // CHECK-LABEL: test_svqincp_n_u64_b32
141   // CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
142   // CHECK: %[[INTRINSIC:.*]] = call i64 @llvm.aarch64.sve.uqincp.n64.nxv4i1(i64 %op, <vscale x 4 x i1> %[[PG]])
143   // CHECK: ret i64 %[[INTRINSIC]]
144   return SVE_ACLE_FUNC(svqincp,_n_u64,_b32,)(op, pg);
145 }
146 
test_svqincp_n_u64_b64(uint64_t op,svbool_t pg)147 uint64_t test_svqincp_n_u64_b64(uint64_t op, svbool_t pg)
148 {
149   // CHECK-LABEL: test_svqincp_n_u64_b64
150   // CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
151   // CHECK: %[[INTRINSIC:.*]] = call i64 @llvm.aarch64.sve.uqincp.n64.nxv2i1(i64 %op, <vscale x 2 x i1> %[[PG]])
152   // CHECK: ret i64 %[[INTRINSIC]]
153   return SVE_ACLE_FUNC(svqincp,_n_u64,_b64,)(op, pg);
154 }
155 
test_svqincp_s16(svint16_t op,svbool_t pg)156 svint16_t test_svqincp_s16(svint16_t op, svbool_t pg)
157 {
158   // CHECK-LABEL: test_svqincp_s16
159   // CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
160   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.sqincp.nxv8i16(<vscale x 8 x i16> %op, <vscale x 8 x i1> %[[PG]])
161   // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
162   return SVE_ACLE_FUNC(svqincp,_s16,,)(op, pg);
163 }
164 
test_svqincp_s32(svint32_t op,svbool_t pg)165 svint32_t test_svqincp_s32(svint32_t op, svbool_t pg)
166 {
167   // CHECK-LABEL: test_svqincp_s32
168   // CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
169   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.sqincp.nxv4i32(<vscale x 4 x i32> %op, <vscale x 4 x i1> %[[PG]])
170   // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
171   return SVE_ACLE_FUNC(svqincp,_s32,,)(op, pg);
172 }
173 
test_svqincp_s64(svint64_t op,svbool_t pg)174 svint64_t test_svqincp_s64(svint64_t op, svbool_t pg)
175 {
176   // CHECK-LABEL: test_svqincp_s64
177   // CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
178   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.sqincp.nxv2i64(<vscale x 2 x i64> %op, <vscale x 2 x i1> %[[PG]])
179   // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
180   return SVE_ACLE_FUNC(svqincp,_s64,,)(op, pg);
181 }
182 
test_svqincp_u16(svuint16_t op,svbool_t pg)183 svuint16_t test_svqincp_u16(svuint16_t op, svbool_t pg)
184 {
185   // CHECK-LABEL: test_svqincp_u16
186   // CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
187   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.uqincp.nxv8i16(<vscale x 8 x i16> %op, <vscale x 8 x i1> %[[PG]])
188   // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
189   return SVE_ACLE_FUNC(svqincp,_u16,,)(op, pg);
190 }
191 
test_svqincp_u32(svuint32_t op,svbool_t pg)192 svuint32_t test_svqincp_u32(svuint32_t op, svbool_t pg)
193 {
194   // CHECK-LABEL: test_svqincp_u32
195   // CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
196   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.uqincp.nxv4i32(<vscale x 4 x i32> %op, <vscale x 4 x i1> %[[PG]])
197   // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
198   return SVE_ACLE_FUNC(svqincp,_u32,,)(op, pg);
199 }
200 
test_svqincp_u64(svuint64_t op,svbool_t pg)201 svuint64_t test_svqincp_u64(svuint64_t op, svbool_t pg)
202 {
203   // CHECK-LABEL: test_svqincp_u64
204   // CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
205   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.uqincp.nxv2i64(<vscale x 2 x i64> %op, <vscale x 2 x i1> %[[PG]])
206   // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
207   return SVE_ACLE_FUNC(svqincp,_u64,,)(op, pg);
208 }
209