diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2019-11-10 22:38:42 +0000 |
---|---|---|
committer | Richard Sandiford <richard.sandiford@arm.com> | 2020-01-21 16:22:13 +0000 |
commit | 63492372c4709b48dd918e86640fd675856595a4 (patch) | |
tree | 99660c8d1c0f2753c1f42b19340247a348523986 | |
parent | fb15e2bab5267213b8706fa6a29eeef94f62a524 (diff) | |
download | gcc-63492372c4709b48dd918e86640fd675856595a4.zip gcc-63492372c4709b48dd918e86640fd675856595a4.tar.gz gcc-63492372c4709b48dd918e86640fd675856595a4.tar.bz2 |
aarch64: Use stdint types for SVE ACLE elements
I'd used mode-based element types in the SVE ACLE implementation, but
it turns out that they don't correspond to the <stdint.h> types used by
ILP32 newlib. GCC already knows what the correct <stdint.h> types are,
I just wasn't using the right interface to find them.
A consequence of this is that ILP32 newlib code needs to cast "int *"
pointers to "int32_t *" before passing them to s32 loads and stores,
since int32_t is defined as "long int" rather than "int". That matches
the normal C++ overloading behaviour for this target, where passing
"int *" to:
void f(int32_t *);
void f(int64_t *);
would be ambiguous. It also matches the corresponding <arm_neon.h>
behaviour.
2020-01-21 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* config/aarch64/aarch64-sve-builtins.def: Use get_typenode_from_name
to get the integer element types.
gcc/testsuite/
* gcc.target/aarch64/sve/acle/general-c/load_1.c (f1): Cast to
int32_t * rather than int *.
* gcc.target/aarch64/sve/acle/general-c/load_2.c (f1): Likewise.
* gcc.target/aarch64/sve/acle/general-c/load_gather_sv_1.c
(f1): Likewise.
* gcc.target/aarch64/sve/acle/general-c/load_gather_sv_2.c
(f1): Likewise.
* gcc.target/aarch64/sve/acle/general-c/load_gather_sv_restricted_1.c
(f1): Likewise.
* gcc.target/aarch64/sve/acle/general-c/load_replicate_1.c
(f1): Likewise.
* gcc.target/aarch64/sve/acle/general-c/store_1.c (f1): Likewise.
* gcc.target/aarch64/sve/acle/general-c/store_2.c (f1): Likewise.
* gcc.target/aarch64/sve/acle/general-c/store_scatter_index_1.c
(f1): Likewise.
* gcc.target/aarch64/sve/acle/general-c/store_scatter_offset_2.c
(f1): Likewise.
* gcc.target/aarch64/sve/acle/general-c/store_scatter_offset_restricted_1.c
(f1): Likewise.
14 files changed, 49 insertions, 19 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 63ff0bf..e2f3d0d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2020-01-21 Richard Sandiford <richard.sandiford@arm.com> + * config/aarch64/aarch64-sve-builtins.def: Use get_typenode_from_name + to get the integer element types. + +2020-01-21 Richard Sandiford <richard.sandiford@arm.com> + * config/aarch64/aarch64-sve-builtins.h (function_expander::convert_to_pmode): Declare. * config/aarch64/aarch64-sve-builtins.cc diff --git a/gcc/config/aarch64/aarch64-sve-builtins.def b/gcc/config/aarch64/aarch64-sve-builtins.def index 040f1d8..a5a5aca 100644 --- a/gcc/config/aarch64/aarch64-sve-builtins.def +++ b/gcc/config/aarch64/aarch64-sve-builtins.def @@ -64,14 +64,17 @@ DEF_SVE_TYPE (svbool_t, 10, __SVBool_t, boolean_type_node) DEF_SVE_TYPE (svfloat16_t, 13, __SVFloat16_t, aarch64_fp16_type_node) DEF_SVE_TYPE (svfloat32_t, 13, __SVFloat32_t, float_type_node) DEF_SVE_TYPE (svfloat64_t, 13, __SVFloat64_t, double_type_node) -DEF_SVE_TYPE (svint8_t, 10, __SVInt8_t, intQI_type_node) -DEF_SVE_TYPE (svint16_t, 11, __SVInt16_t, intHI_type_node) -DEF_SVE_TYPE (svint32_t, 11, __SVInt32_t, intSI_type_node) -DEF_SVE_TYPE (svint64_t, 11, __SVInt64_t, intDI_type_node) -DEF_SVE_TYPE (svuint8_t, 11, __SVUint8_t, unsigned_intQI_type_node) -DEF_SVE_TYPE (svuint16_t, 12, __SVUint16_t, unsigned_intHI_type_node) -DEF_SVE_TYPE (svuint32_t, 12, __SVUint32_t, unsigned_intSI_type_node) -DEF_SVE_TYPE (svuint64_t, 12, __SVUint64_t, unsigned_intDI_type_node) +DEF_SVE_TYPE (svint8_t, 10, __SVInt8_t, get_typenode_from_name (INT8_TYPE)) +DEF_SVE_TYPE (svint16_t, 11, __SVInt16_t, get_typenode_from_name (INT16_TYPE)) +DEF_SVE_TYPE (svint32_t, 11, __SVInt32_t, get_typenode_from_name (INT32_TYPE)) +DEF_SVE_TYPE (svint64_t, 11, __SVInt64_t, get_typenode_from_name (INT64_TYPE)) +DEF_SVE_TYPE (svuint8_t, 11, __SVUint8_t, get_typenode_from_name (UINT8_TYPE)) +DEF_SVE_TYPE (svuint16_t, 12, __SVUint16_t, + get_typenode_from_name (UINT16_TYPE)) +DEF_SVE_TYPE (svuint32_t, 12, __SVUint32_t, + get_typenode_from_name (UINT32_TYPE)) +DEF_SVE_TYPE (svuint64_t, 12, __SVUint64_t, + get_typenode_from_name (UINT64_TYPE)) DEF_SVE_TYPE_SUFFIX (b, svbool_t, bool, 8, VNx16BImode) DEF_SVE_TYPE_SUFFIX (b8, svbool_t, bool, 8, VNx16BImode) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2bb1d52..4bea57e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,25 @@ +2020-01-21 Richard Sandiford <richard.sandiford@arm.com> + + * gcc.target/aarch64/sve/acle/general-c/load_1.c (f1): Cast to + int32_t * rather than int *. + * gcc.target/aarch64/sve/acle/general-c/load_2.c (f1): Likewise. + * gcc.target/aarch64/sve/acle/general-c/load_gather_sv_1.c + (f1): Likewise. + * gcc.target/aarch64/sve/acle/general-c/load_gather_sv_2.c + (f1): Likewise. + * gcc.target/aarch64/sve/acle/general-c/load_gather_sv_restricted_1.c + (f1): Likewise. + * gcc.target/aarch64/sve/acle/general-c/load_replicate_1.c + (f1): Likewise. + * gcc.target/aarch64/sve/acle/general-c/store_1.c (f1): Likewise. + * gcc.target/aarch64/sve/acle/general-c/store_2.c (f1): Likewise. + * gcc.target/aarch64/sve/acle/general-c/store_scatter_index_1.c + (f1): Likewise. + * gcc.target/aarch64/sve/acle/general-c/store_scatter_offset_2.c + (f1): Likewise. + * gcc.target/aarch64/sve/acle/general-c/store_scatter_offset_restricted_1.c + (f1): Likewise. + 2020-01-21 Szabolcs Nagy <szabolcs.nagy@arm.com> PR target/92424 diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/load_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/load_1.c index 34f989b..784fdc3 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/load_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/load_1.c @@ -13,7 +13,7 @@ f1 (svbool_t pg, signed char *s8_ptr, void *void_ptr, struct s *s_ptr, svld1 (pg, s8_ptr, 0); /* { dg-error {too many arguments to function 'svld1'} } */ svld1 (0, s8_ptr); /* { dg-error {passing 'int' to argument 1 of 'svld1', which expects 'svbool_t'} } */ svld1 (pg, 0); /* { dg-error {passing 'int' to argument 2 of 'svld1', which expects a pointer type} } */ - svld1 (pg, (int *) 0); + svld1 (pg, (int32_t *) 0); svld1 (pg, void_ptr); /* { dg-error {passing 'void \*' to argument 2 of 'svld1', but 'void' is not a valid SVE element type} } */ svld1 (pg, s_ptr); /* { dg-error {passing 'struct s \*' to argument 2 of 'svld1', but 'struct s' is not a valid SVE element type} } */ svld1 (pg, f32_ptr); diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/load_2.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/load_2.c index beb07f1..a828876 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/load_2.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/load_2.c @@ -13,7 +13,7 @@ f1 (svbool_t pg, signed char *s8_ptr, void *void_ptr, struct s *s_ptr, svld1_s8 (pg, s8_ptr, 0); /* { dg-error {too many arguments to function 'svld1_s8'} } */ svld1_s8 (0, 0); /* { dg-error {incompatible type for argument 1 of 'svld1_s8'} } */ svld1_s8 (pg, 0); - svld1_s32 (pg, (int *) 0); + svld1_s32 (pg, (int32_t *) 0); svld1_s8 (pg, void_ptr); svld1_s8 (pg, s_ptr); /* { dg-warning {passing argument 2 of 'svld1_s8' from incompatible pointer type} } */ svld1_f32 (pg, f32_ptr); diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/load_gather_sv_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/load_gather_sv_1.c index 21566a9..4daede7 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/load_gather_sv_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/load_gather_sv_1.c @@ -18,7 +18,7 @@ f1 (svbool_t pg, signed char *s8_ptr, short *s16_ptr, svld1_gather_offset (pg, s32_ptr, s32, 0); /* { dg-error {too many arguments to function 'svld1_gather_offset'} } */ svld1_gather_offset (0, s32_ptr, s32); /* { dg-error {passing 'int' to argument 1 of 'svld1_gather_offset', which expects 'svbool_t'} } */ svld1_gather_offset (pg, 0, s32); /* { dg-error {passing 'int' to argument 2 of 'svld1_gather_offset', which expects a pointer type} } */ - svld1_gather_offset (pg, (int *) 0, s32); + svld1_gather_offset (pg, (int32_t *) 0, s32); svld1_gather_offset (pg, void_ptr, s32); /* { dg-error {passing 'void \*' to argument 2 of 'svld1_gather_offset', but 'void' is not a valid SVE element type} } */ svld1_gather_offset (pg, s_ptr, s32); /* { dg-error {passing 'struct s \*' to argument 2 of 'svld1_gather_offset', but 'struct s' is not a valid SVE element type} } */ svld1_gather_offset (pg, f32_ptr, s32); diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/load_gather_sv_2.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/load_gather_sv_2.c index 4c15fc4..65510cb 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/load_gather_sv_2.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/load_gather_sv_2.c @@ -18,7 +18,7 @@ f1 (svbool_t pg, signed char *s8_ptr, short *s16_ptr, svld1_gather_index (pg, s32_ptr, s32, 0); /* { dg-error {too many arguments to function 'svld1_gather_index'} } */ svld1_gather_index (0, s32_ptr, s32); /* { dg-error {passing 'int' to argument 1 of 'svld1_gather_index', which expects 'svbool_t'} } */ svld1_gather_index (pg, 0, s32); /* { dg-error {passing 'int' to argument 2 of 'svld1_gather_index', which expects a pointer type} } */ - svld1_gather_index (pg, (int *) 0, s32); + svld1_gather_index (pg, (int32_t *) 0, s32); svld1_gather_index (pg, void_ptr, s32); /* { dg-error {passing 'void \*' to argument 2 of 'svld1_gather_index', but 'void' is not a valid SVE element type} } */ svld1_gather_index (pg, s_ptr, s32); /* { dg-error {passing 'struct s \*' to argument 2 of 'svld1_gather_index', but 'struct s' is not a valid SVE element type} } */ svld1_gather_index (pg, f32_ptr, s32); diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/load_gather_sv_restricted_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/load_gather_sv_restricted_1.c index b12faad..51e11fc 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/load_gather_sv_restricted_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/load_gather_sv_restricted_1.c @@ -20,7 +20,7 @@ f1 (svbool_t pg, signed char *s8_ptr, short *s16_ptr, svldnt1_gather_offset (pg, s32_ptr, s32, 0); /* { dg-error {too many arguments to function 'svldnt1_gather_offset'} } */ svldnt1_gather_offset (0, s32_ptr, u32); /* { dg-error {passing 'int' to argument 1 of 'svldnt1_gather_offset', which expects 'svbool_t'} } */ svldnt1_gather_offset (pg, 0, s32); /* { dg-error {passing 'int' to argument 2 of 'svldnt1_gather_offset', which expects a pointer type} } */ - svldnt1_gather_offset (pg, (int *) 0, u32); + svldnt1_gather_offset (pg, (int32_t *) 0, u32); svldnt1_gather_offset (pg, void_ptr, u32); /* { dg-error {passing 'void \*' to argument 2 of 'svldnt1_gather_offset', but 'void' is not a valid SVE element type} } */ svldnt1_gather_offset (pg, s_ptr, u32); /* { dg-error {passing 'struct s \*' to argument 2 of 'svldnt1_gather_offset', but 'struct s' is not a valid SVE element type} } */ svldnt1_gather_offset (pg, f32_ptr, u32); diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/load_replicate_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/load_replicate_1.c index d4ff76e..ebcb0e8 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/load_replicate_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/load_replicate_1.c @@ -13,7 +13,7 @@ f1 (svbool_t pg, signed char *s8_ptr, void *void_ptr, struct s *s_ptr, svld1rq (pg, s8_ptr, 0); /* { dg-error {too many arguments to function 'svld1rq'} } */ svld1rq (0, s8_ptr); /* { dg-error {passing 'int' to argument 1 of 'svld1rq', which expects 'svbool_t'} } */ svld1rq (pg, 0); /* { dg-error {passing 'int' to argument 2 of 'svld1rq', which expects a pointer type} } */ - svld1rq (pg, (int *) 0); + svld1rq (pg, (int32_t *) 0); svld1rq (pg, void_ptr); /* { dg-error {passing 'void \*' to argument 2 of 'svld1rq', but 'void' is not a valid SVE element type} } */ svld1rq (pg, s_ptr); /* { dg-error {passing 'struct s \*' to argument 2 of 'svld1rq', but 'struct s' is not a valid SVE element type} } */ svld1rq (pg, f32_ptr); diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_1.c index 267db83..625f059 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_1.c @@ -16,7 +16,7 @@ f1 (svbool_t pg, signed char *s8_ptr, void *void_ptr, struct s *s_ptr, svst1 (pg, void_ptr, 0); /* { dg-error {passing 'int' to argument 3 of 'svst1', which expects an SVE vector type} } */ svst1 (pg, void_ptr, pg); /* { dg-error {'svst1' has no form that takes 'svbool_t' arguments} } */ svst1 (pg, 0, s8); - svst1 (pg, (int *) 0, s8); /* { dg-warning "passing argument 2 of 'svst1_s8' from incompatible pointer type" } */ + svst1 (pg, (int32_t *) 0, s8); /* { dg-warning "passing argument 2 of 'svst1_s8' from incompatible pointer type" } */ svst1 (pg, void_ptr, s8); svst1 (pg, s_ptr, s8); /* { dg-warning "passing argument 2 of 'svst1_s8' from incompatible pointer type" } */ svst1 (pg, f32_ptr, s8); /* { dg-warning "passing argument 2 of 'svst1_s8' from incompatible pointer type" } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_2.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_2.c index 4e4fb3c..c718b3e 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_2.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_2.c @@ -18,7 +18,7 @@ f1 (svbool_t pg, signed char *s8_ptr, void *void_ptr, struct s *s_ptr, svst1_vnum (pg, void_ptr, 0, 0); /* { dg-error {passing 'int' to argument 4 of 'svst1_vnum', which expects an SVE vector type} } */ svst1_vnum (pg, void_ptr, 0, pg); /* { dg-error {'svst1_vnum' has no form that takes 'svbool_t' arguments} } */ svst1_vnum (pg, 0, 0, s8); - svst1_vnum (pg, (int *) 0, 0, s8); /* { dg-warning "passing argument 2 of 'svst1_vnum_s8' from incompatible pointer type" } */ + svst1_vnum (pg, (int32_t *) 0, 0, s8); /* { dg-warning "passing argument 2 of 'svst1_vnum_s8' from incompatible pointer type" } */ svst1_vnum (pg, void_ptr, 0, s8); svst1_vnum (pg, s_ptr, 0, s8); /* { dg-warning "passing argument 2 of 'svst1_vnum_s8' from incompatible pointer type" } */ svst1_vnum (pg, f32_ptr, 0, s8); /* { dg-warning "passing argument 2 of 'svst1_vnum_s8' from incompatible pointer type" } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_scatter_index_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_scatter_index_1.c index 3209149..8952823 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_scatter_index_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_scatter_index_1.c @@ -18,7 +18,7 @@ f1 (svbool_t pg, signed char *s8_ptr, short *s16_ptr, svst1_scatter_index (pg, s32_ptr, s32, s32, 0); /* { dg-error {too many arguments to function 'svst1_scatter_index'} } */ svst1_scatter_index (0, s32_ptr, s32, s32); /* { dg-error {passing 'int' to argument 1 of 'svst1_scatter_index', which expects 'svbool_t'} } */ svst1_scatter_index (pg, 0, s32, s32); - svst1_scatter_index (pg, (int *) 0, s32, s32); + svst1_scatter_index (pg, (int32_t *) 0, s32, s32); svst1_scatter_index (pg, void_ptr, s32, s32); svst1_scatter_index (pg, s_ptr, s32, s32); /* { dg-warning "passing argument 2 of 'svst1_scatter_s32index_s32' from incompatible pointer type" } */ svst1_scatter_index (pg, f32_ptr, s32, s32); /* { dg-warning "passing argument 2 of 'svst1_scatter_s32index_s32' from incompatible pointer type" } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_scatter_offset_2.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_scatter_offset_2.c index 8ee8129..4854818 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_scatter_offset_2.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_scatter_offset_2.c @@ -18,7 +18,7 @@ f1 (svbool_t pg, signed char *s8_ptr, short *s16_ptr, svst1_scatter_offset (pg, s32_ptr, s32, s32, 0); /* { dg-error {too many arguments to function 'svst1_scatter_offset'} } */ svst1_scatter_offset (0, s32_ptr, s32, s32); /* { dg-error {passing 'int' to argument 1 of 'svst1_scatter_offset', which expects 'svbool_t'} } */ svst1_scatter_offset (pg, 0, s32, s32); - svst1_scatter_offset (pg, (int *) 0, s32, s32); + svst1_scatter_offset (pg, (int32_t *) 0, s32, s32); svst1_scatter_offset (pg, void_ptr, s32, s32); svst1_scatter_offset (pg, s_ptr, s32, s32); /* { dg-warning "passing argument 2 of 'svst1_scatter_s32offset_s32' from incompatible pointer type" } */ svst1_scatter_offset (pg, f32_ptr, s32, s32); /* { dg-warning "passing argument 2 of 'svst1_scatter_s32offset_s32' from incompatible pointer type" } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_scatter_offset_restricted_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_scatter_offset_restricted_1.c index aef152a..100624b 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_scatter_offset_restricted_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/store_scatter_offset_restricted_1.c @@ -20,7 +20,7 @@ f1 (svbool_t pg, signed char *s8_ptr, short *s16_ptr, svstnt1_scatter_offset (pg, s32_ptr, u32, s32, 0); /* { dg-error {too many arguments to function 'svstnt1_scatter_offset'} } */ svstnt1_scatter_offset (0, s32_ptr, u32, s32); /* { dg-error {passing 'int' to argument 1 of 'svstnt1_scatter_offset', which expects 'svbool_t'} } */ svstnt1_scatter_offset (pg, 0, u32, s32); - svstnt1_scatter_offset (pg, (int *) 0, u32, s32); + svstnt1_scatter_offset (pg, (int32_t *) 0, u32, s32); svstnt1_scatter_offset (pg, void_ptr, u32, s32); svstnt1_scatter_offset (pg, s_ptr, u32, s32); /* { dg-warning "passing argument 2 of 'svstnt1_scatter_u32offset_s32' from incompatible pointer type" } */ svstnt1_scatter_offset (pg, f32_ptr, u32, s32); /* { dg-warning "passing argument 2 of 'svstnt1_scatter_u32offset_s32' from incompatible pointer type" } */ |