[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

[PATCH v6 09/19] fmv: Add reject_target_clone hook for filtering target_clone versions.

2025-06-12 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 v6 07/19] fmv: Refactor FMV name mangling.

2025-06-12 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 v6 08/19] riscv: Refactor riscv target parsing to take string_slice.

2025-06-12 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 v6 02/19] Remove unnecessary `record` argument from maybe_version_functions.

2025-06-12 Thread Alfie Richards
Previously, the `record` argument in maybe_version_function allowed the call to cgraph_node::record_function_versions to be skipped. However, this was only skipped when both decls were already marked as versioned, in which case we trigger the early exit in record_function_versions instead. Therefo

[PATCH v6 03/19] Change make_attribute to take string_slice.

2025-06-12 Thread Alfie Richards
Note: Approved by Jeff Law, waiting on string_slice. -- >8 -- gcc/ChangeLog: * attribs.cc (make_attribute): Change arguments. * attribs.h (make_attribute): Change arguments. Approved by Richard Sandiford. --- gcc/attribs.cc | 16 +--- gcc/attribs.h | 2 +- 2 files

[PATCH v6 05/19] Add dispatcher_resolver_function and is_target_clone flags to cgraph_node.

2025-06-12 Thread Alfie Richards
Note: Approved by Jeff Law, waiting on patches that make use of these. -- >8 -- These are needed to correctly mangle FMV declarations. gcc/ChangeLog: * cgraph.h (struct cgraph_node): Add dispatcher_resolver_function and is_target_clone. --- gcc/cgraph.h | 10 +- 1 file

[PATCH v6 01/19] Add string_slice class.

2025-06-12 Thread Alfie Richards
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 when needing to refer to a substring of an attribute in the syntax tree. Adds some minim

[PATCH v6 00/19] FMV refactor, C FMV support and ACLE compliance.

2025-06-12 Thread Alfie Richards
. Approved patches have been noted as such. Regression tested and bootstrapped for aarch64-none-linux-gnu and x86_64-unknown-linux-gnu. Cross compiled and checked FMV tests for riscv and powerpc. Kind regards, Alfie Richards Change log == V6: - Merged "Add assembler_na

Re: [PATCH v5 09/24] Add assembler_name to cgraph_function_version_info.

2025-06-11 Thread Alfie Richards
On 04/06/2025 15:59, Jeff Law wrote: On 5/29/25 6:46 AM, Alfie Richards wrote: Add the assembler_name member to cgraph_function_version_info to store the base assembler name of the funciton set, before FMV mangling. This is Just a typo in the patch description.  Should be "function&qu

Re: [PATCH] powerpc: testsuite: Fix powerpc FMV symbol tests [PR 120519]

2025-06-11 Thread alfie . richards
Hello Segher, My sincere appologies for this. I am fairly new to GCC development, and misremembered the rules/process for minor patches. Thank you for correcting my mistake, it won't happen again. Kind regards, Alfie Richards On 10/06/2025 21:40, Segher Boessenkool wrote: On Wed, J

Re: [PATCH v5 06/24] Refactor record_function_versions.

2025-06-10 Thread Alfie Richards
On 5/29/25 6:46 AM, Alfie Richards wrote: Renames record_function_versions to add_function_version, and make it explicit that it is adding a single version to the function structure. Additionally, change the insertion point to always maintain priority ordering of the versions. This allows

Re: [PATCH v5 08/24] Add get_clone_versions and get_target_version functions.

2025-06-05 Thread Alfie Richards
On 04/06/2025 15:57, Jeff Law wrote: On 5/29/25 6:46 AM, Alfie Richards wrote: 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

[PATCH] powerpc: testsuite: Fix powerpc FMV symbol tests [PR 120519]

2025-06-04 Thread Alfie Richards
Hi, This fixes the FMV powerpc tests I recently committed, and hopefully makes them work on a wider range of target configurations. I plan to commit this on Monday if no one has any objections. Thanks, Alfie --- >8 --- As discussed on the BZ page, this removes the tests on the symbols in the r

Re: [PATCH 02/14] aarch64: Add support for unpacked SVE FP conversions

2025-06-02 Thread Alfie Richards
On 02/06/2025 11:06, Spencer Abson wrote: This patch introduces expanders for FP<-FP conversions that levarage partial vector modes. We also extend the INT<-FP and FP<-INT conversions using the same approach. The ACLE enables vectorized conversions like the following: fcvt z0.h, p7/m, z1.s Mo

[PATCH v5 22/24] c: Add target_version attribute support.

2025-05-29 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 v5 20/24] aarch64: testsuite: Add diagnostic tests for Aarch64 FMV.

2025-05-29 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 v5 21/24] aarch64: Remove FMV beta warning.

2025-05-29 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 v5 12/24] fmv: i386: Refactor FMV name mangling.

2025-05-29 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 v5 19/24] c++: Fix FMV return type ambiguation

2025-05-29 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 v5 24/24] FMV: Redirect to specific target

2025-05-29 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 v5 10/24] Add dispatcher_resolver_function and is_target_clone flags to cgraph_node.

2025-05-29 Thread Alfie Richards
These are needed to correctly mangle FMV declarations. gcc/ChangeLog: * cgraph.h (struct cgraph_node): Add dispatcher_resolver_function and is_target_clone. --- gcc/cgraph.h | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gcc/cgraph.h b/gcc/cgraph.h

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

2025-05-29 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 v5 23/24] c/aarch64: Add FMV diagnostic tests.

2025-05-29 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 v5 09/24] Add assembler_name to cgraph_function_version_info.

2025-05-29 Thread Alfie Richards
Add the assembler_name member to cgraph_function_version_info to store the base assembler name of the funciton set, before FMV mangling. This is used in later patches for refactoring FMV mangling. gcc/ChangeLog: * cgraph.cc (cgraph_node::insert_new_function_version): Record assemb

[PATCH v5 14/24] fmv: Add reject_target_clone hook for filtering target_clone versions.

2025-05-29 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 v5 17/24] c++: Refactor FMV frontend conflict and merging logic and hooks.

2025-05-29 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 v5 06/24] Refactor record_function_versions.

2025-05-29 Thread Alfie Richards
Renames record_function_versions to add_function_version, and make it explicit that it is adding a single version to the function structure. Additionally, change the insertion point to always maintain priority ordering of the versions. This allows for removing logic for moving the default to the

[PATCH v5 11/24] Add clone_identifier function.

2025-05-29 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 v5 18/24] fmv: Support mixing of target_clones and target_version.

2025-05-29 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 v5 15/24] fmv: Change target_version semantics to follow ACLE specification.

2025-05-29 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 v5 05/24] Update is_function_default_version to work with target_version.

2025-05-29 Thread Alfie Richards
Notably this respects target_version semantics where an unannotated function can be the default version. gcc/ChangeLog: * attribs.cc (is_function_default_version): Add target_version logic. Approved by Richard Sandiford. --- gcc/attribs.cc | 27 --- 1 file change

[PATCH v5 13/24] riscv: Refactor riscv target parsing to take string_slice.

2025-05-29 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 v5 08/24] Add get_clone_versions and get_target_version functions.

2025-05-29 Thread Alfie Richards
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 string from a decl. gcc/c-family/ChangeLog: * c-attribs.c

[PATCH v5 07/24] Change make_attribute to take string_slice.

2025-05-29 Thread Alfie Richards
gcc/ChangeLog: * attribs.cc (make_attribute): Change arguments. * attribs.h (make_attribute): Change arguments. Approved by Richard Sandiford. --- gcc/attribs.cc | 16 +--- gcc/attribs.h | 2 +- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/gcc/att

[PATCH v5 03/24] Add string_slice class.

2025-05-29 Thread Alfie Richards
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 when needing to refer to a substring of an attribute in the syntax tree. Adds some minim

[PATCH v5 04/24] Remove unnecessary `record` argument from maybe_version_functions.

2025-05-29 Thread Alfie Richards
Previously, the `record` argument in maybe_version_function allowed the call to cgraph_node::record_function_versions to be skipped. However, this was only skipped when both decls were already marked as versioned, in which case we trigger the early exit in record_function_versions instead. Therefo

[PATCH v5 02/24] i386: Add x86 FMV symbol tests

2025-05-29 Thread Alfie Richards
-authored-by: Alfie Richards --- gcc/testsuite/g++.target/i386/mv-symbols1.C | 68 gcc/testsuite/g++.target/i386/mv-symbols2.C | 56 gcc/testsuite/g++.target/i386/mv-symbols3.C | 44 + gcc/testsuite/g++.target/i386/mv-symbols4.C | 50

[PATCH v5 00/24] FMV refactor, C FMV support and ACLE compliance.

2025-05-29 Thread Alfie Richards
inlining optimization patch. It proved keeping 3 patch series in sync was more bother than it was worth. Kind regards, Alfie Richards Change log == V5: - Merged patch series with C support series, and FMV call inlining optimization - Addressed Jason's feedback and simplified the diagno

[PATCH v5 01/24] ppc: Add PowerPC FMV symbol tests.

2025-05-29 Thread Alfie Richards
.C: New test. * g++.target/powerpc/mvc-symbols4.C: New test. Co-authored-by: Alfie Richards --- .../g++.target/powerpc/mvc-symbols1.C | 47 +++ .../g++.target/powerpc/mvc-symbols2.C | 35 ++ .../g++.target/powerpc/mvc-symbols3.C | 41

[PATCH v4 10/20] Add dispatcher_resolver_function and is_target_clone flags to cgraph_node.

2025-05-28 Thread Alfie Richards
These are needed to correctly mangle FMV declarations. gcc/ChangeLog: * cgraph.h (struct cgraph_node): Add dispatcher_resolver_function and is_target_clone. --- gcc/cgraph.h | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gcc/cgraph.h b/gcc/cgraph.h

[PATCH v4 20/20] Remove FMV beta warning.

2025-05-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 v4 18/20] Fix FMV return type ambiguation

2025-05-28 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 v4 15/20] Change target_version semantics to follow ACLE specification.

2025-05-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 v4 12/20] Refactor FMV name mangling.

2025-05-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 v4 19/20] Add diagnostic tests for Aarch64 FMV.

2025-05-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 v4 17/20] Support mixing of target_clones and target_version.

2025-05-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 v4 11/20] Add clone_identifier function.

2025-05-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 v4 05/20] Update is_function_default_version to work with target_version.

2025-05-28 Thread Alfie Richards
Notably this respects target_version semantics where an unannotated function can be the default version. gcc/ChangeLog: * attribs.cc (is_function_default_version): Add target_version logic. Approved by Richard Sandiford. --- gcc/attribs.cc | 27 --- 1 file change

[PATCH v4 09/20] Add assembler_name to cgraph_function_version_info.

2025-05-28 Thread Alfie Richards
Add the assembler_name member to cgraph_function_version_info to store the base assembler name of the funciton set, before FMV mangling. This is used in later patches for refactoring FMV mangling. gcc/ChangeLog: * cgraph.cc (cgraph_node::insert_new_function_version): Record assemb

[PATCH v4 16/20] Refactor FMV frontend conflict and merging logic and hooks.

2025-05-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 v4 13/20] Refactor riscv target parsing to take string_slice.

2025-05-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

[PATCH v4 07/20] Change make_attribute to take string_slice.

2025-05-28 Thread Alfie Richards
gcc/ChangeLog: * attribs.cc (make_attribute): Change arguments. * attribs.h (make_attribute): Change arguments. Approved by Richard Sandiford. --- gcc/attribs.cc | 16 +--- gcc/attribs.h | 2 +- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/gcc/att

[PATCH v4 14/20] Add reject_target_clone hook for filtering target_clone versions.

2025-05-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 v4 08/20] Add get_clone_versions and get_version functions.

2025-05-28 Thread Alfie Richards
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 string from a decl. gcc/c-family/ChangeLog: * c-attribs.c

[PATCH v4 06/20] Refactor record_function_versions.

2025-05-28 Thread Alfie Richards
Renames record_function_versions to add_function_version, and make it explicit that it is adding a single version to the function structure. Additionally, change the insertion point to always maintain priority ordering of the versions. This allows for removing logic for moving the default to the

[PATCH v4 02/20] Add x86 FMV symbol tests

2025-05-28 Thread Alfie Richards
-authored-by: Alfie Richards --- gcc/testsuite/g++.target/i386/mv-symbols1.C | 68 gcc/testsuite/g++.target/i386/mv-symbols2.C | 56 gcc/testsuite/g++.target/i386/mv-symbols3.C | 44 + gcc/testsuite/g++.target/i386/mv-symbols4.C | 50

[PATCH v4 01/20] Add PowerPC FMV symbol tests.

2025-05-28 Thread Alfie Richards
.C: New test. * g++.target/powerpc/mvc-symbols4.C: New test. Co-authored-by: Alfie Richards --- .../g++.target/powerpc/mvc-symbols1.C | 47 +++ .../g++.target/powerpc/mvc-symbols2.C | 35 ++ .../g++.target/powerpc/mvc-symbols3.C | 41

[PATCH v4 04/20] Remove unnecessary `record` argument from maybe_version_functions.

2025-05-28 Thread Alfie Richards
Previously, the `record` argument in maybe_version_function allowed the call to cgraph_node::record_function_versions to be skipped. However, this was only skipped when both decls were already marked as versioned, in which case we trigger the early exit in record_function_versions instead. Therefo

[PATCH v4 08/20] Add get_clone_versions and get_target_version functions.

2025-05-28 Thread Alfie Richards
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 string from a decl. gcc/c-family/ChangeLog: * c-attribs.c

[PATCH v4 03/20] Add string_slice class.

2025-05-28 Thread Alfie Richards
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 when needing to refer to a substring of an attribute in the syntax tree. Adds some minim

[Repost PATCH v4 00/20] FMV refactor and ACLE compliance.

2025-05-28 Thread Alfie Richards
/pipermail/gcc-patches/2025-February/674973.html - Initial Alfie Richards (18): Add string_slice class. Remove unnecessary `record` argument from maybe_version_functions. Update is_function_default_version to work with target_version (Approved). Refactor record_function_versions. Change

Re: [PATCH 0/3] Redirect to specific target based on TARGET_VERSION_COMPATIBLE

2025-05-28 Thread Alfie Richards
On 28/05/2025 03:36, Jeff Law wrote: On 5/27/25 2:36 AM, Alfie Richards wrote: Hi Jeff, On 22/05/2025 21:02, Jeff Law wrote: On 5/22/25 9:05 AM, Alfie Richards wrote: Hi Jeff, I sent this patch with my implementation a while ago: https://gcc.gnu.org/pipermail/gcc-patches/2025-April

Re: [PATCH 0/3] Redirect to specific target based on TARGET_VERSION_COMPATIBLE

2025-05-27 Thread Alfie Richards
Hi Jeff, On 22/05/2025 21:02, Jeff Law wrote: On 5/22/25 9:05 AM, Alfie Richards wrote: Hi Jeff, I sent this patch with my implementation a while ago: https://gcc.gnu.org/pipermail/gcc-patches/2025-April/681043.html There hasn't been any feedback on that patch yet. These patches are

Re: [PATCH 0/3] Redirect to specific target based on TARGET_VERSION_COMPATIBLE

2025-05-22 Thread Alfie Richards
on as it is a bit stronger, but it also requires my larger FMV series to be approved first. Thanks, Alfie On 22/05/2025 04:30, Jeff Law wrote: On 4/14/25 5:34 AM, Yangyu Chen wrote: On 14 Apr 2025, at 19:06, Alfie Richards wrote: Hi Yangyu, This looks great with what we discussed previ

Re: [PATCH v4 16/20] Refactor FMV frontend conflict and merging logic and hooks.

2025-05-20 Thread Alfie Richards
On 20/05/2025 03:28, Jason Merrill wrote: On 4/15/25 6:31 AM, Alfie Richards wrote: This change refactors FMV handling in the frontend to allows greater reasoning about versions in shared code. Looking at the cp/ changes: diff --git a/gcc/cp/class.cc b/gcc/cp/class.cc index c28d9e5b3ab

Ping^2: [PATCH v4 00/20] FMV refactor and ACLE compliance.

2025-05-13 Thread Alfie Richards
Hi all, Ping for this main patch series. Alfie On 15/04/2025 11:31, Alfie Richards wrote: Hi all, Another update to this series. This patch changes the version info structure to be sorted by priority. This allows easier reasoning for optimisations and prevents having to calculate the

Re: [RFC PATCH 0/2] Add target_clones profile option support

2025-05-06 Thread Alfie Richards
On 06/05/2025 09:36, Yangyu Chen wrote: On 6 May 2025, at 16:01, Alfie Richards wrote: Hello, I like this idea. I have a couple thoughts to add. On 05/05/2025 09:46, Yangyu Chen wrote: On 5 May 2025, at 16:34, Kyrylo Tkachov wrote: On 4 May 2025, at 19:19, Yangyu Chen wrote: Hi

Re: [RFC PATCH 0/2] Add target_clones profile option support

2025-05-06 Thread Alfie Richards
rch=+v bar(int, char) |arch=+zba,+zbb file.C:baz(char) |arch=+zba,+zbb#arch=+v namespace::qux |arch=+v ``` Thanks, Alfie Richards Thanks, Yangyu Chen The primary objective of this patch series is to provide a user-friendly way to specify target_clones attributes without modifying the sou

[PING PATCH v4 00/20] FMV refactor and ACLE compliance.

2025-05-06 Thread Alfie Richards
Hi all, Ping for this patch series. There are a handful of other patches that are dependant on this series so I am keen to start getting this reviewed. Kind regards, Alfie On 15/04/2025 11:31, Alfie Richards wrote: Hi all, Another update to this series. This patch changes the version

[PATCH v4 08/20] Add get_clone_versions and get_version functions.

2025-04-15 Thread Alfie Richards
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 string from a decl. gcc/c-family/ChangeLog: * c-attribs.c

[PATCH v4 16/20] Refactor FMV frontend conflict and merging logic and hooks.

2025-04-15 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 v4 18/20] Fix FMV return type ambiguation

2025-04-15 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 v4 10/20] Add dispatcher_resolver_function and is_target_clone flags to cgraph_node.

2025-04-15 Thread Alfie Richards
These are needed to correctly mangle FMV declarations. gcc/ChangeLog: * cgraph.h (struct cgraph_node): Add dispatcher_resolver_function and is_target_clone. --- gcc/cgraph.h | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gcc/cgraph.h b/gcc/cgraph.h

[PATCH v4 15/20] Change target_version semantics to follow ACLE specification.

2025-04-15 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 v4 14/20] Add reject_target_clone hook for filtering target_clone versions.

2025-04-15 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 v4 08/20] Add get_clone_versions and get_target_version functions.

2025-04-15 Thread Alfie Richards
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 string from a decl. gcc/c-family/ChangeLog: * c-attribs.c

[PATCH v4 06/20] Refactor record_function_versions.

2025-04-15 Thread Alfie Richards
Renames record_function_versions to add_function_version, and make it explicit that it is adding a single version to the function structure. Additionally, change the insertion point to always maintain priority ordering of the versions. This allows for removing logic for moving the default to the

[PATCH v4 03/20] Add string_slice class.

2025-04-15 Thread Alfie Richards
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 when needing to refer to a substring of an attribute in the syntax tree. Adds some minim

[PATCH v4 12/20] Refactor FMV name mangling.

2025-04-15 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 v4 11/20] Add clone_identifier function.

2025-04-15 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 v4 19/20] Add diagnostic tests for Aarch64 FMV.

2025-04-15 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 v4 20/20] Remove FMV beta warning.

2025-04-15 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 v4 04/20] Remove unnecessary `record` argument from maybe_version_functions.

2025-04-15 Thread Alfie Richards
Previously, the `record` argument in maybe_version_function allowed the call to cgraph_node::record_function_versions to be skipped. However, this was only skipped when both decls were already marked as versioned, in which case we trigger the early exit in record_function_versions instead. Therefo

[PATCH v4 17/20] Support mixing of target_clones and target_version.

2025-04-15 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   >