diff options
author | Lucas Duarte Prates <lucas.prates@arm.com> | 2023-11-16 15:38:32 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-16 15:38:32 +0000 |
commit | 59b2301508ecd97175f4093039bbf887f6d5b484 (patch) | |
tree | 3b7f9dfacadbdfd4baaaeb54ee65f71e581d3a2a /clang | |
parent | f432a004c55b9996d48b70f88d8af96b56ccdf20 (diff) | |
download | llvm-59b2301508ecd97175f4093039bbf887f6d5b484.zip llvm-59b2301508ecd97175f4093039bbf887f6d5b484.tar.gz llvm-59b2301508ecd97175f4093039bbf887f6d5b484.tar.bz2 |
[AArch64] Introduce the Armv9.5-A architecture version (#72392)
This introduces the Armv9.5-A architecture version, including the
relevant command-line option for -march.
Mode details about the Armv9.5-A architecture version can be found at:
*
https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/arm-a-profile-architecture-developments-2023
* https://developer.arm.com/documentation/ddi0602/2023-09/
Patch by Oliver Stannard.
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/Basic/Targets/AArch64.cpp | 11 | ||||
-rw-r--r-- | clang/lib/Basic/Targets/AArch64.h | 2 | ||||
-rw-r--r-- | clang/lib/Driver/ToolChains/Arch/AArch64.cpp | 1 | ||||
-rw-r--r-- | clang/test/Driver/aarch64-v95a.c | 15 | ||||
-rw-r--r-- | clang/test/Preprocessor/aarch64-target-features.c | 2 |
5 files changed, 31 insertions, 0 deletions
diff --git a/clang/lib/Basic/Targets/AArch64.cpp b/clang/lib/Basic/Targets/AArch64.cpp index c71af71..fde2201 100644 --- a/clang/lib/Basic/Targets/AArch64.cpp +++ b/clang/lib/Basic/Targets/AArch64.cpp @@ -333,6 +333,12 @@ void AArch64TargetInfo::getTargetDefinesARMV94A(const LangOptions &Opts, getTargetDefinesARMV89A(Opts, Builder); } +void AArch64TargetInfo::getTargetDefinesARMV95A(const LangOptions &Opts, + MacroBuilder &Builder) const { + // Armv9.5-A does not have a v8.* equivalent, but is a superset of v9.4-A. + getTargetDefinesARMV94A(Opts, Builder); +} + void AArch64TargetInfo::getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const { // Target identification. @@ -565,6 +571,8 @@ void AArch64TargetInfo::getTargetDefines(const LangOptions &Opts, getTargetDefinesARMV93A(Opts, Builder); else if (*ArchInfo == llvm::AArch64::ARMV9_4A) getTargetDefinesARMV94A(Opts, Builder); + else if (*ArchInfo == llvm::AArch64::ARMV9_5A) + getTargetDefinesARMV95A(Opts, Builder); // All of the __sync_(bool|val)_compare_and_swap_(1|2|4|8) builtins work. Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1"); @@ -899,6 +907,9 @@ bool AArch64TargetInfo::handleTargetFeatures(std::vector<std::string> &Features, if (Feature == "+v9.4a" && ArchInfo->Version < llvm::AArch64::ARMV9_4A.Version) ArchInfo = &llvm::AArch64::ARMV9_4A; + if (Feature == "+v9.5a" && + ArchInfo->Version < llvm::AArch64::ARMV9_5A.Version) + ArchInfo = &llvm::AArch64::ARMV9_5A; if (Feature == "+v8r") ArchInfo = &llvm::AArch64::ARMV8R; if (Feature == "+fullfp16") { diff --git a/clang/lib/Basic/Targets/AArch64.h b/clang/lib/Basic/Targets/AArch64.h index 4304693..9ccc637 100644 --- a/clang/lib/Basic/Targets/AArch64.h +++ b/clang/lib/Basic/Targets/AArch64.h @@ -143,6 +143,8 @@ public: MacroBuilder &Builder) const; void getTargetDefinesARMV94A(const LangOptions &Opts, MacroBuilder &Builder) const; + void getTargetDefinesARMV95A(const LangOptions &Opts, + MacroBuilder &Builder) const; void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override; diff --git a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp index 276984f..1f77c98 100644 --- a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp +++ b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp @@ -411,6 +411,7 @@ void aarch64::getAArch64TargetFeatures(const Driver &D, else if (*I == "+v9.2a") V9Version = 2; else if (*I == "+v9.3a") V9Version = 3; else if (*I == "+v9.4a") V9Version = 4; + else if (*I == "+v9.5a") V9Version = 5; else if (*I == "+sm4") HasSM4 = true; else if (*I == "+sha3") HasSHA3 = true; else if (*I == "+sha2") HasSHA2 = true; diff --git a/clang/test/Driver/aarch64-v95a.c b/clang/test/Driver/aarch64-v95a.c new file mode 100644 index 0000000..6044a4f --- /dev/null +++ b/clang/test/Driver/aarch64-v95a.c @@ -0,0 +1,15 @@ +// RUN: %clang -target aarch64 -march=armv9.5a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV95A %s +// RUN: %clang -target aarch64 -march=armv9.5-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV95A %s +// RUN: %clang -target aarch64 -mlittle-endian -march=armv9.5a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV95A %s +// RUN: %clang -target aarch64 -mlittle-endian -march=armv9.5-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV95A %s +// RUN: %clang -target aarch64_be -mlittle-endian -march=armv9.5a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV95A %s +// RUN: %clang -target aarch64_be -mlittle-endian -march=armv9.5-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV95A %s +// GENERICV95A: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v9.5a" +// RUN: %clang -target aarch64_be -march=armv9.5a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV95A-BE %s +// RUN: %clang -target aarch64_be -march=armv9.5-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV95A-BE %s +// RUN: %clang -target aarch64 -mbig-endian -march=armv9.5a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV95A-BE %s +// RUN: %clang -target aarch64 -mbig-endian -march=armv9.5-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV95A-BE %s +// RUN: %clang -target aarch64_be -mbig-endian -march=armv9.5a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV95A-BE %s +// RUN: %clang -target aarch64_be -mbig-endian -march=armv9.5-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV95A-BE %s +// GENERICV95A-BE: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v9.5a" + diff --git a/clang/test/Preprocessor/aarch64-target-features.c b/clang/test/Preprocessor/aarch64-target-features.c index 55bf3c7..db89aa7 100644 --- a/clang/test/Preprocessor/aarch64-target-features.c +++ b/clang/test/Preprocessor/aarch64-target-features.c @@ -207,6 +207,7 @@ // RUN: %clang -target aarch64-none-linux-gnu -march=armv9.2-a -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-SVE2 %s // RUN: %clang -target aarch64-none-linux-gnu -march=armv9.3-a -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-SVE2 %s // RUN: %clang -target aarch64-none-linux-gnu -march=armv9.4-a -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-SVE2 %s +// RUN: %clang -target aarch64-none-linux-gnu -march=armv9.5-a -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-SVE2 %s // RUN: %clang -target aarch64-none-linux-gnu -march=armv9-a+sve2 -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-SVE2 %s // CHECK-SVE2: __ARM_FEATURE_FP16_SCALAR_ARITHMETIC 1 // CHECK-SVE2: __ARM_FEATURE_FP16_VECTOR_ARITHMETIC 1 @@ -599,6 +600,7 @@ // RUN: %clang -target aarch64-none-elf -march=armv9.1-a -x c -E -dM %s -o - | FileCheck --check-prefixes=CHECK-V81-OR-LATER,CHECK-V83-OR-LATER,CHECK-V85-OR-LATER %s // RUN: %clang -target aarch64-none-elf -march=armv9.2-a -x c -E -dM %s -o - | FileCheck --check-prefixes=CHECK-V81-OR-LATER,CHECK-V83-OR-LATER,CHECK-V85-OR-LATER %s // RUN: %clang -target aarch64-none-elf -march=armv9.3-a -x c -E -dM %s -o - | FileCheck --check-prefixes=CHECK-V81-OR-LATER,CHECK-V83-OR-LATER,CHECK-V85-OR-LATER %s +// RUN: %clang -target aarch64-none-elf -march=armv9.5-a -x c -E -dM %s -o - | FileCheck --check-prefixes=CHECK-V81-OR-LATER,CHECK-V83-OR-LATER,CHECK-V85-OR-LATER %s // CHECK-V81-OR-LATER: __ARM_FEATURE_ATOMICS 1 // CHECK-V85-OR-LATER: __ARM_FEATURE_BTI 1 // CHECK-V83-OR-LATER: __ARM_FEATURE_COMPLEX 1 |