[committed] aarch64: Use stdint types for SVE ACLE elements
diff mbox series

Message ID mptlfq0u64w.fsf@arm.com
State New
Headers show
Series
  • [committed] aarch64: Use stdint types for SVE ACLE elements
Related show

Commit Message

Richard Sandiford Jan. 21, 2020, 4:27 p.m. UTC
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.

Tested on aarch64-linux-gnu and aarch64_be-elf, applied.

There are still other ILP32-related ACLE failures to go...

Richard


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.
---
 gcc/config/aarch64/aarch64-sve-builtins.def   | 19 +++++++++++--------
 .../aarch64/sve/acle/general-c/load_1.c       |  2 +-
 .../aarch64/sve/acle/general-c/load_2.c       |  2 +-
 .../sve/acle/general-c/load_gather_sv_1.c     |  2 +-
 .../sve/acle/general-c/load_gather_sv_2.c     |  2 +-
 .../general-c/load_gather_sv_restricted_1.c   |  2 +-
 .../sve/acle/general-c/load_replicate_1.c     |  2 +-
 .../aarch64/sve/acle/general-c/store_1.c      |  2 +-
 .../aarch64/sve/acle/general-c/store_2.c      |  2 +-
 .../acle/general-c/store_scatter_index_1.c    |  2 +-
 .../acle/general-c/store_scatter_offset_2.c   |  2 +-
 .../store_scatter_offset_restricted_1.c       |  2 +-
 12 files changed, 22 insertions(+), 19 deletions(-)

Patch
diff mbox series

diff --git a/gcc/config/aarch64/aarch64-sve-builtins.def b/gcc/config/aarch64/aarch64-sve-builtins.def
index 040f1d8cb8f..a5a5aca58dd 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/gcc.target/aarch64/sve/acle/general-c/load_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/load_1.c
index 34f989bf8bb..784fdc317e6 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 beb07f138d7..a8288762695 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 21566a9d96d..4daede78dcb 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 4c15fc40c10..65510cbe3f6 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 b12faadda55..51e11fca88a 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 d4ff76ea871..ebcb0e85b1a 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 267db83f70f..625f059af44 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 4e4fb3c6d66..c718b3ee04e 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 3209149b619..89528237522 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 8ee8129fa10..4854818cae6 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 aef152acf5b..100624b7b03 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" } */