Skip to content

Commit

Permalink
Respond to review feedback
Browse files Browse the repository at this point in the history
- Add __arm_preserves_za to the changelog entry.

- Fix the names of the __ARM_STATE macros (pointed out by
  Sander privately).

- Add an example that involves saving and restoring ZT0.

- Remove “as described below”.
  • Loading branch information
rsandifo-arm committed Jan 31, 2024
1 parent dfe9a72 commit ba68f64
Showing 1 changed file with 27 additions and 6 deletions.
33 changes: 27 additions & 6 deletions main/acle.md
Original file line number Diff line number Diff line change
Expand Up @@ -4633,10 +4633,10 @@ this way. The strings are listed in the table below.

<span id="state-strings"></span>

| **String** | **State** | **State macro** | **Feature macro** |
| ---------- | ------------------ | ------------------ | -------------------- |
| `"za"` | SME's ZA storage | `__ARM_STATE_SME` | `__ARM_FEATURE_SME` |
| `"zt0"` | SME2's ZT0 | `__ARM_STATE_SME2` | `__ARM_FEATURE_SME2` |
| **String** | **State** | **State macro** | **Feature macro** |
| ---------- | ------------------ | ----------------- | -------------------- |
| `"za"` | SME's ZA storage | `__ARM_STATE_ZA` | `__ARM_FEATURE_SME` |
| `"zt0"` | SME2's ZT0 | `__ARM_STATE_ZT0` | `__ARM_FEATURE_SME2` |

For each string, there are two associated macros:

Expand All @@ -4649,7 +4649,7 @@ For each string, there are two associated macros:
A compiler that predefines the feature macro must also predefine the
state macro.

For example, `__ARM_STATE_SME` allows declarations of functions that share ZA.
For example, `__ARM_STATE_ZA` allows declarations of functions that share ZA.
`__ARM_FEATURE_SME` allows function definitions to use ZA internally.

The strings are case-sensitive. For example, `"za"` cannot be written `"ZA"`.
Expand Down Expand Up @@ -4861,7 +4861,7 @@ state](#uses-state) S, the two possibilities are:

If an asm takes this option for state that is controlled by PSTATE.ZA,
the asm itself is responsible for handling the [[AAPCS64]](#AAPCS64)
lazy save scheme, as described below.
lazy save scheme.

[[AAPCS64]](#AAPCS64) defines three possible states for ZA:
“off”, “dormant” or “active”. These states describe the values
Expand Down Expand Up @@ -4979,6 +4979,27 @@ internally. The comments describe when ZA should be saved and restored:
}
```

ZT0 cannot be lazily saved, so if ZT0 is live before a call to a
function that does not share ZT0, the compiler must save and restore
ZT0 around the call. For example:

``` c
void setup_zt0() __arm_out("zt0");
void use_zt0() __arm_in("zt0");
void f_private();

__arm_new("zt0") void test() {
f_private(); // ZT0 is not live, no save necessary

setup_zt0(); // ZT0 is live after this call
f_private(); // The compiler should save and restore ZT0
// around the call ("caller-save")
use_zt0(); // ZT0 is no longer live after this call

f_private(); // ZT0 is not live, no save necessary
}
```

# System register access

## Special register intrinsics
Expand Down

0 comments on commit ba68f64

Please sign in to comment.