Index: include/llvm/Support/AArch64TargetParser.def =================================================================== --- include/llvm/Support/AArch64TargetParser.def +++ include/llvm/Support/AArch64TargetParser.def @@ -71,6 +71,7 @@ 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 Index: include/llvm/Support/TargetParser.h =================================================================== --- include/llvm/Support/TargetParser.h +++ include/llvm/Support/TargetParser.h @@ -181,6 +181,7 @@ AEK_AES = 1 << 16, AEK_FP16FML = 1 << 17, AEK_RAND = 1 << 18, + AEK_MTE = 1 << 19, }; StringRef getCanonicalArchName(StringRef Arch); Index: lib/Target/AArch64/AArch64.td =================================================================== --- lib/Target/AArch64/AArch64.td +++ lib/Target/AArch64/AArch64.td @@ -229,6 +229,9 @@ def FeatureRandGen : SubtargetFeature<"rand", "HasRandGen", "true", "Enable Random Number generation instructions" >; +def FeatureMTE : SubtargetFeature<"mte", "HasMTE", + "true", "Enable Memory Tagging Extension" >; + //===----------------------------------------------------------------------===// // Architectures. // Index: lib/Target/AArch64/AArch64Subtarget.h =================================================================== --- lib/Target/AArch64/AArch64Subtarget.h +++ lib/Target/AArch64/AArch64Subtarget.h @@ -103,6 +103,7 @@ bool HasCCDP = false; bool HasBTI = false; bool HasRandGen = false; + bool HasMTE = false; // HasZeroCycleRegMove - Has zero-cycle register mov instructions. bool HasZeroCycleRegMove = false; @@ -324,6 +325,7 @@ bool hasCCDP() { return HasCCDP; } bool hasBTI() { return HasBTI; } bool hasRandGen() { return HasRandGen; } + bool hasMTE() { return HasMTE; } bool isLittleEndian() const { return IsLittle; } Index: unittests/Support/TargetParserTest.cpp =================================================================== --- unittests/Support/TargetParserTest.cpp +++ unittests/Support/TargetParserTest.cpp @@ -968,7 +968,8 @@ {"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]),