On Fri, Oct 24, 2025 at 04:36:46PM +0100, Karl Meakin wrote:
> 
> On 24/10/2025 15:26, Kyrylo Tkachov wrote:
> > 
> > > On 16 Sep 2025, at 12:43, via Sourceware Forge 
> > > <[email protected]> wrote:
> > > 
> > > 
> > > From: Karl Meakin <[email protected]>
> > > 
> > I’ve added Karl explicitly on CC myself as I think the forge doesn’t do it 
> > currently.
> > 
> > 
> > > Document all the `DEF_*` macros and their arguments.
> > > 
> > > gcc/ChangeLog:
> > > 
> > > * config/aarch64/aarch64-neon-sve-bridge-builtins.def 
> > > (DEF_NEON_SVE_FUNCTION): Document.
> > > * config/aarch64/aarch64-sve-builtins-base.def (DEF_SVE_FUNCTION_GS_FPM): 
> > > Likewise.
> > > (DEF_SVE_FUNCTION_GS): Likewise.
> > > (DEF_SVE_FUNCTION): Likewise.
> > > * config/aarch64/aarch64-sve-builtins-sme.def (DEF_SME_FUNCTION): 
> > > Likewise.
> > > (DEF_SME_FUNCTION_GS): Likewise.
> > > (DEF_SME_ZA_FUNCTION_GS): Likewise.
> > > (DEF_SME_ZA_FUNCTION): Likewise.
> > > * config/aarch64/aarch64-sve-builtins.def (DEF_SVE_MODE): Likewise.
> > > (DEF_SVE_TYPE): Likewise.
> > > (DEF_SVE_TYPE_SUFFIX): Likewise.
> > > (DEF_SME_ZA_SUFFIX): Likewise.
> > > (DEF_SVE_GROUP_SUFFIX): Likewise.
> > > (DEF_SVE_FUNCTION_GS_FPM): Likewise.
> > > (DEF_SVE_FUNCTION_GS): Likewise.
> > > (DEF_SVE_NEON_TYPE_SUFFIX): Likewise.
> > > (DEF_SVE_FUNCTION): Likewise.
> > > ---
> > > .../aarch64-neon-sve-bridge-builtins.def      |  4 +-
> > > .../aarch64/aarch64-sve-builtins-base.def     | 22 +++++++++
> > > .../aarch64/aarch64-sve-builtins-sme.def      | 24 +++++++---
> > > gcc/config/aarch64/aarch64-sve-builtins.def   | 45 ++++++++++++++-----
> > > 4 files changed, 76 insertions(+), 19 deletions(-)
> > > 
> > > diff --git a/gcc/config/aarch64/aarch64-neon-sve-bridge-builtins.def 
> > > b/gcc/config/aarch64/aarch64-neon-sve-bridge-builtins.def
> > > index a28d219a2d7..2935a2f832e 100644
> > > --- a/gcc/config/aarch64/aarch64-neon-sve-bridge-builtins.def
> > > +++ b/gcc/config/aarch64/aarch64-neon-sve-bridge-builtins.def
> > > @@ -17,8 +17,10 @@
> > >     along with GCC; see the file COPYING3.  If not see
> > >     <http://www.gnu.org/licenses/>.  */
> > > 
> > > +/* Define an SVE function with a Neon bridge.
> > > +   See the fields in `function_group_info` for the meaning of each 
> > > argument.  */
> > > #ifndef DEF_NEON_SVE_FUNCTION
> > > -#define DEF_NEON_SVE_FUNCTION(A, B, C, D, E)
> > > +#define DEF_NEON_SVE_FUNCTION(NAME, SHAPE, TYPES, GROUPS, PREDS)
> > > #endif
> > > 
> > > DEF_NEON_SVE_FUNCTION (svset_neonq, set_neonq, all_data, none, none)
> > > diff --git a/gcc/config/aarch64/aarch64-sve-builtins-base.def 
> > > b/gcc/config/aarch64/aarch64-sve-builtins-base.def
> > > index 4c8d9a62d71..a994b10ca17 100644
> > > --- a/gcc/config/aarch64/aarch64-sve-builtins-base.def
> > > +++ b/gcc/config/aarch64/aarch64-sve-builtins-base.def
> > > @@ -17,6 +17,26 @@
> > >     along with GCC; see the file COPYING3.  If not see
> > >     <http://www.gnu.org/licenses/>.  */
> > > 
> > > +/* clang-format off */
> > > +
> > I notice this directive is a new thing in the aarch64 backend.
> > Grepping around I see it used quite a bit in the Rust frontend and a couple 
> > of places in the Fortran frontend.
> > So I don’t object really, just curious if it was intended.
> > Patch is ok.
> > Thanks,
> > Kyrill
> 
> Yes, it was intentional. I wanted to align the arguments to macros on
> successive lines (eg `DEF_SVE_FUNCTION` and `DEF_SVE_FUNCTION_GS`) and
> clang-format was interfering

I don't think there's any benefit to having these clang-format markings added
to the repository in an adhoc manner when much of the surrounding code wouldn't
satisfy clang-format either.  In contrast, I notice that rust/CONTRIBUTING.md
discusses running clang-format on the whole of that directory, so perhaps the
entire Rust frontend has been written to satisfy clang-format.

If you find these annotations useful when you're writing the code, would it be
convenient to include then delete them before sending/pushing?  I'm not sure
how clang-format fits into your workflow, so that might be harder than it
seems.

Alice

> 
> > 
> > > +/* Define an SVE function group.
> > > +   See the fields in `function_group_info` for the meaning of each 
> > > argument.  */
> > > +#ifndef DEF_SVE_FUNCTION_GS_FPM
> > > +#define DEF_SVE_FUNCTION_GS_FPM(NAME, SHAPE, TYPES, GROUPS, PREDS, 
> > > FPM_MODE)
> > > +#endif
> > > +
> > > +/* Same as `DEF_SVE_FUNCTION_GS_FPM` above, but with FPM = unused.  */
> > > +#ifndef DEF_SVE_FUNCTION_GS
> > > +#define DEF_SVE_FUNCTION_GS(NAME, SHAPE, TYPES, GROUPS, PREDS) \
> > > +   DEF_SVE_FUNCTION_GS_FPM (NAME, SHAPE, TYPES, GROUPS, PREDS, unused)
> > > +#endif
> > > +
> > > +/* Same as `DEF_SVE_FUNCTION_GS` above, but with GROUPS = none.  */
> > > +#ifndef DEF_SVE_FUNCTION
> > > +#define DEF_SVE_FUNCTION(NAME, SHAPE, TYPES,       PREDS) \
> > > +    DEF_SVE_FUNCTION_GS (NAME, SHAPE, TYPES, none, PREDS)
> > > +#endif
> > > +
> > > #define REQUIRED_EXTENSIONS ssve (0)
> > > DEF_SVE_FUNCTION (svabd, binary_opt_n, all_arith, mxz)
> > > DEF_SVE_FUNCTION (svabs, unary, all_float_and_signed, mxz)
> > > @@ -371,3 +391,5 @@ DEF_SVE_FUNCTION (svuzp2q, binary, all_data, none)
> > > DEF_SVE_FUNCTION (svzip1q, binary, all_data, none)
> > > DEF_SVE_FUNCTION (svzip2q, binary, all_data, none)
> > > #undef REQUIRED_EXTENSIONS
> > > +
> > > +/* clang-format on */
> > > diff --git a/gcc/config/aarch64/aarch64-sve-builtins-sme.def 
> > > b/gcc/config/aarch64/aarch64-sve-builtins-sme.def
> > > index 978a74f438d..9d1944e15fa 100644
> > > --- a/gcc/config/aarch64/aarch64-sve-builtins-sme.def
> > > +++ b/gcc/config/aarch64/aarch64-sve-builtins-sme.def
> > > @@ -17,19 +17,29 @@
> > >     along with GCC; see the file COPYING3.  If not see
> > >     <http://www.gnu.org/licenses/>.  */
> > > 
> > > -#ifndef DEF_SME_FUNCTION
> > > -#define DEF_SME_FUNCTION(NAME, SHAPE, TYPES, PREDS) \
> > > -  DEF_SME_FUNCTION_GS (NAME, SHAPE, TYPES, none, PREDS)
> > > +/* clang-format off */
> > > +
> > > +/* Define an SME function.
> > > +   See `function_group_info` for the meaning of each argument.  */
> > > +#ifndef DEF_SME_FUNCTION_GS
> > > +#define DEF_SME_FUNCTION_GS(NAME, SHAPE, TYPES, GROUPS, PREDS)
> > > #endif
> > > 
> > > +/* Same as `DEF_SME_FUNCTION_GS` above, but with GROUPS = none.  */
> > > +#define DEF_SME_FUNCTION(NAME, SHAPE, TYPES,       PREDS) \
> > > +    DEF_SME_FUNCTION_GS (NAME, SHAPE, TYPES, none, PREDS)
> > > +
> > > +/* Define an SME function that operates on ZA.
> > > +   See `function_group_info` for the meaning of each argument.  */
> > > #ifndef DEF_SME_ZA_FUNCTION_GS
> > > #define DEF_SME_ZA_FUNCTION_GS(NAME, SHAPE, TYPES, GROUP, PREDS) \
> > > -  DEF_SME_FUNCTION_GS (NAME, SHAPE, TYPES, GROUP, PREDS)
> > > +          DEF_SME_FUNCTION_GS (NAME, SHAPE, TYPES, GROUP, PREDS)
> > > #endif
> > > 
> > > +/* Same as `DEF_SME_ZA_FUNCTION_GS` above, but with GROUPS = none.  */
> > > #ifndef DEF_SME_ZA_FUNCTION
> > > -#define DEF_SME_ZA_FUNCTION(NAME, SHAPE, TYPES, PREDS) \
> > > -  DEF_SME_ZA_FUNCTION_GS (NAME, SHAPE, TYPES, none, PREDS)
> > > +#define DEF_SME_ZA_FUNCTION(NAME, SHAPE, TYPES,       PREDS) \
> > > +    DEF_SME_ZA_FUNCTION_GS (NAME, SHAPE, TYPES, none, PREDS)
> > > #endif
> > > 
> > > #define REQUIRED_EXTENSIONS streaming_compatible (0)
> > > @@ -262,3 +272,5 @@ DEF_SME_FUNCTION_GS (svluti4_zt,      luti4_zt,      
> > > b_integer, x4,   none)
> > > #undef DEF_SME_ZA_FUNCTION
> > > #undef DEF_SME_ZA_FUNCTION_GS
> > > #undef DEF_SME_FUNCTION
> > > +
> > > +/* clang-format on */
> > > diff --git a/gcc/config/aarch64/aarch64-sve-builtins.def 
> > > b/gcc/config/aarch64/aarch64-sve-builtins.def
> > > index df77497abae..64f3df71290 100644
> > > --- a/gcc/config/aarch64/aarch64-sve-builtins.def
> > > +++ b/gcc/config/aarch64/aarch64-sve-builtins.def
> > > @@ -17,43 +17,62 @@
> > >     along with GCC; see the file COPYING3.  If not see
> > >     <http://www.gnu.org/licenses/>.  */
> > > 
> > > +/* clang-format off */
> > > +
> > > +/* Define an SVE mode suffix.
> > > +   See the fields in `mode_suffix_info` for the meaning of each 
> > > argument. */
> > > #ifndef DEF_SVE_MODE
> > > -#define DEF_SVE_MODE(A, B, C, D)
> > > +#define DEF_SVE_MODE(NAME, BASE, DISPLACEMENT, UNITS)
> > > #endif
> > > 
> > > +/* Define an SVE vector or predicate type.
> > > +   See the fields in `vector_type_info` for the meaning of each 
> > > argument. */
> > > #ifndef DEF_SVE_TYPE
> > > -#define DEF_SVE_TYPE(A, B, C, D)
> > > +#define DEF_SVE_TYPE(ACLE_NAME, NCHARS, ABI_NAME, SCALAR_TYPE)
> > > #endif
> > > 
> > > +/* Define an SVE type suffix.
> > > +   See the fields in `type_suffix_info` for the meaning of each 
> > > argument. */
> > > #ifndef DEF_SVE_TYPE_SUFFIX
> > > -#define DEF_SVE_TYPE_SUFFIX(A, B, C, D, E)
> > > +#define DEF_SVE_TYPE_SUFFIX(NAME, ACLE_TYPE, CLASS, BITS, MODE)
> > > #endif
> > > 
> > > +/* Define an SME ZA type suffix.
> > > +   See the fields in `type_suffix_info` for the meaning of each 
> > > argument. */
> > > #ifndef DEF_SME_ZA_SUFFIX
> > > -#define DEF_SME_ZA_SUFFIX(A, B, C)
> > > +#define DEF_SME_ZA_SUFFIX(NAME, BITS, MODE)
> > > #endif
> > > 
> > > +/* Define an SVE group suffix.
> > > +   See the fields in `group_suffix_info` for the meaning of each 
> > > argument. */
> > > #ifndef DEF_SVE_GROUP_SUFFIX
> > > -#define DEF_SVE_GROUP_SUFFIX(A, B, C)
> > > +#define DEF_SVE_GROUP_SUFFIX(NAME, VG, VECTORS_PER_TUPLE)
> > > #endif
> > > 
> > > +/* Define an SVE function group.
> > > +   See the fields in `function_group_info` for the meaning of each 
> > > argument. */
> > > #ifndef DEF_SVE_FUNCTION_GS_FPM
> > > -#define DEF_SVE_FUNCTION_GS_FPM(A, B, C, D, E, F)
> > > +#define DEF_SVE_FUNCTION_GS_FPM(NAME, SHAPE, TYPES, GROUPS, PREDS, 
> > > FPM_MODE)
> > > #endif
> > > 
> > > +/* Same as `DEF_SVE_FUNCTION_GS_FPM` above, but with FPM = unused.  */
> > > #ifndef DEF_SVE_FUNCTION_GS
> > > -#define DEF_SVE_FUNCTION_GS(A, B, C, D, E) \
> > > -  DEF_SVE_FUNCTION_GS_FPM(A, B, C, D, E, unused)
> > > +#define DEF_SVE_FUNCTION_GS(NAME, SHAPE, TYPES, GROUPS, PREDS) \
> > > +    DEF_SVE_FUNCTION_GS_FPM(NAME, SHAPE, TYPES, GROUPS, PREDS, unused)
> > > #endif
> > > 
> > > +/* Define an SVE type suffix, with associated 64-bit and 128-bit types 
> > > for
> > > +   compatability with Neon.
> > > +   See the fields in `type_suffix_info` for the meaning of each column. 
> > > */
> > > #ifndef DEF_SVE_NEON_TYPE_SUFFIX
> > > -#define DEF_SVE_NEON_TYPE_SUFFIX(A, B, C, D, E, F, G) \
> > > -  DEF_SVE_TYPE_SUFFIX(A, B, C, D, E)
> > > +#define DEF_SVE_NEON_TYPE_SUFFIX(NAME, ACLE_TYPE, CLASS, BITS, MODE, 
> > > NEON64, NEON128) \
> > > +             DEF_SVE_TYPE_SUFFIX(NAME, ACLE_TYPE, CLASS, BITS, MODE)
> > > #endif
> > > 
> > > +/* Same as `DEF_SVE_FUNCTION_GS` above, but with GROUPS = none.  */
> > > #ifndef DEF_SVE_FUNCTION
> > > -#define DEF_SVE_FUNCTION(NAME, SHAPE, TYPES, PREDS) \
> > > -  DEF_SVE_FUNCTION_GS (NAME, SHAPE, TYPES, none, PREDS)
> > > +#define DEF_SVE_FUNCTION(NAME, SHAPE, TYPES,       PREDS) \
> > > +     DEF_SVE_FUNCTION_GS(NAME, SHAPE, TYPES, none, PREDS)
> > > #endif
> > > 
> > > DEF_SVE_MODE (n, none, none, none)
> > > @@ -176,3 +195,5 @@ DEF_SVE_GROUP_SUFFIX (vg4x4, 4, 4)
> > > #undef DEF_SVE_TYPE_SUFFIX
> > > #undef DEF_SVE_TYPE
> > > #undef DEF_SVE_MODE
> > > +
> > > +/* clang-format on */

Reply via email to