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_svcnot_s8_z(svbool_t pg,svint8_t op)16 svint8_t test_svcnot_s8_z(svbool_t pg, svint8_t op)
17 {
18 // CHECK-LABEL: test_svcnot_s8_z
19 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.cnot.nxv16i8(<vscale x 16 x i8> zeroinitializer, <vscale x 16 x i1> %pg, <vscale x 16 x i8> %op)
20 // CHECK: ret <vscale x 16 x i8> %[[INTRINSIC]]
21 return SVE_ACLE_FUNC(svcnot,_s8,_z,)(pg, op);
22 }
23
test_svcnot_s16_z(svbool_t pg,svint16_t op)24 svint16_t test_svcnot_s16_z(svbool_t pg, svint16_t op)
25 {
26 // CHECK-LABEL: test_svcnot_s16_z
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 <vscale x 8 x i16> @llvm.aarch64.sve.cnot.nxv8i16(<vscale x 8 x i16> zeroinitializer, <vscale x 8 x i1> %[[PG]], <vscale x 8 x i16> %op)
29 // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
30 return SVE_ACLE_FUNC(svcnot,_s16,_z,)(pg, op);
31 }
32
test_svcnot_s32_z(svbool_t pg,svint32_t op)33 svint32_t test_svcnot_s32_z(svbool_t pg, svint32_t op)
34 {
35 // CHECK-LABEL: test_svcnot_s32_z
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 <vscale x 4 x i32> @llvm.aarch64.sve.cnot.nxv4i32(<vscale x 4 x i32> zeroinitializer, <vscale x 4 x i1> %[[PG]], <vscale x 4 x i32> %op)
38 // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
39 return SVE_ACLE_FUNC(svcnot,_s32,_z,)(pg, op);
40 }
41
test_svcnot_s64_z(svbool_t pg,svint64_t op)42 svint64_t test_svcnot_s64_z(svbool_t pg, svint64_t op)
43 {
44 // CHECK-LABEL: test_svcnot_s64_z
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 <vscale x 2 x i64> @llvm.aarch64.sve.cnot.nxv2i64(<vscale x 2 x i64> zeroinitializer, <vscale x 2 x i1> %[[PG]], <vscale x 2 x i64> %op)
47 // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
48 return SVE_ACLE_FUNC(svcnot,_s64,_z,)(pg, op);
49 }
50
test_svcnot_u8_z(svbool_t pg,svuint8_t op)51 svuint8_t test_svcnot_u8_z(svbool_t pg, svuint8_t op)
52 {
53 // CHECK-LABEL: test_svcnot_u8_z
54 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.cnot.nxv16i8(<vscale x 16 x i8> zeroinitializer, <vscale x 16 x i1> %pg, <vscale x 16 x i8> %op)
55 // CHECK: ret <vscale x 16 x i8> %[[INTRINSIC]]
56 return SVE_ACLE_FUNC(svcnot,_u8,_z,)(pg, op);
57 }
58
test_svcnot_u16_z(svbool_t pg,svuint16_t op)59 svuint16_t test_svcnot_u16_z(svbool_t pg, svuint16_t op)
60 {
61 // CHECK-LABEL: test_svcnot_u16_z
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 <vscale x 8 x i16> @llvm.aarch64.sve.cnot.nxv8i16(<vscale x 8 x i16> zeroinitializer, <vscale x 8 x i1> %[[PG]], <vscale x 8 x i16> %op)
64 // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
65 return SVE_ACLE_FUNC(svcnot,_u16,_z,)(pg, op);
66 }
67
test_svcnot_u32_z(svbool_t pg,svuint32_t op)68 svuint32_t test_svcnot_u32_z(svbool_t pg, svuint32_t op)
69 {
70 // CHECK-LABEL: test_svcnot_u32_z
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 <vscale x 4 x i32> @llvm.aarch64.sve.cnot.nxv4i32(<vscale x 4 x i32> zeroinitializer, <vscale x 4 x i1> %[[PG]], <vscale x 4 x i32> %op)
73 // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
74 return SVE_ACLE_FUNC(svcnot,_u32,_z,)(pg, op);
75 }
76
test_svcnot_u64_z(svbool_t pg,svuint64_t op)77 svuint64_t test_svcnot_u64_z(svbool_t pg, svuint64_t op)
78 {
79 // CHECK-LABEL: test_svcnot_u64_z
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 <vscale x 2 x i64> @llvm.aarch64.sve.cnot.nxv2i64(<vscale x 2 x i64> zeroinitializer, <vscale x 2 x i1> %[[PG]], <vscale x 2 x i64> %op)
82 // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
83 return SVE_ACLE_FUNC(svcnot,_u64,_z,)(pg, op);
84 }
85
test_svcnot_s8_m(svint8_t inactive,svbool_t pg,svint8_t op)86 svint8_t test_svcnot_s8_m(svint8_t inactive, svbool_t pg, svint8_t op)
87 {
88 // CHECK-LABEL: test_svcnot_s8_m
89 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.cnot.nxv16i8(<vscale x 16 x i8> %inactive, <vscale x 16 x i1> %pg, <vscale x 16 x i8> %op)
90 // CHECK: ret <vscale x 16 x i8> %[[INTRINSIC]]
91 return SVE_ACLE_FUNC(svcnot,_s8,_m,)(inactive, pg, op);
92 }
93
test_svcnot_s16_m(svint16_t inactive,svbool_t pg,svint16_t op)94 svint16_t test_svcnot_s16_m(svint16_t inactive, svbool_t pg, svint16_t op)
95 {
96 // CHECK-LABEL: test_svcnot_s16_m
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 <vscale x 8 x i16> @llvm.aarch64.sve.cnot.nxv8i16(<vscale x 8 x i16> %inactive, <vscale x 8 x i1> %[[PG]], <vscale x 8 x i16> %op)
99 // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
100 return SVE_ACLE_FUNC(svcnot,_s16,_m,)(inactive, pg, op);
101 }
102
test_svcnot_s32_m(svint32_t inactive,svbool_t pg,svint32_t op)103 svint32_t test_svcnot_s32_m(svint32_t inactive, svbool_t pg, svint32_t op)
104 {
105 // CHECK-LABEL: test_svcnot_s32_m
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 <vscale x 4 x i32> @llvm.aarch64.sve.cnot.nxv4i32(<vscale x 4 x i32> %inactive, <vscale x 4 x i1> %[[PG]], <vscale x 4 x i32> %op)
108 // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
109 return SVE_ACLE_FUNC(svcnot,_s32,_m,)(inactive, pg, op);
110 }
111
test_svcnot_s64_m(svint64_t inactive,svbool_t pg,svint64_t op)112 svint64_t test_svcnot_s64_m(svint64_t inactive, svbool_t pg, svint64_t op)
113 {
114 // CHECK-LABEL: test_svcnot_s64_m
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 <vscale x 2 x i64> @llvm.aarch64.sve.cnot.nxv2i64(<vscale x 2 x i64> %inactive, <vscale x 2 x i1> %[[PG]], <vscale x 2 x i64> %op)
117 // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
118 return SVE_ACLE_FUNC(svcnot,_s64,_m,)(inactive, pg, op);
119 }
120
test_svcnot_u8_m(svuint8_t inactive,svbool_t pg,svuint8_t op)121 svuint8_t test_svcnot_u8_m(svuint8_t inactive, svbool_t pg, svuint8_t op)
122 {
123 // CHECK-LABEL: test_svcnot_u8_m
124 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.cnot.nxv16i8(<vscale x 16 x i8> %inactive, <vscale x 16 x i1> %pg, <vscale x 16 x i8> %op)
125 // CHECK: ret <vscale x 16 x i8> %[[INTRINSIC]]
126 return SVE_ACLE_FUNC(svcnot,_u8,_m,)(inactive, pg, op);
127 }
128
test_svcnot_u16_m(svuint16_t inactive,svbool_t pg,svuint16_t op)129 svuint16_t test_svcnot_u16_m(svuint16_t inactive, svbool_t pg, svuint16_t op)
130 {
131 // CHECK-LABEL: test_svcnot_u16_m
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 <vscale x 8 x i16> @llvm.aarch64.sve.cnot.nxv8i16(<vscale x 8 x i16> %inactive, <vscale x 8 x i1> %[[PG]], <vscale x 8 x i16> %op)
134 // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
135 return SVE_ACLE_FUNC(svcnot,_u16,_m,)(inactive, pg, op);
136 }
137
test_svcnot_u32_m(svuint32_t inactive,svbool_t pg,svuint32_t op)138 svuint32_t test_svcnot_u32_m(svuint32_t inactive, svbool_t pg, svuint32_t op)
139 {
140 // CHECK-LABEL: test_svcnot_u32_m
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 <vscale x 4 x i32> @llvm.aarch64.sve.cnot.nxv4i32(<vscale x 4 x i32> %inactive, <vscale x 4 x i1> %[[PG]], <vscale x 4 x i32> %op)
143 // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
144 return SVE_ACLE_FUNC(svcnot,_u32,_m,)(inactive, pg, op);
145 }
146
test_svcnot_u64_m(svuint64_t inactive,svbool_t pg,svuint64_t op)147 svuint64_t test_svcnot_u64_m(svuint64_t inactive, svbool_t pg, svuint64_t op)
148 {
149 // CHECK-LABEL: test_svcnot_u64_m
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 <vscale x 2 x i64> @llvm.aarch64.sve.cnot.nxv2i64(<vscale x 2 x i64> %inactive, <vscale x 2 x i1> %[[PG]], <vscale x 2 x i64> %op)
152 // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
153 return SVE_ACLE_FUNC(svcnot,_u64,_m,)(inactive, pg, op);
154 }
155
test_svcnot_s8_x(svbool_t pg,svint8_t op)156 svint8_t test_svcnot_s8_x(svbool_t pg, svint8_t op)
157 {
158 // CHECK-LABEL: test_svcnot_s8_x
159 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.cnot.nxv16i8(<vscale x 16 x i8> undef, <vscale x 16 x i1> %pg, <vscale x 16 x i8> %op)
160 // CHECK: ret <vscale x 16 x i8> %[[INTRINSIC]]
161 return SVE_ACLE_FUNC(svcnot,_s8,_x,)(pg, op);
162 }
163
test_svcnot_s16_x(svbool_t pg,svint16_t op)164 svint16_t test_svcnot_s16_x(svbool_t pg, svint16_t op)
165 {
166 // CHECK-LABEL: test_svcnot_s16_x
167 // CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
168 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.cnot.nxv8i16(<vscale x 8 x i16> undef, <vscale x 8 x i1> %[[PG]], <vscale x 8 x i16> %op)
169 // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
170 return SVE_ACLE_FUNC(svcnot,_s16,_x,)(pg, op);
171 }
172
test_svcnot_s32_x(svbool_t pg,svint32_t op)173 svint32_t test_svcnot_s32_x(svbool_t pg, svint32_t op)
174 {
175 // CHECK-LABEL: test_svcnot_s32_x
176 // CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
177 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.cnot.nxv4i32(<vscale x 4 x i32> undef, <vscale x 4 x i1> %[[PG]], <vscale x 4 x i32> %op)
178 // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
179 return SVE_ACLE_FUNC(svcnot,_s32,_x,)(pg, op);
180 }
181
test_svcnot_s64_x(svbool_t pg,svint64_t op)182 svint64_t test_svcnot_s64_x(svbool_t pg, svint64_t op)
183 {
184 // CHECK-LABEL: test_svcnot_s64_x
185 // CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
186 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.cnot.nxv2i64(<vscale x 2 x i64> undef, <vscale x 2 x i1> %[[PG]], <vscale x 2 x i64> %op)
187 // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
188 return SVE_ACLE_FUNC(svcnot,_s64,_x,)(pg, op);
189 }
190
test_svcnot_u8_x(svbool_t pg,svuint8_t op)191 svuint8_t test_svcnot_u8_x(svbool_t pg, svuint8_t op)
192 {
193 // CHECK-LABEL: test_svcnot_u8_x
194 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.cnot.nxv16i8(<vscale x 16 x i8> undef, <vscale x 16 x i1> %pg, <vscale x 16 x i8> %op)
195 // CHECK: ret <vscale x 16 x i8> %[[INTRINSIC]]
196 return SVE_ACLE_FUNC(svcnot,_u8,_x,)(pg, op);
197 }
198
test_svcnot_u16_x(svbool_t pg,svuint16_t op)199 svuint16_t test_svcnot_u16_x(svbool_t pg, svuint16_t op)
200 {
201 // CHECK-LABEL: test_svcnot_u16_x
202 // CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
203 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.cnot.nxv8i16(<vscale x 8 x i16> undef, <vscale x 8 x i1> %[[PG]], <vscale x 8 x i16> %op)
204 // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
205 return SVE_ACLE_FUNC(svcnot,_u16,_x,)(pg, op);
206 }
207
test_svcnot_u32_x(svbool_t pg,svuint32_t op)208 svuint32_t test_svcnot_u32_x(svbool_t pg, svuint32_t op)
209 {
210 // CHECK-LABEL: test_svcnot_u32_x
211 // CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
212 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.cnot.nxv4i32(<vscale x 4 x i32> undef, <vscale x 4 x i1> %[[PG]], <vscale x 4 x i32> %op)
213 // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
214 return SVE_ACLE_FUNC(svcnot,_u32,_x,)(pg, op);
215 }
216
test_svcnot_u64_x(svbool_t pg,svuint64_t op)217 svuint64_t test_svcnot_u64_x(svbool_t pg, svuint64_t op)
218 {
219 // CHECK-LABEL: test_svcnot_u64_x
220 // CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
221 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.cnot.nxv2i64(<vscale x 2 x i64> undef, <vscale x 2 x i1> %[[PG]], <vscale x 2 x i64> %op)
222 // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
223 return SVE_ACLE_FUNC(svcnot,_u64,_x,)(pg, op);
224 }
225