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_svqdecp_n_s32_b8(int32_t op,svbool_t pg)18 int32_t test_svqdecp_n_s32_b8(int32_t op, svbool_t pg)
19 {
20   // CHECK-LABEL: test_svqdecp_n_s32_b8
21   // CHECK: %[[INTRINSIC:.*]] = call i32 @llvm.aarch64.sve.sqdecp.n32.nxv16i1(i32 %op, <vscale x 16 x i1> %pg)
22   // CHECK: ret i32 %[[INTRINSIC]]
23   return SVE_ACLE_FUNC(svqdecp,_n_s32,_b8,)(op, pg);
24 }
25 
test_svqdecp_n_s32_b16(int32_t op,svbool_t pg)26 int32_t test_svqdecp_n_s32_b16(int32_t op, svbool_t pg)
27 {
28   // CHECK-LABEL: test_svqdecp_n_s32_b16
29   // CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
30   // CHECK: %[[INTRINSIC:.*]] = call i32 @llvm.aarch64.sve.sqdecp.n32.nxv8i1(i32 %op, <vscale x 8 x i1> %[[PG]])
31   // CHECK: ret i32 %[[INTRINSIC]]
32   return SVE_ACLE_FUNC(svqdecp,_n_s32,_b16,)(op, pg);
33 }
34 
test_svqdecp_n_s32_b32(int32_t op,svbool_t pg)35 int32_t test_svqdecp_n_s32_b32(int32_t op, svbool_t pg)
36 {
37   // CHECK-LABEL: test_svqdecp_n_s32_b32
38   // CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
39   // CHECK: %[[INTRINSIC:.*]] = call i32 @llvm.aarch64.sve.sqdecp.n32.nxv4i1(i32 %op, <vscale x 4 x i1> %[[PG]])
40   // CHECK: ret i32 %[[INTRINSIC]]
41   return SVE_ACLE_FUNC(svqdecp,_n_s32,_b32,)(op, pg);
42 }
43 
test_svqdecp_n_s32_b64(int32_t op,svbool_t pg)44 int32_t test_svqdecp_n_s32_b64(int32_t op, svbool_t pg)
45 {
46   // CHECK-LABEL: test_svqdecp_n_s32_b64
47   // CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
48   // CHECK: %[[INTRINSIC:.*]] = call i32 @llvm.aarch64.sve.sqdecp.n32.nxv2i1(i32 %op, <vscale x 2 x i1> %[[PG]])
49   // CHECK: ret i32 %[[INTRINSIC]]
50   return SVE_ACLE_FUNC(svqdecp,_n_s32,_b64,)(op, pg);
51 }
52 
test_svqdecp_n_s64_b8(int64_t op,svbool_t pg)53 int64_t test_svqdecp_n_s64_b8(int64_t op, svbool_t pg)
54 {
55   // CHECK-LABEL: test_svqdecp_n_s64_b8
56   // CHECK: %[[INTRINSIC:.*]] = call i64 @llvm.aarch64.sve.sqdecp.n64.nxv16i1(i64 %op, <vscale x 16 x i1> %pg)
57   // CHECK: ret i64 %[[INTRINSIC]]
58   return SVE_ACLE_FUNC(svqdecp,_n_s64,_b8,)(op, pg);
59 }
60 
test_svqdecp_n_s64_b16(int64_t op,svbool_t pg)61 int64_t test_svqdecp_n_s64_b16(int64_t op, svbool_t pg)
62 {
63   // CHECK-LABEL: test_svqdecp_n_s64_b16
64   // CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
65   // CHECK: %[[INTRINSIC:.*]] = call i64 @llvm.aarch64.sve.sqdecp.n64.nxv8i1(i64 %op, <vscale x 8 x i1> %[[PG]])
66   // CHECK: ret i64 %[[INTRINSIC]]
67   return SVE_ACLE_FUNC(svqdecp,_n_s64,_b16,)(op, pg);
68 }
69 
test_svqdecp_n_s64_b32(int64_t op,svbool_t pg)70 int64_t test_svqdecp_n_s64_b32(int64_t op, svbool_t pg)
71 {
72   // CHECK-LABEL: test_svqdecp_n_s64_b32
73   // CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
74   // CHECK: %[[INTRINSIC:.*]] = call i64 @llvm.aarch64.sve.sqdecp.n64.nxv4i1(i64 %op, <vscale x 4 x i1> %[[PG]])
75   // CHECK: ret i64 %[[INTRINSIC]]
76   return SVE_ACLE_FUNC(svqdecp,_n_s64,_b32,)(op, pg);
77 }
78 
test_svqdecp_n_s64_b64(int64_t op,svbool_t pg)79 int64_t test_svqdecp_n_s64_b64(int64_t op, svbool_t pg)
80 {
81   // CHECK-LABEL: test_svqdecp_n_s64_b64
82   // CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
83   // CHECK: %[[INTRINSIC:.*]] = call i64 @llvm.aarch64.sve.sqdecp.n64.nxv2i1(i64 %op, <vscale x 2 x i1> %[[PG]])
84   // CHECK: ret i64 %[[INTRINSIC]]
85   return SVE_ACLE_FUNC(svqdecp,_n_s64,_b64,)(op, pg);
86 }
87 
test_svqdecp_n_u32_b8(uint32_t op,svbool_t pg)88 uint32_t test_svqdecp_n_u32_b8(uint32_t op, svbool_t pg)
89 {
90   // CHECK-LABEL: test_svqdecp_n_u32_b8
91   // CHECK: %[[INTRINSIC:.*]] = call i32 @llvm.aarch64.sve.uqdecp.n32.nxv16i1(i32 %op, <vscale x 16 x i1> %pg)
92   // CHECK: ret i32 %[[INTRINSIC]]
93   return SVE_ACLE_FUNC(svqdecp,_n_u32,_b8,)(op, pg);
94 }
95 
test_svqdecp_n_u32_b16(uint32_t op,svbool_t pg)96 uint32_t test_svqdecp_n_u32_b16(uint32_t op, svbool_t pg)
97 {
98   // CHECK-LABEL: test_svqdecp_n_u32_b16
99   // CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
100   // CHECK: %[[INTRINSIC:.*]] = call i32 @llvm.aarch64.sve.uqdecp.n32.nxv8i1(i32 %op, <vscale x 8 x i1> %[[PG]])
101   // CHECK: ret i32 %[[INTRINSIC]]
102   return SVE_ACLE_FUNC(svqdecp,_n_u32,_b16,)(op, pg);
103 }
104 
test_svqdecp_n_u32_b32(uint32_t op,svbool_t pg)105 uint32_t test_svqdecp_n_u32_b32(uint32_t op, svbool_t pg)
106 {
107   // CHECK-LABEL: test_svqdecp_n_u32_b32
108   // CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
109   // CHECK: %[[INTRINSIC:.*]] = call i32 @llvm.aarch64.sve.uqdecp.n32.nxv4i1(i32 %op, <vscale x 4 x i1> %[[PG]])
110   // CHECK: ret i32 %[[INTRINSIC]]
111   return SVE_ACLE_FUNC(svqdecp,_n_u32,_b32,)(op, pg);
112 }
113 
test_svqdecp_n_u32_b64(uint32_t op,svbool_t pg)114 uint32_t test_svqdecp_n_u32_b64(uint32_t op, svbool_t pg)
115 {
116   // CHECK-LABEL: test_svqdecp_n_u32_b64
117   // CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
118   // CHECK: %[[INTRINSIC:.*]] = call i32 @llvm.aarch64.sve.uqdecp.n32.nxv2i1(i32 %op, <vscale x 2 x i1> %[[PG]])
119   // CHECK: ret i32 %[[INTRINSIC]]
120   return SVE_ACLE_FUNC(svqdecp,_n_u32,_b64,)(op, pg);
121 }
122 
test_svqdecp_n_u64_b8(uint64_t op,svbool_t pg)123 uint64_t test_svqdecp_n_u64_b8(uint64_t op, svbool_t pg)
124 {
125   // CHECK-LABEL: test_svqdecp_n_u64_b8
126   // CHECK: %[[INTRINSIC:.*]] = call i64 @llvm.aarch64.sve.uqdecp.n64.nxv16i1(i64 %op, <vscale x 16 x i1> %pg)
127   // CHECK: ret i64 %[[INTRINSIC]]
128   return SVE_ACLE_FUNC(svqdecp,_n_u64,_b8,)(op, pg);
129 }
130 
test_svqdecp_n_u64_b16(uint64_t op,svbool_t pg)131 uint64_t test_svqdecp_n_u64_b16(uint64_t op, svbool_t pg)
132 {
133   // CHECK-LABEL: test_svqdecp_n_u64_b16
134   // CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
135   // CHECK: %[[INTRINSIC:.*]] = call i64 @llvm.aarch64.sve.uqdecp.n64.nxv8i1(i64 %op, <vscale x 8 x i1> %[[PG]])
136   // CHECK: ret i64 %[[INTRINSIC]]
137   return SVE_ACLE_FUNC(svqdecp,_n_u64,_b16,)(op, pg);
138 }
139 
test_svqdecp_n_u64_b32(uint64_t op,svbool_t pg)140 uint64_t test_svqdecp_n_u64_b32(uint64_t op, svbool_t pg)
141 {
142   // CHECK-LABEL: test_svqdecp_n_u64_b32
143   // CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
144   // CHECK: %[[INTRINSIC:.*]] = call i64 @llvm.aarch64.sve.uqdecp.n64.nxv4i1(i64 %op, <vscale x 4 x i1> %[[PG]])
145   // CHECK: ret i64 %[[INTRINSIC]]
146   return SVE_ACLE_FUNC(svqdecp,_n_u64,_b32,)(op, pg);
147 }
148 
test_svqdecp_n_u64_b64(uint64_t op,svbool_t pg)149 uint64_t test_svqdecp_n_u64_b64(uint64_t op, svbool_t pg)
150 {
151   // CHECK-LABEL: test_svqdecp_n_u64_b64
152   // CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
153   // CHECK: %[[INTRINSIC:.*]] = call i64 @llvm.aarch64.sve.uqdecp.n64.nxv2i1(i64 %op, <vscale x 2 x i1> %[[PG]])
154   // CHECK: ret i64 %[[INTRINSIC]]
155   return SVE_ACLE_FUNC(svqdecp,_n_u64,_b64,)(op, pg);
156 }
157 
test_svqdecp_s16(svint16_t op,svbool_t pg)158 svint16_t test_svqdecp_s16(svint16_t op, svbool_t pg)
159 {
160   // CHECK-LABEL: test_svqdecp_s16
161   // CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
162   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.sqdecp.nxv8i16(<vscale x 8 x i16> %op, <vscale x 8 x i1> %[[PG]])
163   // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
164   return SVE_ACLE_FUNC(svqdecp,_s16,,)(op, pg);
165 }
166 
test_svqdecp_s32(svint32_t op,svbool_t pg)167 svint32_t test_svqdecp_s32(svint32_t op, svbool_t pg)
168 {
169   // CHECK-LABEL: test_svqdecp_s32
170   // CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
171   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.sqdecp.nxv4i32(<vscale x 4 x i32> %op, <vscale x 4 x i1> %[[PG]])
172   // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
173   return SVE_ACLE_FUNC(svqdecp,_s32,,)(op, pg);
174 }
175 
test_svqdecp_s64(svint64_t op,svbool_t pg)176 svint64_t test_svqdecp_s64(svint64_t op, svbool_t pg)
177 {
178   // CHECK-LABEL: test_svqdecp_s64
179   // CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
180   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.sqdecp.nxv2i64(<vscale x 2 x i64> %op, <vscale x 2 x i1> %[[PG]])
181   // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
182   return SVE_ACLE_FUNC(svqdecp,_s64,,)(op, pg);
183 }
184 
test_svqdecp_u16(svuint16_t op,svbool_t pg)185 svuint16_t test_svqdecp_u16(svuint16_t op, svbool_t pg)
186 {
187   // CHECK-LABEL: test_svqdecp_u16
188   // CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
189   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.uqdecp.nxv8i16(<vscale x 8 x i16> %op, <vscale x 8 x i1> %[[PG]])
190   // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
191   return SVE_ACLE_FUNC(svqdecp,_u16,,)(op, pg);
192 }
193 
test_svqdecp_u32(svuint32_t op,svbool_t pg)194 svuint32_t test_svqdecp_u32(svuint32_t op, svbool_t pg)
195 {
196   // CHECK-LABEL: test_svqdecp_u32
197   // CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
198   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.uqdecp.nxv4i32(<vscale x 4 x i32> %op, <vscale x 4 x i1> %[[PG]])
199   // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
200   return SVE_ACLE_FUNC(svqdecp,_u32,,)(op, pg);
201 }
202 
test_svqdecp_u64(svuint64_t op,svbool_t pg)203 svuint64_t test_svqdecp_u64(svuint64_t op, svbool_t pg)
204 {
205   // CHECK-LABEL: test_svqdecp_u64
206   // CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
207   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.uqdecp.nxv2i64(<vscale x 2 x i64> %op, <vscale x 2 x i1> %[[PG]])
208   // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
209   return SVE_ACLE_FUNC(svqdecp,_u64,,)(op, pg);
210 }
211