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
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
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 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 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
/* 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
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
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
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
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
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
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
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
> &
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
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
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
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
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
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
(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
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
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
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
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
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
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
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
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
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:
`
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
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
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:
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
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
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
.
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)
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
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
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
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
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-
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
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
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
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
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
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
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
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
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
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
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
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
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:
`
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:
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
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
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
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
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
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
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 (@
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 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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:
```
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
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
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 - 100 of 279 matches
Mail list logo