Debian Codegraph @

clang/test/Sema/AArch64/sve-vector-conditional-op.cpp

raw
1 // RUN: %clang_cc1 %s -fsyntax-only -triple aarch64-none-linux-gnu -target-feature +sve -verify
2
3 typedef int fixed_vector __attribute__((vector_size(4)));
4
5 auto error_fixed_vector_result(__SVBool_t svbool, fixed_vector a, fixed_vector b) {
6 // expected-error@+1 {{vector condition type '__SVBool_t' and result type 'fixed_vector' (vector of 1 'int' value) do not have the same number of elements}}
7 return svbool ? a : b;
8 }
9
10 auto error_void_result(__SVBool_t svbool) {
11 // expected-error@+1 {{GNU vector conditional operand cannot be void}}
12 return svbool ? (void)0 : (void)1;
13 }
14
15 auto error_sve_splat_result_unsupported(__SVBool_t svbool, long long a, long long b) {
16 // expected-error@+1 {{scalar type 'long long' not supported with vector condition type '__SVBool_t'}}
17 return svbool ? a : b;
18 }
19
20 auto error_sve_vector_result_matched_element_count(__SVBool_t svbool, __SVUint32_t a, __SVUint32_t b) {
21 // expected-error@+1 {{vector condition type '__SVBool_t' and result type '__SVUint32_t' do not have the same number of elements}}
22 return svbool ? a : b;
23 }
24
25 auto error_fixed_cond_mixed_scalar_and_vector_operands(fixed_vector cond, unsigned char a, __SVUint8_t b) {
26 // expected-error@+1 {{cannot mix vectors and sizeless vectors in a vector conditional}}
27 return cond ? a : b;
28 }
29
30 auto error_scalable_cond_mixed_scalar_and_vector_operands(__SVBool_t svbool, unsigned char a, fixed_vector b) {
31 // expected-error@+1 {{cannot mix vectors and sizeless vectors in a vector conditional}}
32 return svbool ? a : b;
33 }
34
35 // The following cases should be supported:
36
37 __SVBool_t cond_svbool(__SVBool_t a, __SVBool_t b) {
38 return a < b ? a : b;
39 }
40
41 __SVFloat32_t cond_svf32(__SVFloat32_t a, __SVFloat32_t b) {
42 return a < b ? a : b;
43 }
44
45 __SVUint64_t cond_u64_splat(__SVUint64_t a) {
46 return a < 1ul ? a : 1ul;
47 }