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 Language Extension. The functional differences consist of: 1. Generating the resolver for the dispatched symbol at the site of the default version definition. 2. Mangling non-default FMV annotated functions even when no other versions are present. This allows for better behavior when definitions are spread across different TU's as one resolver will be created and the [ACLE](https://github.com/ARM-software/acle/blob/main/main/acle.md#function-multi-versioning) stipulates that the default implementation must have visibility of all other versions so that resolver will be complete. This also matches Clangs behavior. The only remaining discrepancy I'm aware of when targeting AArch64 is we do not allow the coexistence of target_version and target_clone, which is specified as supported in the ACLE but will be addressed later. Note this hook is only true on Aarch64, so other targets will not be affected. To enable these functionality changes I added mangling to the initial processing of functions in the CPP frontend, and changed the logic for the creation of resolver bodies to create at default declaration implementations. Additionally, the previous naming logic relied on the fact that if there existed a call to a dispatched function the resolver would also be created which would do some renaming. As that no longer is guaranteed this patch hacks on the assembler names to make them correct. Reg tested on AArch64 and X86_64. Bootstrapped tested on aarch64-none-linux-gnu and x86_64-unknown-linux-gnu. gcc/ChangeLog: * attribs.cc (make_dispatcher_decl): Add optional name parameter. (is_function_default_version): Add check_versioned parameter. * attribs.h (make_dispatcher_decl): Add optional name parameter. (is_function_default_version): Add optional check_versioned parameter. * cgraphunit.cc (cgraph_node::analyze): Change dispatcher creation logic. * config/aarch64/aarch64.cc (get_assembler_name_without_default): New. (get_suffixed_assembler_name): Change to use get_assembler_name_without_default. (aarch64_get_function_versions_dispatcher): Change to use get_assembler_name_without_default. * config/aarch64/aarch64.h (TARGET_CREATE_FMV_DISPATCHER_AT_DEFAULT_IMPL): New. * defaults.h (TARGET_CREATE_FMV_DISPATCHER_AT_DEFAULT_IMPL): New. gcc/cp/ChangeLog: * class.cc (add_method): Update call * cp-tree.h (maybe_version_functions): Remove unecessary argument. * decl.cc (decls_match): Remove unecessary argument. (maybe_version_functions): Remove unecessary parameter. (start_preparsed_function): Change logic. gcc/testsuite/ChangeLog: * g++.target/aarch64/mv-1.C: Update. * g++.target/aarch64/mv-symbols2.C: Update. * g++.target/aarch64/mv-symbols3.C: Update. * g++.target/aarch64/mv-symbols4.C: Update. * g++.target/aarch64/mv-symbols5.C: Update. * g++.target/aarch64/mv-symbols6.C: New test. --- gcc/attribs.cc | 31 +++++++++++----- gcc/attribs.h | 6 ++-- gcc/cgraphunit.cc | 36 +++++++++++++++---- gcc/config/aarch64/aarch64.cc | 31 ++++++++++++---- gcc/config/aarch64/aarch64.h | 2 ++ gcc/cp/class.cc | 2 +- gcc/cp/cp-tree.h | 2 +- gcc/cp/decl.cc | 18 ++++++---- gcc/defaults.h | 10 ++++++ gcc/testsuite/g++.target/aarch64/mv-1.C | 4 +++ .../g++.target/aarch64/mv-symbols2.C | 12 +++---- .../g++.target/aarch64/mv-symbols3.C | 6 ++-- .../g++.target/aarch64/mv-symbols4.C | 6 ++-- .../g++.target/aarch64/mv-symbols5.C | 6 ++-- .../g++.target/aarch64/mv-symbols6.C | 22 ++++++++++++ 15 files changed, 148 insertions(+), 46 deletions(-) create mode 100644 gcc/testsuite/g++.target/aarch64/mv-symbols6.C