[clang] c84b8be - [AArch64] clang support for Armv8.8/9.3 MOPS
via cfe-commits
cfe-commits at lists.llvm.org
Sat Jan 15 12:15:36 PST 2022
Author: Lucas Prates
Date: 2022-01-15T19:52:30Z
New Revision: c84b8be516bcc4d021ff804169d58a7b3104e050
URL: https://github.com/llvm/llvm-project/commit/c84b8be516bcc4d021ff804169d58a7b3104e050
DIFF: https://github.com/llvm/llvm-project/commit/c84b8be516bcc4d021ff804169d58a7b3104e050.diff
LOG: [AArch64] clang support for Armv8.8/9.3 MOPS
This introduces clang command line support for the new Armv8.8-A and
Armv9.3-A instructions for standardising memcpy, memset and memmove
operations, which was previously introduced into LLVM in
https://reviews.llvm.org/D116157.
Patch by Lucas Prates, Tomas Matheson and Son Tuan Vu.
Differential Revision: https://reviews.llvm.org/D117271
Added:
clang/test/Driver/aarch64-mops.c
Modified:
clang/lib/Basic/Targets/AArch64.cpp
clang/lib/Basic/Targets/AArch64.h
llvm/include/llvm/Support/AArch64TargetParser.def
llvm/include/llvm/Support/AArch64TargetParser.h
llvm/lib/Support/AArch64TargetParser.cpp
llvm/unittests/Support/TargetParserTest.cpp
Removed:
################################################################################
diff --git a/clang/lib/Basic/Targets/AArch64.cpp b/clang/lib/Basic/Targets/AArch64.cpp
index 4a2d2a8f7f04d..8e23cc4c421a5 100644
--- a/clang/lib/Basic/Targets/AArch64.cpp
+++ b/clang/lib/Basic/Targets/AArch64.cpp
@@ -544,6 +544,7 @@ bool AArch64TargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
HasMatmulFP32 = false;
HasLSE = false;
HasHBC = false;
+ HasMOPS = false;
ArchKind = llvm::AArch64::ArchKind::INVALID;
diff --git a/clang/lib/Basic/Targets/AArch64.h b/clang/lib/Basic/Targets/AArch64.h
index aa1ee7708b0d9..b9e6e3214c44d 100644
--- a/clang/lib/Basic/Targets/AArch64.h
+++ b/clang/lib/Basic/Targets/AArch64.h
@@ -54,6 +54,7 @@ class LLVM_LIBRARY_VISIBILITY AArch64TargetInfo : public TargetInfo {
bool HasLSE;
bool HasFlagM;
bool HasHBC;
+ bool HasMOPS;
llvm::AArch64::ArchKind ArchKind;
diff --git a/clang/test/Driver/aarch64-mops.c b/clang/test/Driver/aarch64-mops.c
new file mode 100644
index 0000000000000..4cd48143033d6
--- /dev/null
+++ b/clang/test/Driver/aarch64-mops.c
@@ -0,0 +1,6 @@
+// Test that target feature mops is implemented and available correctly
+// RUN: %clang -### -target aarch64-none-none-eabi -march=armv8.8-a+mops %s 2>&1 | FileCheck %s
+// CHECK: "-target-feature" "+mops"
+
+// RUN: %clang -### -target aarch64-none-none-eabi -march=armv8.8-a+nomops %s 2>&1 | FileCheck %s --check-prefix=NO_MOPS
+// NO_MOPS: "-target-feature" "-mops"
diff --git a/llvm/include/llvm/Support/AArch64TargetParser.def b/llvm/include/llvm/Support/AArch64TargetParser.def
index 2b2b519a5c1b9..9d92d96e67a2d 100644
--- a/llvm/include/llvm/Support/AArch64TargetParser.def
+++ b/llvm/include/llvm/Support/AArch64TargetParser.def
@@ -145,6 +145,7 @@ AARCH64_ARCH_EXT_NAME("sme", AArch64::AEK_SME, "+sme",
AARCH64_ARCH_EXT_NAME("sme-f64", AArch64::AEK_SMEF64, "+sme-f64", "-sme-f64")
AARCH64_ARCH_EXT_NAME("sme-i64", AArch64::AEK_SMEI64, "+sme-i64", "-sme-i64")
AARCH64_ARCH_EXT_NAME("hbc", AArch64::AEK_HBC, "+hbc", "-hbc")
+AARCH64_ARCH_EXT_NAME("mops", AArch64::AEK_MOPS, "+mops", "-mops")
#undef AARCH64_ARCH_EXT_NAME
#ifndef AARCH64_CPU_NAME
diff --git a/llvm/include/llvm/Support/AArch64TargetParser.h b/llvm/include/llvm/Support/AArch64TargetParser.h
index 21bca23c3041f..b998bb481d8da 100644
--- a/llvm/include/llvm/Support/AArch64TargetParser.h
+++ b/llvm/include/llvm/Support/AArch64TargetParser.h
@@ -70,6 +70,7 @@ enum ArchExtKind : uint64_t {
AEK_SMEF64 = 1ULL << 38,
AEK_SMEI64 = 1ULL << 39,
AEK_HBC = 1ULL << 40,
+ AEK_MOPS = 1ULL << 41,
};
enum class ArchKind {
diff --git a/llvm/lib/Support/AArch64TargetParser.cpp b/llvm/lib/Support/AArch64TargetParser.cpp
index d4957d4359eb5..9f1c17104cf43 100644
--- a/llvm/lib/Support/AArch64TargetParser.cpp
+++ b/llvm/lib/Support/AArch64TargetParser.cpp
@@ -116,6 +116,8 @@ bool AArch64::getExtensionFeatures(uint64_t Extensions,
Features.push_back("+sme-i64");
if (Extensions & AArch64::AEK_HBC)
Features.push_back("+hbc");
+ if (Extensions & AArch64::AEK_MOPS)
+ Features.push_back("+mops");
return true;
}
diff --git a/llvm/unittests/Support/TargetParserTest.cpp b/llvm/unittests/Support/TargetParserTest.cpp
index bbba9f41cc950..9e2a29a1dc0e0 100644
--- a/llvm/unittests/Support/TargetParserTest.cpp
+++ b/llvm/unittests/Support/TargetParserTest.cpp
@@ -1519,6 +1519,7 @@ TEST(TargetParserTest, AArch64ArchExtFeature) {
{"sme-f64", "nosme-f64", "+sme-f64", "-sme-f64"},
{"sme-i64", "nosme-i64", "+sme-i64", "-sme-i64"},
{"hbc", "nohbc", "+hbc", "-hbc"},
+ {"mops", "nomops", "+mops", "-mops"},
};
for (unsigned i = 0; i < array_lengthof(ArchExt); i++) {
More information about the cfe-commits
mailing list