[llvm] [AArch64][SME2] Preserve ZT0 state around function calls (PR #76968)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 8 06:21:12 PST 2024


================
@@ -60,6 +67,12 @@ SMEAttrs::SMEAttrs(const AttributeList &Attrs) {
     Bitmask |= ZA_New;
   if (Attrs.hasFnAttr("aarch64_pstate_za_preserved"))
     Bitmask |= ZA_Preserved;
+  if (Attrs.hasFnAttr("aarch64_sme_pstate_zt0_shared"))
+    Bitmask |= ZT_Shared;
+  if (Attrs.hasFnAttr("aarch64_sme_pstate_zt0_new"))
+    Bitmask |= ZT_New;
+  if (Attrs.hasFnAttr("aarch64_sme_pstate_zt0_preserved"))
+    Bitmask |= ZT_Preserved;
----------------
sdesmalen-arm wrote:

```suggestion
  if (Attrs.hasFnAttr("aarch64_sme_zt0_in"))
    Bitmask |= ZT0_In;
  if (Attrs.hasFnAttr("aarch64_sme_zt0_out"))
    Bitmask |= ZT0_Out;
  if (Attrs.hasFnAttr("aarch64_sme_zt0_inout"))
    Bitmask |= ZT0_InOut;
  if (Attrs.hasFnAttr("aarch64_sme_zt0_preserved"))
    Bitmask |= ZT0_Preserved;
  if (Attrs.hasFnAttr("aarch64_sme_zt0_new"))
    Bitmask |= ZT_New;
```

Two things:
* Remove `pstate_` from the attribute names, since there is no architectural state named `PSTATE.ZT0`. There is only `PSTATE.ZA`, which includes access to `ZA` and `ZT0`.
* I'd like to suggest making the LLVM ZT0 attributes already in line with the new Clang attributes (note that the ZT0 attributes are all mutually exclusive)

https://github.com/llvm/llvm-project/pull/76968


More information about the llvm-commits mailing list