Update existing compile test with tests to cover C/C++ operations on svbool_t type objects.
gcc/testsuite/ChangeLog: * g++.dg/ext/sve-sizeless-1.C: Add new tests. * g++.dg/ext/sve-sizeless-2.C: Add new tests. * g++.target/aarch64/sve/acle/general-c++/gnu_vectors_1.C: Add new tests. * g++.target/aarch64/sve/acle/general-c++/gnu_vectors_2.C: Add new tests. * gcc.target/aarch64/sve/acle/general-c/gnu_vectors_1.c: Add new tests. * gcc.target/aarch64/sve/acle/general-c/gnu_vectors_2.c: Add new tests. * gcc.target/aarch64/sve/acle/general-c/sizeless-1.c: Add new tests. * gcc.target/aarch64/sve/acle/general-c/sizeless-2.c : Add new tests. --- gcc/testsuite/g++.dg/ext/sve-sizeless-1.C | 10 ++ gcc/testsuite/g++.dg/ext/sve-sizeless-2.C | 21 +++ .../sve/acle/general-c++/gnu_vectors_1.C | 138 +++++++++++++++++- .../sve/acle/general-c++/gnu_vectors_2.C | 138 +++++++++++++++++- .../sve/acle/general-c/gnu_vectors_1.c | 133 ++++++++++++++++- .../sve/acle/general-c/gnu_vectors_2.c | 133 ++++++++++++++++- .../aarch64/sve/acle/general-c/sizeless-1.c | 14 +- .../aarch64/sve/acle/general-c/sizeless-2.c | 32 ++++ 8 files changed, 610 insertions(+), 9 deletions(-) diff --git a/gcc/testsuite/g++.dg/ext/sve-sizeless-1.C b/gcc/testsuite/g++.dg/ext/sve-sizeless-1.C index 37bcec1efb9..23688dd3e6e 100644 --- a/gcc/testsuite/g++.dg/ext/sve-sizeless-1.C +++ b/gcc/testsuite/g++.dg/ext/sve-sizeless-1.C @@ -173,6 +173,16 @@ statements (int n) svint32_t init_sve_vc8 = { 0, 1, 2, 3, 4, 5 }; // { dg-error {too many initializers for 'svint32_t'} } svint32_t init_sve_vc9 = { 0, bar (), 2, 3, 4, n }; // { dg-error {too many initializers for 'svint32_t'} } + svbool_t init_sve_vb1 = { 0, -1 }; + svbool_t init_sve_vb2 = { 0, bar () }; // { dg-warning {narrowing conversion} "" { target c++11 } } + svbool_t init_sve_vb3 = { bar (), n }; // { dg-warning {narrowing conversion} "" { target c++11 } } + svbool_t init_sve_vb4 = { 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + svbool_t init_sve_vb5 = { 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, bar (), 0, 0}; // { dg-warning {narrowing conversion} "" { target c++11 } } + svbool_t init_sve_vb6 = { 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1}; // { dg-error {too many initializers for 'svbool_t'} } + svbool_t init_sve_vb7 = { 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, bar ()}; // { dg-error {too many initializers for 'svbool_t'} } + svbool_t init_sve_vb8 = { 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, bar (), -1}; // { dg-error {too many initializers for 'svbool_t'} } + svbool_t init_sve_vb9 = { 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, bar (), n}; // { dg-error {too many initializers for 'svbool_t'} } + // Constructor calls. (0, svint8_t ()); diff --git a/gcc/testsuite/g++.dg/ext/sve-sizeless-2.C b/gcc/testsuite/g++.dg/ext/sve-sizeless-2.C index 3243a17f606..3ad4f3b1cd4 100644 --- a/gcc/testsuite/g++.dg/ext/sve-sizeless-2.C +++ b/gcc/testsuite/g++.dg/ext/sve-sizeless-2.C @@ -173,6 +173,27 @@ statements (int n) svint32_t init_sve_vc8 = { 0, bar (), 2, 3, 4, n, 5, 6, 7, 8, 9 }; // { dg-error {too many initializers for 'svint32_t'} } svint32_t init_sve_vc9 = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; // { dg-error {too many initializers for 'svint32_t'} } + svbool_t init_sve_vb1 = { 0, -1 }; + svbool_t init_sve_vb2 = { 0, bar () }; // { dg-warning {narrowing conversion} "" { target c++11 } } + svbool_t init_sve_vb3 = { bar (), n }; // { dg-warning {narrowing conversion} "" { target c++11 } } + svbool_t init_sve_vb4 = { 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // dg-warning { {overflow in conversion from} } + svbool_t init_sve_vb5 = { 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, -1, -1, -1, 0, 0, 0, bar (), 0, 0, 0, 0, 0, 0, // { dg-warning {narrowing conversion} "" { target c++11 } } + 0, 0 }; + svbool_t init_sve_vb6 = { 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0 }; // { dg-error {too many initializers for 'svbool_t'} } + svbool_t init_sve_vb7 = { 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + bar () }; // { dg-error {too many initializers for 'svbool_t'} } + svbool_t init_sve_vb8 = { 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + bar (), -1 }; // { dg-error {too many initializers for 'svbool_t'} } + svbool_t init_sve_vb9 = { 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + bar (), n}; // { dg-error {too many initializers for 'svbool_t'} } + // Constructor calls. (0, svint8_t ()); diff --git a/gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/gnu_vectors_1.C b/gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/gnu_vectors_1.C index cdd48cbc454..2a5228e9f82 100644 --- a/gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/gnu_vectors_1.C +++ b/gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/gnu_vectors_1.C @@ -5,9 +5,13 @@ typedef uint8_t gnu_uint8_t __attribute__ ((vector_size (32))); typedef int8_t gnu_int8_t __attribute__ ((vector_size (32))); +typedef int32_t gnu128_int32_t __attribute__ ((vector_size (128))); +typedef int32_t gnu32_int32_t __attribute__ ((vector_size (32))); + void -f (svuint8_t sve_u1, svint8_t sve_s1, - gnu_uint8_t gnu_u1, gnu_int8_t gnu_s1, int n, unsigned char uc) +f (svuint8_t sve_u1, svint8_t sve_s1, svbool_t sve_b1, svbool_t sve_b2, + gnu_uint8_t gnu_u1, gnu_int8_t gnu_s1, gnu128_int32_t gnu128_s1, + int n, unsigned char uc) { // Initialization @@ -56,6 +60,20 @@ f (svuint8_t sve_u1, svint8_t sve_s1, gnu_uint8_t init_gnu_u20 (sve_s1); // { dg-error {cannot convert 'svint8_t' to 'gnu_uint8_t'[^\n]* in initialization} } gnu_uint8_t init_gnu_u21 (gnu_s1); // { dg-error {cannot convert 'gnu_int8_t'[^\n]* to 'gnu_uint8_t'[^\n]* in initialization} } + // Boolean inits. + svbool_t init_sve_b1 = 0; // { dg-error {cannot convert 'int' to 'svbool_t'} } + svbool_t init_sve_b2 = {}; + svbool_t init_sve_b3 = { sve_b1 }; + svbool_t init_sve_b4 = { gnu_u1 }; // { dg-error {cannot convert 'gnu_uint8_t'[^\n]* to 'signed char:1'} } + svbool_t init_sve_b5 = { sve_s1 }; // { dg-error {cannot convert 'svint8_t' to 'signed char:1'} } + svbool_t init_sve_b6 = { gnu_s1 }; // { dg-error {cannot convert 'gnu_int8_t'[^\n]* to 'signed char:1'} } + svbool_t init_sve_b7 = { 0 }; + + svbool_t init_sve_b8 = { sve_u1, sve_u1 }; // { dg-error {cannot convert 'svuint8_t' to 'signed char:1'} } + svbool_t init_sve_b9 = { gnu_u1, gnu_u1 }; // { dg-error {cannot convert 'gnu_uint8_t'[^\n]* to 'signed char:1'} } + init_gnu_u8 = { sve_b1 }; // { dg-error {cannot convert '<brace-enclosed initializer list>' to 'gnu_uint8_t'[^\n]*} } + init_gnu_u8 = { sve_b1, sve_b1 }; // { dg-error {cannot convert '<brace-enclosed initializer list>' to 'gnu_uint8_t'[^\n]*} } + // Compound literals (svuint8_t) {}; @@ -76,6 +94,17 @@ f (svuint8_t sve_u1, svint8_t sve_s1, (gnu_uint8_t) { sve_u1, sve_u1 }; // { dg-error {cannot convert 'svuint8_t' to 'unsigned char' in initialization} } (gnu_uint8_t) { gnu_u1, gnu_u1 }; // { dg-error {cannot convert 'gnu_uint8_t'[^\n]* to 'unsigned char' in initialization} } + // Boolean compound literals. + + (svbool_t) {}; + (svbool_t) { 0 }; + (svbool_t) { sve_b1 }; + (svbool_t) { gnu_u1 }; // { dg-error {cannot convert 'gnu_uint8_t'[^\n]* to 'signed char:1'} } + (svbool_t) { sve_s1 }; // { dg-error {cannot convert 'svint8_t' to 'signed char:1'} } + (svbool_t) { sve_u1 }; // { dg-error {cannot convert 'svuint8_t' to 'signed char:1'} } + (svbool_t) { gnu_s1 }; // { dg-error {cannot convert 'gnu_int8_t'[^\n]* to 'signed char:1'} } + (gnu_uint8_t) { sve_b1 }; // { dg-error {cannot convert 'svbool_t' to 'unsigned char'} } + // Assignment sve_u1 = 0; // { dg-error {cannot convert 'int' to 'svuint8_t' in assignment} } @@ -90,6 +119,14 @@ f (svuint8_t sve_u1, svint8_t sve_s1, gnu_u1 = sve_s1; // { dg-error {cannot convert 'svint8_t' to 'gnu_uint8_t'[^\n]* in assignment} } gnu_u1 = gnu_s1; // { dg-error {cannot convert 'gnu_int8_t'[^\n]* to 'gnu_uint8_t'[^\n]* in assignment} } + // Boolean Assignments. + + sve_b1 = 0; // { dg-error {cannot convert 'int' to 'svbool_t'} } + sve_b1 = sve_b1; + sve_b1 = sve_s1; // { dg-error {cannot convert 'svint8_t' to 'svbool_t'} } + sve_b1 = gnu_s1; // { dg-error {cannot convert 'gnu_int8_t'[^\n]* to 'svbool_t'} } + gnu_u1 = sve_b1; // { dg-error {cannot convert 'svbool_t' to 'gnu_uint8_t'} } + // Casts (void) sve_u1; @@ -112,6 +149,17 @@ f (svuint8_t sve_u1, svint8_t sve_s1, (gnu_uint8_t) sve_s1; (gnu_uint8_t) gnu_s1; + // Boolean casts. + (void) sve_b1; + (svbool_t) sve_b1; + (svbool_t) gnu_u1; // { dg-error {cannot convert a value of type 'gnu_uint8_t'[^\n]* to vector type 'svbool_t' which has different size} } + (svbool_t) sve_u1; // { dg-error {cannot convert a value of type 'svuint8_t' to vector type 'svbool_t' which has different size} } + (svbool_t) 0; + (svbool_t) n; + (svint8_t) sve_b1; // { dg-error {cannot convert a value of type 'svbool_t' to vector type 'svint8_t' which has different size} } + (gnu_uint8_t) sve_b1; // { dg-error {cannot convert a value of type 'svbool_t' to vector type 'gnu_uint8_t'[^\n]* which has different size} } + (gnu_int8_t) sve_b1; // { dg-error {cannot convert a value of type 'svbool_t' to vector type 'gnu_int8_t'[^\n]* which has different size} } + // Vector indexing. sve_u1[0]; @@ -120,6 +168,11 @@ f (svuint8_t sve_u1, svint8_t sve_s1, gnu_u1[0]; &gnu_u1[0]; + // Boolean vector indexing. + + sve_b1[0]; + &sve_b1[0]; // { dg-error {taking address of a boolean vector element} } + // Unary vector arithmetic. +sve_u1; @@ -147,6 +200,20 @@ f (svuint8_t sve_u1, svint8_t sve_s1, gnu_u1++; gnu_u1--; + // Boolean unary ops. + + +sve_b1; + -sve_b1; // { dg-error {negation operation not permitted} } + ~sve_b1; + !sve_b1; + *sve_b1; // { dg-error {invalid type argument of unary '\*'} } + __real sve_b1; // { dg-error {wrong type argument to __real} } + __imag sve_b1; // { dg-error {wrong type argument to __imag} } + ++sve_b1; // { dg-error {not permitted} } + --sve_b1; // { dg-error {not permitted} } + sve_b1++; // { dg-error {not permitted} } + sve_b1--; // { dg-error {not permitted} } + // Vector-vector binary arithmetic. sve_u1 + sve_u1; @@ -169,6 +236,27 @@ f (svuint8_t sve_u1, svint8_t sve_s1, sve_u1 && sve_u1; sve_u1 || sve_u1; + // Boolean vector-vector binary arithmetic. + + sve_b1 + sve_b1; // { dg-error {not permitted} } + sve_b1 - sve_b1; // { dg-error {not permitted} } + sve_b1 * sve_b1; // { dg-error {not permitted} } + sve_b1 / sve_b1; // { dg-error {not permitted} } + sve_b1 % sve_b1; // { dg-error {invalid operands} } + sve_b1 & sve_b1; + sve_b1 | sve_b1; + sve_b1 ^ sve_b1; + sve_b1 == sve_b1; + sve_b1 != sve_b1; + sve_b1 <= sve_b1; // { dg-error {only == and != operations permitted} } + sve_b1 < sve_b1; // { dg-error {only == and != operations permitted} } + sve_b1 > sve_b1; // { dg-error {only == and != operations permitted} } + sve_b1 >= sve_b1; // { dg-error {only == and != operations permitted} } + sve_b1 << sve_b1; // { dg-error {not permitted} } + sve_b1 >> sve_b1; // { dg-error {not permitted} } + sve_b1 && sve_b1; + sve_b1 || sve_b1; + sve_u1 + gnu_u1; // { dg-error {cannot combine GNU and SVE vectors in a binary operation} } sve_u1 - gnu_u1; // { dg-error {cannot combine GNU and SVE vectors in a binary operation} } sve_u1 * gnu_u1; // { dg-error {cannot combine GNU and SVE vectors in a binary operation} } @@ -456,6 +544,25 @@ f (svuint8_t sve_u1, svint8_t sve_s1, gnu_u1 ? gnu_u1 : uc; gnu_u1 ? uc : gnu_u1; + // Boolean conditional expressions. + + uc ? sve_b1 : sve_b2; + sve_b1 ? sve_b1 : sve_b2; + + sve_b1 ? sve_u1 : sve_u1; // { dg-error {incompatible vector types in conditional expression} } + sve_b1 ? sve_s1 : sve_s1; // { dg-error {incompatible vector types in conditional expression} } + sve_b1 ? gnu_u1 : sve_u1; // { dg-error {incompatible vector types in conditional expression} } + sve_b1 ? sve_u1 : gnu_u1; // { dg-error {incompatible vector types in conditional expression} } + sve_b1 ? gnu_u1 : gnu_u1; // { dg-error {incompatible vector types in conditional expression} } + sve_b1 ? gnu_s1 : gnu_s1; // { dg-error {incompatible vector types in conditional expression} } + + sve_u1 ? sve_b1 : sve_b2; // { dg-error {incompatible vector types in conditional expression} } + sve_s1 ? sve_b1 : sve_b2; // { dg-error {incompatible vector types in conditional expression} } + gnu_u1 ? sve_b1 : sve_b2; // { dg-error {incompatible vector types in conditional expression} } + gnu_s1 ? sve_b1 : sve_b2; // { dg-error {incompatible vector types in conditional expression} } + gnu_u1 ? gnu_u1 : sve_b1; // { dg-error {incompatible vector types in conditional expression} } + gnu_u1 ? sve_b1 : gnu_u1; // { dg-error {incompatible vector types in conditional expression} } + // Vector built-ins. __builtin_shuffle (sve_u1, sve_u1, sve_u1); @@ -469,6 +576,33 @@ f (svuint8_t sve_u1, svint8_t sve_s1, __builtin_convertvector (sve_u1, gnu_uint8_t); __builtin_convertvector (gnu_u1, gnu_uint8_t); + // Boolean vector built-ins. + + __builtin_shuffle (sve_b1, sve_b1, sve_s1); + __builtin_shuffle (sve_b1, sve_b1, sve_u1); + __builtin_shuffle (sve_b1, sve_b1, gnu_s1); + __builtin_shuffle (sve_b1, sve_b1, gnu_u1); + + __builtin_shuffle (sve_b1, gnu_u1, gnu_u1); // { dg-error {'__builtin_shuffle' argument vectors must be of the same type} } + __builtin_shuffle (gnu_u1, sve_b1, gnu_u1); // { dg-error {'__builtin_shuffle' argument vectors must be of the same type} } + + __builtin_convertvector (sve_b1, svint8_t); + __builtin_convertvector (sve_b1, svuint8_t); + __builtin_convertvector (sve_b1, gnu_int8_t); + __builtin_convertvector (sve_b1, gnu_uint8_t); + + __builtin_convertvector (sve_s1, svbool_t); + __builtin_convertvector (gnu_s1, svbool_t); + __builtin_convertvector (sve_u1, svbool_t); + __builtin_convertvector (gnu_u1, svbool_t); + + __builtin_convertvector (sve_b1, svint32_t); /* { dg-error {'__builtin_convertvector' number of elements of the first argument vector and the second argument vector type should be the same} } */ + __builtin_convertvector (sve_b1, svuint32_t); /* { dg-error {'__builtin_convertvector' number of elements of the first argument vector and the second argument vector type should be the same} } */ + __builtin_convertvector (sve_b1, gnu32_int32_t); /* { dg-error {'__builtin_convertvector' number of elements of the first argument vector and the second argument vector type should be the same} } */ + + __builtin_convertvector (sve_b1, gnu128_int32_t); + __builtin_convertvector (gnu128_s1, svbool_t); + // Type queries. static_assert(__is_literal_type(svuint8_t)); diff --git a/gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/gnu_vectors_2.C b/gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/gnu_vectors_2.C index 587d28d2363..e44229c8df1 100644 --- a/gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/gnu_vectors_2.C +++ b/gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/gnu_vectors_2.C @@ -5,9 +5,13 @@ typedef uint8_t gnu_uint8_t __attribute__ ((vector_size (32))); typedef int8_t gnu_int8_t __attribute__ ((vector_size (32))); +typedef int32_t gnu128_int32_t __attribute__ ((vector_size (128))); +typedef int32_t gnu32_int32_t __attribute__ ((vector_size (32))); + void -f (svuint8_t sve_u1, svint8_t sve_s1, - gnu_uint8_t gnu_u1, gnu_int8_t gnu_s1, int n, unsigned char uc) +f (svuint8_t sve_u1, svint8_t sve_s1, svbool_t sve_b1, svbool_t sve_b2, + gnu_uint8_t gnu_u1, gnu_int8_t gnu_s1, gnu128_int32_t gnu128_s1, + int n, unsigned char uc) { // Initialization @@ -56,6 +60,20 @@ f (svuint8_t sve_u1, svint8_t sve_s1, gnu_uint8_t init_gnu_u20 (sve_s1); gnu_uint8_t init_gnu_u21 (gnu_s1); + // Boolean inits. + svbool_t init_sve_b1 = 0; // { dg-error {cannot convert 'int' to 'svbool_t'} } + svbool_t init_sve_b2 = {}; + svbool_t init_sve_b3 = { sve_b1 }; + svbool_t init_sve_b4 = { gnu_u1 }; // { dg-error {cannot convert 'gnu_uint8_t'[^\n]* to 'signed char:1'} } + svbool_t init_sve_b5 = { sve_s1 }; // { dg-error {cannot convert 'svint8_t' to 'signed char:1'} } + svbool_t init_sve_b6 = { gnu_s1 }; // { dg-error {cannot convert 'gnu_int8_t'[^\n]* to 'signed char:1'} } + svbool_t init_sve_b7 = { 0 }; + + svbool_t init_sve_b8 = { sve_u1, sve_u1 }; // { dg-error {cannot convert 'svuint8_t' to 'signed char:1'} } + svbool_t init_sve_b9 = { gnu_u1, gnu_u1 }; // { dg-error {cannot convert 'gnu_uint8_t'[^\n]* to 'signed char:1'} } + init_gnu_u8 = { sve_b1 }; // { dg-error {cannot convert '<brace-enclosed initializer list>' to 'gnu_uint8_t'[^\n]*} } + init_gnu_u8 = { sve_b1, sve_b1 }; // { dg-error {cannot convert '<brace-enclosed initializer list>' to 'gnu_uint8_t'[^\n]*} } + // Compound literals (svuint8_t) {}; @@ -76,6 +94,17 @@ f (svuint8_t sve_u1, svint8_t sve_s1, (gnu_uint8_t) { sve_u1, sve_u1 }; // { dg-error {cannot convert 'svuint8_t' to 'unsigned char' in initialization} } (gnu_uint8_t) { gnu_u1, gnu_u1 }; // { dg-error {cannot convert 'gnu_uint8_t'[^\n]* to 'unsigned char' in initialization} } + // Boolean compound literals. + + (svbool_t) {}; + (svbool_t) { 0 }; + (svbool_t) { sve_b1 }; + (svbool_t) { gnu_u1 }; // { dg-error {cannot convert 'gnu_uint8_t'[^\n]* to 'signed char:1'} } + (svbool_t) { sve_s1 }; // { dg-error {cannot convert 'svint8_t' to 'signed char:1'} } + (svbool_t) { sve_u1 }; // { dg-error {cannot convert 'svuint8_t' to 'signed char:1'} } + (svbool_t) { gnu_s1 }; // { dg-error {cannot convert 'gnu_int8_t'[^\n]* to 'signed char:1'} } + (gnu_uint8_t) { sve_b1 }; // { dg-error {cannot convert 'svbool_t' to 'unsigned char'} } + // Assignment sve_u1 = 0; // { dg-error {cannot convert 'int' to 'svuint8_t' in assignment} } @@ -90,6 +119,14 @@ f (svuint8_t sve_u1, svint8_t sve_s1, gnu_u1 = sve_s1; gnu_u1 = gnu_s1; + // Boolean Assignments. + + sve_b1 = 0; // { dg-error {cannot convert 'int' to 'svbool_t'} } + sve_b1 = sve_b1; + sve_b1 = sve_s1; // { dg-error {cannot convert 'svint8_t' to 'svbool_t'} } + sve_b1 = gnu_s1; // { dg-error {cannot convert 'gnu_int8_t'[^\n]* to 'svbool_t'} } + gnu_u1 = sve_b1; // { dg-error {cannot convert 'svbool_t' to 'gnu_uint8_t'} } + // Casts (void) sve_u1; @@ -112,6 +149,17 @@ f (svuint8_t sve_u1, svint8_t sve_s1, (gnu_uint8_t) sve_s1; (gnu_uint8_t) gnu_s1; + // Boolean casts. + (void) sve_b1; + (svbool_t) sve_b1; + (svbool_t) gnu_u1; // { dg-error {cannot convert a value of type 'gnu_uint8_t'[^\n]* to vector type 'svbool_t' which has different size} } + (svbool_t) sve_u1; // { dg-error {cannot convert a value of type 'svuint8_t' to vector type 'svbool_t' which has different size} } + (svbool_t) 0; + (svbool_t) n; + (svint8_t) sve_b1; // { dg-error {cannot convert a value of type 'svbool_t' to vector type 'svint8_t' which has different size} } + (gnu_uint8_t) sve_b1; // { dg-error {cannot convert a value of type 'svbool_t' to vector type 'gnu_uint8_t'[^\n]* which has different size} } + (gnu_int8_t) sve_b1; // { dg-error {cannot convert a value of type 'svbool_t' to vector type 'gnu_int8_t'[^\n]* which has different size} } + // Vector indexing. sve_u1[0]; @@ -120,6 +168,11 @@ f (svuint8_t sve_u1, svint8_t sve_s1, gnu_u1[0]; &gnu_u1[0]; + // Boolean vector indexing. + + sve_b1[0]; + &sve_b1[0]; // { dg-error {taking address of a boolean vector element} } + // Unary vector arithmetic. +sve_u1; @@ -147,6 +200,20 @@ f (svuint8_t sve_u1, svint8_t sve_s1, gnu_u1++; gnu_u1--; + // Boolean unary ops. + + +sve_b1; + -sve_b1; // { dg-error {negation operation not permitted} } + ~sve_b1; + !sve_b1; + *sve_b1; // { dg-error {invalid type argument of unary '\*'} } + __real sve_b1; // { dg-error {wrong type argument to __real} } + __imag sve_b1; // { dg-error {wrong type argument to __imag} } + ++sve_b1; // { dg-error {not permitted} } + --sve_b1; // { dg-error {not permitted} } + sve_b1++; // { dg-error {not permitted} } + sve_b1--; // { dg-error {not permitted} } + // Vector-vector binary arithmetic. sve_u1 + sve_u1; @@ -169,6 +236,27 @@ f (svuint8_t sve_u1, svint8_t sve_s1, sve_u1 && sve_u1; sve_u1 || sve_u1; + // Boolean vector-vector binary arithmetic. + + sve_b1 + sve_b1; // { dg-error {not permitted} } + sve_b1 - sve_b1; // { dg-error {not permitted} } + sve_b1 * sve_b1; // { dg-error {not permitted} } + sve_b1 / sve_b1; // { dg-error {not permitted} } + sve_b1 % sve_b1; // { dg-error {invalid operands} } + sve_b1 & sve_b1; + sve_b1 | sve_b1; + sve_b1 ^ sve_b1; + sve_b1 == sve_b1; + sve_b1 != sve_b1; + sve_b1 <= sve_b1; // { dg-error {only == and != operations permitted} } + sve_b1 < sve_b1; // { dg-error {only == and != operations permitted} } + sve_b1 > sve_b1; // { dg-error {only == and != operations permitted} } + sve_b1 >= sve_b1; // { dg-error {only == and != operations permitted} } + sve_b1 << sve_b1; // { dg-error {not permitted} } + sve_b1 >> sve_b1; // { dg-error {not permitted} } + sve_b1 && sve_b1; + sve_b1 || sve_b1; + sve_u1 + gnu_u1; // { dg-error {cannot combine GNU and SVE vectors in a binary operation} } sve_u1 - gnu_u1; // { dg-error {cannot combine GNU and SVE vectors in a binary operation} } sve_u1 * gnu_u1; // { dg-error {cannot combine GNU and SVE vectors in a binary operation} } @@ -456,6 +544,25 @@ f (svuint8_t sve_u1, svint8_t sve_s1, gnu_u1 ? gnu_u1 : uc; gnu_u1 ? uc : gnu_u1; + // Boolean conditional expressions. + + uc ? sve_b1 : sve_b2; + sve_b1 ? sve_b1 : sve_b2; + + sve_b1 ? sve_u1 : sve_u1; // { dg-error {incompatible vector types in conditional expression} } + sve_b1 ? sve_s1 : sve_s1; // { dg-error {incompatible vector types in conditional expression} } + sve_b1 ? gnu_u1 : sve_u1; // { dg-error {incompatible vector types in conditional expression} } + sve_b1 ? sve_u1 : gnu_u1; // { dg-error {incompatible vector types in conditional expression} } + sve_b1 ? gnu_u1 : gnu_u1; // { dg-error {incompatible vector types in conditional expression} } + sve_b1 ? gnu_s1 : gnu_s1; // { dg-error {incompatible vector types in conditional expression} } + + sve_u1 ? sve_b1 : sve_b2; // { dg-error {incompatible vector types in conditional expression} } + sve_s1 ? sve_b1 : sve_b2; // { dg-error {incompatible vector types in conditional expression} } + gnu_u1 ? sve_b1 : sve_b2; // { dg-error {incompatible vector types in conditional expression} } + gnu_s1 ? sve_b1 : sve_b2; // { dg-error {incompatible vector types in conditional expression} } + gnu_u1 ? gnu_u1 : sve_b1; // { dg-error {incompatible vector types in conditional expression} } + gnu_u1 ? sve_b1 : gnu_u1; // { dg-error {incompatible vector types in conditional expression} } + // Vector built-ins. __builtin_shuffle (sve_u1, sve_u1, sve_u1); @@ -469,6 +576,33 @@ f (svuint8_t sve_u1, svint8_t sve_s1, __builtin_convertvector (sve_u1, gnu_uint8_t); __builtin_convertvector (gnu_u1, gnu_uint8_t); + // Boolean vector built-ins. + + __builtin_shuffle (sve_b1, sve_b1, sve_s1); + __builtin_shuffle (sve_b1, sve_b1, sve_u1); + __builtin_shuffle (sve_b1, sve_b1, gnu_s1); + __builtin_shuffle (sve_b1, sve_b1, gnu_u1); + + __builtin_shuffle (sve_b1, gnu_u1, gnu_u1); // { dg-error {'__builtin_shuffle' argument vectors must be of the same type} } + __builtin_shuffle (gnu_u1, sve_b1, gnu_u1); // { dg-error {'__builtin_shuffle' argument vectors must be of the same type} } + + __builtin_convertvector (sve_b1, svint8_t); + __builtin_convertvector (sve_b1, svuint8_t); + __builtin_convertvector (sve_b1, gnu_int8_t); + __builtin_convertvector (sve_b1, gnu_uint8_t); + + __builtin_convertvector (sve_s1, svbool_t); + __builtin_convertvector (gnu_s1, svbool_t); + __builtin_convertvector (sve_u1, svbool_t); + __builtin_convertvector (gnu_u1, svbool_t); + + __builtin_convertvector (sve_b1, svint32_t); /* { dg-error {'__builtin_convertvector' number of elements of the first argument vector and the second argument vector type should be the same} } */ + __builtin_convertvector (sve_b1, svuint32_t); /* { dg-error {'__builtin_convertvector' number of elements of the first argument vector and the second argument vector type should be the same} } */ + __builtin_convertvector (sve_b1, gnu32_int32_t); /* { dg-error {'__builtin_convertvector' number of elements of the first argument vector and the second argument vector type should be the same} } */ + + __builtin_convertvector (sve_b1, gnu128_int32_t); + __builtin_convertvector (gnu128_s1, svbool_t); + // Type queries. static_assert(__is_literal_type(svuint8_t)); diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/gnu_vectors_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/gnu_vectors_1.c index 32bb826e240..30c821f266a 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/gnu_vectors_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/gnu_vectors_1.c @@ -5,9 +5,12 @@ typedef uint8_t gnu_uint8_t __attribute__ ((vector_size (32))); typedef int8_t gnu_int8_t __attribute__ ((vector_size (32))); +typedef int32_t gnu128_int32_t __attribute__ ((vector_size (128))); +typedef int32_t gnu32_int32_t __attribute__ ((vector_size (32))); + void -f (svuint8_t sve_u1, svint8_t sve_s1, - gnu_uint8_t gnu_u1, gnu_int8_t gnu_s1, int n, unsigned char uc) +f (svuint8_t sve_u1, svint8_t sve_s1, svbool_t sve_b1, svbool_t sve_b2, + gnu_uint8_t gnu_u1, gnu_int8_t gnu_s1, gnu128_int32_t gnu128_s1, int n, unsigned char uc) { /* Initialization. */ @@ -19,6 +22,15 @@ f (svuint8_t sve_u1, svint8_t sve_s1, svuint8_t init_sve_u6 = { gnu_s1 }; /* { dg-error {incompatible types when initializing type 'unsigned char'} } */ svuint8_t init_sve_u7 = { 0 }; + /* Boolean inits. */ + svbool_t init_sve_b1 = 0; /* { dg-error {incompatible types when initializing type 'svbool_t' using type 'int'} } */ + svbool_t init_sve_b2 = {}; + svbool_t init_sve_b3 = { sve_b1 }; /* { dg-error {incompatible types when initializing type 'signed char:1'} } */ + svbool_t init_sve_b4 = { gnu_u1 }; /* { dg-error {incompatible types when initializing type 'signed char:1'} } */ + svbool_t init_sve_b5 = { sve_s1 }; /* { dg-error {incompatible types when initializing type 'signed char:1'} } */ + svbool_t init_sve_b6 = { gnu_s1 }; /* { dg-error {incompatible types when initializing type 'signed char:1'} } */ + svbool_t init_sve_b7 = { 0 }; + svuint8_t init_sve_u8 = { sve_u1, sve_u1 }; /* { dg-error {incompatible types when initializing type 'unsigned char'} } */ svuint8_t init_sve_u9 = { gnu_u1, gnu_u1 }; /* { dg-error {incompatible types when initializing type 'unsigned char'} } */ @@ -30,6 +42,11 @@ f (svuint8_t sve_u1, svint8_t sve_s1, gnu_uint8_t init_gnu_u6 = { gnu_s1 }; /* { dg-error {incompatible types when initializing type 'unsigned char'} } */ gnu_uint8_t init_gnu_u7 = { 0 }; + /* Boolean inits. */ + svbool_t init_sve_b8 = { sve_u1, sve_u1 }; /* { dg-error {incompatible types when initializing type 'signed char:1'} } */ + svbool_t init_sve_b9 = { gnu_u1, gnu_u1 }; /* { dg-error {incompatible types when initializing type 'signed char:1'} } */ + gnu_uint8_t init_gnu_u8 = { sve_b1 }; /* { dg-error {incompatible types when initializing type 'unsigned char'} } */ + /* Compound literals. */ (svuint8_t) {}; @@ -44,6 +61,16 @@ f (svuint8_t sve_u1, svint8_t sve_s1, (gnu_uint8_t) { sve_u1 }; /* { dg-error {incompatible types when initializing type 'unsigned char'} } */ (gnu_uint8_t) { gnu_u1 }; /* { dg-error {incompatible types when initializing type 'unsigned char'} } */ + /* Boolean compound literals. */ + (svbool_t) {}; + (svbool_t) { 0 }; + (svbool_t) { sve_b1 }; /* { dg-error {incompatible types when initializing type 'signed char:1'} } */ + (svbool_t) { gnu_u1 }; /* { dg-error {incompatible types when initializing type 'signed char:1'} } */ + (svbool_t) { sve_s1 }; /* { dg-error {incompatible types when initializing type 'signed char:1'} } */ + (svbool_t) { sve_u1 }; /* { dg-error {incompatible types when initializing type 'signed char:1'} } */ + (svbool_t) { gnu_s1 }; /* { dg-error {incompatible types when initializing type 'signed char:1'} } */ + (gnu_uint8_t) { sve_b1 }; /* { dg-error {incompatible types when initializing type 'unsigned char'} } */ + /* Assignment. */ sve_u1 = 0; /* { dg-error {incompatible types when assigning to type 'svuint8_t' from type 'int'} } */ @@ -58,6 +85,14 @@ f (svuint8_t sve_u1, svint8_t sve_s1, gnu_u1 = sve_s1; /* { dg-error {incompatible types when assigning to type 'gnu_uint8_t'[^\n]* from type 'svint8_t'} } */ gnu_u1 = gnu_s1; /* { dg-error {incompatible types when assigning to type 'gnu_uint8_t'[^\n]* from type 'gnu_int8_t'} } */ + /* Boolean Assignments. */ + + sve_b1 = 0; /* { dg-error {incompatible types when assigning to type 'svbool_t' from type 'int'} } */ + sve_b1 = sve_b1; + sve_b1 = sve_s1; /* { dg-error {incompatible types when assigning to type 'svbool_t' from type 'svint8_t'} } */ + sve_b1 = gnu_s1; /* { dg-error {incompatible types when assigning to type 'svbool_t' from type 'gnu_int8_t'} } */ + gnu_u1 = sve_b1; /* { dg-error {incompatible types when assigning to type 'gnu_uint8_t'[^\n]* from type 'svbool_t'} } */ + /* Casts. */ (void) sve_u1; @@ -76,6 +111,19 @@ f (svuint8_t sve_u1, svint8_t sve_s1, (gnu_int8_t) sve_u1; (gnu_int8_t) gnu_u1; + /* Boolean casts. */ + (void) sve_b1; + (svbool_t) sve_b1; + (svbool_t) gnu_u1; /* { dg-error {cannot convert a value of type 'gnu_uint8_t'} } */ + (svbool_t) sve_u1; /* { dg-error {cannot convert a value of type 'svuint8_t'} } */ + (svbool_t) 0; /* This is OK. sizeof (svbool_t) == sizeof (int) for VL == 256. */ + (svbool_t) n; /* This is OK. sizeof (svbool_t) == sizeof (int) for VL == 256. */ + (svbool_t) (short)0; /* { dg-error {cannot convert a value of type 'short int'} } */ + (svbool_t) (short)n; /* { dg-error {cannot convert a value of type 'short int'} } */ + (svint8_t) sve_b1; /* { dg-error {cannot convert a value of type 'svbool_t'} } */ + (gnu_uint8_t) sve_b1; /* { dg-error {cannot convert a value of type 'svbool_t'} } */ + (gnu_int8_t) sve_b1; /* { dg-error {cannot convert a value of type 'svbool_t'} } */ + /* Vector indexing. */ sve_u1[0]; @@ -84,6 +132,11 @@ f (svuint8_t sve_u1, svint8_t sve_s1, gnu_u1[0]; &gnu_u1[0]; + /* Boolean vector indexing. */ + + sve_b1[0]; + &sve_b1[0]; /* { dg-error {taking address of a boolean vector element 'svbool_t'} } */ + /* Unary operators. */ +sve_u1; @@ -110,6 +163,20 @@ f (svuint8_t sve_u1, svint8_t sve_s1, gnu_u1++; gnu_u1--; + /* Boolean unary ops. */ + + +sve_b1; + -sve_b1; /* { dg-error {negation operation not permitted} } */ + ~sve_b1; + !sve_b1; /* { dg-error {wrong type argument to unary exclamation mark} } */ + *sve_b1; /* { dg-error {invalid type argument of unary '\*'} } */ + __real sve_b1; /* { dg-error {wrong type argument to __real} } */ + __imag sve_b1; /* { dg-error {wrong type argument to __imag} } */ + ++sve_b1; /* { dg-error {not permitted} } */ + --sve_b1; /* { dg-error {not permitted} } */ + sve_b1++; /* { dg-error {not permitted} } */ + sve_b1--; /* { dg-error {not permitted} } */ + /* Vector-vector binary arithmetic. */ sve_u1 + sve_u1; @@ -131,6 +198,27 @@ f (svuint8_t sve_u1, svint8_t sve_s1, sve_u1 && sve_u1; /* { dg-error {used vector type where scalar is required} } */ sve_u1 || sve_u1; /* { dg-error {used vector type where scalar is required} } */ + /* Boolean vector-vector binary arithmetic. */ + + sve_b1 + sve_b1; /* { dg-error {not permitted} } */ + sve_b1 - sve_b1; /* { dg-error {not permitted} } */ + sve_b1 * sve_b1; /* { dg-error {not permitted} } */ + sve_b1 / sve_b1; /* { dg-error {not permitted} } */ + sve_b1 % sve_b1; /* { dg-error {invalid operands to binary} } */ + sve_b1 & sve_b1; + sve_b1 | sve_b1; + sve_b1 ^ sve_b1; + sve_b1 == sve_b1; + sve_b1 != sve_b1; + sve_b1 <= sve_b1; /* { dg-error {only == and != operations permitted} } */ + sve_b1 < sve_b1; /* { dg-error {only == and != operations permitted} } */ + sve_b1 > sve_b1; /* { dg-error {only == and != operations permitted} } */ + sve_b1 >= sve_b1; /* { dg-error {only == and != operations permitted} } */ + sve_b1 << sve_b1; /* { dg-error {not permitted} } */ + sve_b1 >> sve_b1; /* { dg-error {not permitted} } */ + sve_b1 && sve_b1; /* { dg-error {used vector type where scalar is required} } */ + sve_b1 || sve_b1; /* { dg-error {used vector type where scalar is required} } */ + sve_u1 + gnu_u1; /* { dg-error {cannot combine GNU and SVE vectors in a binary operation} } */ sve_u1 - gnu_u1; /* { dg-error {cannot combine GNU and SVE vectors in a binary operation} } */ sve_u1 * gnu_u1; /* { dg-error {cannot combine GNU and SVE vectors in a binary operation} } */ @@ -401,6 +489,20 @@ f (svuint8_t sve_u1, svint8_t sve_s1, gnu_u1 ? sve_u1 : gnu_u1; /* { dg-error {used vector type where scalar is required} } */ gnu_u1 ? gnu_u1 : gnu_u1; /* { dg-error {used vector type where scalar is required} } */ + /* Boolean conditional expressions. */ + + uc ? sve_b1 : sve_b2; + + sve_b1 ? sve_u1 : sve_u1; /* { dg-error {used vector type where scalar is required} } */ + sve_b1 ? gnu_u1 : sve_u1; /* { dg-error {used vector type where scalar is required} } */ + sve_b1 ? sve_u1 : gnu_u1; /* { dg-error {used vector type where scalar is required} } */ + sve_b1 ? gnu_u1 : gnu_u1; /* { dg-error {used vector type where scalar is required} } */ + + sve_u1 ? sve_b1 : sve_b2; /* { dg-error {used vector type where scalar is required} } */ + gnu_u1 ? sve_b1 : sve_b2; /* { dg-error {used vector type where scalar is required} } */ + gnu_u1 ? gnu_u1 : sve_b1; /* { dg-error {used vector type where scalar is required} } */ + gnu_u1 ? sve_b1 : gnu_u1; /* { dg-error {used vector type where scalar is required} } */ + /* Vector built-ins. */ __builtin_shuffle (sve_u1, sve_u1, sve_u1); @@ -413,4 +515,31 @@ f (svuint8_t sve_u1, svint8_t sve_s1, __builtin_convertvector (gnu_u1, svuint8_t); __builtin_convertvector (sve_u1, gnu_uint8_t); __builtin_convertvector (gnu_u1, gnu_uint8_t); + + /* Boolean vector built-ins. */ + + __builtin_shuffle (sve_b1, sve_b1, sve_s1); + __builtin_shuffle (sve_b1, sve_b1, sve_u1); + __builtin_shuffle (sve_b1, sve_b1, gnu_s1); + __builtin_shuffle (sve_b1, sve_b1, gnu_u1); + + __builtin_shuffle (sve_b1, gnu_u1, gnu_u1); /* { dg-error {'__builtin_shuffle' argument vectors must be of the same type} } */ + __builtin_shuffle (gnu_u1, sve_b1, gnu_u1); /* { dg-error {'__builtin_shuffle' argument vectors must be of the same type} } */ + + __builtin_convertvector (sve_b1, svint8_t); + __builtin_convertvector (sve_b1, svuint8_t); + __builtin_convertvector (sve_b1, gnu_int8_t); + __builtin_convertvector (sve_b1, gnu_uint8_t); + + __builtin_convertvector (sve_s1, svbool_t); + __builtin_convertvector (gnu_s1, svbool_t); + __builtin_convertvector (sve_u1, svbool_t); + __builtin_convertvector (gnu_u1, svbool_t); + + __builtin_convertvector (sve_b1, svint32_t); /* { dg-error {'__builtin_convertvector' number of elements of the first argument vector and the second argument vector type should be the same} } */ + __builtin_convertvector (sve_b1, svuint32_t); /* { dg-error {'__builtin_convertvector' number of elements of the first argument vector and the second argument vector type should be the same} } */ + __builtin_convertvector (sve_b1, gnu32_int32_t); /* { dg-error {'__builtin_convertvector' number of elements of the first argument vector and the second argument vector type should be the same} } */ + + __builtin_convertvector (sve_b1, gnu128_int32_t); + __builtin_convertvector (gnu128_s1, svbool_t); } diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/gnu_vectors_2.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/gnu_vectors_2.c index c311e162f9e..82f9d341369 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/gnu_vectors_2.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/gnu_vectors_2.c @@ -5,9 +5,12 @@ typedef uint8_t gnu_uint8_t __attribute__ ((vector_size (32))); typedef int8_t gnu_int8_t __attribute__ ((vector_size (32))); +typedef int32_t gnu128_int32_t __attribute__ ((vector_size (128))); +typedef int32_t gnu32_int32_t __attribute__ ((vector_size (32))); + void -f (svuint8_t sve_u1, svint8_t sve_s1, - gnu_uint8_t gnu_u1, gnu_int8_t gnu_s1, int n, unsigned char uc) +f (svuint8_t sve_u1, svint8_t sve_s1, svbool_t sve_b1, svbool_t sve_b2, + gnu_uint8_t gnu_u1, gnu_int8_t gnu_s1, gnu128_int32_t gnu128_s1, int n, unsigned char uc) { /* Initialization. */ @@ -21,6 +24,15 @@ f (svuint8_t sve_u1, svint8_t sve_s1, svuint8_t init_sve_u8 = { sve_u1, sve_u1 }; /* { dg-error {incompatible types when initializing type 'unsigned char'} } */ svuint8_t init_sve_u9 = { gnu_u1, gnu_u1 }; /* { dg-error {incompatible types when initializing type 'unsigned char'} } */ + /* Boolean inits. */ + svbool_t init_sve_b1 = 0; /* { dg-error {incompatible types when initializing type 'svbool_t' using type 'int'} } */ + svbool_t init_sve_b2 = {}; + svbool_t init_sve_b3 = { sve_b1 }; /* { dg-error {incompatible types when initializing type 'signed char:1'} } */ + svbool_t init_sve_b4 = { gnu_u1 }; /* { dg-error {incompatible types when initializing type 'signed char:1'} } */ + svbool_t init_sve_b5 = { sve_s1 }; /* { dg-error {incompatible types when initializing type 'signed char:1'} } */ + svbool_t init_sve_b6 = { gnu_s1 }; /* { dg-error {incompatible types when initializing type 'signed char:1'} } */ + svbool_t init_sve_b7 = { 0 }; + gnu_uint8_t init_gnu_u1 = 0; /* { dg-error {incompatible types when initializing type 'gnu_uint8_t'[^\n]* using type 'int'} } */ gnu_uint8_t init_gnu_u2 = {}; gnu_uint8_t init_gnu_u3 = { sve_u1 }; /* { dg-error {incompatible types when initializing type 'unsigned char'} } */ @@ -29,6 +41,11 @@ f (svuint8_t sve_u1, svint8_t sve_s1, gnu_uint8_t init_gnu_u6 = { gnu_s1 }; /* { dg-error {incompatible types when initializing type 'unsigned char'} } */ gnu_uint8_t init_gnu_u7 = { 0 }; + /* Boolean inits. */ + svbool_t init_sve_b8 = { sve_u1, sve_u1 }; /* { dg-error {incompatible types when initializing type 'signed char:1'} } */ + svbool_t init_sve_b9 = { gnu_u1, gnu_u1 }; /* { dg-error {incompatible types when initializing type 'signed char:1'} } */ + gnu_uint8_t init_gnu_u8 = { sve_b1 }; /* { dg-error {incompatible types when initializing type 'unsigned char'} } */ + /* Compound literals. */ (svuint8_t) {}; @@ -43,6 +60,16 @@ f (svuint8_t sve_u1, svint8_t sve_s1, (gnu_uint8_t) { sve_u1 }; /* { dg-error {incompatible types when initializing type 'unsigned char'} } */ (gnu_uint8_t) { gnu_u1 }; /* { dg-error {incompatible types when initializing type 'unsigned char'} } */ + /* Boolean compound literals. */ + (svbool_t) {}; + (svbool_t) { 0 }; + (svbool_t) { sve_b1 }; /* { dg-error {incompatible types when initializing type 'signed char:1'} } */ + (svbool_t) { gnu_u1 }; /* { dg-error {incompatible types when initializing type 'signed char:1'} } */ + (svbool_t) { sve_s1 }; /* { dg-error {incompatible types when initializing type 'signed char:1'} } */ + (svbool_t) { sve_u1 }; /* { dg-error {incompatible types when initializing type 'signed char:1'} } */ + (svbool_t) { gnu_s1 }; /* { dg-error {incompatible types when initializing type 'signed char:1'} } */ + (gnu_uint8_t) { sve_b1 }; /* { dg-error {incompatible types when initializing type 'unsigned char'} } */ + /* Assignment. */ sve_u1 = 0; /* { dg-error {incompatible types when assigning to type 'svuint8_t' from type 'int'} } */ @@ -57,6 +84,14 @@ f (svuint8_t sve_u1, svint8_t sve_s1, gnu_u1 = sve_s1; gnu_u1 = gnu_s1; + /* Boolean Assignments. */ + + sve_b1 = 0; /* { dg-error {incompatible types when assigning to type 'svbool_t' from type 'int'} } */ + sve_b1 = sve_b1; + sve_b1 = sve_s1; /* { dg-error {incompatible types when assigning to type 'svbool_t' from type 'svint8_t'} } */ + sve_b1 = gnu_s1; /* { dg-error {incompatible types when assigning to type 'svbool_t' from type 'gnu_int8_t'} } */ + gnu_u1 = sve_b1; /* { dg-error {incompatible types when assigning to type 'gnu_uint8_t'[^\n]* from type 'svbool_t'} } */ + /* Casts. */ (void) sve_u1; @@ -75,6 +110,19 @@ f (svuint8_t sve_u1, svint8_t sve_s1, (gnu_int8_t) sve_u1; (gnu_int8_t) gnu_u1; + /* Boolean casts. */ + (void) sve_b1; + (svbool_t) sve_b1; + (svbool_t) gnu_u1; /* { dg-error {cannot convert a value of type 'gnu_uint8_t'} } */ + (svbool_t) sve_u1; /* { dg-error {cannot convert a value of type 'svuint8_t'} } */ + (svbool_t) 0; /* This is OK. sizeof (svbool_t) == sizeof (int) for VL == 256. */ + (svbool_t) n; /* This is OK. sizeof (svbool_t) == sizeof (int) for VL == 256. */ + (svbool_t) (short)0; /* { dg-error {cannot convert a value of type 'short int'} } */ + (svbool_t) (short)n; /* { dg-error {cannot convert a value of type 'short int'} } */ + (svint8_t) sve_b1; /* { dg-error {cannot convert a value of type 'svbool_t'} } */ + (gnu_uint8_t) sve_b1; /* { dg-error {cannot convert a value of type 'svbool_t'} } */ + (gnu_int8_t) sve_b1; /* { dg-error {cannot convert a value of type 'svbool_t'} } */ + /* Vector indexing. */ sve_u1[0]; @@ -83,6 +131,11 @@ f (svuint8_t sve_u1, svint8_t sve_s1, gnu_u1[0]; &gnu_u1[0]; + /* Boolean vector indexing. */ + + sve_b1[0]; + &sve_b1[0]; /* { dg-error {taking address of a boolean vector element 'svbool_t'} } */ + /* Unary operators. */ +sve_u1; @@ -109,6 +162,20 @@ f (svuint8_t sve_u1, svint8_t sve_s1, gnu_u1++; gnu_u1--; + /* Boolean unary ops. */ + + +sve_b1; + -sve_b1; /* { dg-error {negation operation not permitted} } */ + ~sve_b1; + !sve_b1; /* { dg-error {wrong type argument to unary exclamation mark} } */ + *sve_b1; /* { dg-error {invalid type argument of unary '\*'} } */ + __real sve_b1; /* { dg-error {wrong type argument to __real} } */ + __imag sve_b1; /* { dg-error {wrong type argument to __imag} } */ + ++sve_b1; /* { dg-error {not permitted} } */ + --sve_b1; /* { dg-error {not permitted} } */ + sve_b1++; /* { dg-error {not permitted} } */ + sve_b1--; /* { dg-error {not permitted} } */ + /* Vector-vector binary arithmetic. */ sve_u1 + sve_u1; @@ -130,6 +197,27 @@ f (svuint8_t sve_u1, svint8_t sve_s1, sve_u1 && sve_u1; /* { dg-error {used vector type where scalar is required} } */ sve_u1 || sve_u1; /* { dg-error {used vector type where scalar is required} } */ + /* Boolean vector-vector binary arithmetic. */ + + sve_b1 + sve_b1; /* { dg-error {not permitted} } */ + sve_b1 - sve_b1; /* { dg-error {not permitted} } */ + sve_b1 * sve_b1; /* { dg-error {not permitted} } */ + sve_b1 / sve_b1; /* { dg-error {not permitted} } */ + sve_b1 % sve_b1; /* { dg-error {invalid operands to binary} } */ + sve_b1 & sve_b1; + sve_b1 | sve_b1; + sve_b1 ^ sve_b1; + sve_b1 == sve_b1; + sve_b1 != sve_b1; + sve_b1 <= sve_b1; /* { dg-error {only == and != operations permitted} } */ + sve_b1 < sve_b1; /* { dg-error {only == and != operations permitted} } */ + sve_b1 > sve_b1; /* { dg-error {only == and != operations permitted} } */ + sve_b1 >= sve_b1; /* { dg-error {only == and != operations permitted} } */ + sve_b1 << sve_b1; /* { dg-error {not permitted} } */ + sve_b1 >> sve_b1; /* { dg-error {not permitted} } */ + sve_b1 && sve_b1; /* { dg-error {used vector type where scalar is required} } */ + sve_b1 || sve_b1; /* { dg-error {used vector type where scalar is required} } */ + sve_u1 + gnu_u1; /* { dg-error {cannot combine GNU and SVE vectors in a binary operation} } */ sve_u1 - gnu_u1; /* { dg-error {cannot combine GNU and SVE vectors in a binary operation} } */ sve_u1 * gnu_u1; /* { dg-error {cannot combine GNU and SVE vectors in a binary operation} } */ @@ -400,6 +488,20 @@ f (svuint8_t sve_u1, svint8_t sve_s1, gnu_u1 ? sve_u1 : gnu_u1; /* { dg-error {used vector type where scalar is required} } */ gnu_u1 ? gnu_u1 : gnu_u1; /* { dg-error {used vector type where scalar is required} } */ + /* Boolean conditional expressions. */ + + uc ? sve_b1 : sve_b2; + + sve_b1 ? sve_u1 : sve_u1; /* { dg-error {used vector type where scalar is required} } */ + sve_b1 ? gnu_u1 : sve_u1; /* { dg-error {used vector type where scalar is required} } */ + sve_b1 ? sve_u1 : gnu_u1; /* { dg-error {used vector type where scalar is required} } */ + sve_b1 ? gnu_u1 : gnu_u1; /* { dg-error {used vector type where scalar is required} } */ + + sve_u1 ? sve_b1 : sve_b2; /* { dg-error {used vector type where scalar is required} } */ + gnu_u1 ? sve_b1 : sve_b2; /* { dg-error {used vector type where scalar is required} } */ + gnu_u1 ? gnu_u1 : sve_b1; /* { dg-error {used vector type where scalar is required} } */ + gnu_u1 ? sve_b1 : gnu_u1; /* { dg-error {used vector type where scalar is required} } */ + /* Vector built-ins. */ __builtin_shuffle (sve_u1, sve_u1, sve_u1); @@ -412,4 +514,31 @@ f (svuint8_t sve_u1, svint8_t sve_s1, __builtin_convertvector (gnu_u1, svuint8_t); __builtin_convertvector (sve_u1, gnu_uint8_t); __builtin_convertvector (gnu_u1, gnu_uint8_t); + + /* Boolean vector built-ins. */ + + __builtin_shuffle (sve_b1, sve_b1, sve_s1); + __builtin_shuffle (sve_b1, sve_b1, sve_u1); + __builtin_shuffle (sve_b1, sve_b1, gnu_s1); + __builtin_shuffle (sve_b1, sve_b1, gnu_u1); + + __builtin_shuffle (sve_b1, gnu_u1, gnu_u1); /* { dg-error {'__builtin_shuffle' argument vectors must be of the same type} } */ + __builtin_shuffle (gnu_u1, sve_b1, gnu_u1); /* { dg-error {'__builtin_shuffle' argument vectors must be of the same type} } */ + + __builtin_convertvector (sve_b1, svint8_t); + __builtin_convertvector (sve_b1, svuint8_t); + __builtin_convertvector (sve_b1, gnu_int8_t); + __builtin_convertvector (sve_b1, gnu_uint8_t); + + __builtin_convertvector (sve_s1, svbool_t); + __builtin_convertvector (gnu_s1, svbool_t); + __builtin_convertvector (sve_u1, svbool_t); + __builtin_convertvector (gnu_u1, svbool_t); + + __builtin_convertvector (sve_b1, svint32_t); /* { dg-error {'__builtin_convertvector' number of elements of the first argument vector and the second argument vector type should be the same} } */ + __builtin_convertvector (sve_b1, svuint32_t); /* { dg-error {'__builtin_convertvector' number of elements of the first argument vector and the second argument vector type should be the same} } */ + __builtin_convertvector (sve_b1, gnu32_int32_t); /* { dg-error {'__builtin_convertvector' number of elements of the first argument vector and the second argument vector type should be the same} } */ + + __builtin_convertvector (sve_b1, gnu128_int32_t); + __builtin_convertvector (gnu128_s1, svbool_t); } diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/sizeless-1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/sizeless-1.c index 9677b6535fd..da5ac2a0f5a 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/sizeless-1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/sizeless-1.c @@ -81,7 +81,19 @@ statements (int n) svint32_t init_sve_vc8 = { 0, 1, 2, 3, 4, 5 }; /* { dg-error {excess elements in vector initializer} } */ svint32_t init_sve_vc9 = { 0, bar (), 2, 3, 4, n }; /* { dg-error {excess elements in vector initializer} } */ - + svbool_t init_sve_vb1 = { 0, -1 }; /* { dg-warning {overflow in conversion from} } */ + svbool_t init_sve_vb2 = { 0, bar () }; + svbool_t init_sve_vb3 = { bar (), n }; + svbool_t init_sve_vb4 = { 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; /* { dg-warning {overflow in conversion from} } */ + svbool_t init_sve_vb5 = { 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, bar (), 0, 0}; /* { dg-warning {overflow in conversion from} } */ + svbool_t init_sve_vb6 = { 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1}; /* { dg-error {excess elements in vector initializer} } */ + /* { dg-warning "overflow in conversion from" "" { target *-*-* } .-1 } */ + svbool_t init_sve_vb7 = { 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, bar ()}; /* { dg-error {excess elements in vector initializer} } */ + /* { dg-warning "overflow in conversion from" "" { target *-*-* } .-1 } */ + svbool_t init_sve_vb8 = { 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, bar (), -1}; /* { dg-error {excess elements in vector initializer} } */ + /* { dg-warning "overflow in conversion from" "" { target *-*-* } .-1 } */ + svbool_t init_sve_vb9 = { 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, bar (), n}; /* { dg-error {excess elements in vector initializer} } */ + /* { dg-warning "overflow in conversion from" "" { target *-*-* } .-1 } */ /* Compound literals. */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/sizeless-2.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/sizeless-2.c index 73828a5729f..682e2e053ed 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/sizeless-2.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/sizeless-2.c @@ -81,6 +81,38 @@ statements (int n) svint32_t init_sve_vc8 = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; /* { dg-warning {excess elements in vector initializer} } */ svint32_t init_sve_vc9 = { 0, bar (), 2, 3, 4, 5, 6, 7, 8, 9, n }; /* { dg-warning {excess elements in vector initializer} } */ + svbool_t init_sve_vb1 = { 0, -1 }; /* { dg-warning {overflow in conversion from} } */ + svbool_t init_sve_vb2 = { 0, bar () }; + svbool_t init_sve_vb3 = { bar (), n }; + svbool_t init_sve_vb4 = { 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + /* { dg-warning "overflow in conversion from" "" { target *-*-* } .-2 } */ + /* { dg-warning "overflow in conversion from" "" { target *-*-* } .-2 } */ + svbool_t init_sve_vb5 = { 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, -1, -1, -1, 0, 0, 0, bar (), 0, 0, 0, 0, 0, 0, + 0, 0 }; + /* { dg-warning "overflow in conversion from" "" { target *-*-* } .-3 } */ + /* { dg-warning "overflow in conversion from" "" { target *-*-* } .-3 } */ + svbool_t init_sve_vb6 = { 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0 }; /* { dg-warning {excess elements in vector initializer} } */ + /* { dg-warning "overflow in conversion from" "" { target *-*-* } .-3 } */ + /* { dg-warning "overflow in conversion from" "" { target *-*-* } .-3 } */ + svbool_t init_sve_vb7 = { 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + bar () }; /* { dg-warning {excess elements in vector initializer} } */ + /* { dg-warning "overflow in conversion from" "" { target *-*-* } .-3 } */ + /* { dg-warning "overflow in conversion from" "" { target *-*-* } .-3 } */ + svbool_t init_sve_vb8 = { 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + bar (), -1 }; /* { dg-warning {excess elements in vector initializer} } */ + /* { dg-warning "overflow in conversion from" "" { target *-*-* } .-3 } */ + /* { dg-warning "overflow in conversion from" "" { target *-*-* } .-3 } */ + svbool_t init_sve_vb9 = { 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + bar (), n}; /* { dg-warning {excess elements in vector initializer} } */ + /* { dg-warning "overflow in conversion from" "" { target *-*-* } .-3 } */ + /* { dg-warning "overflow in conversion from" "" { target *-*-* } .-3 } */ /* Compound literals. */ -- 2.25.1