Skip to content

Commit

Permalink
[FMV] Allow mixing target_version with target_clones.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
labrinea committed Mar 21, 2024
1 parent 9ec2de7 commit 3660e07
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions main/acle.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down Expand Up @@ -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.
Expand All @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit 3660e07

Please sign in to comment.