From: Karl Meakin <[email protected]>

Spread the initializers over several lines, and include the names of
each field in a comment (in lieu of C++20 designated initializers).

Also rename `CONSTEXPR` to `constexpr` and remove `const` (it is
redundant, because `constexpr` implies `const`).

gcc/ChangeLog:

        * config/aarch64/aarch64-sve-builtins.cc (vector_types): Reformat.
        (mode_suffixes): Likewise.
        (group_suffixes): Likewise.
        (function_groups): Likewise.
        (neon_sve_function_groups): Likewise.
        (sme_function_groups): Likewise.
---
 gcc/config/aarch64/aarch64-sve-builtins.cc | 179 +++++++++++++--------
 1 file changed, 110 insertions(+), 69 deletions(-)

diff --git a/gcc/config/aarch64/aarch64-sve-builtins.cc b/gcc/config/aarch64/aarch64-sve-builtins.cc
index b5daddd3fe1..e05c5f5719a 100644
--- a/gcc/config/aarch64/aarch64-sve-builtins.cc
+++ b/gcc/config/aarch64/aarch64-sve-builtins.cc
@@ -103,11 +103,15 @@ struct registered_function_hasher : nofree_ptr_hash <registered_function>
 };
 
 /* Information about each single-predicate or single-vector type.  */
-static CONSTEXPR const vector_type_info vector_types[] = {
-#define DEF_SVE_TYPE(ACLE_NAME, NCHARS, ABI_NAME, SCALAR_TYPE) \
-  { #ACLE_NAME, #ABI_NAME, "u" #NCHARS #ABI_NAME },
+/* clang-format off */
+static constexpr vector_type_info vector_types[] = {
+#define DEF_SVE_TYPE(ACLE_NAME, NCHARS, ABI_NAME, SCALAR_TYPE)			\
+  { /* .acle_name    = */ #ACLE_NAME,						\
+    /* .abi_name     = */ #ABI_NAME,						\
+    /* .mangled_name = */ "u" #NCHARS #ABI_NAME },
 #include "aarch64-sve-builtins.def"
 };
+/* clang-format on */
 
 /* The function name suffix associated with each predication type.  */
 static const char *const pred_suffixes[NUM_PREDS + 1] = {
@@ -121,61 +125,72 @@ static const char *const pred_suffixes[NUM_PREDS + 1] = {
 };
 
 /* Static information about each mode_suffix_index.  */
-CONSTEXPR const mode_suffix_info mode_suffixes[] = {
+/* clang-format off */
+constexpr mode_suffix_info mode_suffixes[] = {
 #define VECTOR_TYPE_none NUM_VECTOR_TYPES
-#define DEF_SVE_MODE(NAME, BASE, DISPLACEMENT, UNITS) \
-  { "_" #NAME, VECTOR_TYPE_##BASE, VECTOR_TYPE_##DISPLACEMENT, UNITS_##UNITS },
+#define DEF_SVE_MODE(NAME, BASE, DISPLACEMENT, UNITS)				\
+  { /* .string                   = */ "_" #NAME,				\
+    /* .base_vector_type         = */ VECTOR_TYPE_##BASE,			\
+    /* .displacement_vector_type = */ VECTOR_TYPE_##DISPLACEMENT,		\
+    /* .displacement_units       = */ UNITS_##UNITS },
 #include "aarch64-sve-builtins.def"
-#undef VECTOR_TYPE_none
-  { "", NUM_VECTOR_TYPES, NUM_VECTOR_TYPES, UNITS_none }
+  { "", VECTOR_TYPE_none, VECTOR_TYPE_none, UNITS_none }
 };
+/* clang-format on */
 
 /* Static information about each type_suffix_index.  */
-CONSTEXPR const type_suffix_info type_suffixes[NUM_TYPE_SUFFIXES + 1] = {
-#define DEF_SVE_NEON_TYPE_SUFFIX(NAME, ACLE_TYPE, CLASS, BITS, MODE, \
-				 NEON64, NEON128) \
-  { "_" #NAME, \
-    VECTOR_TYPE_##ACLE_TYPE, \
-    TYPE_##CLASS, \
-    BITS, \
-    BITS / BITS_PER_UNIT, \
-    TYPE_##CLASS == TYPE_signed || TYPE_##CLASS == TYPE_unsigned, \
-    TYPE_##CLASS == TYPE_unsigned, \
-    TYPE_##CLASS == TYPE_float || TYPE_##CLASS == TYPE_bfloat, \
-    TYPE_##CLASS != TYPE_bool, \
-    TYPE_##CLASS == TYPE_bool, \
-    false, \
-    0, \
-    MODE, \
-    NEON64, \
-    NEON128 },
-#define DEF_SME_ZA_SUFFIX(NAME, BITS, MODE) \
-  { "_" #NAME, \
-    NUM_VECTOR_TYPES, \
-    NUM_TYPE_CLASSES, \
-    BITS, \
-    BITS / BITS_PER_UNIT, \
-    false, \
-    false, \
-    false, \
-    false, \
-    false, \
-    true, \
-    0, \
-    MODE, \
-    ARM_NEON_H_TYPES_LAST, \
-    ARM_NEON_H_TYPES_LAST },
+/* clang-format off */
+constexpr type_suffix_info type_suffixes[NUM_TYPE_SUFFIXES + 1] = {
+#define DEF_SVE_NEON_TYPE_SUFFIX(NAME, ACLE_TYPE, CLASS, BITS, MODE,		\
+				 NEON64, NEON128)				\
+  { /* .string        = */ "_" #NAME,						\
+    /* .vector_type   = */ VECTOR_TYPE_##ACLE_TYPE,				\
+    /* .tclass        = */ TYPE_##CLASS,					\
+    /* .element_bits  = */ BITS,						\
+    /* .element_bytes = */ BITS / BITS_PER_UNIT,				\
+    /* .integer_p     = */ TYPE_##CLASS == TYPE_signed				\
+			|| TYPE_##CLASS == TYPE_unsigned,			\
+    /* .unsigned_p    = */ TYPE_##CLASS == TYPE_unsigned,			\
+    /* .float_p       = */ TYPE_##CLASS == TYPE_float				\
+			|| TYPE_##CLASS == TYPE_bfloat,				\
+    /* .vector_p      = */ TYPE_##CLASS != TYPE_bool,				\
+    /* .bool_p        = */ TYPE_##CLASS == TYPE_bool,				\
+    /* .za_p          = */ false,						\
+    /* .spare         = */ 0,							\
+    /* .vector_mode   = */ MODE,						\
+    /* .neon64_type   = */ NEON64,						\
+    /* .neon128_type  = */ NEON128 },
+#define DEF_SME_ZA_SUFFIX(NAME, BITS, MODE)					\
+  { /* .string        = */ "_" #NAME,						\
+    /* .vector_type   = */ NUM_VECTOR_TYPES,					\
+    /* .tclass        = */ NUM_TYPE_CLASSES,					\
+    /* .element_bits  = */ BITS,						\
+    /* .element_bytes = */ BITS / BITS_PER_UNIT,				\
+    /* .integer_p     = */ false,						\
+    /* .unsigned_p    = */ false,						\
+    /* .float_p       = */ false,						\
+    /* .vector_p      = */ false,						\
+    /* .bool_p        = */ false,						\
+    /* .za_p          = */ true,						\
+    /* .spare         = */ 0,							\
+    /* .vector_mode   = */ MODE,						\
+    /* .neon64_type   = */ ARM_NEON_H_TYPES_LAST,				\
+    /* .neon128_type  = */ ARM_NEON_H_TYPES_LAST },
 #include "aarch64-sve-builtins.def"
-  { "", NUM_VECTOR_TYPES, TYPE_bool, 0, 0, false, false, false, false,
-    false, false, 0, VOIDmode, ARM_NEON_H_TYPES_LAST, ARM_NEON_H_TYPES_LAST }
-};
-
-CONSTEXPR const group_suffix_info group_suffixes[] = {
-#define DEF_SVE_GROUP_SUFFIX(NAME, VG, VECTORS_PER_TUPLE) \
-  { "_" #NAME, VG, VECTORS_PER_TUPLE },
+  {"", NUM_VECTOR_TYPES, TYPE_bool, 0, 0, false, false, false, false, false,
+   false, 0, VOIDmode, ARM_NEON_H_TYPES_LAST, ARM_NEON_H_TYPES_LAST}};
+/* clang-format on */
+
+/* clang-format off */
+constexpr group_suffix_info group_suffixes[] = {
+#define DEF_SVE_GROUP_SUFFIX(NAME, VG, VECTORS_PER_TUPLE)			\
+  { /* .string		  = */ "_" #NAME,					\
+    /* .vectors_per_group = */ VG,						\
+    /* .vectors_per_tuple = */ VECTORS_PER_TUPLE },
 #include "aarch64-sve-builtins.def"
   { "", 0, 1 }
 };
+/* clang-format on */
 
 /* Define a TYPES_<combination> macro for each combination of type
    suffixes that an ACLE function can have, where <combination> is the
@@ -965,36 +980,62 @@ static const predication_index preds_za_m[] = { PRED_za_m, NUM_PREDS };
 #define SSVE(X) SVE_AND_SME (X, X)
 
 /* A list of all arm_sve.h functions.  */
-static CONSTEXPR const function_group_info function_groups[] = {
-#define DEF_SVE_FUNCTION_GS_FPM(NAME, SHAPE, TYPES, GROUPS, PREDS, FPM_MODE) \
-  { #NAME, &functions::NAME, &shapes::SHAPE, types_##TYPES, groups_##GROUPS, \
-    preds_##PREDS, aarch64_required_extensions::REQUIRED_EXTENSIONS, \
-    FPM_##FPM_MODE },
+/* clang-format off */
+static constexpr function_group_info function_groups[] = {
+#define DEF_SVE_FUNCTION_GS_FPM(NAME, SHAPE, TYPES, GROUPS, PREDS, FPM_MODE)	\
+  { /* .base_name  = */ #NAME,							\
+    /* .base       = */ &functions::NAME,					\
+    /* .shape      = */ &shapes::SHAPE,						\
+    /* .types      = */ types_##TYPES,						\
+    /* .groups     = */ groups_##GROUPS,					\
+    /* .preds      = */ preds_##PREDS,						\
+    /* .extensions = */ aarch64_required_extensions::REQUIRED_EXTENSIONS,	\
+    /* .fpm_mode   = */ FPM_##FPM_MODE },
 #include "aarch64-sve-builtins.def"
 };
+/* clang-format on */
 
 /* A list of all arm_neon_sve_bridge.h ACLE functions.  */
-static CONSTEXPR const function_group_info neon_sve_function_groups[] = {
-#define DEF_NEON_SVE_FUNCTION(NAME, SHAPE, TYPES, GROUPS, PREDS) \
-  { #NAME, &neon_sve_bridge_functions::NAME, &shapes::SHAPE, types_##TYPES, \
-    groups_##GROUPS, preds_##PREDS, aarch64_required_extensions::ssve (0), \
-    FPM_unused },
+/* clang-format off */
+static constexpr function_group_info neon_sve_function_groups[] = {
+#define DEF_NEON_SVE_FUNCTION(NAME, SHAPE, TYPES, GROUPS, PREDS)		\
+  { /* .base_name  = */ #NAME,							\
+    /* .base       = */ &neon_sve_bridge_functions::NAME,			\
+    /* .shape      = */ &shapes::SHAPE,						\
+    /* .types      = */ types_##TYPES,						\
+    /* .groups     = */ groups_##GROUPS,					\
+    /* .preds      = */ preds_##PREDS,						\
+    /* .extensions = */ aarch64_required_extensions::ssve (0),			\
+    /* .fpm_mode   = */ FPM_unused },
 #include "aarch64-neon-sve-bridge-builtins.def"
 };
+/* clang-format on */
 
 /* A list of all arm_sme.h functions.  */
-static CONSTEXPR const function_group_info sme_function_groups[] = {
-#define DEF_SME_FUNCTION_GS(NAME, SHAPE, TYPES, GROUPS, PREDS) \
-  { #NAME, &functions::NAME, &shapes::SHAPE, types_##TYPES, groups_##GROUPS, \
-    preds_##PREDS, aarch64_required_extensions::REQUIRED_EXTENSIONS, \
-    FPM_unused },
-#define DEF_SME_ZA_FUNCTION_GS(NAME, SHAPE, TYPES, GROUPS, PREDS) \
-  { #NAME, &functions::NAME##_za, &shapes::SHAPE, types_##TYPES, \
-    groups_##GROUPS, preds_##PREDS, \
-    aarch64_required_extensions::REQUIRED_EXTENSIONS \
-      .and_also (AARCH64_FL_ZA_ON), FPM_unused },
+/* clang-format off */
+static constexpr function_group_info sme_function_groups[] = {
+#define DEF_SME_FUNCTION_GS(NAME, SHAPE, TYPES, GROUPS, PREDS)			\
+  { /* .base_name  = */ #NAME,							\
+    /* .base       = */ &functions::NAME,					\
+    /* .shape      = */ &shapes::SHAPE,						\
+    /* .types      = */ types_##TYPES,						\
+    /* .groups     = */ groups_##GROUPS,					\
+    /* .preds      = */ preds_##PREDS,						\
+    /* .extensions = */ aarch64_required_extensions::REQUIRED_EXTENSIONS,	\
+    /* .fpm_mode   = */ FPM_unused },
+#define DEF_SME_ZA_FUNCTION_GS(NAME, SHAPE, TYPES, GROUPS, PREDS)		\
+  { /* .base_name  = */ #NAME,							\
+    /* .base       = */ &functions::NAME##_za,					\
+    /* .shape      = */ &shapes::SHAPE,						\
+    /* .types      = */ types_##TYPES,						\
+    /* .groups     = */ groups_##GROUPS,					\
+    /* .preds      = */ preds_##PREDS,						\
+    /* .extensions = */ aarch64_required_extensions::REQUIRED_EXTENSIONS	\
+                          .and_also (AARCH64_FL_ZA_ON),				\
+    /* .fpm_mode   = */ FPM_unused },
 #include "aarch64-sve-builtins-sme.def"
 };
+/* clang-format on */
 
 /* The scalar type associated with each vector type.  */
 extern GTY(()) tree scalar_types[NUM_VECTOR_TYPES + 1];

Reply via email to