Skip to content

Commit c84b8be

Browse files
pratlucastyb-arm
authored andcommitted
[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
1 parent 0b010ef commit c84b8be

File tree

7 files changed

+13
-0
lines changed

7 files changed

+13
-0
lines changed

clang/lib/Basic/Targets/AArch64.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,7 @@ bool AArch64TargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
544544
HasMatmulFP32 = false;
545545
HasLSE = false;
546546
HasHBC = false;
547+
HasMOPS = false;
547548

548549
ArchKind = llvm::AArch64::ArchKind::INVALID;
549550

clang/lib/Basic/Targets/AArch64.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class LLVM_LIBRARY_VISIBILITY AArch64TargetInfo : public TargetInfo {
5454
bool HasLSE;
5555
bool HasFlagM;
5656
bool HasHBC;
57+
bool HasMOPS;
5758

5859
llvm::AArch64::ArchKind ArchKind;
5960

clang/test/Driver/aarch64-mops.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Test that target feature mops is implemented and available correctly
2+
// RUN: %clang -### -target aarch64-none-none-eabi -march=armv8.8-a+mops %s 2>&1 | FileCheck %s
3+
// CHECK: "-target-feature" "+mops"
4+
5+
// RUN: %clang -### -target aarch64-none-none-eabi -march=armv8.8-a+nomops %s 2>&1 | FileCheck %s --check-prefix=NO_MOPS
6+
// NO_MOPS: "-target-feature" "-mops"

llvm/include/llvm/Support/AArch64TargetParser.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ AARCH64_ARCH_EXT_NAME("sme", AArch64::AEK_SME, "+sme",
145145
AARCH64_ARCH_EXT_NAME("sme-f64", AArch64::AEK_SMEF64, "+sme-f64", "-sme-f64")
146146
AARCH64_ARCH_EXT_NAME("sme-i64", AArch64::AEK_SMEI64, "+sme-i64", "-sme-i64")
147147
AARCH64_ARCH_EXT_NAME("hbc", AArch64::AEK_HBC, "+hbc", "-hbc")
148+
AARCH64_ARCH_EXT_NAME("mops", AArch64::AEK_MOPS, "+mops", "-mops")
148149
#undef AARCH64_ARCH_EXT_NAME
149150

150151
#ifndef AARCH64_CPU_NAME

llvm/include/llvm/Support/AArch64TargetParser.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ enum ArchExtKind : uint64_t {
7070
AEK_SMEF64 = 1ULL << 38,
7171
AEK_SMEI64 = 1ULL << 39,
7272
AEK_HBC = 1ULL << 40,
73+
AEK_MOPS = 1ULL << 41,
7374
};
7475

7576
enum class ArchKind {

llvm/lib/Support/AArch64TargetParser.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ bool AArch64::getExtensionFeatures(uint64_t Extensions,
116116
Features.push_back("+sme-i64");
117117
if (Extensions & AArch64::AEK_HBC)
118118
Features.push_back("+hbc");
119+
if (Extensions & AArch64::AEK_MOPS)
120+
Features.push_back("+mops");
119121

120122
return true;
121123
}

llvm/unittests/Support/TargetParserTest.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1519,6 +1519,7 @@ TEST(TargetParserTest, AArch64ArchExtFeature) {
15191519
{"sme-f64", "nosme-f64", "+sme-f64", "-sme-f64"},
15201520
{"sme-i64", "nosme-i64", "+sme-i64", "-sme-i64"},
15211521
{"hbc", "nohbc", "+hbc", "-hbc"},
1522+
{"mops", "nomops", "+mops", "-mops"},
15221523
};
15231524

15241525
for (unsigned i = 0; i < array_lengthof(ArchExt); i++) {

0 commit comments

Comments
 (0)