@@ -430,6 +430,8 @@ Armv8.4-A [[ARMARMv84]](#ARMARMv84). Support is added for the Dot Product intrin
430430* Changed `__ARM_NEON_SVE_BRIDGE` to refer to the availability of the
431431 [`arm_neon_sve_bridge.h`](#arm_neon_sve_bridge.h) header file, rather
432432 than the [NEON-SVE bridge](#neon-sve-bridge) intrinsics.
433+ * Refined function versioning scope and signature rules to use the default
434+ version scope and signature.
433435
434436### References
435437
@@ -2685,6 +2687,9 @@ The following attributes trigger the multi version code generation:
26852687* If only the `default` version exist it should be linked directly.
26862688* FMV may be disabled in compile time by a compiler flag. In this
26872689 case the `default` version shall be used.
2690+ * The scope for calling the versioned function is the scope of the
2691+ default version.
2692+ * All function versions must be declared at the same scope level.
26882693
26892694[^fmv-note-names]: For example the `sve_bf16` feature depends on `sve`
26902695 but it is enough to say `target_version("sve_bf16")` in the code.
@@ -2699,11 +2704,26 @@ following:
26992704 in one of the translation units.
27002705 * Implicitly, without this attribute,
27012706 * or explicitly providing the `default` in the attribute.
2702- * All instances of the versions shall share the same function
2703- signature and calling convention.
2707+ * The default version signature is the signature for calling
2708+ the multiversioned functions.
2709+ * Non-default versions shall share the same calling convention
2710+ of the default version and have a type that is convertible to the type
2711+ of the default version.
2712+
27042713* All the function versions must be declared at the translation
27052714 unit in which the definition of the default version resides.
27062715
2716+ For example, the below is valid and 2 is passed as the
2717+ value for `c` when calling `fn`.
2718+
2719+ ```C
2720+ int __attribute__((target_version("simd"))) fn (int c = 1);
2721+ int __attribute__((target_version("default"))) fn (int c = 2);
2722+ int __attribute__((target_version("sve"))) fn (int c = 3);
2723+
2724+ int baz() { return fn(); }
2725+ ```
2726+
27072727The attribute `__attribute__((target_clones("name",...)))` expresses the
27082728following:
27092729
0 commit comments