Skip to content

Commit 8592a65

Browse files
authored
[AArch64][llvm] GICv5 instruction GIC CDEOI takes no operand (#167322)
There was a minor oversight in commit 6836261; the AArch64 GICv5 instruction `GIC CDEOI` takes no operands, since the text of the specification says: ``` The Rt field should be set to 0b11111. If the Rt field is not set to 0b11111, it is CONSTRAINED UNPREDICTABLE whether: * The instruction is UNDEFINED. * The instruction behaves as if the Rt field is set to 0b11111. ```
1 parent 3378ea2 commit 8592a65

File tree

5 files changed

+14
-10
lines changed

5 files changed

+14
-10
lines changed

llvm/lib/Target/AArch64/AArch64SystemOperands.td

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2602,14 +2602,14 @@ foreach n=0-15 in {
26022602
//===----------------------------------------------------------------------===//
26032603

26042604
// GIC
2605-
class GIC<string name, bits<3> op1, bits<4> crn, bits<4> crm, bits<3> op2> {
2605+
class GIC<string name, bits<3> op1, bits<4> crn, bits<4> crm, bits<3> op2, bit needsreg = 1> {
26062606
string Name = name;
26072607
bits<14> Encoding;
26082608
let Encoding{13-11} = op1;
26092609
let Encoding{10-7} = crn;
26102610
let Encoding{6-3} = crm;
26112611
let Encoding{2-0} = op2;
2612-
bit NeedsReg = 1;
2612+
bit NeedsReg = needsreg;
26132613
string RequiresStr = [{ {AArch64::FeatureGCIE} }];
26142614
}
26152615

@@ -2686,12 +2686,12 @@ def : GSB<"ack", 0b000, 0b1100, 0b0000, 0b001>;
26862686
def : GICR<"cdia", 0b000, 0b1100, 0b0011, 0b000>;
26872687
def : GICR<"cdnmia", 0b000, 0b1100, 0b0011, 0b001>;
26882688

2689-
// Op1 CRn CRm Op2
2689+
// Op1 CRn CRm Op2, needsreg
26902690
def : GIC<"cdaff", 0b000, 0b1100, 0b0001, 0b011>;
26912691
def : GIC<"cddi", 0b000, 0b1100, 0b0010, 0b000>;
26922692
def : GIC<"cddis", 0b000, 0b1100, 0b0001, 0b000>;
26932693
def : GIC<"cden", 0b000, 0b1100, 0b0001, 0b001>;
2694-
def : GIC<"cdeoi", 0b000, 0b1100, 0b0001, 0b111>;
2694+
def : GIC<"cdeoi", 0b000, 0b1100, 0b0001, 0b111, 0>;
26952695
def : GIC<"cdhm", 0b000, 0b1100, 0b0010, 0b001>;
26962696
def : GIC<"cdpend", 0b000, 0b1100, 0b0001, 0b100>;
26972697
def : GIC<"cdpri", 0b000, 0b1100, 0b0001, 0b010>;

llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4111,7 +4111,7 @@ bool AArch64AsmParser::parseSysAlias(StringRef Name, SMLoc NameLoc,
41114111
setRequiredFeatureString(GIC->getRequiredFeatures(), Str);
41124112
return TokError(Str);
41134113
}
4114-
ExpectRegister = true;
4114+
ExpectRegister = GIC->NeedsReg;
41154115
createSysAlias(GIC->Encoding, Operands, S);
41164116
} else if (Mnemonic == "gsb") {
41174117
const AArch64GSB::GSB *GSB = AArch64GSB::lookupGSBByName(Op);

llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@ bool AArch64InstPrinter::printSysAlias(const MCInst *MI,
10341034
if (!GIC || !GIC->haveFeatures(STI.getFeatureBits()))
10351035
return false;
10361036

1037-
NeedsReg = true;
1037+
NeedsReg = GIC->NeedsReg;
10381038
Ins = "gic\t";
10391039
Name = std::string(GIC->Name);
10401040
} else {

llvm/test/MC/AArch64/armv9.7a-gcie-diagnostics.s

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,7 @@ gicr x3, foo
1616

1717
gic cdaff
1818
// CHECK-ERROR: error: specified gic op requires a register
19+
20+
gic cdeoi, x3
21+
// CHECK-ERROR: error: specified gic op does not use a register
22+

llvm/test/MC/AArch64/armv9.7a-gcie.s

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -828,10 +828,10 @@ GIC CDEN, x3
828828
// CHECK-UNKNOWN: d508c123 sys #0, c12, c1, #1, x3
829829
// CHECK-ERROR: error: GIC cden requires: gcie
830830

831-
GIC CDEOI, x3
832-
// CHECK-INST: gic cdeoi, x3
833-
// CHECK-ENCODING: [0xe3,0xc1,0x08,0xd5]
834-
// CHECK-UNKNOWN: d508c1e3 sys #0, c12, c1, #7, x3
831+
GIC CDEOI
832+
// CHECK-INST: gic cdeoi
833+
// CHECK-ENCODING: [0xff,0xc1,0x08,0xd5]
834+
// CHECK-UNKNOWN: d508c1ff sys #0, c12, c1, #7
835835
// CHECK-ERROR: error: GIC cdeoi requires: gcie
836836

837837
GIC CDHM, x3

0 commit comments

Comments
 (0)