Skip to content

Commit

Permalink
[AArch64][v8.5A] Add MTE as an optional AArch64 extension
Browse files Browse the repository at this point in the history
This adds the memory tagging extension, which is an optional extension
introduced in v8.5A. The new instructions and registers will be added by
subsequent patches.

Patch by Pablo Barrio!

Differential revision: https://reviews.llvm.org/D52486

llvm-svn: 343563
  • Loading branch information
ostannard committed Oct 2, 2018
1 parent ad23f27 commit 85de540
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions llvm/include/llvm/Support/AArch64TargetParser.def
Expand Up @@ -71,6 +71,7 @@ AARCH64_ARCH_EXT_NAME("ras", AArch64::AEK_RAS, "+ras", "-ras")
AARCH64_ARCH_EXT_NAME("sve", AArch64::AEK_SVE, "+sve", "-sve")
AARCH64_ARCH_EXT_NAME("rcpc", AArch64::AEK_RCPC, "+rcpc", "-rcpc")
AARCH64_ARCH_EXT_NAME("rng", AArch64::AEK_RAND, "+rand", "-rand")
AARCH64_ARCH_EXT_NAME("memtag", AArch64::AEK_MTE, "+mte", "-mte")
#undef AARCH64_ARCH_EXT_NAME

#ifndef AARCH64_CPU_NAME
Expand Down
1 change: 1 addition & 0 deletions llvm/include/llvm/Support/TargetParser.h
Expand Up @@ -181,6 +181,7 @@ enum ArchExtKind : unsigned {
AEK_AES = 1 << 16,
AEK_FP16FML = 1 << 17,
AEK_RAND = 1 << 18,
AEK_MTE = 1 << 19,
};

StringRef getCanonicalArchName(StringRef Arch);
Expand Down
3 changes: 3 additions & 0 deletions llvm/lib/Target/AArch64/AArch64.td
Expand Up @@ -233,6 +233,9 @@ def FeatureBranchTargetId : SubtargetFeature<"bti", "HasBTI",
def FeatureRandGen : SubtargetFeature<"rand", "HasRandGen",
"true", "Enable Random Number generation instructions" >;

def FeatureMTE : SubtargetFeature<"mte", "HasMTE",
"true", "Enable Memory Tagging Extension" >;

//===----------------------------------------------------------------------===//
// Architectures.
//
Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/Target/AArch64/AArch64Subtarget.h
Expand Up @@ -103,6 +103,7 @@ class AArch64Subtarget final : public AArch64GenSubtargetInfo {
bool HasCCDP = false;
bool HasBTI = false;
bool HasRandGen = false;
bool HasMTE = false;

// HasZeroCycleRegMove - Has zero-cycle register mov instructions.
bool HasZeroCycleRegMove = false;
Expand Down Expand Up @@ -328,6 +329,7 @@ class AArch64Subtarget final : public AArch64GenSubtargetInfo {
bool hasCCDP() { return HasCCDP; }
bool hasBTI() { return HasBTI; }
bool hasRandGen() { return HasRandGen; }
bool hasMTE() { return HasMTE; }

bool isLittleEndian() const { return IsLittle; }

Expand Down
3 changes: 2 additions & 1 deletion llvm/unittests/Support/TargetParserTest.cpp
Expand Up @@ -966,7 +966,8 @@ TEST(TargetParserTest, AArch64ArchExtFeature) {
{"sve", "nosve", "+sve", "-sve"},
{"dotprod", "nodotprod", "+dotprod", "-dotprod"},
{"rcpc", "norcpc", "+rcpc", "-rcpc" },
{"rng", "norng", "+rand", "-rand"}};
{"rng", "norng", "+rand", "-rand"},
{"memtag", "nomemtag", "+mte", "-mte"}};

for (unsigned i = 0; i < array_lengthof(ArchExt); i++) {
EXPECT_EQ(StringRef(ArchExt[i][2]),
Expand Down

0 comments on commit 85de540

Please sign in to comment.