Skip to content

Commit fbb838f

Browse files
Change the FMV rules so target_clones defaults must be explicitly stated
This is needed to disambiguate cases such as: ```c++ // Translation unit 1 __attribute__ ((target_clone("dotprod, sve"))) int foo(); int foo() { return 1; } ``` ```c // Translation unit 2 __attribute__ ((target_clone("dotprod, sve"))) int foo() { return 2; } ``` Where with the previous specification two dispatchers would be created and two defaults with different contents. This is fixed by requiring default versions in target_clones to be explicitly stated. This makes it bery simple to determine where the dispatcher should be created accross translation units.
1 parent 7ec1e3a commit fbb838f

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

main/acle.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,7 @@ Armv8.4-A [[ARMARMv84]](#ARMARMv84). Support is added for the Dot Product intrin
424424
* Removed Function Multi Versioning feature dgh.
425425
* Document Function Multi Versioning feature dependencies.
426426
* Simplified Function Multi Versioning version selection rules.
427+
* Changed the Function Multi Versioning default version rules to be more explicit.
427428
* Fixed range of operand `o0` (too small) in AArch64 system register designations.
428429
* Fixed SVE2.1 quadword gather load/scatter store intrinsics.
429430
* Removed unnecessary Zd argument from `svcvtnb_mf8[_f32_x2]_fpm`.
@@ -439,7 +440,6 @@ Armv8.4-A [[ARMARMv84]](#ARMARMv84). Support is added for the Dot Product intrin
439440
* Changed the status of the SME2p1 ACLE from Alpha to Beta.
440441
* Changed the status of the SVE2p1 ACLE from Alpha to Beta.
441442

442-
443443
### References
444444

445445
This document refers to the following documents.
@@ -2704,17 +2704,19 @@ The following attributes trigger the multi version code generation:
27042704
type of the default version.
27052705
* All the function versions must be declared at the translation
27062706
unit in which the definition of the default version resides.
2707+
* One `default` version of the function is required to be provided
2708+
in one of the translation units.
2709+
* Implicitly, as a definition without any attribute,
2710+
* as a function annotated with `target_version("default")`,
2711+
* or, as a function annotated with `target_clones(...)` where one
2712+
of the versions is `default`.
27072713

27082714
The attribute `__attribute__((target_version("name")))` expresses the
27092715
following:
27102716

27112717
* When applied to a function it becomes one of the versions.
27122718
* Multiple function versions may exist in the same or in different
27132719
translation units.
2714-
* One `default` version of the function is required to be provided
2715-
in one of the translation units.
2716-
* Implicitly, without this attribute,
2717-
* or explicitly providing the `default` in the attribute.
27182720

27192721
For example, the below is valid and 2 is used as the default
27202722
value for `c` when calling the multiversioned function `f`.
@@ -2741,11 +2743,6 @@ following:
27412743

27422744
* when applied to a function the compiler emits multiple versions
27432745
based on the arguments.
2744-
* One of them is implicitly the `default`.
2745-
* If the `default` matches with another explicitly provided
2746-
version in the same translation unit, then the compiler can
2747-
emit only one function instead of the two. The explicitly
2748-
provided version shall be preferred.
27492746
* If a name is not recognized the compiler should ignore it[^fmv-note-ignore].
27502747

27512748
[^fmv-note-ignore]: The intention is to support the usecase of newer code if

0 commit comments

Comments
 (0)