[AArch64] Assembly Support for FEAT_GCS/FEAT_CHK
authorArchibald Elliott <archibald.elliott@arm.com>
Wed, 15 Mar 2023 10:38:11 +0000 (10:38 +0000)
committerArchibald Elliott <archibald.elliott@arm.com>
Wed, 15 Mar 2023 11:03:53 +0000 (11:03 +0000)
commitcb7fb737858cdfdc90406f9675c8470ea98417ed
tree242973401f272203b17bc893685f889652c0f911
parent536f35ea62c62d9b28444b33d173d5f556945c90
[AArch64] Assembly Support for FEAT_GCS/FEAT_CHK

This implements support for two new 2022 A-profile extensions:
- FEAT_CHK - Check Feature Status Extension
- FEAT_GCS - Guarded Control Stacks

FEAT_CHK is mandatory from armv8.0-a, but is in the hint space so
there's no clang command-line flag for it, and we only print the hint as
`chkfeat x16` at v8.9a and above, to be compatible when using a
non-integrated assembler that might not yet know about the extension.

FEAT_GCS is optional from armv9.4-a onwards. It is enabled using `+gcs`
in a clang `-march=` or `-mcpu=` option string, or using a
`.arch_extension gcs` assembly directive.

This patch includes changes by Ties Stuij, Tomas Matheson, and Keith
Walker.

Differential Revision: https://reviews.llvm.org/D145563
14 files changed:
clang/lib/Basic/Targets/AArch64.cpp
clang/lib/Basic/Targets/AArch64.h
llvm/include/llvm/TargetParser/AArch64TargetParser.h
llvm/lib/Target/AArch64/AArch64.td
llvm/lib/Target/AArch64/AArch64InstrInfo.td
llvm/lib/Target/AArch64/AArch64SystemOperands.td
llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
llvm/test/MC/AArch64/armv9.4a-chk.s [new file with mode: 0644]
llvm/test/MC/AArch64/armv9.4a-gcs.s [new file with mode: 0644]
llvm/test/MC/AArch64/directive-arch_extension-negative.s
llvm/test/MC/AArch64/directive-arch_extension.s
llvm/test/MC/Disassembler/AArch64/armv9.4a-chk.txt [new file with mode: 0644]
llvm/test/MC/Disassembler/AArch64/armv9.4a-gcs.txt [new file with mode: 0644]
llvm/unittests/TargetParser/TargetParserTest.cpp