diff --git a/main/acle.md b/main/acle.md index 34b1283d..08a5c1c8 100644 --- a/main/acle.md +++ b/main/acle.md @@ -400,6 +400,7 @@ Armv8.4-A [[ARMARMv84]](#ARMARMv84). Support is added for the Dot Product intrin * Added a requirement for function version declaration in Function Multi Versioning. * Fixed some rendering issues in the online Markdown documentation and fixed a misplaced anchor. +* Added [`__arm_agnostic`](#arm_agnostic) keyword attribute ### References @@ -826,6 +827,7 @@ predefine the associated macro to a nonzero value. | **Name** | **Target** | **Predefined macro** | | ----------------------------------------------------------- | --------------------- | --------------------------------- | +| [`__arm_agnostic`](#arm_agnostic) | function type | `__ARM_FEATURE_SME` | | [`__arm_locally_streaming`](#arm_locally_streaming) | function declaration | `__ARM_FEATURE_LOCALLY_STREAMING` | | [`__arm_in`](#ways-of-sharing-state) | function type | Argument-dependent | | [`__arm_inout`](#ways-of-sharing-state) | function type | Argument-dependent | @@ -4836,6 +4838,30 @@ if such a restoration is necessary. For example: } ``` +## `__arm_agnostic` + +A function with the `__arm_agnostic` [keyword attribute](#keyword-attributes) +must preserve the architectural state that is specified by its arguments when +such state exists at runtime. The function is otherwise unconcerned with this +state. + +The `__arm_agnostic` [keyword attribute](#keyword-attributes) applies to +**function types** and accepts the following arguments: + +```"sme_za_state"``` + +* This attribute affects the ABI of a function, which must implement an + [agnostic-ZA interface](#agnostic-za). It is the compiler's responsibility + to ensure that the function's object code honors the ABI requirements. + +* The use of `__arm_agnostic("sme_za_state")` allows writing functions that + are compatible with ZA state without having to share ZA state with the + caller, as required by `__arm_preserves`. + +* It is not valid for a function declaration with + `__arm_agnostic("sme_za_state")` to [share](#shares-state) PSTATE.ZA state + with its caller. + ## Mapping to the Procedure Call Standard [[AAPCS64]](#AAPCS64) classifies functions as having one of the following @@ -4847,6 +4873,10 @@ interfaces: * a “shared-ZA” interface + + +* a "agnostic-ZA" interface + If a C or C++ function F forms part of the object code's ABI, that object code function has a shared-ZA interface if and only if at least one of the following is true: @@ -4855,7 +4885,17 @@ one of the following is true: * F shares ZT0 with its caller -All other functions have a private-ZA interface. +All other functions have either a private-ZA or an agnostic-ZA interface. + +If F implements an agnostic-ZA interface and PSTATE.ZA is available at runtime, +then a call to F must return with its ZA state unchanged in accordance +to the [[AAPCS64]](#AAPCS64). In practice this means that calls to F don't have +to emit code to set up a lazy-save for ZA or to preserve other state like ZT0 +when such state is live at the call site. + +The implementation of F must not make any assumptions on the availability of +PSTATE.ZA or any architectural state associated with it. + ## Function definitions