@@ -430,6 +430,8 @@ Armv8.4-A [[ARMARMv84]](#ARMARMv84). Support is added for the Dot Product intrin
430
430
* Changed `__ARM_NEON_SVE_BRIDGE` to refer to the availability of the
431
431
[`arm_neon_sve_bridge.h`](#arm_neon_sve_bridge.h) header file, rather
432
432
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.
433
435
434
436
### References
435
437
@@ -2685,6 +2687,9 @@ The following attributes trigger the multi version code generation:
2685
2687
* If only the `default` version exist it should be linked directly.
2686
2688
* FMV may be disabled in compile time by a compiler flag. In this
2687
2689
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.
2688
2693
2689
2694
[^fmv-note-names]: For example the `sve_bf16` feature depends on `sve`
2690
2695
but it is enough to say `target_version("sve_bf16")` in the code.
@@ -2699,11 +2704,26 @@ following:
2699
2704
in one of the translation units.
2700
2705
* Implicitly, without this attribute,
2701
2706
* 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
+
2704
2713
* All the function versions must be declared at the translation
2705
2714
unit in which the definition of the default version resides.
2706
2715
2716
+ For example, the below is valid and 2 is passed as the
2717
+ value for `c` when calling `f`.
2718
+
2719
+ ```C
2720
+ int __attribute__((target_version("simd"))) f (int c = 1);
2721
+ int __attribute__((target_version("default"))) f (int c = 2);
2722
+ int __attribute__((target_version("sve"))) f (int c = 3);
2723
+
2724
+ int g() { return f(); }
2725
+ ```
2726
+
2707
2727
The attribute `__attribute__((target_clones("name",...)))` expresses the
2708
2728
following:
2709
2729
0 commit comments