Skip to content

Commit

Permalink
[Arm][AArch64] Add support for v8.9-A/v9.4-A base extensions
Browse files Browse the repository at this point in the history
This implements the base extensions that are part of the v8.9-A and
v9.4-A architecture versions, including:

* The Clear BHB Instruction (FEAT_CLRBHB)
* The Speculation Restriction Instruction (FEAT_SPECRES2)
* The SLC target for the PRFM instruction
* New system registers:
  * ID_AA64PFR2_EL1
  * ID_AA64MMFR3_EL1
  * HFGITR2_EL2
  * SCTLR2_EL3

More information on the new extensions can be found on:

* https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/arm-a-profile-architecture-2022
* https://developer.arm.com/downloads/-/exploration-tools

Contributors: Sam Elliott, Tomas Matheson and Son Tuan Vu.

Reviewed By: lenary

Differential Revision: https://reviews.llvm.org/D139424
  • Loading branch information
pratlucas committed Dec 8, 2022
1 parent 8a900f2 commit 2050e7e
Show file tree
Hide file tree
Showing 29 changed files with 431 additions and 78 deletions.
1 change: 1 addition & 0 deletions llvm/include/llvm/Support/AArch64TargetParser.def
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ AARCH64_ARCH_EXT_NAME("sme2p1", AArch64::AEK_SME2p1, "+sme2p1",
AARCH64_ARCH_EXT_NAME("hbc", AArch64::AEK_HBC, "+hbc", "-hbc")
AARCH64_ARCH_EXT_NAME("mops", AArch64::AEK_MOPS, "+mops", "-mops")
AARCH64_ARCH_EXT_NAME("pmuv3", AArch64::AEK_PERFMON, "+perfmon", "-perfmon")
AARCH64_ARCH_EXT_NAME("predres2", AArch64::AEK_SPECRES2, "+specres2", "-specres2")
AARCH64_ARCH_EXT_NAME("cssc", AArch64::AEK_CSSC, "+cssc", "-cssc")
AARCH64_ARCH_EXT_NAME("rcpc3", AArch64::AEK_RCPC3, "+rcpc3", "-rcpc3")
AARCH64_ARCH_EXT_NAME("the", AArch64::AEK_THE, "+the", "-the")
Expand Down
1 change: 1 addition & 0 deletions llvm/include/llvm/Support/AArch64TargetParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ enum ArchExtKind : uint64_t {
AEK_THE = 1ULL << 50, // FEAT_THE
AEK_D128 = 1ULL << 51, // FEAT_D128
AEK_LSE128 = 1ULL << 52, // FEAT_LSE128
AEK_SPECRES2 = 1ULL << 53, // FEAT_SPECRES2
};
// clang-format on

Expand Down
13 changes: 12 additions & 1 deletion llvm/lib/Target/AArch64/AArch64.td
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,16 @@ def FeatureNoBTIAtReturnTwice : SubtargetFeature<"no-bti-at-return-twice",
"Don't place a BTI instruction "
"after a return-twice">;

def FeatureCLRBHB : SubtargetFeature<"clrbhb", "HasCLRBHB",
"true", "Enable Clear BHB instruction (FEAT_CLRBHB)">;

def FeaturePRFM_SLC : SubtargetFeature<"prfm-slc-target", "HasPRFM_SLC",
"true", "Enable SLC target for PRFM instruction">;

def FeatureSPECRES2 : SubtargetFeature<"specres2", "HasSPECRES2",
"true", "Enable Speculation Restriction Instruction (FEAT_SPECRES2)",
[FeaturePredRes]>;

def FeatureMEC : SubtargetFeature<"mec", "HasMEC",
"true", "Enable Memory Encryption Contexts Extension", [FeatureRME]>;

Expand Down Expand Up @@ -578,7 +588,8 @@ def HasV8_8aOps : SubtargetFeature<

def HasV8_9aOps : SubtargetFeature<
"v8.9a", "HasV8_9aOps", "true", "Support ARM v8.9a instructions",
[HasV8_8aOps, FeatureCSSC]>;
[HasV8_8aOps, FeatureCLRBHB, FeaturePRFM_SLC, FeatureSPECRES2,
FeatureCSSC]>;

def HasV9_0aOps : SubtargetFeature<
"v9a", "HasV9_0aOps", "true", "Support ARM v9a instructions",
Expand Down
9 changes: 9 additions & 0 deletions llvm/lib/Target/AArch64/AArch64InstrInfo.td
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,10 @@ def HasHBC : Predicate<"Subtarget->hasHBC()">,
AssemblerPredicateWithAll<(all_of FeatureHBC), "hbc">;
def HasMOPS : Predicate<"Subtarget->hasMOPS()">,
AssemblerPredicateWithAll<(all_of FeatureMOPS), "mops">;
def HasCLRBHB : Predicate<"Subtarget->hasCLRBHB()">,
AssemblerPredicateWithAll<(all_of FeatureCLRBHB), "clrbhb">;
def HasSPECRES2 : Predicate<"Subtarget->hasSPECRES2()">,
AssemblerPredicateWithAll<(all_of FeatureSPECRES2), "specres2">;
def HasITE : Predicate<"Subtarget->hasITE()">,
AssemblerPredicateWithAll<(all_of FeatureITE), "ite">;
def HasTHE : Predicate<"Subtarget->hasTHE()">,
Expand Down Expand Up @@ -8546,6 +8550,11 @@ def : Pat<(AArch64AssertZExtBool GPR32:$op),
//===----------------------------===//
// 2022 Architecture Extensions:
//===----------------------------===//
def : InstAlias<"clrbhb", (HINT 22), 0>;
let Predicates = [HasCLRBHB] in {
def : InstAlias<"clrbhb", (HINT 22), 1>;
}

defm RCW : ReadCheckWriteCompareAndSwap;

defm RCWCLR : ReadCheckWriteOperation<0b001, "clr">;
Expand Down
105 changes: 55 additions & 50 deletions llvm/lib/Target/AArch64/AArch64SystemOperands.td
Original file line number Diff line number Diff line change
Expand Up @@ -230,33 +230,51 @@ def : TSB<"csync", 0>;
// PRFM (prefetch) instruction options.
//===----------------------------------------------------------------------===//

class PRFM<string name, bits<5> encoding> : SearchableTable {
class PRFM<string type, bits<2> type_encoding,
string target, bits<2> target_encoding,
string policy, bits<1> policy_encoding> : SearchableTable {
let SearchableFields = ["Name", "Encoding"];
let EnumValueField = "Encoding";

string Name = name;
string Name = type # target # policy;
bits<5> Encoding;
let Encoding = encoding;
let Encoding{4-3} = type_encoding;
let Encoding{2-1} = target_encoding;
let Encoding{0} = policy_encoding;

code Requires = [{ {} }];
}

def : PRFM<"pldl1keep", 0x00>;
def : PRFM<"pldl1strm", 0x01>;
def : PRFM<"pldl2keep", 0x02>;
def : PRFM<"pldl2strm", 0x03>;
def : PRFM<"pldl3keep", 0x04>;
def : PRFM<"pldl3strm", 0x05>;
def : PRFM<"plil1keep", 0x08>;
def : PRFM<"plil1strm", 0x09>;
def : PRFM<"plil2keep", 0x0a>;
def : PRFM<"plil2strm", 0x0b>;
def : PRFM<"plil3keep", 0x0c>;
def : PRFM<"plil3strm", 0x0d>;
def : PRFM<"pstl1keep", 0x10>;
def : PRFM<"pstl1strm", 0x11>;
def : PRFM<"pstl2keep", 0x12>;
def : PRFM<"pstl2strm", 0x13>;
def : PRFM<"pstl3keep", 0x14>;
def : PRFM<"pstl3strm", 0x15>;
def : PRFM<"pld", 0b00, "l1", 0b00, "keep", 0b0>;
def : PRFM<"pld", 0b00, "l1", 0b00, "strm", 0b1>;
def : PRFM<"pld", 0b00, "l2", 0b01, "keep", 0b0>;
def : PRFM<"pld", 0b00, "l2", 0b01, "strm", 0b1>;
def : PRFM<"pld", 0b00, "l3", 0b10, "keep", 0b0>;
def : PRFM<"pld", 0b00, "l3", 0b10, "strm", 0b1>;
let Requires = [{ {AArch64::FeaturePRFM_SLC} }] in {
def : PRFM<"pld", 0b00, "slc", 0b11, "keep", 0b0>;
def : PRFM<"pld", 0b00, "slc", 0b11, "strm", 0b1>;
}
def : PRFM<"pli", 0b01, "l1", 0b00, "keep", 0b0>;
def : PRFM<"pli", 0b01, "l1", 0b00, "strm", 0b1>;
def : PRFM<"pli", 0b01, "l2", 0b01, "keep", 0b0>;
def : PRFM<"pli", 0b01, "l2", 0b01, "strm", 0b1>;
def : PRFM<"pli", 0b01, "l3", 0b10, "keep", 0b0>;
def : PRFM<"pli", 0b01, "l3", 0b10, "strm", 0b1>;
let Requires = [{ {AArch64::FeaturePRFM_SLC} }] in {
def : PRFM<"pli", 0b01, "slc", 0b11, "keep", 0b0>;
def : PRFM<"pli", 0b01, "slc", 0b11, "strm", 0b1>;
}
def : PRFM<"pst", 0b10, "l1", 0b00, "keep", 0b0>;
def : PRFM<"pst", 0b10, "l1", 0b00, "strm", 0b1>;
def : PRFM<"pst", 0b10, "l2", 0b01, "keep", 0b0>;
def : PRFM<"pst", 0b10, "l2", 0b01, "strm", 0b1>;
def : PRFM<"pst", 0b10, "l3", 0b10, "keep", 0b0>;
def : PRFM<"pst", 0b10, "l3", 0b10, "strm", 0b1>;
let Requires = [{ {AArch64::FeaturePRFM_SLC} }] in {
def : PRFM<"pst", 0b10, "slc", 0b11, "keep", 0b0>;
def : PRFM<"pst", 0b10, "slc", 0b11, "strm", 0b1>;
}

//===----------------------------------------------------------------------===//
// SVE Prefetch instruction options.
Expand Down Expand Up @@ -600,23 +618,6 @@ defm : TLBI<"PAALLOS", 0b110, 0b1000, 0b0001, 0b100, 0>;
defm : TLBI<"PAALL", 0b110, 0b1000, 0b0111, 0b100, 0>;
}

// Armv8.5-A Prediction Restriction by Context instruction options:
class PRCTX<string name, bits<4> crm> : SearchableTable {
let SearchableFields = ["Name", "Encoding"];
let EnumValueField = "Encoding";

string Name = name;
bits<11> Encoding;
let Encoding{10-4} = 0b0110111;
let Encoding{3-0} = crm;
bit NeedsReg = 1;
code Requires = [{ {} }];
}

let Requires = [{ {AArch64::FeaturePredRes} }] in {
def : PRCTX<"RCTX", 0b0011>;
}

//===----------------------------------------------------------------------===//
// MRS/MSR (system register read/write) instruction options.
//===----------------------------------------------------------------------===//
Expand Down Expand Up @@ -709,6 +710,7 @@ def : ROSysReg<"ID_ISAR6_EL1", 0b11, 0b000, 0b0000, 0b0010, 0b111> {
}
def : ROSysReg<"ID_AA64PFR0_EL1", 0b11, 0b000, 0b0000, 0b0100, 0b000>;
def : ROSysReg<"ID_AA64PFR1_EL1", 0b11, 0b000, 0b0000, 0b0100, 0b001>;
def : ROSysReg<"ID_AA64PFR2_EL1", 0b11, 0b000, 0b0000, 0b0100, 0b010>;
def : ROSysReg<"ID_AA64DFR0_EL1", 0b11, 0b000, 0b0000, 0b0101, 0b000>;
def : ROSysReg<"ID_AA64DFR1_EL1", 0b11, 0b000, 0b0000, 0b0101, 0b001>;
def : ROSysReg<"ID_AA64AFR0_EL1", 0b11, 0b000, 0b0000, 0b0101, 0b100>;
Expand All @@ -719,20 +721,21 @@ def : ROSysReg<"ID_AA64ISAR2_EL1", 0b11, 0b000, 0b0000, 0b0110, 0b010>;
def : ROSysReg<"ID_AA64MMFR0_EL1", 0b11, 0b000, 0b0000, 0b0111, 0b000>;
def : ROSysReg<"ID_AA64MMFR1_EL1", 0b11, 0b000, 0b0000, 0b0111, 0b001>;
def : ROSysReg<"ID_AA64MMFR2_EL1", 0b11, 0b000, 0b0000, 0b0111, 0b010>;
def : ROSysReg<"MVFR0_EL1", 0b11, 0b000, 0b0000, 0b0011, 0b000>;
def : ROSysReg<"MVFR1_EL1", 0b11, 0b000, 0b0000, 0b0011, 0b001>;
def : ROSysReg<"MVFR2_EL1", 0b11, 0b000, 0b0000, 0b0011, 0b010>;
def : ROSysReg<"RVBAR_EL1", 0b11, 0b000, 0b1100, 0b0000, 0b001>;
def : ROSysReg<"RVBAR_EL2", 0b11, 0b100, 0b1100, 0b0000, 0b001>;
def : ROSysReg<"RVBAR_EL3", 0b11, 0b110, 0b1100, 0b0000, 0b001>;
def : ROSysReg<"ISR_EL1", 0b11, 0b000, 0b1100, 0b0001, 0b000>;
def : ROSysReg<"CNTPCT_EL0", 0b11, 0b011, 0b1110, 0b0000, 0b001>;
def : ROSysReg<"CNTVCT_EL0", 0b11, 0b011, 0b1110, 0b0000, 0b010>;
def : ROSysReg<"ID_MMFR4_EL1", 0b11, 0b000, 0b0000, 0b0010, 0b110>;
def : ROSysReg<"ID_MMFR5_EL1", 0b11, 0b000, 0b0000, 0b0011, 0b110>;
def : ROSysReg<"ID_AA64MMFR3_EL1", 0b11, 0b000, 0b0000, 0b0111, 0b011>;
def : ROSysReg<"MVFR0_EL1", 0b11, 0b000, 0b0000, 0b0011, 0b000>;
def : ROSysReg<"MVFR1_EL1", 0b11, 0b000, 0b0000, 0b0011, 0b001>;
def : ROSysReg<"MVFR2_EL1", 0b11, 0b000, 0b0000, 0b0011, 0b010>;
def : ROSysReg<"RVBAR_EL1", 0b11, 0b000, 0b1100, 0b0000, 0b001>;
def : ROSysReg<"RVBAR_EL2", 0b11, 0b100, 0b1100, 0b0000, 0b001>;
def : ROSysReg<"RVBAR_EL3", 0b11, 0b110, 0b1100, 0b0000, 0b001>;
def : ROSysReg<"ISR_EL1", 0b11, 0b000, 0b1100, 0b0001, 0b000>;
def : ROSysReg<"CNTPCT_EL0", 0b11, 0b011, 0b1110, 0b0000, 0b001>;
def : ROSysReg<"CNTVCT_EL0", 0b11, 0b011, 0b1110, 0b0000, 0b010>;
def : ROSysReg<"ID_MMFR4_EL1", 0b11, 0b000, 0b0000, 0b0010, 0b110>;
def : ROSysReg<"ID_MMFR5_EL1", 0b11, 0b000, 0b0000, 0b0011, 0b110>;

// Trace registers
// Op0 Op1 CRn CRm Op2
// Op0 Op1 CRn CRm Op2
def : ROSysReg<"TRCSTATR", 0b10, 0b001, 0b0000, 0b0011, 0b000>;
def : ROSysReg<"TRCIDR8", 0b10, 0b001, 0b0000, 0b0000, 0b110>;
def : ROSysReg<"TRCIDR9", 0b10, 0b001, 0b0000, 0b0001, 0b110>;
Expand Down Expand Up @@ -1662,6 +1665,7 @@ def : RWSysReg<"HDFGRTR2_EL2", 0b11, 0b100, 0b0011, 0b0001, 0b000>;
def : RWSysReg<"HDFGWTR2_EL2", 0b11, 0b100, 0b0011, 0b0001, 0b001>;
def : RWSysReg<"HFGRTR2_EL2", 0b11, 0b100, 0b0011, 0b0001, 0b010>;
def : RWSysReg<"HFGWTR2_EL2", 0b11, 0b100, 0b0011, 0b0001, 0b011>;
def : RWSysReg<"HFGITR2_EL2", 0b11, 0b100, 0b0011, 0b0001, 0b111>;
}

// v8.6a Enhanced Counter Virtualization
Expand Down Expand Up @@ -1768,6 +1772,7 @@ def : RWSysReg<"S2POR_EL1", 0b11, 0b000, 0b1010, 0b0010, 0b101>;
def : RWSysReg<"SCTLR2_EL1", 0b11, 0b000, 0b0001, 0b0000, 0b011>;
def : RWSysReg<"SCTLR2_EL12", 0b11, 0b101, 0b0001, 0b0000, 0b011>;
def : RWSysReg<"SCTLR2_EL2", 0b11, 0b100, 0b0001, 0b0000, 0b011>;
def : RWSysReg<"SCTLR2_EL3", 0b11, 0b110, 0b0001, 0b0000, 0b011>;

// v8.9a/v9.4a Extension to Translation Control Registers (FEAT_TCR2)
// Op0 Op1 CRn CRm Op2
Expand Down
43 changes: 26 additions & 17 deletions llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3639,6 +3639,7 @@ static const struct Extension {
{"ras", {AArch64::FeatureRAS}},
{"lse", {AArch64::FeatureLSE}},
{"predres", {AArch64::FeaturePredRes}},
{"predres2", {AArch64::FeatureSPECRES2}},
{"ccdp", {AArch64::FeatureCacheDeepPersist}},
{"mte", {AArch64::FeatureMTE}},
{"memtag", {AArch64::FeatureMTE}},
Expand Down Expand Up @@ -3797,23 +3798,31 @@ bool AArch64AsmParser::parseSysAlias(StringRef Name, SMLoc NameLoc,
return TokError(Str);
}
createSysAlias(TLBI->Encoding, Operands, S);
} else if (Mnemonic == "cfp" || Mnemonic == "dvp" || Mnemonic == "cpp") {
const AArch64PRCTX::PRCTX *PRCTX = AArch64PRCTX::lookupPRCTXByName(Op);
if (!PRCTX)
} else if (Mnemonic == "cfp" || Mnemonic == "dvp" || Mnemonic == "cpp" || Mnemonic == "cosp") {

if (Op.lower() != "rctx")
return TokError("invalid operand for prediction restriction instruction");
else if (!PRCTX->haveFeatures(getSTI().getFeatureBits())) {
std::string Str(
Mnemonic.upper() + std::string(PRCTX->Name) + " requires: ");
setRequiredFeatureString(PRCTX->getRequiredFeatures(), Str);
return TokError(Str);
}
uint16_t PRCTX_Op2 =
Mnemonic == "cfp" ? 4 :
Mnemonic == "dvp" ? 5 :
Mnemonic == "cpp" ? 7 :
0;
assert(PRCTX_Op2 && "Invalid mnemonic for prediction restriction instruction");
createSysAlias(PRCTX->Encoding << 3 | PRCTX_Op2 , Operands, S);

bool hasAll = getSTI().hasFeature(AArch64::FeatureAll);
bool hasPredres = hasAll || getSTI().hasFeature(AArch64::FeaturePredRes);
bool hasSpecres2 = hasAll || getSTI().hasFeature(AArch64::FeatureSPECRES2);

if (Mnemonic == "cosp" && !hasSpecres2)
return TokError("COSP requires: predres2");
if (!hasPredres)
return TokError(Mnemonic.upper() + "RCTX requires: predres");

uint16_t PRCTX_Op2 = Mnemonic == "cfp" ? 0b100
: Mnemonic == "dvp" ? 0b101
: Mnemonic == "cosp" ? 0b110
: Mnemonic == "cpp" ? 0b111
: 0;
assert(PRCTX_Op2 &&
"Invalid mnemonic for prediction restriction instruction");
const auto SYS_3_7_3 = 0b01101110011; // op=3, CRn=7, CRm=3
const auto Encoding = SYS_3_7_3 << 3 | PRCTX_Op2;

createSysAlias(Encoding, Operands, S);
}

Lex(); // Eat operand.
Expand Down Expand Up @@ -5080,7 +5089,7 @@ bool AArch64AsmParser::ParseInstruction(ParseInstructionInfo &Info,
// IC, DC, AT, TLBI and Prediction invalidation instructions are aliases for
// the SYS instruction.
if (Head == "ic" || Head == "dc" || Head == "at" || Head == "tlbi" ||
Head == "cfp" || Head == "dvp" || Head == "cpp")
Head == "cfp" || Head == "dvp" || Head == "cpp" || Head == "cosp")
return parseSysAlias(Head, NameLoc, Operands);

// TLBIP instructions are aliases for the SYSP instruction.
Expand Down
22 changes: 15 additions & 7 deletions llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -910,18 +910,23 @@ bool AArch64InstPrinter::printSysAlias(const MCInst *MI,
// Prediction Restriction aliases
case 3: {
Search_PRCTX:
const AArch64PRCTX::PRCTX *PRCTX = AArch64PRCTX::lookupPRCTXByEncoding(Encoding >> 3);
if (!PRCTX || !PRCTX->haveFeatures(STI.getFeatureBits()))
if (Op1Val != 3 || CnVal != 7 || CmVal != 3)
return false;

NeedsReg = PRCTX->NeedsReg;
const auto Requires =
Op2Val == 6 ? AArch64::FeatureSPECRES2 : AArch64::FeaturePredRes;
if (!(STI.hasFeature(AArch64::FeatureAll) || STI.hasFeature(Requires)))
return false;

NeedsReg = true;
switch (Op2Val) {
default: return false;
case 4: Ins = "cfp\t"; break;
case 5: Ins = "dvp\t"; break;
case 6: Ins = "cosp\t"; break;
case 7: Ins = "cpp\t"; break;
}
Name = std::string(PRCTX->Name);
Name = "RCTX";
}
break;
// IC aliases
Expand Down Expand Up @@ -1433,9 +1438,12 @@ void AArch64InstPrinter::printPrefetchOp(const MCInst *MI, unsigned OpNum,
O << PRFM->Name;
return;
}
} else if (auto PRFM = AArch64PRFM::lookupPRFMByEncoding(prfop)) {
O << PRFM->Name;
return;
} else {
auto PRFM = AArch64PRFM::lookupPRFMByEncoding(prfop);
if (PRFM && PRFM->haveFeatures(STI.getFeatureBits())) {
O << PRFM->Name;
return;
}
}

O << markup("<imm:") << '#' << formatImm(prfop) << markup(">");
Expand Down
7 changes: 6 additions & 1 deletion llvm/lib/Target/ARM/ARM.td
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,11 @@ def FeatureNoBTIAtReturnTwice : SubtargetFeature<"no-bti-at-return-twice",
"Don't place a BTI instruction "
"after a return-twice">;

// Armv8.9-A/Armv9.4-A 2022 Architecture Extensions
def FeatureCLRBHB : SubtargetFeature<"clrbhb", "HasCLRBHB", "true",
"Enable Clear BHB instruction">;


def FeatureFixCortexA57AES1742098 : SubtargetFeature<"fix-cortex-a57-aes-1742098",
"FixCortexA57AES1742098", "true",
"Work around Cortex-A57 Erratum 1742098 / Cortex-A72 Erratum 1655431 (AES)">;
Expand Down Expand Up @@ -674,7 +679,7 @@ def HasV8_8aOps : SubtargetFeature<"v8.8a", "HasV8_8aOps", "true",

def HasV8_9aOps : SubtargetFeature<"v8.9a", "HasV8_9aOps", "true",
"Support ARM v8.9a instructions",
[HasV8_8aOps]>;
[HasV8_8aOps, FeatureCLRBHB]>;

def HasV9_0aOps : SubtargetFeature<"v9a", "HasV9_0aOps", "true",
"Support ARM v9a instructions",
Expand Down
4 changes: 4 additions & 0 deletions llvm/lib/Target/ARM/ARMInstrInfo.td
Original file line number Diff line number Diff line change
Expand Up @@ -2189,6 +2189,10 @@ def : InstAlias<"sevl$p", (HINT 5, pred:$p)>, Requires<[IsARM, HasV8]>;
def : InstAlias<"esb$p", (HINT 16, pred:$p)>, Requires<[IsARM, HasRAS]>;
def : InstAlias<"csdb$p", (HINT 20, pred:$p)>, Requires<[IsARM, HasV6K]>;

// Clear BHB instruction
def : InstAlias<"clrbhb$p", (HINT 22, pred:$p), 0>, Requires<[IsARM, HasV8]>;
def : InstAlias<"clrbhb$p", (HINT 22, pred:$p), 1>, Requires<[IsARM, HasV8, HasCLRBHB]>;

def SEL : AI<(outs GPR:$Rd), (ins GPR:$Rn, GPR:$Rm), DPFrm, NoItinerary, "sel",
"\t$Rd, $Rn, $Rm",
[(set GPR:$Rd, (int_arm_sel GPR:$Rn, GPR:$Rm))]>,
Expand Down
4 changes: 4 additions & 0 deletions llvm/lib/Target/ARM/ARMInstrThumb2.td
Original file line number Diff line number Diff line change
Expand Up @@ -4089,6 +4089,10 @@ def : t2InstAlias<"bti$p", (t2HINT 15, pred:$p), 1>;
def : t2InstAlias<"pac$p r12,lr,sp", (t2HINT 29, pred:$p), 1>;
def : t2InstAlias<"aut$p r12,lr,sp", (t2HINT 45, pred:$p), 1>;

// Clear BHB instruction
def : InstAlias<"clrbhb$p", (t2HINT 22, pred:$p), 0>, Requires<[IsThumb2, HasV8]>;
def : InstAlias<"clrbhb$p", (t2HINT 22, pred:$p), 1>, Requires<[IsThumb2, HasV8, HasCLRBHB]>;

def t2DBG : T2I<(outs), (ins imm0_15:$opt), NoItinerary, "dbg", "\t$opt",
[(int_arm_dbg imm0_15:$opt)]> {
bits<4> opt;
Expand Down
4 changes: 4 additions & 0 deletions llvm/lib/Target/ARM/ARMPredicates.td
Original file line number Diff line number Diff line change
Expand Up @@ -226,3 +226,7 @@ def GenExecuteOnly : Predicate<"Subtarget->genExecuteOnly()">;
// Armv8.5-A extensions
def HasSB : Predicate<"Subtarget->hasSB()">,
AssemblerPredicate<(all_of FeatureSB), "sb">;

// Armv8.9-A/9.4-A 2022 Architecture extensions
def HasCLRBHB : Predicate<"Subtarget->hasCLRBHB()">,
AssemblerPredicate<(all_of FeatureCLRBHB), "clrbhb">;
Loading

0 comments on commit 2050e7e

Please sign in to comment.