diff options
author | Sander de Smalen <sander.desmalen@arm.com> | 2024-01-15 09:41:32 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-15 09:41:32 +0000 |
commit | 8e7f073eb42c92aa7a2b651ca314d7fcebf296e3 (patch) | |
tree | 1b6b5ddd8c7c88a0228b65dcdb4f0ffec8639e1f /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 06e3abcb54f339edc2ba757cfa947e024677b21e (diff) | |
download | llvm-8e7f073eb42c92aa7a2b651ca314d7fcebf296e3.zip llvm-8e7f073eb42c92aa7a2b651ca314d7fcebf296e3.tar.gz llvm-8e7f073eb42c92aa7a2b651ca314d7fcebf296e3.tar.bz2 |
[Clang][AArch64] Change SME attributes for shared/new/preserved state. (#76971)
This patch replaces the `__arm_new_za`, `__arm_shared_za` and
`__arm_preserves_za` attributes in favour of:
* `__arm_new("za")`
* `__arm_in("za")`
* `__arm_out("za")`
* `__arm_inout("za")`
* `__arm_preserves("za")`
As described in https://github.com/ARM-software/acle/pull/276.
One change is that `__arm_in/out/inout/preserves(S)` are all mutually
exclusive, whereas previously it was fine to write `__arm_shared_za
__arm_preserves_za`. This case is now represented with `__arm_in("za")`.
The current implementation uses the same LLVM attributes under the hood,
since `__arm_in/out/inout` are all variations of "shared ZA", so can use
the existing `aarch64_pstate_za_shared` attribute in LLVM.
#77941 will add support for the new "zt0" state as introduced
with SME2.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 0cfe7a0..01b042c 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -2380,8 +2380,10 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D, if (D->hasAttr<ArmLocallyStreamingAttr>()) B.addAttribute("aarch64_pstate_sm_body"); - if (D->hasAttr<ArmNewZAAttr>()) - B.addAttribute("aarch64_pstate_za_new"); + if (auto *Attr = D->getAttr<ArmNewAttr>()) { + if (Attr->isNewZA()) + B.addAttribute("aarch64_pstate_za_new"); + } // Track whether we need to add the optnone LLVM attribute, // starting with the default for this optimization level. |