From 3660e0723e3ce155f2c030eb1e5557dee5022d5b Mon Sep 17 00:00:00 2001 From: Alexandros Lamprineas Date: Wed, 20 Mar 2024 17:11:10 +0000 Subject: [PATCH] [FMV] Allow mixing target_version with target_clones. The combination of these attributes is now permitted. Therefore, it is also worth clarifying the existance of a single default version across all translation units with the explicitly provided version being the preferred in case `target_version` and `target_clones` are mixed. --- main/acle.md | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/main/acle.md b/main/acle.md index 5319fd21..883ea087 100644 --- a/main/acle.md +++ b/main/acle.md @@ -363,6 +363,11 @@ Armv8.4-A [[ARMARMv84]](#ARMARMv84). Support is added for the Dot Product intrin to use keyword attributes instead of GNU-style attributes. * Added description of SVE reinterpret intrinsics. * Changes and fixes for [Function Multi Versioning](#function-multi-versioning): + * Combination of attributes `target_version` and `target_clones` is allowed. + * Clarify the existance of a single default version across all translation + units with the explicitly provided version being the preferred in case + `target_version` and `target_clones` are mixed. + * Emphasise that all instances of the versions share the same calling convention. * Changed the mangling rules [Name mangling](#name-mangling), such that feature names are appended in lexicographic order, not in priority order. * Mangled names contain a unique set of features (no duplicates). @@ -2474,7 +2479,7 @@ The following attributes trigger the multi version code generation: `__attribute__((target_version("name")))` and `__attribute__((target_clones("name",...)))`. -* These attributes can't be mixed with each other. +* These attributes can be mixed with each other. * The `default` version means the version of the function that would be generated without these attributes. * `name` is the dependent features from the tables below. @@ -2498,11 +2503,13 @@ following: * when applied to a function it becomes one of the versions. Function with the same name may exist with multiple versions in the same translation unit. -* One `default` version of the function is required to be provided. +* Function versions may reside in different translation units. +* One `default` version of the function is required to be provided + in one of the translation units. * Implicitly, without this attribute, * or explicitly providing the `default` in the attribute. * All instances of the versions shall share the same function - signature. + signature and calling convention. The attribute `__attribute__((target_clones("name",...)))` expresses the following: @@ -2511,8 +2518,9 @@ following: based on the arguments. * One of them is implicitly the `default`. * If the `default` matches with an other explicitly provided - version the compiler can emit only one function instead of the - two. + version in the same translation unit, then the compiler can + emit only one function instead of the two. The explicitly + provided version shall be preferred. * If a name is not recognized the compiler should ignore it[^fmv-note-ignore]. [^fmv-note-ignore]: The intention is to support the usecase of newer code if