Re: [PATCH v3 3/3] fmv: Add -ftarget-clones-table option support

2025-10-03 Thread Alfie Richards
The 10/03/2025 01:08, Yangyu Chen wrote: > > > On 29/9/2025 19:50, Alfie Richards wrote: > > On 28/09/2025 16:52, Yangyu Chen wrote: > > > This patch adds support for target_clones table option. The > > > target_clones table option allows users to specify mult

Re: [PATCH v11 11/13] c: Add target_version attribute support.

2025-09-28 Thread Alfie Richards
On 27/09/2025 10:44, Alfie Richards wrote: On 26/09/2025 21:26, Joseph Myers wrote: Since this feature involves function name mangling, I'd like to understand how it interacts with other features affecting assembler names for functions, and make sure there are associated testcases for

Re: [PATCH v11 11/13] c: Add target_version attribute support.

2025-09-27 Thread Alfie Richards
On 26/09/2025 21:26, Joseph Myers wrote: Since this feature involves function name mangling, I'd like to understand how it interacts with other features affecting assembler names for functions, and make sure there are associated testcases for those interactions. Specifically: * How does this in

[PING][PATCH v10 07/13] c++: Refactor FMV frontend conflict and merging logic and hooks.

2025-09-15 Thread Alfie Richards
Ping for the front-end agnostic parts of this patch. (attribs.h/cc, hooks.h/cc, tree.h/cc, docs) All other parts have been approved. Thanks, Alfie The 08/28/2025 09:49, alfie.richa...@arm.com wrote: > From: Alfie Richards > > This change refactors FMV handling in the frontend

[PING][PATCH v10 02/13] fmv: Refactor FMV name mangling.

2025-09-15 Thread Alfie Richards
Ping for the x86 parts of this patch. All other parts have been approved. Thanks, Alfie The 08/28/2025 09:49, alfie.richa...@arm.com wrote: > From: Alfie Richards > > This patch is an overhaul of how FMV name mangling works. Previously > mangling logic was duplicated in several p

Re: [PATCH v10 11/13] c: Add target_version attribute support.

2025-09-08 Thread Alfie Richards
amp; !TARGET_HAS_FMV_TARGET_ATTRIBUTE > > + && get_target_version (decl).is_valid ()) > > +{ > > + maybe_mark_function_versioned (decl); > > + if (current_scope != file_scope) > > + error ("versioned declarations are only allowed at file scope"); > > +} > > I'd expect tests for this error as well. As far as I can see, you only > have a test in patch 12 for the different error about versioned > *definitions* not at file scope (i.e. versioned nested functions). I will add tests for this in the next version. > > -- > Joseph S. Myers > josmy...@redhat.com > -- Alfie Richards

Re: [PATCH v10 02/13] fmv: Refactor FMV name mangling.

2025-09-07 Thread Alfie Richards
The 09/07/2025 12:41, Jeff Law wrote: > > > On 8/28/25 3:49 AM, alfie.richa...@arm.com wrote: > > From: Alfie Richards > > > > This patch is an overhaul of how FMV name mangling works. Previously > > mangling logic was duplicated in several places ac

Re: [PATCH v10 06/13] c: c++: Add target_[version/clones] to decl diagnostics formatting.

2025-08-28 Thread Alfie Richards
The 08/28/2025 15:56, Jason Merrill wrote: > On 8/28/25 8:59 AM, Alfie Richards wrote: > > The 08/28/2025 14:43, Jason Merrill wrote: > > > On 8/28/25 5:49 AM, alfie.richa...@arm.com wrote: > > > > From: Alfie Richards > > > > > > > > A

Re: [PATCH v10 06/13] c: c++: Add target_[version/clones] to decl diagnostics formatting.

2025-08-28 Thread Alfie Richards
The 08/28/2025 14:43, Jason Merrill wrote: > On 8/28/25 5:49 AM, alfie.richa...@arm.com wrote: > > From: Alfie Richards > > > > Adds the target_version and target_clones attributes to diagnostic messages > > for target_version semantics. > > > > This is b

Re: [PATCH v9 06/13] c/c++: Add target_[version/clones] to decl diagnostics formatting.

2025-08-26 Thread Alfie Richards
The 08/19/2025 14:06, Jason Merrill wrote: > On 8/19/25 4:49 AM, Alfie Richards wrote: > > Adds the target_version and target_clones attributes to diagnostic messages > > for target_version semantics. > > > > This is because the target_version/target_clones attribut

Re: [PATCH v9 05/13] fmv: Change target_version semantics to follow ACLE specification.

2025-08-26 Thread Alfie Richards
The 08/22/2025 12:22, Jason Merrill wrote: > On 8/19/25 4:48 AM, Alfie Richards wrote: > > This patch changes the semantics of target_version and target_clones > > attributes > > to match the behavior described in the Arm C Language extension. > > > > The change

Re: [PATCH v9 00/13] C/C++: FMV refactor, C FMV support and ACLE compliance

2025-08-21 Thread Alfie Richards
On 21/08/2025 18:45, Jeff Law wrote: On 8/19/25 2:43 AM, Alfie Richards wrote: Hi All, Resending due to some email issues resulting in undelivered email. Thank you so much for the reviews. This revision is mostly addressing feedback from Richard S. Changes since V8: - Several stylistic

Re: [PATCH v9 06/13] c/c++: Add target_[version/clones] to decl diagnostics formatting.

2025-08-21 Thread Alfie Richards
On 19/08/2025 19:06, Jason Merrill wrote: On 8/19/25 4:49 AM, Alfie Richards wrote: Adds the target_version and target_clones attributes to diagnostic messages for target_version semantics. This is because the target_version/target_clones attributes affect the identity of the decls, so need

[PATCH v9 12/13] c/aarch64: Add FMV diagnostic tests.

2025-08-19 Thread Alfie Richards
g-options "-O0" } */ + +__attribute__ ((target_clones ("default, dotprod"))) float +foo (); /* { dg-message "previous declaration of .foo \\\[\\\[target_clones\\(.default., .dotprod.\\)\\\]\\\]." } */ + +__attribute__ ((target_clones ("dotprod", "sve"))) float +foo () { return 3; } /* { dg-error ".foo \\\[\\\[target_clones\\(.dotprod., .sve.\\)\\\]\\\]. conflicts with overlapping .target_clone. declaration" } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mvc-warning1.c b/gcc/testsuite/gcc.target/aarch64/mvc-warning1.c new file mode 100644 index 000..1bae38cceeb --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mvc-warning1.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-require-ifunc "" } */ +/* { dg-options "-O0" } */ + +__attribute__((target_clones("default", "dotprod", "sve+sve2"))) +int foo () { + return 1; +} + +__attribute__((target_clones("invalid1"))) +int foo () { /* { dg-warning "invalid feature modifier .invalid1. in version .invalid1. for .target_clones. attribute" } */ + return 2; +} -- 2.34.1 -- Alfie Richards

[PATCH v9 09/13] aarch64: testsuite: Add diagnostic tests for Aarch64 FMV.

2025-08-19 Thread Alfie Richards
ttribute__ ((target_clones ("default, dotprod"))) float +foo () { return 3; } /* { dg-message "previous declaration" } */ + +__attribute__ ((target_clones ("dotprod", "sve"))) float +foo () { return 3; } /* { dg-error "conflicts with overlapping .target_clone. declaration" } */ diff --git a/gcc/testsuite/g++.target/aarch64/mvc-warning1.C b/gcc/testsuite/g++.target/aarch64/mvc-warning1.C index 59acec3fad2..289ba64c4fc 100644 --- a/gcc/testsuite/g++.target/aarch64/mvc-warning1.C +++ b/gcc/testsuite/g++.target/aarch64/mvc-warning1.C @@ -1,6 +1,14 @@ /* { dg-do compile } */ /* { dg-require-ifunc "" } */ /* { dg-options "-O0" } */ +/* { dg-additional-options "-Wno-experimental-fmv-target" } */ -__attribute__((target_clones("default", "sve"))) -int foo () { return 1; }/* { dg-warning "Function Multi Versioning support is experimental, and the behavior is likely to change" } */ +__attribute__((target_clones("default", "dotprod", "sve+sve2"))) +int foo () { + return 1; +} + +__attribute__((target_clones("invalid1+sve"))) +int foo () { /* { dg-warning "invalid feature modifier .invalid1. in version .invalid1\\+sve. for .target_clones. attribute" } */ + return 2; +} -- 2.34.1 -- Alfie Richards

[PATCH v9 06/13] c/c++: Add target_[version/clones] to decl diagnostics formatting.

2025-08-19 Thread Alfie Richards
4 100644 --- a/gcc/cp/error.cc +++ b/gcc/cp/error.cc @@ -1953,6 +1953,9 @@ dump_function_decl (cxx_pretty_printer *pp, tree t, int flags) } } + pp_cxx_function_target_version (pp, t); + pp_cxx_function_target_clones (pp, t); + if (DECL_NAME (t) && LAMBDA_FUNCTION_P (t)) return dump_lambda_function (pp, t, template_parms, template_args, flags); -- 2.34.1 -- Alfie Richards

[PATCH v9 04/13] fmv: Add check_target_clone hook for filtering target_clone versions.

2025-08-19 Thread Alfie Richards
get_clone_versions + (const tree,int * = NULL, bool = true); /* Returns a vector of the version strings from a target_clones attribute - directly. */ -extern auto_vec get_clone_attr_versions (const tree, int *); + directly. Additionally takes a bool to control whether or not the results + should be filtered with TARGET_CHECK_TARGET_CLONE_VERSION. */ +extern auto_vec get_clone_attr_versions + (const tree, int *, bool = true); #endif /* GCC_TREE_H */ -- 2.34.1 -- Alfie Richards

[PATCH v9 08/13] fmv: Support mixing of target_clones and target_version.

2025-08-19 Thread Alfie Richards
sve+sve2"))) +int foo () +{ + return 1; +} + +__attribute__((target_clones("sve2+sme", "sve2+sme2"))) +int foo () +{ + return 2; +} + +int bar() +{ + return foo (); +} + + +/* { dg-final { scan-assembler-times "\n_Z3foov\.default:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n_Z3foov\._Mdotprod:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n_Z3foov\._MsveMsve2:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n_Z3foov\._Msve2Msme:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n_Z3foov\._Msve2Msme2:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n_Z3foov\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tbl\t_Z3foov\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\t_Z3foov, %gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\t_Z3foov,_Z3foov\.resolver\n" 1 } } */ -- 2.34.1 -- Alfie Richards

[PATCH v9 13/13] FMV: Redirect to specific target

2025-08-19 Thread Alfie Richards
ot;O0")]] +[[gnu::target_version ("default")]] +int bar () { + return 1; +} + +[[gnu::optimize("O0")]] +[[gnu::target ("+sve2")]] +[[gnu::target_version ("sve")]] +int bar (); + +[[gnu::target ("+sve")]] +int foo () { + return bar(); +} + +/* { dg-final { scan-assembler-times "\n\tb\t_Z3barv\._Msve\n" 1 } } */ + +[[gnu::target_version ("default")]] +int bar2 () { + return 1; +} + +[[gnu::target_version ("sve2")]] +int bar2 (); + +[[gnu::target_version ("default")]] +int foo2 (); + +[[gnu::target_version ("sve")]] +[[gnu::target ("+sve2")]] +int foo2 () { + return bar2(); +} + +/* { dg-final { scan-assembler-times "\n\tb\t_Z4bar2v\._Msve2\n" 1 } } */ + +[[gnu::target_version ("default")]] +int bar3 () { + return 1; +} + +[[gnu::target_version ("sve")]] +int bar3 (); + +[[gnu::target ("+rng")]] +[[gnu::target_version ("sve2")]] +int bar3 (); + +[[gnu::target_version ("default")]] +int foo3 (); + +[[gnu::target_version ("sve")]] +int foo3 () { + return bar3 (); +} + +[[gnu::target_version ("sve2+rng")]] +int foo3 (); + +/* { dg-final { scan-assembler-times "\n\tb\t_Z4bar3v\n" 1 } } */ -- 2.34.1 -- Alfie Richards

[PATCH v9 05/13] fmv: Change target_version semantics to follow ACLE specification.

2025-08-19 Thread Alfie Richards
This patch changes the semantics of target_version and target_clones attributes to match the behavior described in the Arm C Language extension. The changes to behavior are: - The scope and signature of an FMV function set is now that of the default version. - The FMV resolver is now created at

[PATCH v9 11/13] c: Add target_version attribute support.

2025-08-19 Thread Alfie Richards
bler-times "\nfoo\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tbl\tfoo\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\tfoo, %gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\tfoo,foo\.resolver\n" 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mvc-symbols2.c b/gcc/testsuite/gcc.target/aarch64/mvc-symbols2.c new file mode 100644 index 000..78385ed904b --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mvc-symbols2.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_clones ("default", "dotprod", "sve+sve2"))) int +foo () +{ + return 1; +} + +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mdotprod:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._MsveMsve2:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\tfoo, %gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\tfoo,foo\.resolver\n" 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mvc-symbols3.c b/gcc/testsuite/gcc.target/aarch64/mvc-symbols3.c new file mode 100644 index 000..1cbe3fd0850 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mvc-symbols3.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_clones ("default", "dotprod", "sve+sve2"))) int +foo (); + +int +bar () +{ + return foo (); +} + +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mdotprod:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._MsveMsve2:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n\tbl\tfoo\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\tfoo, %gnu_indirect_function\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\tfoo,foo\.resolver\n" 0 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mvc-symbols4.c b/gcc/testsuite/gcc.target/aarch64/mvc-symbols4.c new file mode 100644 index 000..abaf60f91c3 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mvc-symbols4.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_clones ("default", "dotprod", "sve+sve2"))) int +foo (); + +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mdotprod:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._MsveMsve2:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\tfoo, %gnu_indirect_function\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\tfoo,foo\.resolver\n" 0 } } */ -- 2.34.1 -- Alfie Richards

[PATCH v9 10/13] aarch64: Remove FMV beta warning.

2025-08-19 Thread Alfie Richards
stsuite/g++.target/aarch64/mvc-symbols3.C index 2a315d2db5c..baea04ef5ec 100644 --- a/gcc/testsuite/g++.target/aarch64/mvc-symbols3.C +++ b/gcc/testsuite/g++.target/aarch64/mvc-symbols3.C @@ -1,7 +1,6 @@ /* { dg-do compile } */ /* { dg-require-ifunc "" } */ /* { dg-options "-O0" } */ -/* { dg-additional-options "-Wno-experimental-fmv-target" } */ __attribute__((target_clones("default", "dotprod", "sve+sve2"))) int foo (); diff --git a/gcc/testsuite/g++.target/aarch64/mvc-symbols4.C b/gcc/testsuite/g++.target/aarch64/mvc-symbols4.C index 9c8a7bd37f2..6c86ae61e5f 100644 --- a/gcc/testsuite/g++.target/aarch64/mvc-symbols4.C +++ b/gcc/testsuite/g++.target/aarch64/mvc-symbols4.C @@ -1,7 +1,6 @@ /* { dg-do compile } */ /* { dg-require-ifunc "" } */ /* { dg-options "-O0" } */ -/* { dg-additional-options "-Wno-experimental-fmv-target" } */ __attribute__((target_clones("default", "dotprod", "sve+sve2"))) int foo (); diff --git a/gcc/testsuite/g++.target/aarch64/mvc-warning1.C b/gcc/testsuite/g++.target/aarch64/mvc-warning1.C index 289ba64c4fc..d394e768eb0 100644 --- a/gcc/testsuite/g++.target/aarch64/mvc-warning1.C +++ b/gcc/testsuite/g++.target/aarch64/mvc-warning1.C @@ -1,7 +1,6 @@ /* { dg-do compile } */ /* { dg-require-ifunc "" } */ /* { dg-options "-O0" } */ -/* { dg-additional-options "-Wno-experimental-fmv-target" } */ __attribute__((target_clones("default", "dotprod", "sve+sve2"))) int foo () { -- 2.34.1 -- Alfie Richards

[PATCH v9 07/13] c++: Refactor FMV frontend conflict and merging logic and hooks.

2025-08-19 Thread Alfie Richards
/* The only remaining case is two target_version annoteted decls. Must + be mergeable as otherwise are distinct. */ +return true; +} + void tree_cc_finalize (void) { diff --git a/gcc/tree.h b/gcc/tree.h index f773ea1fef1..bb8c5a75f51 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -7112,4 +7112,9 @@ extern auto_vec get_clone_versions extern auto_vec get_clone_attr_versions (const tree, int *, bool = true); +/* Checks if two decls define any overlapping versions. */ +extern bool distinct_version_decls (tree, tree); +/* Checks if two overlapping decls are mergeable. */ +extern bool diagnose_versioned_decls (tree, tree); + #endif /* GCC_TREE_H */ -- 2.34.1 -- Alfie Richards

[PATCH v9 02/13] fmv: Refactor FMV name mangling.

2025-08-19 Thread Alfie Richards
This patch is an overhaul of how FMV name mangling works. Previously mangling logic was duplicated in several places across both target specific and independent code. This patch changes this such that all mangling is done in targetm.mangle_decl_assembler_name (including for the dispatched symbol an

[PATCH v9 03/13] riscv: Refactor riscv target parsing to take string_slice.

2025-08-19 Thread Alfie Richards
e_features_for_version (v, + DECL_SOURCE_LOCATION (version_decl), version_info.features, version_info.prio); function_versions.push_back (version_info); -- 2.34.1 -- Alfie Richards

[PATCH v9 01/13] cgraph: Add clone_identifier function.

2025-08-19 Thread Alfie Richards
converted_suffix, (char *) 0)); + return get_identifier (result); +} +} /* Create callgraph node clone with new declaration. The actual body will be copied later at compilation stage. The name of the new clone will be -- 2.34.1 -- Alfie Richards

[PATCH v9 00/13] C/C++: FMV refactor, C FMV support and ACLE compliance

2025-08-19 Thread Alfie Richards
C++ front end changes now. Bootstrapped and reg tested on Aarch64 and x86. Still hoping for GCC 16 for this, we're keen to get this synced with LLVM before we start pushing it for users. Kind regards, Alfie Patches === Alfie Richards (13): cgraph: Add clone_identifier fun

Re: [PATCH v8 04/13] fmv: Add check_target_clone hook for filtering target_clone versions.

2025-08-13 Thread Alfie Richards
The 08/07/2025 15:44, Richard Sandiford wrote: > writes: > > From: Alfie Richards > > > > This patch introduces the TARGET_CHECK_TARGET_CLONE_VERSION hook > > which is used to determine if a target_clones version string parses. > > > > The hook ha

Re: [PATCH v8 13/13] FMV: Redirect to specific target

2025-08-13 Thread Alfie Richards
The 08/08/2025 17:44, Richard Sandiford wrote: > writes: > > From: Alfie Richards > > > > Adds an optimisation in FMV to redirect to a specific target if possible. > > > > A call is redirected to a specific target if both: > > - the caller can always c

Re: [PATCH v7 13/13] FMV: Redirect to specific target

2025-08-05 Thread Alfie Richards
The 08/04/2025 11:29, Richard Sandiford wrote: > Alfie Richards writes: > > Adds an optimisation in FMV to redirect to a specific target if possible. > > > > A call is redirected to a specific target if both: > > - the caller can always call the callee version > &

Re: [PATCH v7 02/13] fmv: Refactor FMV name mangling.

2025-08-01 Thread Alfie Richards
The 08/01/2025 14:07, Richard Sandiford wrote: > Alfie Richards writes: > > On 01/08/2025 11:46, Richard Sandiford wrote: > >> Sorry, I think I missed the multiple_targets.cc changes in my > >> previous review. > >> > >> Alfie Richards writes: &g

Re: [PATCH v7 02/13] fmv: Refactor FMV name mangling.

2025-08-01 Thread Alfie Richards
On 01/08/2025 11:46, Richard Sandiford wrote: Sorry, I think I missed the multiple_targets.cc changes in my previous review. Alfie Richards writes: diff --git a/gcc/multiple_target.cc b/gcc/multiple_target.cc index d25277c0a93..44340cbc6a4 100644 --- a/gcc/multiple_target.cc +++ b/gcc

Re: [PATCH v7 04/13] fmv: Add reject_target_clone hook for filtering target_clone versions.

2025-08-01 Thread Alfie Richards
On 31/07/2025 16:37, Richard Sandiford wrote: Alfie Richards writes: diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 5e305643b3a..253ea6dd77f 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -12268,6 +12268,11 @@ function version at run-time for a given set of function versions

Re: [RFC] vect: Add support for runtime capped VF.

2025-07-29 Thread Alfie Richards
On 29/07/2025 11:39, Richard Biener wrote: On Tue, 29 Jul 2025, Alfie Richards wrote: On 29/07/2025 10:13, Richard Biener wrote: On Tue, 29 Jul 2025, Alfie Richards wrote: (Whoops, s/WIP/RFC) Hi All, This patch adds support for capping VF at runtime for VLA loops with a data dependency

[PATCH] aarch64: Fix sme2+faminmax intrisic gating (PR 121300)

2025-07-29 Thread Alfie Richards
Hi All, Quick fixup for the gating (s/&&/|/) for an error I made. Only needed for trunk as the intrinsics were only added recently. Bootstrapped and reg tested on Aatch64. Thanks, Alfie -- >8 -- Fixes the feature gating for the SME2+FAMINMAX intrinsics. PR target/121300 gcc/ChangeLo

Re: [RFC] vect: Add support for runtime capped VF.

2025-07-29 Thread Alfie Richards
On 29/07/2025 10:13, Richard Biener wrote: On Tue, 29 Jul 2025, Alfie Richards wrote: (Whoops, s/WIP/RFC) Hi All, This patch adds support for capping VF at runtime for VLA loops with a data dependency. On 28/07/2025 15:56, Alfie Richards wrote: Hi All, This patch adds support for capping VF

[RFC] vect: Add support for runtime capped VF.

2025-07-29 Thread Alfie Richards
(Whoops, s/WIP/RFC) Hi All, This patch adds support for capping VF at runtime for VLA loops with a data dependency. On 28/07/2025 15:56, Alfie Richards wrote: Hi All, This patch adds support for capping VF at runtime for VLA loops with a data dependency. Previously, no loop with a data

Re: [PATCH] Fix UB in string_slice::operator== (PR 121261)

2025-07-29 Thread Alfie Richards
On 28/07/2025 17:13, Richard Sandiford wrote: Alfie Richards writes: Hi, Small fix to resolve an UBSAN diagnostic. Reg tested for Aarch64 Thanks, Alfie -- >8 -- This adds a nullptr check to fix a regression where it is possible to call `memcmp (NULL, NULL, 0)` which is UB. This sho

Re: [PATCH] Fix UB in string_slice::operator== (PR 121261)

2025-07-29 Thread Alfie Richards
On 28/07/2025 16:36, Sam James wrote: Alfie Richards writes: Hi, Small fix to resolve an UBSAN diagnostic. Reg tested for Aarch64 To be sure: checked with bootstrap-ubsan too? (though note that it doesn't error out by default, so you'd need to grep the logs or set UBSAN_OPTIO

[PATCH] [WIP] vect: Add support for runtime capped VF.

2025-07-28 Thread Alfie Richards
Hi All, This patch adds support for capping VF at runtime for VLA loops with a data dependency. Previously, no loop with a data dependency could be vectorized with VLA as we made no assumption on the upper bound of vector length. This adds basic support for this case (only for partial vectors wit

[PATCH] Fix UB in string_slice::operator== (PR 121261)

2025-07-28 Thread Alfie Richards
Hi, Small fix to resolve an UBSAN diagnostic. Reg tested for Aarch64 Thanks, Alfie -- >8 -- This adds a nullptr check to fix a regression where it is possible to call `memcmp (NULL, NULL, 0)` which is UB. This should fix the bootstrap-ubsan build. gcc/ChangeLog: PR middle-end/121261

Re: [PATCH v6 07/19] fmv: Refactor FMV name mangling.

2025-07-28 Thread Alfie Richards
On 26/07/2025 14:27, Jeff Law wrote: On 6/12/25 10:53 AM, Alfie Richards wrote: This patch is an overhaul of how FMV name mangling works. Previously mangling logic was duplicated in several places across both target specific and independent code. This patch changes this such that all mangling

[PATCH v7 13/13] FMV: Redirect to specific target

2025-07-28 Thread Alfie Richards
Adds an optimisation in FMV to redirect to a specific target if possible. A call is redirected to a specific target if both: - the caller can always call the callee version - and, it is possible to rule out all higher priority versions of the callee fmv set. That is estabilished either by the ca

[PATCH v7 12/13] c/aarch64: Add FMV diagnostic tests.

2025-07-28 Thread Alfie Richards
Adds some aarch64 C fmv diagnostic tests. This mostly tests C front end code, but has to be target specific at FMV is requires specifying target extensions. gcc/testsuite/ChangeLog: * gcc.target/aarch64/mv-and-mvc-error1.c: New test. * gcc.target/aarch64/mv-and-mvc-error2.c: New

[PATCH v7 10/13] aarch64: Remove FMV beta warning.

2025-07-28 Thread Alfie Richards
This patch removes the warning for target_version and target_clones in aarch64 as it is now spec compliant. gcc/ChangeLog: * config/aarch64/aarch64.cc (aarch64_process_target_version_attr): Remove warning. * config/aarch64/aarch64.opt: Mark -Wno-experimental-fmv-target

[PATCH v7 06/13] c/c++: Add target_[version/clones] to decl diagnostics formatting.

2025-07-28 Thread Alfie Richards
Adds the target_version and target_clones attributes to diagnostic messages for target_version semantics. This is because the target_version/target_clones attributes affect the identity of the decls, so need to be represented in diagnostics for them. After this change diagnostics look like: c: `

[PATCH v7 11/13] c: Add target_version attribute support.

2025-07-28 Thread Alfie Richards
Hi All, Apologies, that previous patch was clearly hastily made and included some rubbish temp files. Cleaned up patch attached -- >8 -- This commit introduces support for the target_version attribute in the c frontend, following the behavior defined in the Arm C Language Extension. Key change

[PATCH v7 05/13] fmv: Change target_version semantics to follow ACLE specification.

2025-07-28 Thread Alfie Richards
This patch changes the semantics of target_version and target_clones attributes to match the behavior described in the Arm C Language extension. The changes to behavior are: - The scope and signature of an FMV function set is now that of the default version. - The FMV resolver is now created at

[PATCH v7 01/13] Add clone_identifier function.

2025-07-28 Thread Alfie Richards
This is similar to clone_function_name and its siblings but takes an identifier tree node rather than a function declaration. This is to be used in conjunction with the identifier node stored in cgraph_function_version_info::assembler_name to mangle FMV functions in later patches. gcc/ChangeLog:

[PATCH v7 02/13] fmv: Refactor FMV name mangling.

2025-07-28 Thread Alfie Richards
This patch is an overhaul of how FMV name mangling works. Previously mangling logic was duplicated in several places across both target specific and independent code. This patch changes this such that all mangling is done in targetm.mangle_decl_assembler_name (including for the dispatched symbol an

[PATCH v7 08/13] fmv: Support mixing of target_clones and target_version.

2025-07-28 Thread Alfie Richards
Add support for a FMV set defined by a combination of target_clones and target_version definitions. Additionally, change is_function_default_version to consider a function declaration annotated with target_clones containing default to be a default version. Lastly, add support for the case that a

[PATCH v7 04/13] fmv: Add reject_target_clone hook for filtering target_clone versions.

2025-07-28 Thread Alfie Richards
This patch introduces the TARGET_REJECT_FUNCTION_CLONE_VERSION hook which is used to determine if a target_clones version string parses. If true is returned, a warning is emitted and from then on the version is ignored. This is as specified in the Arm C Language Extension. The purpose of this is

[PATCH v7 00/13] FMV refactor, C FMV support and ACLE compliance.

2025-07-28 Thread Alfie Richards
. Still hoping for GCC 16 for this, we're keen to get this synced with LLVM before we start pushing it for users. Kind regards, Alfie Patches === Alfie Richards (13): Add clone_identifier function. (Approved https://gcc.gnu.org/pipermail/gcc-patches/2025-June/686239.html)

[PATCH v7 07/13] c++: Refactor FMV frontend conflict and merging logic and hooks.

2025-07-28 Thread Alfie Richards
This change refactors FMV handling in the frontend to allows greater reasoning about versions in shared code. This is needed for allowing target_clones and target_versions to be used together in a function set, as there is then two distinct concerns when encountering two declarations that previous

[PATCH v7 09/13] aarch64: testsuite: Add diagnostic tests for Aarch64 FMV.

2025-07-28 Thread Alfie Richards
Add tests covering many FMV errors for Aarch64, including redeclaration, and mixing target_clones and target_versions. gcc/testsuite/ChangeLog: * g++.target/aarch64/mv-and-mvc-error1.C: New test. * g++.target/aarch64/mv-and-mvc-error2.C: New test. * g++.target/aarch64/mv-a

[PATCH v7 03/13] riscv: Refactor riscv target parsing to take string_slice.

2025-07-28 Thread Alfie Richards
This is a quick refactor of the riscv target processing code to take a string_slice rather than a decl. The reason for this is to enable it to work with target_clones where merging logic requires reasoning about each version string individually in the front end. This refactor primarily serves jus

[RFC] vect: remove cast to pointer for create_iv in vect_create_data_ref_ptr

2025-07-24 Thread Alfie Richards
Hi, This patch comes from me getting confused about gimple dumps from vect. Specifically, while seemingly not causing any issues I found the conversion of the IV step from an integral step, to a pointer value, and then to sizetype misleading. By the look of things create_iv already has the infrast

Re: [PATCH v2 3/3] testsuite: Add runtime test for FMV resolvers

2025-07-23 Thread Alfie Richards
On 23/07/2025 09:45, Yury Khrustalev wrote: gcc/testsuite/ChangeLog: * g++.target/aarch64/mv-cpu-features.C: new test. --- .../g++.target/aarch64/mv-cpu-features.C | 65 +++ 1 file changed, 65 insertions(+) create mode 100644 gcc/testsuite/g++.target/aarch64/mv-

[PATCH v7 11/13] c: Add target_version attribute support.

2025-07-22 Thread Alfie Richards
Hi All, Apologies, that previous patch was clearly hastily made and included some rubbish temp files. Cleaned up patch attached -- >8 -- This commit introduces support for the target_version attribute in the c frontend, following the behavior defined in the Arm C Language Extension. Key change

[PATCH v7 11/13] c: Add target_version attribute support.

2025-07-22 Thread Alfie Richards
Hello, Quick update for this patch as I found a minor bug with it. Changed the decl merging logic slightly and added a new test. Reg tested on Aarch64 and x68_64. Kind regards, Alfie -- >8 -- This commit introduces support for the target_version attribute in the c frontend, following the beha

[PATCH v7 11/13] c: Add target_version attribute support.

2025-07-21 Thread Alfie Richards
This commit introduces support for the target_version attribute in the c frontend, following the behavior defined in the Arm C Language Extension. Key changes include: - During pushdecl, the compiler now checks whether the current symbol is part of a multiversioned set. - New versions are add

[PATCH v7 12/13] c/aarch64: Add FMV diagnostic tests.

2025-07-21 Thread Alfie Richards
Adds some aarch64 C fmv diagnostic tests. This mostly tests C front end code, but has to be target specific at FMV is requires specifying target extensions. gcc/testsuite/ChangeLog: * gcc.target/aarch64/mv-and-mvc-error1.c: New test. * gcc.target/aarch64/mv-and-mvc-error2.c: New

[PATCH v7 09/13] aarch64: testsuite: Add diagnostic tests for Aarch64 FMV.

2025-07-21 Thread Alfie Richards
Add tests covering many FMV errors for Aarch64, including redeclaration, and mixing target_clones and target_versions. gcc/testsuite/ChangeLog: * g++.target/aarch64/mv-and-mvc-error1.C: New test. * g++.target/aarch64/mv-and-mvc-error2.C: New test. * g++.target/aarch64/mv-a

[PATCH v7 04/13] fmv: Add reject_target_clone hook for filtering target_clone versions.

2025-07-21 Thread Alfie Richards
This patch introduces the TARGET_REJECT_FUNCTION_CLONE_VERSION hook which is used to determine if a target_clones version string parses. If true is returned, a warning is emitted and from then on the version is ignored. This is as specified in the Arm C Language Extension. The purpose of this is

[PATCH v7 02/13] fmv: Refactor FMV name mangling.

2025-07-21 Thread Alfie Richards
This patch is an overhaul of how FMV name mangling works. Previously mangling logic was duplicated in several places across both target specific and independent code. This patch changes this such that all mangling is done in targetm.mangle_decl_assembler_name (including for the dispatched symbol an

[PATCH v7 10/13] aarch64: Remove FMV beta warning.

2025-07-21 Thread Alfie Richards
This patch removes the warning for target_version and target_clones in aarch64 as it is now spec compliant. gcc/ChangeLog: * config/aarch64/aarch64.cc (aarch64_process_target_version_attr): Remove warning. * config/aarch64/aarch64.opt: Mark -Wno-experimental-fmv-target

[PATCH v7 13/13] FMV: Redirect to specific target

2025-07-21 Thread Alfie Richards
Adds an optimisation in FMV to redirect to a specific target if possible. A call is redirected to a specific target if both: - the caller can always call the callee version - and, it is possible to rule out all higher priority versions of the callee fmv set. That is estabilished either by the ca

[PATCH v7 08/13] fmv: Support mixing of target_clones and target_version.

2025-07-21 Thread Alfie Richards
Add support for a FMV set defined by a combination of target_clones and target_version definitions. Additionally, change is_function_default_version to consider a function declaration annotated with target_clones containing default to be a default version. Lastly, add support for the case that a

[PATCH v7 07/13] c++: Refactor FMV frontend conflict and merging logic and hooks.

2025-07-21 Thread Alfie Richards
This change refactors FMV handling in the frontend to allows greater reasoning about versions in shared code. This is needed for allowing target_clones and target_versions to be used together in a function set, as there is then two distinct concerns when encountering two declarations that previous

[PATCH v7 05/13] fmv: Change target_version semantics to follow ACLE specification.

2025-07-21 Thread Alfie Richards
This patch changes the semantics of target_version and target_clones attributes to match the behavior described in the Arm C Language extension. The changes to behavior are: - The scope and signature of an FMV function set is now that of the default version. - The FMV resolver is now created at

[PATCH v7 06/13] c/c++: Add target_[version/clones] to decl diagnostics formatting.

2025-07-21 Thread Alfie Richards
Adds the target_version and target_clones attributes to diagnostic messages for target_version semantics. This is because the target_version/target_clones attributes affect the identity of the decls, so need to be represented in diagnostics for them. After this change diagnostics look like: c: `

[PATCH v7 01/13] Add clone_identifier function.

2025-07-21 Thread Alfie Richards
This is similar to clone_function_name and its siblings but takes an identifier tree node rather than a function declaration. This is to be used in conjunction with the identifier node stored in cgraph_function_version_info::assembler_name to mangle FMV functions in later patches. gcc/ChangeLog:

[PATCH v7 03/13] riscv: Refactor riscv target parsing to take string_slice.

2025-07-21 Thread Alfie Richards
This is a quick refactor of the riscv target processing code to take a string_slice rather than a decl. The reason for this is to enable it to work with target_clones where merging logic requires reasoning about each version string individually in the front end. This refactor primarily serves jus

[PATCH v7 00/13] FMV refactor, C FMV support and ACLE compliance.

2025-07-21 Thread Alfie Richards
LLVM before we start pushing it for users. Kind regards, Alfie Patches === Alfie Richards (13): Add clone_identifier function. (Approved https://gcc.gnu.org/pipermail/gcc-patches/2025-June/686239.html) fmv: Refactor FMV name mangling. (Needs review) riscv: Refactor riscv t

Re: [PATCH v5 16/24] c/c++: Add target_[version/clones] to decl diagnostics formatting.

2025-07-14 Thread Alfie Richards
On 09/07/2025 18:00, Jason Merrill wrote: On 5/29/25 8:52 AM, Alfie Richards wrote: Adds the target_version and target_clones attributes to diagnostic messages for target_version semantics. This is because the target_version/target_clones attributes affect the identity of the decls, so need

[PATCH] aarch64: fixup: Implement sme2+faminmax extension.

2025-07-14 Thread Alfie Richards
Hi all, This is a minor fixup to the previous patch I committed fixing Spencers comments. Bootstrapped and reg tested for Aarch64. Thanks, Alfie -- >8 -- Fixup to the SME2+FAMINMAX intrinsics commit. gcc/ChangeLog: * config/aarch64/aarch64-sme.md (@aarch64_sme_): Change gatin

Re: [PATCH] aarch64: Implement sme2+faminmax extension.

2025-07-14 Thread Alfie Richards
On 14/07/2025 10:35, Spencer Abson wrote: On Mon, Jul 07, 2025 at 08:46:15AM +, Alfie Richards wrote: Hello all, This patch implements the couple of amin/amax instructions that are part of SME2 + faminmax. Regression testsed and bootstrapped for Aarch64. Thanks, Alfie -- &g

Re: [PATCH] aarch64: Implement sme2+faminmax extension.

2025-07-13 Thread Alfie Richards
On 09/07/2025 09:28, Kyrylo Tkachov wrote: Hi Alfie, On 7 Jul 2025, at 10:46, Alfie Richards wrote: Hello all, This patch implements the couple of amin/amax instructions that are part of SME2 + faminmax. Regression testsed and bootstrapped for Aarch64. Thanks, Alfie -- >8 -- Impleme

[PATCH] aarch64: Implement sme2+faminmax extension.

2025-07-07 Thread Alfie Richards
Hello all, This patch implements the couple of amin/amax instructions that are part of SME2 + faminmax. Regression testsed and bootstrapped for Aarch64. Thanks, Alfie -- >8 -- Implements the sme2+faminmax svamin and svamax intrinsics. gcc/ChangeLog: * config/aarch64/aarch64-sme.md (@

[PATCH v2] c++: Fix FMV return type ambiguation

2025-07-02 Thread Alfie Richards
Hi Jason, Thanks for the feedback, see below an updated patch. Again reg-tested on Aarch64 and x86. Thanks, Alfie -- >8 -- Add logic for the case of two FMV annotated functions with identical signature other than the return type. Previously this was ignored, this changes the behavior to emit

[PING][PATCH] Add string_slice class.

2025-07-02 Thread Alfie Richards
Ping for this patch. Thanks, Alfie On 20/06/2025 14:23, Alfie Richards wrote: Thanks for the pointer Joseph. This update adds tests to gcc/testsuite/g++.dg/warn/Wformat-gcc_diag-1.C as this seems to be where similar tests are done (eg, %D for tree). I couldn't find any tests for the a

Re: [RFC PATCH v2 3/3] Add -ftarget-clones-table option support

2025-06-30 Thread Alfie Richards
On 29/06/2025 19:57, Yangyu Chen wrote: This patch adds support for target_clones table option. The target_clones table option allows users to specify multiple versions of a function and select the version at runtime based on the specified table. The target clone table is a JSON object where fun

Re: [RFC PATCH v2 0/3] Add -ftarget-clones-table option support

2025-06-30 Thread Alfie Richards
Hi Yangyu, The design of this looks really good to me. Thanks for your work on it. I really appreciate how you made the JSON structure work for all targets. Out of curiosity, have you thought about what happens in the case of an invalid target version string? There will be some conflicts to

[PATCH] c++: Fix FMV return type ambiguation

2025-06-30 Thread Alfie Richards
Hi Jeff, Yes agreed, I've respun this to be standalone and moved the relevant test from another patch to this. Sending again for reapproval in an abbundance of caution. Regr tested on Aarch64 and x86. Thanks, Alfie -- >8 -- Add logic for the case of two FMV annotated functions with identical

[PATCH] ivopts: Change constant_multiple_of to expand aff nodes.

2025-06-25 Thread Alfie Richards
Hi all, This is a small change to ivopts to expand SSA variables enabling ivopts to correctly work out when an address IV step is set to be a multiple on index step in the loop header (ie, not constant, not calculated each loop.) Seems like this might have compile speed costs that need to be cons

[PATCH] Add string_slice class.

2025-06-20 Thread Alfie Richards
Thanks for the pointer Joseph. This update adds tests to gcc/testsuite/g++.dg/warn/Wformat-gcc_diag-1.C as this seems to be where similar tests are done (eg, %D for tree). I couldn't find any tests for the actual output of string slice debug statements for the other format specifiers so haven't i

[PATCH] Add string_slice class.

2025-06-18 Thread Alfie Richards
Minor update to this patch addressing Jeff Law's feedback. It turns out I ended up not using the strcmp function, so no edits to other patches are required. I've left the function in as I have future work that I plan to use it for. Regression tested and bootstrapped for aarch64-none-linux-gnu and

Re: [PATCH v6 01/19] Add string_slice class.

2025-06-18 Thread Alfie Richards
On 17/06/2025 14:37, Jeff Law wrote: On 6/12/25 10:53 AM, Alfie Richards wrote: The string_slice inherits from array_slice and is used to refer to a substring of an array that is memory managed elsewhere without modifying the underlying array. For example, this is useful in cases such as

[PATCH v6 14/19] c++: Fix FMV return type ambiguation

2025-06-12 Thread Alfie Richards
Add logic for the case of two FMV annotated functions with identical signature other than the return type. Previously this was ignored, this changes the behavior to emit a diagnostic. gcc/cp/ChangeLog: PR c++/119498 * decl.cc (duplicate_decls): Change logic to not always exclude F

[PATCH v6 19/19] FMV: Redirect to specific target

2025-06-12 Thread Alfie Richards
Adds an optimisation in FMV to redirect to a specific target if possible. A call is redirected to a specific target if both: - the caller can always call the callee version - and, it is possible to rule out all higher priority versions of the callee fmv set. That is estabilished either by the ca

[PATCH v6 17/19] c: Add target_version attribute support.

2025-06-12 Thread Alfie Richards
This commit introduces support for the target_version attribute in the c frontend, following the behavior defined in the Arm C Language Extension. Key changes include: - During pushdecl, the compiler now checks whether the current symbol is part of a multiversioned set. - New versions are add

[PATCH v6 18/19] c/aarch64: Add FMV diagnostic tests.

2025-06-12 Thread Alfie Richards
Adds some aarch64 C fmv diagnostic tests. This mostly tests C front end code, but has to be target specific at FMV is requires specifying target extensions. gcc/testsuite/ChangeLog: * gcc.target/aarch64/mv-and-mvc-error1.c: New test. * gcc.target/aarch64/mv-and-mvc-error2.c: New

[PATCH v6 12/19] c++: Refactor FMV frontend conflict and merging logic and hooks.

2025-06-12 Thread Alfie Richards
This change refactors FMV handling in the frontend to allows greater reasoning about versions in shared code. This is needed for allowing target_clones and target_versions to be used together in a function set, as there is then two distinct concerns when encountering two declarations that previous

[PATCH v6 16/19] aarch64: Remove FMV beta warning.

2025-06-12 Thread Alfie Richards
This patch removes the warning for target_version and target_clones in aarch64 as it is now spec compliant. gcc/ChangeLog: * config/aarch64/aarch64.cc (aarch64_process_target_version_attr): Remove warning. * config/aarch64/aarch64.opt: Mark -Wno-experimental-fmv-target

[PATCH v6 15/19] aarch64: testsuite: Add diagnostic tests for Aarch64 FMV.

2025-06-12 Thread Alfie Richards
Add tests covering many FMV errors for Aarch64, including redeclaration, and mixing target_clones and target_versions. gcc/testsuite/ChangeLog: * g++.target/aarch64/mv-and-mvc-error1.C: New test. * g++.target/aarch64/mv-and-mvc-error2.C: New test. * g++.target/aarch64/mv-a

[PATCH v6 10/19] fmv: Change target_version semantics to follow ACLE specification.

2025-06-12 Thread Alfie Richards
This patch changes the semantics of target_version and target_clones attributes to match the behavior described in the Arm C Language extension. The changes to behavior are: - The scope and signature of an FMV function set is now that of the default version. - The FMV resolver is now created at

[PATCH v6 11/19] c/c++: Add target_[version/clones] to decl diagnostics formatting.

2025-06-12 Thread Alfie Richards
Adds the target_version and target_clones attributes to diagnostic messages for target_version semantics. This is because the target_version/target_clones attributes affect the identity of the decls, so need to be represented in diagnostics for them. After this change diagnostics look like: ```

[PATCH v6 04/19] Add get_clone_versions and get_target_version functions.

2025-06-12 Thread Alfie Richards
Note: Approved by Jeff Law, waiting on string_slice. -- >8 -- This is a reimplementation of get_target_clone_attr_len, get_attr_str, and separate_attrs using string_slice and auto_vec to make memory management and use simpler. Adds get_target_version helper function to get the target_version str

[PATCH v6 06/19] Add clone_identifier function.

2025-06-12 Thread Alfie Richards
Note: Approved by Jeff Law, waiting on string_slice. -- >8 -- This is similar to clone_function_name and its siblings but takes an identifier tree node rather than a function declaration. This is to be used in conjunction with the identifier node stored in cgraph_function_version_info::assembler

[PATCH v6 13/19] fmv: Support mixing of target_clones and target_version.

2025-06-12 Thread Alfie Richards
Add support for a FMV set defined by a combination of target_clones and target_version definitions. Additionally, change is_function_default_version to consider a function declaration annotated with target_clones containing default to be a default version. Lastly, add support for the case that a

  1   2   3   >