Re: [PATCH v1 0/2] Aarch64: addp NEON big-endian fix [PR114890]

2024-07-03 Thread Alfie Richards
Hi Kyrill, Okay noted for future! Yes happy someone to commit this. Kind regards, Alfie Sent from Outlook for iOS<https://aka.ms/o0ukef> From: Kyrylo Tkachov Sent: Wednesday, July 3, 2024 11:23:37 AM To: Alfie Richards Cc: gcc-patches@gcc.gnu.org Subje

Re: [PATCH v2 1/1] C: Support Function multiversionsing in the C front end

2024-11-04 Thread Alfie Richards
on I suppose, but this invalidates. Im currently planning to do this at the `pushdecl` level, by iterating through the `shadows` link in c bindings, and then only doing `duplicate_decls` on functions with matching targets. I will get back to you soon, Alfie Richards alfie.richa...@arm.com

*Ping* [PATCH v2 1/1] C: Support Function multiversionsing in the C front end

2024-10-31 Thread Alfie Richards
Hi, Ping for this patch I'd really like to get this in for GCC 15 to align FMV with LLVM and avoid any divergence of use in code bases as much as possible as we push this more to users. Thanks, Alfie Richards > On 24 Oct 2024, at 13:54, alfie.richa...@arm.com wrote: > > >

Fwd: [PATCH v3] C: Support Function multiversionsing in the C front end

2024-11-11 Thread Alfie Richards
Adding missing CC's Forwarded Message Subject: Re: [PATCH v3] C: Support Function multiversionsing in the C front end Date: Mon, 11 Nov 2024 12:29:57 + From: Alfie Richards To: Joseph Myers Hi Joseph, Thank you for the detailed feedback. I am quite j

Ping: [PATCH v4 0/1] C: Support Function multiversioning in the C front end

2024-11-27 Thread Alfie Richards
shing on with that further. Kind regards, Alfie On 15/11/2024 16:36, alfie.richa...@arm.com wrote: From: Alfie Richards Hi Joseph and all, I worked through Josephs feedback, and as I fixed certain issues I came to the conclusion he was correct that a rethink was required. I reworked this to

Ping: [PATCH v3 1/1] CPP: Add flag to generate resolver at default version implementation.

2024-12-03 Thread Alfie Richards
Hi all, Ping for this as it no longer needs the C patch and is independent. Kind regards, Alfie On 26/11/2024 14:35, alfie.richa...@arm.com wrote: This patch adds the TARGET_CREATE_FMV_DISPATCHER_AT_DEFAULT_IMPL flag which changes FMV behavior for target_version functions to match the Arm C La

[PATCH v1 14/16] Change target_version semantics to follow ACLE specification.

2025-02-03 Thread Alfie Richards
This changes behavior of target_clones and target_version attributes to be inline with what is specified in the Arm C Language Extension. Notably this changes the scope and signature of multiversioned functions to that of the default version, and changes the resolver to be created at the implemen

[PATCH v1 08/16] Add get_clone_versions function.

2025-02-03 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. gcc/c-family/ChangeLog: * c-attribs.cc (handle_target_clones_attribute): Change to use get_clone_versions. gcc/Cha

[PATCH v1 16/16] Remove FMV beta warning.

2025-02-03 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. gcc/testsuite/ChangeLog: * g++.target/aarch64/mv-1.C: Remove opt

[RFC][PATCH v1 00/16] FMV refactor and ACLE compliance.

2025-02-03 Thread Alfie Richards
-linux-gnu and x86_64-unknown-linux-gnu. Cross compiled and the FMV tests ran for riscv and powerpc. Kind regards, Alfie Richards Alfie Richards (16): Add PowerPC FMV symbol tests. Add x86 FMV symbol tests Add string_slice class. Remove unnecessary `record` argument from

[PATCH v1 04/16] Remove unnecessary `record` argument from maybe_version_functions.

2025-02-03 Thread Alfie Richards
The `record` argument in maybe_version_function was intended to allow controlling recording the relationship of versions. However, it only exercised this if both input functions were already marked as versioned, and this same logic is repeated in maybe_version_function itself so the argument is un

[PATCH v1 07/16] Add version of make_attribute supporting string_slice.

2025-02-03 Thread Alfie Richards
gcc/ChangeLog: * attribs.cc (make_attribute): New function overload. * attribs.h (make_attribute): New function overload. --- gcc/attribs.cc | 19 ++- gcc/attribs.h | 1 + 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/gcc/attribs.cc b/gcc/attrib

[PATCH v1 02/16] Add x86 FMV symbol tests

2025-02-03 Thread Alfie Richards
This is for testing the x86 mangling of FMV versioned function assembly names. gcc/testsuite/ChangeLog: * g++.target/i386/mv-symbols1.C: New test. * g++.target/i386/mv-symbols2.C: New test. * g++.target/i386/mv-symbols3.C: New test. * g++.target/i386/mv-symbols4.C

[PATCH v1 11/16] Add clone_identifier function.

2025-02-03 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 v1 13/16] Remove unused target_clone parsing code.

2025-02-03 Thread Alfie Richards
This removes the target_clone parsing code that was replaced with get_clone_versions. gcc/ChangeLog: * multiple_target.cc (get_attr_str): Removed. (separate_attrs): Removed. * tree.cc (get_target_clone_attr_len): Removed. * tree.h (get_target_clone_attr_len): Remo

[PATCH v1 05/16] Update is_function_default_version to work with target_version.

2025-02-03 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. --- gcc/attribs.cc | 28 1 file changed, 20 insertions(+), 8 deletio

[PATCH v1 06/16] Change function versions to be implicitly ordered.

2025-02-03 Thread Alfie Richards
This changes function version structures to maintain the default version as the first declaration in the linked data structures by giving priority to the set containing the default when constructing the structure. This allows for removing logic for moving the default to the first position which w

[PATCH v1 09/16] Add assembler_name to cgraph_function_version_info.

2025-02-03 Thread Alfie Richards
This adds the assembler_name member to cgraph_function_version_info to store the base assembler name for the function to be mangled. This is used in later patches for refactoring FMV mangling. gcc/c/ChangeLog: * c-decl.cc (start_decl): Record assembler_name. (start_function): Rec

[PATCH v1 10/16] Add dispatcher_resolver_function and is_target_clone to cgraph_node.

2025-02-03 Thread Alfie Richards
These flags are used to make sure mangling is done correctly. gcc/ChangeLog: * cgraph.h (struct cgraph_node): Add dispatcher_resolver_function and is_target_clone. --- gcc/cgraph.h | 27 --- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/

[PATCH v1 04/16] Remove unecessary `record` argument from maybe_version_functions.

2025-02-03 Thread Alfie Richards
The `record` argument in maybe_version_function was intended to allow controlling recording the relationship of versions. However, it only exercised this if both input funcitons were already marked as versioned, and this same logic is repeated in maybe_version_function itself so the argument is un

[PATCH v1 03/16] Add string_slice class.

2025-02-03 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. This commit al

[PATCH v1 15/16] Support mixing of target_clones and target_version for aarch64.

2025-02-03 Thread Alfie Richards
This patch adds support for the combination of target_clones and target_version in the definition of a versioned function. This patch changes is_function_default_version to consider a function declaration annotated with target_clones containing default to be a default version. It also changes the

[PATCH v1 01/16] Add PowerPC FMV symbol tests.

2025-02-03 Thread Alfie Richards
This tests the mangling of function assembly names when annotated with target_clones attributes. gcc/testsuite/ChangeLog: * g++.target/powerpc/mvc-symbols1.C: New test. * g++.target/powerpc/mvc-symbols2.C: New test. * g++.target/powerpc/mvc-symbols3.C: New test. *

[PATCH v1 12/16] Refactor FMV name mangling.

2025-02-03 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 a

Re: [PATCH v1 06/16] Change function versions to be implicitly ordered.

2025-02-04 Thread Alfie Richards
On 04/02/2025 15:11, Richard Sandiford wrote: Richard Sandiford writes: Alfie Richards writes: --- gcc/cgraph.cc| 39 +++--- gcc/config/aarch64/aarch64.cc| 37 +++- gcc/config/i386/i386-features.cc | 33

Re: [PATCH v1 12/16] Refactor FMV name mangling.

2025-02-06 Thread Alfie Richards
Added missing CC On 05/02/2025 17:14, Richard Sandiford wrote: Alfie Richards writes: On 04/02/2025 10:03, Richard Sandiford wrote: Alfie Richards writes: +    return id; +  else if (cgraph_node::get_create (decl)->dispatcher_resolver_function) +    id = clone_identifier

Re: [PATCH v1 12/16] Refactor FMV name mangling.

2025-02-05 Thread Alfie Richards
On 04/02/2025 10:03, Richard Sandiford wrote: Alfie Richards writes: + return id; + else if (cgraph_node::get_create (decl)->dispatcher_resolver_function) + id = clone_identifier (id, "resolver"); + else if (DECL_FUNCTION_VERSIONED (decl)) { -

Re: [PATCH v1 09/16] Add assembler_name to cgraph_function_version_info.

2025-02-05 Thread Alfie Richards
On 04/02/2025 08:41, Richard Sandiford wrote: Alfie Richards writes: This adds the assembler_name member to cgraph_function_version_info to store the base assembler name for the function to be mangled. This is used in later patches for refactoring FMV mangling. gcc/c/ChangeLog

Re: [PATCH v4 1/1] C++: Add flag to generate resolver at default version implementation.

2024-12-11 Thread Alfie Richards
Hi Richard, Thank you for the feedback! On 10/12/2024 18:49, Richard Sandiford wrote: -/* Returns true if DECL is multi-versioned using the target attribute, and this - is the default version. This function can only be used for targets that do - not support the "target_version" attribute.

Re: [PATCH v2] Add warning for non-spec compliant FMV in Aarch64

2025-01-10 Thread Alfie Richards
Thank you both for feedback. On 10/01/2025 10:47, Kyrylo Tkachov wrote: On 10 Jan 2025, at 11:22, Richard Sandiford wrote: writes: This patch adds a warning when FMV is used for Aarch64. The reasoning for this is the ACLE [1] spec for FMV has diverged significantly from the current implemen

Re: [PATCH] Add warning for use of non-spec FMV in Aarch64

2025-01-09 Thread Alfie Richards
guidance I have added to the warning (in upcoming patch) that the behaviour is likely to change. I will also add similar to the documentation. Thank you for the feedback! I will get an updated patch to you shortly. Alfie Richards

Re: [PATCH 1/8] aarch64: Use PAUTH instead of V8_3A in some places

2025-03-20 Thread Alfie Richards
Hi all, This commit applies cleanly to GCC 14 and fixes PR119372. Bootstrapped and regtested on aarch64-linux-gnu. Okay for gcc 14 backport? Alfie Richards On 08/10/2024 16:46, Richard Sandiford wrote: Andrew Carlotti writes: gcc/ChangeLog: * config/aarch64/aarch64.cc

[PATCH v2 0/1] Cherry pick of patch for gcc-13 fixing PR119372

2025-03-21 Thread Alfie Richards
Minor update to add the PR label from Alex's feedback (thank you!). Regtested and bookstrapped for gcc-12 and gcc-13 (after applying r13-100-g3771486daa1e904ceae6f3e135b28e58af33849 to gcc-12). Alfie Andrew Carlotti (1): aarch64: Use PAUTH instead of V8_3A in some places gcc/config/aarch64/a

[PATCH 0/1] Cherry pick of patch for gcc-13 fixing PR119372

2025-03-20 Thread Alfie Richards
bsanitizer/hwasan/hwasan_checks.h:28 ``` Note the difference in the tags. Does anyone with experience of HWAddressSanitizer know what caused this and if it's an issue? Kind regards, Alfie Richards Andrew Carlotti (1): aarch64: Use PAUTH instead of V8_3A in some places gcc/config/

[PATCH v2 1/1] aarch64: Use PAUTH instead of V8_3A in some places

2025-04-05 Thread Alfie Richards
gcc/ChangeLog: PR target/119372 * config/aarch64/aarch64.cc (aarch64_expand_epilogue): Use TARGET_PAUTH. * config/aarch64/aarch64.md: Update comment. (cherry-picked from commit 20385cb92cbd4a1934661ab97a162c1e25935836) --- gcc/config/aarch64/aarch64.cc | 6 +++---

[PATCH v1 0/2] Add target_version support to C frontend

2025-04-05 Thread Alfie Richards
regression tested on aarch64-linux-gnu and x86_64-linux-gnu. This is targeting GCC 16 stage 1. Kind regards, Alfie Richards Alfie Richards (2): c: Add target_version attribute support. c: Improve diagnostics for C FMV declaration conflicts. gcc/c/c-decl.cc | 144

[PATCH v3 08/19] Add get_clone_versions and get_version functions.

2025-03-27 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. This also adds get_version which is a helper function to get the version string from a decl. gcc/c-family/ChangeLog: * c-a

[PATCH v3 16/19] Refactor FMV frontend hooks and logic.

2025-03-27 Thread Alfie Richards
This change refactors FMV handling in the frontend to allows greater reasoning about versions in shared code. This is needed for target_version semantics and allowing target_clones and target_versions to both be used for the declaration there are now two questions that need to be answered for the

[PATCH v3 02/19] Add x86 FMV symbol tests

2025-03-27 Thread Alfie Richards
.C: New test. * g++.target/i386/mv-symbols5.C: New test. * g++.target/i386/mvc-symbols1.C: New test. * g++.target/i386/mvc-symbols2.C: New test. * g++.target/i386/mvc-symbols3.C: New test. * g++.target/i386/mvc-symbols4.C: New test. Co-authored-by: Alfie

[PATCH v3 17/19] Support mixing of target_clones and target_version.

2025-03-27 Thread Alfie Richards
This patch adds support for the combination of target_clones and target_version in the definition of a versioned function. This patch changes is_function_default_version to consider a function declaration annotated with target_clones containing default to be a default version. This takes advanta

[PATCH v3 10/19] Add dispatcher_resolver_function and is_target_clone to cgraph_node.

2025-03-27 Thread Alfie Richards
These flags are used to make sure mangling is done correctly. gcc/ChangeLog: * cgraph.h (struct cgraph_node): Add dispatcher_resolver_function and is_target_clone. --- gcc/cgraph.h | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gcc/cgraph.h b/gcc/cgr

[PATCH v3 14/19] Add reject_target_clone hook in order to filter target_clone versions.

2025-03-27 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 v3 05/19] Update is_function_default_version to work with target_version.

2025-03-27 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. --- gcc/attribs.cc | 27 --- 1 file changed, 20 insertions(+), 7 deletion

[PATCH v3 19/19] Remove FMV beta warning.

2025-03-27 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 v3 15/19] Change target_version semantics to follow ACLE specification.

2025-03-27 Thread Alfie Richards
This changes behavior of target_clones and target_version attributes to be inline with what is specified in the Arm C Language Extension. Notably this changes the scope and signature of multiversioned functions to that of the default version, and changes the resolver to be created at the implemen

[PATCH v3 18/19] Add error cases and tests for Aarch64 FMV.

2025-03-27 Thread Alfie Richards
This changes the ambiguation error for C++ to cover cases of differently annotated FMV function sets whose signatures only differ by their return type. It also adds tests covering many FMV errors for Aarch64, including redeclaration, and mixing target_clones and target_versions. gcc/cp/ChangeLog

[PATCH v3 09/19] Add assembler_name to cgraph_function_version_info.

2025-03-27 Thread Alfie Richards
This adds the assembler_name member to cgraph_function_version_info to store the base assembler name for the function to be mangled. This is used in later patches for refactoring FMV mangling. gcc/ChangeLog: * cgraph.cc (cgraph_node::insert_new_function_version): Record assembler

[PATCH v3 12/19] Refactor FMV name mangling.

2025-03-27 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 a

[PATCH v3 07/19] Change make_attribute to take string_slice.

2025-03-27 Thread Alfie Richards
gcc/ChangeLog: * attribs.cc (make_attribute): Change arguments. * attribs.h (make_attribute): Change arguments. --- gcc/attribs.cc | 18 ++ gcc/attribs.h | 2 +- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/gcc/attribs.cc b/gcc/attribs.cc inde

[PATCH v3 06/19] Change function versions to be implicitly ordered.

2025-03-27 Thread Alfie Richards
This changes function version structures to maintain the default version as the first declaration in the linked data structures by giving priority to the set containing the default when constructing the structure. This allows for removing logic for moving the default to the first position which w

[PATCH v3 14/19] Add reject_target_clone hook and filter target_clone versions.

2025-03-27 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 v3 03/19] Add string_slice class.

2025-03-27 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. This commit al

[PATCH v3 00/19] FMV refactor and ACLE compliance.

2025-03-27 Thread Alfie Richards
cific_clone logic to work properly with ACLE semantics which will both use the work in this patch. Reg tested and bootstrapped on x86-linux-gnu and aarch64-linux-gnu. FMV tests ran for PowerPC and RiscV. Kind regards, Alfie Richards Alfie Richards (17): Add string_slice class. Remove unnecessa

[PATCH v3 04/19] Remove unnecessary `record` argument from maybe_version_functions.

2025-03-27 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. Theref

[PATCH v3 11/19] Add clone_identifier function.

2025-03-27 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 v3 13/19] Refactor riscv target parsing to take string_slice.

2025-03-27 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 ju

[PATCH v3 01/19] Add PowerPC FMV symbol tests.

2025-03-27 Thread Alfie Richards
. * 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 .../g

Re: [PATCH v3 00/19] FMV refactor and ACLE compliance.

2025-04-10 Thread Alfie Richards
Hello, I have another revision of this coming as I discovered some issues at higher optimisation levels and have found a bunch of nits. Kind regards, Alfie On 27/03/2025 15:45, Alfie Richards wrote: Hi All, This is an update on the patch series enabling ACLE compliant FMV behaviour for

Re: [PATCH 1/8] aarch64: Use PAUTH instead of V8_3A in some places

2025-03-31 Thread Alfie Richards
Hi Richard, Is this backport okay for GCC 14 as well? (It applies cleanly for 14 but patch for 12 and 13 required a minor edit) Alfie On 20/03/2025 14:05, Alfie Richards wrote: Hi all, This commit applies cleanly to GCC 14 and fixes PR119372. Bootstrapped and regtested on aarch64-linux-gnu

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

2025-04-14 Thread Alfie Richards
Hi Yangyu, This looks great with what we discussed previously. I have a very similar patch that implements a slightly stronger optimisation that I was about to send. It makes use of information if the caller is versioned. I will share this with you shortly and we can work out what we wish to

[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

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

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

[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 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 09/20] Add assembler_name to cgraph_function_version_info.

2025-04-15 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 00/20] FMV refactor and ACLE compliance.

2025-04-15 Thread Alfie Richards
- 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 make_attribute to take string_slice (Approved). Add

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

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

[PATCH v4 13/20] Refactor riscv target parsing to take string_slice.

2025-04-15 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 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 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 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 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 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 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 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 v1] FMV: Redirect to specific target

2025-04-15 Thread Alfie Richards
[1] https://patchwork.sourceware.org/comment/197172/ [2] https://gcc.gnu.org/pipermail/gcc-patches/2025-April/680876.html Kind regards, Alfie Richards -- >8 -- Adds an optimisation in FMV to redirect to a specific target if possible. A call is redirected to a specific target if both: - the call

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

2025-04-15 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 01/20] Add PowerPC FMV symbol tests.

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

2025-04-15 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 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 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 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 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 v2 09/16] Add assembler_name to cgraph_function_version_info.

2025-02-17 Thread Alfie Richards
This adds the assembler_name member to cgraph_function_version_info to store the base assembler name for the function to be mangled. This is used in later patches for refactoring FMV mangling. gcc/ChangeLog: * cgraph.cc (cgraph_node::insert_new_function_version): Record assembler

[PATCH v2 15/16] Add error cases and tests for Aarch64 FMV.

2025-02-17 Thread Alfie Richards
This changes the ambiguation error for C++ to cover cases of differently annotated FMV function sets whose signatures only differ by their return type. It also adds tests covering many FMV errors for Aarch64, including redeclaration, and mixing target_clones and target_versions. gcc/cp/ChangeLog

[PATCH v2 04/16] Remove unnecessary `record` argument from maybe_version_functions.

2025-02-17 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. Theref

[PATCH v2 12/16] Refactor FMV name mangling.

2025-02-17 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 a

[PATCH v2 11/16] Add clone_identifier function.

2025-02-17 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 v2 13/16] Change target_version semantics to follow ACLE specification.

2025-02-17 Thread Alfie Richards
This changes behavior of target_clones and target_version attributes to be inline with what is specified in the Arm C Language Extension. Notably this changes the scope and signature of multiversioned functions to that of the default version, and changes the resolver to be created at the implemen

[PATCH v2 16/16] Remove FMV beta warning.

2025-02-17 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 v2 02/16] Add x86 FMV symbol tests

2025-02-17 Thread Alfie Richards
.C: New test. * g++.target/i386/mv-symbols5.C: New test. * g++.target/i386/mvc-symbols1.C: New test. * g++.target/i386/mvc-symbols2.C: New test. * g++.target/i386/mvc-symbols3.C: New test. * g++.target/i386/mvc-symbols4.C: New test. Co-authored-by: Alfie

[PATCH v2 10/16] Add dispatcher_resolver_function and is_target_clone to cgraph_node.

2025-02-17 Thread Alfie Richards
These flags are used to make sure mangling is done correctly. gcc/ChangeLog: * cgraph.h (struct cgraph_node): Add dispatcher_resolver_function and is_target_clone. --- gcc/cgraph.h | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gcc/cgraph.h b/gcc/cgr

[PATCH v2 07/16] Add version of make_attribute supporting string_slice.

2025-02-17 Thread Alfie Richards
gcc/ChangeLog: * attribs.cc (make_attribute): New function overload. * attribs.h (make_attribute): New function overload. --- gcc/attribs.cc | 14 +- gcc/attribs.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/gcc/attribs.cc b/gcc/attribs.cc

[PATCH v2 03/16] Add string_slice class.

2025-02-17 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. This commit al

[PATCH v2 08/16] Add get_clone_versions function.

2025-02-17 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. gcc/c-family/ChangeLog: * c-attribs.cc (handle_target_clones_attribute): Change to use get_clone_versions. gcc/Cha

[PATCH v2 06/16] Change function versions to be implicitly ordered.

2025-02-17 Thread Alfie Richards
This changes function version structures to maintain the default version as the first declaration in the linked data structures by giving priority to the set containing the default when constructing the structure. This allows for removing logic for moving the default to the first position which w

[PATCH v2 05/16] Update is_function_default_version to work with target_version.

2025-02-17 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. --- gcc/attribs.cc | 27 --- 1 file changed, 20 insertions(+), 7 deletion

  1   2   3   >