-
Notifications
You must be signed in to change notification settings - Fork 65
Minor modification to FMV rules for scope and signatures #363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -433,6 +433,8 @@ Armv8.4-A [[ARMARMv84]](#ARMARMv84). Support is added for the Dot Product intrin | |
| than the [NEON-SVE bridge](#neon-sve-bridge) intrinsics. | ||
| * Removed extraneous `const` from SVE2.1 store intrinsics. | ||
| * Added [`__arm_agnostic`](#arm_agnostic) keyword attribute. | ||
| * Refined function versioning scope and signature rules to use the default | ||
| version scope and signature. | ||
|
|
||
| ### References | ||
|
|
||
|
|
@@ -2675,10 +2677,12 @@ The following attributes trigger the multi version code generation: | |
| `__attribute__((target_version("name")))` and | ||
| `__attribute__((target_clones("name",...)))`. | ||
|
|
||
| * Functions are allowed to have the same name and signature when | ||
| annotated with these attributes. | ||
| * These attributes can be mixed with each other. | ||
| * `name` is the dependent features from the tables below. | ||
| * 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. | ||
| * The dependent features could be joined by the `+` sign. | ||
| * None of these attributes will enable the corresponding ACLE feature(s) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. attributes enable |
||
| associated to the `name` expressed in the attribute. | ||
|
|
@@ -2687,21 +2691,46 @@ The following attributes trigger the multi version code generation: | |
| * If only the `default` version exist it should be linked directly. | ||
| * FMV may be disabled in compile time by a compiler flag. In this | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FMV might |
||
| case the `default` version shall be used. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. case, the |
||
| * All function versions must be declared at the same scope level. | ||
| * The default version signature is the signature for calling | ||
| the multiversioned functions. Therefore, a versioned function | ||
| cannot be called unless the declaration of the default version | ||
| is visible in the scope of the call site. | ||
| * Non-default versions shall have a type that is convertible to the | ||
| type of the default version. | ||
| * All the function versions must be declared at the translation | ||
| unit in which the definition of the default version resides. | ||
|
|
||
| The attribute `__attribute__((target_version("name")))` expresses the | ||
| 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 | ||
| or in different translation units. | ||
| * When applied to a function it becomes one of the versions. | ||
| * Multiple function versions may exist in the same or 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 and calling convention. | ||
labrinea marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| * All the function versions must be declared at the translation | ||
| unit in which the definition of the default version resides. | ||
|
|
||
| For example, the below is valid and 2 is used as the default | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The following example is valid |
||
| value for `c` when calling the multiversioned function `f`. | ||
|
|
||
| ```cpp | ||
| int __attribute__((target_version("simd"))) f (int c = 1); | ||
| int __attribute__((target_version("default"))) f (int c = 2); | ||
| int __attribute__((target_version("sve"))) f (int c = 3); | ||
|
|
||
| int g() { return f(); } | ||
| ``` | ||
AlfieRichardsArm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| Additionally, the below is not valid as the two statements declare | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Additionally, the following example is not valid because |
||
| the same entity (the `default` version of `f`) with conflicting | ||
| signatures. | ||
|
|
||
| ```cpp | ||
| int f (int c = 1); | ||
| int __attribute__((target_version("default"))) f (int c = 2); | ||
| ``` | ||
|
|
||
| The attribute `__attribute__((target_clones("name",...)))` expresses the | ||
| following: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use below or above, because they can be ambiguous. Best to cross-reference to the section containing the tables (Mapping?)