[llvm] [AArch64][SME2] Add ZT0 attributes to SMEAttrs (PR #77607)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 15 07:41:26 PST 2024


================
@@ -76,16 +86,35 @@ class SMEAttrs {
 
   // Interfaces to query PSTATE.ZA
   bool hasNewZABody() const { return Bitmask & ZA_New; }
-  bool hasSharedZAInterface() const { return Bitmask & ZA_Shared; }
+  bool sharesZA() const { return Bitmask & ZA_Shared; }
+  bool hasSharedZAInterface() const { return sharesZA() || sharesZT0(); }
   bool hasPrivateZAInterface() const { return !hasSharedZAInterface(); }
   bool preservesZA() const { return Bitmask & ZA_Preserved; }
-  bool hasZAState() const {
-    return hasNewZABody() || hasSharedZAInterface();
-  }
+  bool hasZAState() const { return hasNewZABody() || sharesZA(); }
   bool requiresLazySave(const SMEAttrs &Callee) const {
     return hasZAState() && Callee.hasPrivateZAInterface() &&
            !(Callee.Bitmask & ZA_NoLazySave);
   }
+
+  // Interfaces to query ZT0 State
+  StateValue getZT0State() const {
+    return static_cast<StateValue>((Bitmask & ZT0_Mask) >> ZT0_Shift);
+  }
+  void setZT0State(StateValue S) {
+    Bitmask |= (static_cast<unsigned>(S) << ZT0_Shift);
+  }
+
+  bool hasNewZT0Body() const { return getZT0State() == StateValue::New; }
----------------
sdesmalen-arm wrote:

```suggestion
  bool isNewZT0() const { return getZT0State() == StateValue::New; }
```

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


More information about the llvm-commits mailing list