@@ -446,6 +446,7 @@ Armv8.4-A [[ARMARMv84]](#ARMARMv84). Support is added for the Dot Product intrin
446
446
* Added `svdot[_n_f16_mf8]_fpm` and `svdot[_n_f32_mf8]_fpm`.
447
447
* Added Guarded Control Stack (GCS) at
448
448
[**Beta**](#current-status-and-anticipated-changes) quality level.
449
+ * Add Function Multi Versioning feature priority syntax.
449
450
450
451
#### Changes between ACLE Q4 2024 and ACLE Q2 2025
451
452
@@ -2755,8 +2756,8 @@ function may be in the final binary. The compiler generates all
2755
2756
supported versions and the runtime makes the selection at load time.
2756
2757
2757
2758
The following attributes trigger the multi version code generation:
2758
- `__attribute__((target_version("name ")))` and
2759
- `__attribute__((target_clones("name ",...)))`.
2759
+ `__attribute__((target_version("<target version string> ")))` and
2760
+ `__attribute__((target_clones("<target version string> ",...)))`.
2760
2761
2761
2762
* Functions are allowed to have the same name and signature when
2762
2763
annotated with these attributes.
@@ -2765,7 +2766,6 @@ The following attributes trigger the multi version code generation:
2765
2766
section.
2766
2767
* The `default` version means the version of the function that would
2767
2768
be generated without these attributes.
2768
- * The dependent features could be joined by the `+` sign.
2769
2769
* None of these attributes enable the corresponding ACLE feature(s)
2770
2770
associated to the `name` expressed in the attribute.
2771
2771
* These attributes have no effect on the calling convention.
@@ -2789,7 +2789,7 @@ The following attributes trigger the multi version code generation:
2789
2789
* or, as a function annotated with `target_clones(...)` where one
2790
2790
of the versions is `default`.
2791
2791
2792
- The attribute `__attribute__((target_version("name ")))` expresses the
2792
+ The attribute `__attribute__((target_version("<target version string> ")))` expresses the
2793
2793
following:
2794
2794
2795
2795
* When applied to a function it becomes one of the versions.
@@ -2816,7 +2816,7 @@ int f (int c = 1);
2816
2816
int __attribute__((target_version("default"))) f (int c = 2);
2817
2817
```
2818
2818
2819
- The attribute `__attribute__((target_clones("name ",...)))` expresses the
2819
+ The attribute `__attribute__((target_clones("<target version string> ",...)))` expresses the
2820
2820
following:
2821
2821
2822
2822
* when applied to a function the compiler emits multiple versions
@@ -2841,6 +2841,32 @@ For example, it can be implemented as:
2841
2841
#define __FUNCTION_MULTI_VERSIONING_SUPPORT_LEVEL __ARM_ACLE_VERSION(2024, 3, 0)
2842
2842
```
2843
2843
2844
+ ### Target version strings
2845
+
2846
+ A target version string is of the following form:
2847
+
2848
+ ```
2849
+ <target version string> := 'default'
2850
+ | <version string>
2851
+ <version string> := <priority string> ';' <arch strings>
2852
+ | <arch strings>
2853
+ <priority string> := 'priority=[1-31]'
2854
+ <arch strings> := <arch strings> '+' arch extension
2855
+ | arch extension
2856
+ ```
2857
+
2858
+ where `arch extension` is any Names value from the Mapping table below.
2859
+
2860
+ Valid string examples are given below
2861
+
2862
+ ```
2863
+ default
2864
+ dotprod
2865
+ dotprod+flagm
2866
+ priority=5;sve
2867
+ priority=23;sve2+sme2
2868
+ ```
2869
+
2844
2870
### Name mangling
2845
2871
2846
2872
The `"default"` version is mangled with `".default"` on top of the
@@ -2857,6 +2883,8 @@ the [[cxxabi]](#cxxabi), and it is defined as follows:
2857
2883
<vendor specific suffix> := `_` followed by token obtained from the tables below and prefixed with `M`
2858
2884
```
2859
2885
2886
+ Note, priority values do not affect mangling.
2887
+
2860
2888
If multiple features are requested then those shall be appended in lexicographic
2861
2889
order and prefixed with `M`. The mangled name shall contain a unique set of
2862
2890
features (duplication of features is not allowed).
@@ -2990,11 +3018,19 @@ the selection algorithm is platform dependent, where with platform means
2990
3018
CPU/Vendor/OS as in the target triplet.
2991
3019
2. The selection is permanent for the
2992
3020
lifetime of the process.
2993
- 3. Among any two versions, the higher priority version is determined by
2994
- identifying the highest priority feature that is specified in exactly one of
2995
- the versions, and selecting that version.
2996
- 4. The selection algorithm must select the highest priority versions whose
2997
- dependent features are all available.
3021
+ 3. The selection algorithm must select the the highest precedence
3022
+ version whose dependent features are all available.
3023
+
3024
+ The precedence for two target version strings is determined by:
3025
+
3026
+ 1. If both target version strings specify a `priority`, with different values,
3027
+ then the version with the higher `priority` has precedence.
3028
+ 2. If only one target version strings specify a `priority`, this version has
3029
+ precedence.
3030
+ 3. Otherwise, if neither target version strings specify a `priority` or specify
3031
+ the same value, then precedence is decided by identifying the highest priority
3032
+ feature that is specified in exactly one of the versions, and selecting that
3033
+ version.
2998
3034
2999
3035
## Weak linkage
3000
3036
0 commit comments