diff mbox series

[1/2] arm: Move arm_simd_info array declaration into header

Message ID ef9ff890-2b49-674b-2fab-2bb5bd92eacc@arm.com
State New
Headers show
Series arm: Define MVE types internally | expand

Commit Message

Murray Steele Nov. 16, 2021, 10:14 a.m. UTC
Hi all,

This patch moves the arm_simd_type and arm_type_qualifiers enums, and
arm_simd_info struct from arm-builtins.c into arm-builtins.h header.

This is a first step towards internalising the type definitions for MVE
predicate, vector, and tuple types.  By moving arm_simd_types into a
header, we allow future patches to use these type trees externally to
arm-builtins.c, which is a crucial step towards developing an MVE
intrinsics framework similar to the current SVE implementation.

Thanks,
Murray

gcc/ChangeLog:

	* config/arm/arm-builtins.c (enum arm_type_qualifiers): Move to
	arm_builtins.h
	(enum arm_simd_type): Move to arm-builtins.h
	(struct arm_simd_type_info): Move to arm-builtins.h
	* config/arm/arm-builtins.h (enum arm_simd_type): Move from
	arm-builtins.c
	(enum arm_type_qualifiers): Move from arm-builtins.c
	(struct arm_simd_type_info): Move from arm-builtins.c

Comments

Richard Earnshaw Nov. 18, 2021, 3:40 p.m. UTC | #1
On 16/11/2021 10:14, Murray Steele via Gcc-patches wrote:
> Hi all,
> 
> This patch moves the arm_simd_type and arm_type_qualifiers enums, and
> arm_simd_info struct from arm-builtins.c into arm-builtins.h header.
> 
> This is a first step towards internalising the type definitions for MVE
> predicate, vector, and tuple types.  By moving arm_simd_types into a
> header, we allow future patches to use these type trees externally to
> arm-builtins.c, which is a crucial step towards developing an MVE
> intrinsics framework similar to the current SVE implementation.
> 
> Thanks,
> Murray
> 
> gcc/ChangeLog:
> 
> 	* config/arm/arm-builtins.c (enum arm_type_qualifiers): Move to
> 	arm_builtins.h
> 	(enum arm_simd_type): Move to arm-builtins.h
> 	(struct arm_simd_type_info): Move to arm-builtins.h
> 	* config/arm/arm-builtins.h (enum arm_simd_type): Move from
> 	arm-builtins.c
> 	(enum arm_type_qualifiers): Move from arm-builtins.c
> 	(struct arm_simd_type_info): Move from arm-builtins.c
> 
> 
> 

OK.

R.
Murray Steele Nov. 24, 2021, 12:15 p.m. UTC | #2
On 18/11/2021 15:40, Richard Earnshaw wrote:
> 
> 
> On 16/11/2021 10:14, Murray Steele via Gcc-patches wrote:
>> Hi all,
>>
>> This patch moves the arm_simd_type and arm_type_qualifiers enums, and
>> arm_simd_info struct from arm-builtins.c into arm-builtins.h header.
>>
>> This is a first step towards internalising the type definitions for MVE
>> predicate, vector, and tuple types.  By moving arm_simd_types into a
>> header, we allow future patches to use these type trees externally to
>> arm-builtins.c, which is a crucial step towards developing an MVE
>> intrinsics framework similar to the current SVE implementation.
>>
>> Thanks,
>> Murray
>>
>> gcc/ChangeLog:
>>
>>     * config/arm/arm-builtins.c (enum arm_type_qualifiers): Move to
>>     arm_builtins.h
>>     (enum arm_simd_type): Move to arm-builtins.h
>>     (struct arm_simd_type_info): Move to arm-builtins.h
>>     * config/arm/arm-builtins.h (enum arm_simd_type): Move from
>>     arm-builtins.c
>>     (enum arm_type_qualifiers): Move from arm-builtins.c
>>     (struct arm_simd_type_info): Move from arm-builtins.c
>>
>>
>>
> 
> OK.
> 
> R.

Hi Richard,

I don't currently have write access, so I will need this patch committed on my behalf.

Thanks again,
Murray
Richard Earnshaw Nov. 24, 2021, 12:18 p.m. UTC | #3
On 24/11/2021 12:15, Murray Steele wrote:
> On 18/11/2021 15:40, Richard Earnshaw wrote:
>>
>>
>> On 16/11/2021 10:14, Murray Steele via Gcc-patches wrote:
>>> Hi all,
>>>
>>> This patch moves the arm_simd_type and arm_type_qualifiers enums, and
>>> arm_simd_info struct from arm-builtins.c into arm-builtins.h header.
>>>
>>> This is a first step towards internalising the type definitions for MVE
>>> predicate, vector, and tuple types.  By moving arm_simd_types into a
>>> header, we allow future patches to use these type trees externally to
>>> arm-builtins.c, which is a crucial step towards developing an MVE
>>> intrinsics framework similar to the current SVE implementation.
>>>
>>> Thanks,
>>> Murray
>>>
>>> gcc/ChangeLog:
>>>
>>>      * config/arm/arm-builtins.c (enum arm_type_qualifiers): Move to
>>>      arm_builtins.h
>>>      (enum arm_simd_type): Move to arm-builtins.h
>>>      (struct arm_simd_type_info): Move to arm-builtins.h
>>>      * config/arm/arm-builtins.h (enum arm_simd_type): Move from
>>>      arm-builtins.c
>>>      (enum arm_type_qualifiers): Move from arm-builtins.c
>>>      (struct arm_simd_type_info): Move from arm-builtins.c
>>>
>>>
>>>
>>
>> OK.
>>
>> R.
> 
> Hi Richard,
> 
> I don't currently have write access, so I will need this patch committed on my behalf.
> 
> Thanks again,
> Murray
> 

That can be done when 2/2 patch has been resolved.  They need to go in 
together.

R.
Richard Earnshaw Dec. 22, 2021, 2:59 p.m. UTC | #4
On 24/11/2021 12:18, Richard Earnshaw via Gcc-patches wrote:
> 
> 
> On 24/11/2021 12:15, Murray Steele wrote:
>> On 18/11/2021 15:40, Richard Earnshaw wrote:
>>>
>>>
>>> On 16/11/2021 10:14, Murray Steele via Gcc-patches wrote:
>>>> Hi all,
>>>>
>>>> This patch moves the arm_simd_type and arm_type_qualifiers enums, and
>>>> arm_simd_info struct from arm-builtins.c into arm-builtins.h header.
>>>>
>>>> This is a first step towards internalising the type definitions for MVE
>>>> predicate, vector, and tuple types.  By moving arm_simd_types into a
>>>> header, we allow future patches to use these type trees externally to
>>>> arm-builtins.c, which is a crucial step towards developing an MVE
>>>> intrinsics framework similar to the current SVE implementation.
>>>>
>>>> Thanks,
>>>> Murray
>>>>
>>>> gcc/ChangeLog:
>>>>
>>>>      * config/arm/arm-builtins.c (enum arm_type_qualifiers): Move to
>>>>      arm_builtins.h
>>>>      (enum arm_simd_type): Move to arm-builtins.h
>>>>      (struct arm_simd_type_info): Move to arm-builtins.h
>>>>      * config/arm/arm-builtins.h (enum arm_simd_type): Move from
>>>>      arm-builtins.c
>>>>      (enum arm_type_qualifiers): Move from arm-builtins.c
>>>>      (struct arm_simd_type_info): Move from arm-builtins.c
>>>>
>>>>
>>>>
>>>
>>> OK.
>>>
>>> R.
>>
>> Hi Richard,
>>
>> I don't currently have write access, so I will need this patch 
>> committed on my behalf.
>>
>> Thanks again,
>> Murray
>>
> 
> That can be done when 2/2 patch has been resolved.  They need to go in 
> together.
> 
> R.

Now pushed.

R.
diff mbox series

Patch

diff --git a/gcc/config/arm/arm-builtins.h b/gcc/config/arm/arm-builtins.h
index bee9f9bb83758820ca7faedf80b7e138026c1ca0..a40fa8950707314d3cc1372fb5c47a8891a18516 100644
--- a/gcc/config/arm/arm-builtins.h
+++ b/gcc/config/arm/arm-builtins.h
@@ -32,4 +32,91 @@  enum resolver_ident {
 enum resolver_ident arm_describe_resolver (tree);
 unsigned arm_cde_end_args (tree);
 
+#define ENTRY(E, M, Q, S, T, G) E,
+enum arm_simd_type
+{
+#include "arm-simd-builtin-types.def"
+  __TYPE_FINAL
+};
+#undef ENTRY
+
+enum arm_type_qualifiers
+{
+  /* T foo.  */
+  qualifier_none = 0x0,
+  /* unsigned T foo.  */
+  qualifier_unsigned = 0x1, /* 1 << 0  */
+  /* const T foo.  */
+  qualifier_const = 0x2, /* 1 << 1  */
+  /* T *foo.  */
+  qualifier_pointer = 0x4, /* 1 << 2  */
+  /* const T * foo.  */
+  qualifier_const_pointer = 0x6,
+  /* Used when expanding arguments if an operand could
+     be an immediate.  */
+  qualifier_immediate = 0x8, /* 1 << 3  */
+  qualifier_unsigned_immediate = 0x9,
+  qualifier_maybe_immediate = 0x10, /* 1 << 4  */
+  /* void foo (...).  */
+  qualifier_void = 0x20, /* 1 << 5  */
+  /* Some patterns may have internal operands, this qualifier is an
+     instruction to the initialisation code to skip this operand.  */
+  qualifier_internal = 0x40, /* 1 << 6  */
+  /* Some builtins should use the T_*mode* encoded in a simd_builtin_datum
+     rather than using the type of the operand.  */
+  qualifier_map_mode = 0x80, /* 1 << 7  */
+  /* qualifier_pointer | qualifier_map_mode  */
+  qualifier_pointer_map_mode = 0x84,
+  /* qualifier_const_pointer | qualifier_map_mode  */
+  qualifier_const_pointer_map_mode = 0x86,
+  /* Polynomial types.  */
+  qualifier_poly = 0x100,
+  /* Lane indices - must be within range of previous argument = a vector.  */
+  qualifier_lane_index = 0x200,
+  /* Lane indices for single lane structure loads and stores.  */
+  qualifier_struct_load_store_lane_index = 0x400,
+  /* A void pointer.  */
+  qualifier_void_pointer = 0x800,
+  /* A const void pointer.  */
+  qualifier_const_void_pointer = 0x802,
+  /* Lane indices selected in pairs - must be within range of previous
+     argument = a vector.  */
+  qualifier_lane_pair_index = 0x1000,
+  /* Lane indices selected in quadtuplets - must be within range of previous
+     argument = a vector.  */
+  qualifier_lane_quadtup_index = 0x2000
+};
+
+struct arm_simd_type_info
+{
+  enum arm_simd_type type;
+
+  /* Internal type name.  */
+  const char *name;
+
+  /* Internal type name(mangled).  The mangled names conform to the
+     AAPCS (see "Procedure Call Standard for the ARM Architecture",
+     Appendix A).  To qualify for emission with the mangled names defined in
+     that document, a vector type must not only be of the correct mode but also
+     be of the correct internal Neon vector type (e.g. __simd64_int8_t);
+     these types are registered by arm_init_simd_builtin_types ().  In other
+     words, vector types defined in other ways e.g. via vector_size attribute
+     will get default mangled names.  */
+  const char *mangle;
+
+  /* Internal type.  */
+  tree itype;
+
+  /* Element type.  */
+  tree eltype;
+
+  /* Machine mode the internal type maps to.  */
+  machine_mode mode;
+
+  /* Qualifiers.  */
+  enum arm_type_qualifiers q;
+};
+
+extern struct arm_simd_type_info arm_simd_types[];
+
 #endif /* GCC_ARM_BUILTINS_H */
diff --git a/gcc/config/arm/arm-builtins.c b/gcc/config/arm/arm-builtins.c
index 3a9ff8f26b8e222c52cb70f7509b714c3e475758..b6bf31349d8f0e996a6c169b061ebe05a2cf9acb 100644
--- a/gcc/config/arm/arm-builtins.c
+++ b/gcc/config/arm/arm-builtins.c
@@ -48,53 +48,6 @@ 
 
 #define SIMD_MAX_BUILTIN_ARGS 7
 
-enum arm_type_qualifiers
-{
-  /* T foo.  */
-  qualifier_none = 0x0,
-  /* unsigned T foo.  */
-  qualifier_unsigned = 0x1, /* 1 << 0  */
-  /* const T foo.  */
-  qualifier_const = 0x2, /* 1 << 1  */
-  /* T *foo.  */
-  qualifier_pointer = 0x4, /* 1 << 2  */
-  /* const T * foo.  */
-  qualifier_const_pointer = 0x6,
-  /* Used when expanding arguments if an operand could
-     be an immediate.  */
-  qualifier_immediate = 0x8, /* 1 << 3  */
-  qualifier_unsigned_immediate = 0x9,
-  qualifier_maybe_immediate = 0x10, /* 1 << 4  */
-  /* void foo (...).  */
-  qualifier_void = 0x20, /* 1 << 5  */
-  /* Some patterns may have internal operands, this qualifier is an
-     instruction to the initialisation code to skip this operand.  */
-  qualifier_internal = 0x40, /* 1 << 6  */
-  /* Some builtins should use the T_*mode* encoded in a simd_builtin_datum
-     rather than using the type of the operand.  */
-  qualifier_map_mode = 0x80, /* 1 << 7  */
-  /* qualifier_pointer | qualifier_map_mode  */
-  qualifier_pointer_map_mode = 0x84,
-  /* qualifier_const_pointer | qualifier_map_mode  */
-  qualifier_const_pointer_map_mode = 0x86,
-  /* Polynomial types.  */
-  qualifier_poly = 0x100,
-  /* Lane indices - must be within range of previous argument = a vector.  */
-  qualifier_lane_index = 0x200,
-  /* Lane indices for single lane structure loads and stores.  */
-  qualifier_struct_load_store_lane_index = 0x400,
-  /* A void pointer.  */
-  qualifier_void_pointer = 0x800,
-  /* A const void pointer.  */
-  qualifier_const_void_pointer = 0x802,
-  /* Lane indices selected in pairs - must be within range of previous
-     argument = a vector.  */
-  qualifier_lane_pair_index = 0x1000,
-  /* Lane indices selected in quadtuplets - must be within range of previous
-     argument = a vector.  */
-  qualifier_lane_quadtup_index = 0x2000
-};
-
 /*  The qualifier_internal allows generation of a unary builtin from
     a pattern with a third pseudo-operand such as a match_scratch.
     T (T).  */
@@ -1377,50 +1330,12 @@  const char *arm_scalar_builtin_types[] = {
   NULL
 };
 
-#define ENTRY(E, M, Q, S, T, G) E,
-enum arm_simd_type
-{
-#include "arm-simd-builtin-types.def"
-  __TYPE_FINAL
-};
-#undef ENTRY
-
-struct arm_simd_type_info
-{
-  enum arm_simd_type type;
-
-  /* Internal type name.  */
-  const char *name;
-
-  /* Internal type name(mangled).  The mangled names conform to the
-     AAPCS (see "Procedure Call Standard for the ARM Architecture",
-     Appendix A).  To qualify for emission with the mangled names defined in
-     that document, a vector type must not only be of the correct mode but also
-     be of the correct internal Neon vector type (e.g. __simd64_int8_t);
-     these types are registered by arm_init_simd_builtin_types ().  In other
-     words, vector types defined in other ways e.g. via vector_size attribute
-     will get default mangled names.  */
-  const char *mangle;
-
-  /* Internal type.  */
-  tree itype;
-
-  /* Element type.  */
-  tree eltype;
-
-  /* Machine mode the internal type maps to.  */
-  machine_mode mode;
-
-  /* Qualifiers.  */
-  enum arm_type_qualifiers q;
-};
-
 #define ENTRY(E, M, Q, S, T, G)		\
   {E,					\
    "__simd" #S "_" #T "_t",		\
    #G "__simd" #S "_" #T "_t",		\
    NULL_TREE, NULL_TREE, M##mode, qualifier_##Q},
-static struct arm_simd_type_info arm_simd_types [] = {
+struct arm_simd_type_info arm_simd_types [] = {
 #include "arm-simd-builtin-types.def"
 };
 #undef ENTRY