Tejas Belagod <tejas.bela...@arm.com> writes: > Hi, > > This is v2 of the series > https://gcc.gnu.org/pipermail/gcc-patches/2024-November/667743.html > > based on review comments. Changes in this version include: > > 1. Canonicalised all index ranges for VLAs to BIT_FIELD_REF. > 2. Added more initialization error tests. > 3. Merged an intermediate state patch into the final state. > 4. Removed duplication in new test cops.c and added tests for > constructors with variable elements. > > A couple of FE patches are yet to be reviewed but just thought I should > get the ones that are fixed out while waiting for reviews.
OK for the aarch64 bits. I responded to patch 4 individually, but otherwise the rest of the series looks good to me as well. OK for the generic bits in a week's time, with the change suggested for patch 4, if there are no other reviews before then. Thanks, Richard > This patchset enables C/C++ operations on SVE ACLE types. The changes enable > operations on SVE ACLE types to have the same semantics as GNU vector types. > These operations like (+, -, &, | etc) behave exactly as they would behave on > GNU vector types. The operations are self-contained as in we still don't allow > mixing GNU and SVE vector types in, for eg, binary operations because the > typeof the expression is ambiguous and this causes PCS issues. > > Other operations like implicit conversions behave as they would with GNU > vectors i.e. > > gnu_uv = sv_uv; // This is possible as long as the size, shape and > element-signedness > // of both vectors are the same. > gnu_uv = sv_sv; // Error as implicit conversion from signed to unsigned is > not possible > // even though size and shape may be similar. > > Such assignments would have to go through an explicit cast > > gnu_uv = (gnu_uv)sv_sv; > > Following unary operations are supported: > > sve_type_var[0]; > &sve_type_var[0]; > sve_type_var[n]; > &sve_type_var[n]; > +sve_type_var; > -sve_type_var; > ~sve_type_var; > !sve_type_var; /* Allowed in C++ */ > *sve_type_var; /* Error! */ > __real sve_type_var; /* Error! */ > __imag sve_type_var; /* Error! */ > ++sve_type_var; > --sve_type_var; > sve_type_var++; > sve_type_var--; > > Following binary ops are supported: > > sve_type_var + sve_type_var; > sve_type_var - sve_type_var; > sve_type_var * sve_type_var; > sve_type_var / sve_type_var; > sve_type_var % sve_type_var; > sve_type_var & sve_type_var; > sve_type_var | sve_type_var; > sve_type_var ^ sve_type_var; > sve_type_var == sve_type_var; > sve_type_var != sve_type_var; > sve_type_var <= sve_type_var; > sve_type_var < sve_type_var; > sve_type_var > sve_type_var; > sve_type_var >= sve_type_var; > sve_type_var << sve_type_var; > sve_type_var >> sve_type_var; > sve_type_var && sve_type_var; /* Allowed in C++ */ > sve_type_var || sve_type_var; /* Allowed in C++ */ > > /* Vector-scalar binary arithmetic. The reverse is also supported > eg. <const_scalar> + sve_type_var */ > > sve_type_var + <const_scalar>; > sve_type_var - <const_scalar>; > sve_type_var * <const_scalar>; > sve_type_var / <const_scalar>; > sve_type_var % <const_scalar>; > sve_type_var & <const_scalar>; > sve_type_var | <const_scalar>; > sve_type_var ^ <const_scalar>; > sve_type_var == <const_scalar>; > sve_type_var != <const_scalar>; > sve_type_var <= <const_scalar>; > sve_type_var < <const_scalar>; > sve_type_var > <const_scalar>; > sve_type_var >= <const_scalar>; > sve_type_var << <const_scalar>; > sve_type_var >> <const_scalar>; > sve_type_var && <const_scalar>; /* Allowed in C++ */ > sve_type_var || <const_scalar>; /* Allowed in C++ */ > sve_type_var + <var_scalar>; > sve_type_var - <var_scalar>; > sve_type_var * <var_scalar>; > sve_type_var / <var_scalar>; > sve_type_var % <var_scalar>; > sve_type_var & <var_scalar>; > sve_type_var | <var_scalar>; > sve_type_var ^ <var_scalar>; > sve_type_var == <var_scalar>; > sve_type_var != <var_scalar>; > sve_type_var <= <var_scalar>; > sve_type_var < <var_scalar>; > sve_type_var > <var_scalar>; > sve_type_var >= <var_scalar>; > sve_type_var << <var_scalar>; > sve_type_var >> <var_scalar>; > sve_type_var && <var_scalar>; /* Allowed in C++ */ > sve_type_var || <var_scalar>; /* Allowed in C++ */ > > Ternary operations: > > <scalar> ? sve_type_var : sve_type_var; > > sve_type_var ? sve_type_var : sve_type_var; /* Allowed in C++ */ > > Builtins: > > /* Vector built-ins. */ > > __builtin_shuffle (sve_type_var, sve_type_var, sve_type_var); > __builtin_convertvector (sve_type_var, <sve_type>); > > These operations are supported for both fixed length and variable length > vectors. > > One outstanding fail > PASS->FAIL: g++.dg/ext/sve-sizeless-1.C -std=gnu++11 (test for errors, line > 163) > > I've left another outstanding fail as is - the test where an address is taken > of an SVE vector element. I'm not > sure what the behaviour should be here. > > Otherwise regression tested and bootstrapped on aarch64-linux-gnu. > Bootstrapped on x86-linux-gnu. > > OK for trunk? > > Thanks, > Tejas. > > Tejas Belagod (8): > aarch64: Fix ACLE macro __ARM_FEATURE_SVE_VECTOR_OPERATORS > aarch64: Make C/C++ operations possible on SVE ACLE types. > c: Range-check indexing of SVE ACLE vectors > gimple: Handle variable-sized vectors in BIT_FIELD_REF > c: Fix constructor bounds checking for VLA and construct VLA vector > constants > aarch64: Add testcase for C/C++ ops on SVE ACLE types. > aarch64: Update SVE ACLE tests > cp: Fix another assumption in the FE about constant vector indices. > > gcc/c-family/c-common.cc | 10 +- > gcc/c/c-typeck.cc | 16 +- > gcc/config/aarch64/aarch64-c.cc | 10 +- > gcc/config/aarch64/aarch64-sve-builtins.cc | 5 +- > gcc/cp/decl.cc | 11 +- > gcc/gimple-fold.cc | 3 +- > gcc/testsuite/g++.dg/ext/sve-sizeless-1.C | 11 + > gcc/testsuite/g++.dg/ext/sve-sizeless-2.C | 9 + > .../sve/acle/general-c++/gnu_vectors_1.C | 438 ++++++------- > .../sve/acle/general-c++/gnu_vectors_2.C | 434 ++++++------- > .../sve/acle/general-c/gnu_vectors_1.c | 349 +++++------ > .../sve/acle/general-c/gnu_vectors_2.c | 346 +++++------ > .../aarch64/sve/acle/general-c/sizeless-1.c | 15 +- > .../aarch64/sve/acle/general-c/sizeless-2.c | 14 +- > .../aarch64/sve/acle/general/attributes_7.c | 30 +- > .../aarch64/sve/acle/general/cops.c | 579 ++++++++++++++++++ > gcc/tree-cfg.cc | 2 +- > gcc/tree.cc | 16 +- > 18 files changed, 1475 insertions(+), 823 deletions(-) > create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/acle/general/cops.c