Skip to content

Commit 472ea0b

Browse files
authored
[RISCV] Merge some of the Sifive decoder tables. (#128794)
This makes a single table for vector and another table for system. I left sf.cease out of system because its not in custom encoding space. The other system instructions are in the custom part of OPC_SYSTEM.
1 parent 8529238 commit 472ea0b

File tree

2 files changed

+20
-27
lines changed

2 files changed

+20
-27
lines changed

llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp

+13-20
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,15 @@ static constexpr FeatureBitset XqciFeatureGroup = {
631631
RISCV::FeatureVendorXqcisls,
632632
};
633633

634+
static constexpr FeatureBitset XSfVectorGroup = {
635+
RISCV::FeatureVendorXSfvcp, RISCV::FeatureVendorXSfvqmaccdod,
636+
RISCV::FeatureVendorXSfvqmaccqoq, RISCV::FeatureVendorXSfvfwmaccqqq,
637+
RISCV::FeatureVendorXSfvfnrclipxfqf};
638+
static constexpr FeatureBitset XSfSystemGroup = {
639+
RISCV::FeatureVendorXSiFivecdiscarddlone,
640+
RISCV::FeatureVendorXSiFivecflushdlone,
641+
};
642+
634643
DecodeStatus RISCVDisassembler::getInstruction32(MCInst &MI, uint64_t &Size,
635644
ArrayRef<uint8_t> Bytes,
636645
uint64_t Address,
@@ -677,26 +686,10 @@ DecodeStatus RISCVDisassembler::getInstruction32(MCInst &MI, uint64_t &Size,
677686
DecoderTableXTHeadSync32, "XTHeadSync");
678687
TRY_TO_DECODE_FEATURE(RISCV::FeatureVendorXTHeadVdot,
679688
DecoderTableXTHeadVdot32, "XTHeadVdot");
680-
TRY_TO_DECODE_FEATURE(RISCV::FeatureVendorXSfvcp, DecoderTableXSfvcp32,
681-
"SiFive VCIX");
682-
TRY_TO_DECODE_FEATURE(
683-
RISCV::FeatureVendorXSfvqmaccdod, DecoderTableXSfvqmaccdod32,
684-
"SiFive Matrix Multiplication (2x8 and 8x2) Instruction");
685-
TRY_TO_DECODE_FEATURE(
686-
RISCV::FeatureVendorXSfvqmaccqoq, DecoderTableXSfvqmaccqoq32,
687-
"SiFive Matrix Multiplication (4x8 and 8x4) Instruction");
688-
TRY_TO_DECODE_FEATURE(RISCV::FeatureVendorXSfvfwmaccqqq,
689-
DecoderTableXSfvfwmaccqqq32,
690-
"SiFive Matrix Multiplication Instruction");
691-
TRY_TO_DECODE_FEATURE(RISCV::FeatureVendorXSfvfnrclipxfqf,
692-
DecoderTableXSfvfnrclipxfqf32,
693-
"SiFive FP32-to-int8 Ranged Clip Instructions");
694-
TRY_TO_DECODE_FEATURE(RISCV::FeatureVendorXSiFivecdiscarddlone,
695-
DecoderTableXSiFivecdiscarddlone32,
696-
"SiFive sf.cdiscard.d.l1");
697-
TRY_TO_DECODE_FEATURE(RISCV::FeatureVendorXSiFivecflushdlone,
698-
DecoderTableXSiFivecflushdlone32,
699-
"SiFive sf.cflush.d.l1");
689+
TRY_TO_DECODE_FEATURE_ANY(XSfVectorGroup, DecoderTableXSfvector32,
690+
"SiFive vector extensions");
691+
TRY_TO_DECODE_FEATURE_ANY(XSfSystemGroup, DecoderTableXSfsystem32,
692+
"SiFive system extensions");
700693
TRY_TO_DECODE_FEATURE(RISCV::FeatureVendorXSfcease, DecoderTableXSfcease32,
701694
"SiFive sf.cease");
702695
TRY_TO_DECODE_FEATURE(RISCV::FeatureVendorXMIPSLSP, DecoderTableXmipslsp32,

llvm/lib/Target/RISCV/RISCVInstrInfoXSf.td

+7-7
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ class CustomSiFiveVFNRCLIP<bits<6> funct6, RISCVVFormat opv, string opcodestr>
184184
}
185185

186186
let Predicates = [HasVendorXSfvcp], mayLoad = 0, mayStore = 0,
187-
hasSideEffects = 1, hasNoSchedulingInfo = 1, DecoderNamespace = "XSfvcp" in {
187+
hasSideEffects = 1, hasNoSchedulingInfo = 1, DecoderNamespace = "XSfvector" in {
188188
defm X : CustomSiFiveVCIX<"x", VCIX_X, uimm5, uimm5, GPR>, Sched<[]>;
189189
defm I : CustomSiFiveVCIX<"i", VCIX_X, uimm5, uimm5, simm5>, Sched<[]>;
190190
defm XV : CustomSiFiveVCIX<"xv", VCIX_XV, uimm5, VR, GPR>, Sched<[]>;
@@ -201,28 +201,28 @@ let Predicates = [HasVendorXSfvcp], mayLoad = 0, mayStore = 0,
201201
defm FVW : CustomSiFiveVCIX<"fvw", VCIX_XVW, VR, VR, FPR32>, Sched<[]>;
202202
}
203203

204-
let Predicates = [HasVendorXSfvqmaccdod], DecoderNamespace = "XSfvqmaccdod",
204+
let Predicates = [HasVendorXSfvqmaccdod], DecoderNamespace = "XSfvector",
205205
DestEEW = EEWSEWx4, RVVConstraint=VS2Constraint in {
206206
def VQMACCU_2x8x2 : CustomSiFiveVMACC<0b101100, OPMVV, "sf.vqmaccu.2x8x2">;
207207
def VQMACC_2x8x2 : CustomSiFiveVMACC<0b101101, OPMVV, "sf.vqmacc.2x8x2">;
208208
def VQMACCUS_2x8x2 : CustomSiFiveVMACC<0b101110, OPMVV, "sf.vqmaccus.2x8x2">;
209209
def VQMACCSU_2x8x2 : CustomSiFiveVMACC<0b101111, OPMVV, "sf.vqmaccsu.2x8x2">;
210210
}
211211

212-
let Predicates = [HasVendorXSfvqmaccqoq], DecoderNamespace = "XSfvqmaccqoq",
212+
let Predicates = [HasVendorXSfvqmaccqoq], DecoderNamespace = "XSfvector",
213213
DestEEW = EEWSEWx4, RVVConstraint=WidenV in {
214214
def VQMACCU_4x8x4 : CustomSiFiveVMACC<0b111100, OPMVV, "sf.vqmaccu.4x8x4">;
215215
def VQMACC_4x8x4 : CustomSiFiveVMACC<0b111101, OPMVV, "sf.vqmacc.4x8x4">;
216216
def VQMACCUS_4x8x4 : CustomSiFiveVMACC<0b111110, OPMVV, "sf.vqmaccus.4x8x4">;
217217
def VQMACCSU_4x8x4 : CustomSiFiveVMACC<0b111111, OPMVV, "sf.vqmaccsu.4x8x4">;
218218
}
219219

220-
let Predicates = [HasVendorXSfvfwmaccqqq], DecoderNamespace = "XSfvfwmaccqqq",
220+
let Predicates = [HasVendorXSfvfwmaccqqq], DecoderNamespace = "XSfvector",
221221
DestEEW = EEWSEWx2, RVVConstraint=WidenV in {
222222
def VFWMACC_4x4x4 : CustomSiFiveVMACC<0b111100, OPFVV, "sf.vfwmacc.4x4x4">;
223223
}
224224

225-
let Predicates = [HasVendorXSfvfnrclipxfqf], DecoderNamespace = "XSfvfnrclipxfqf",
225+
let Predicates = [HasVendorXSfvfnrclipxfqf], DecoderNamespace = "XSfvector",
226226
Uses = [FRM] in {
227227
def VFNRCLIP_XU_F_QF : CustomSiFiveVFNRCLIP<0b100010, OPFVF, "sf.vfnrclip.xu.f.qf">;
228228
def VFNRCLIP_X_F_QF : CustomSiFiveVFNRCLIP<0b100011, OPFVF, "sf.vfnrclip.x.f.qf">;
@@ -836,7 +836,7 @@ let Predicates = [HasVendorXSfvfnrclipxfqf] in {
836836

837837
let Predicates = [HasVendorXSiFivecdiscarddlone] in {
838838
let hasNoSchedulingInfo = 1, hasSideEffects = 1, mayLoad = 0, mayStore = 0,
839-
DecoderNamespace = "XSiFivecdiscarddlone" in
839+
DecoderNamespace = "XSfsystem" in
840840
def SF_CDISCARD_D_L1
841841
: RVInstIUnary<0b111111000010, 0b000, OPC_SYSTEM, (outs), (ins GPR:$rs1),
842842
"sf.cdiscard.d.l1", "$rs1">, Sched<[]> {
@@ -847,7 +847,7 @@ let Predicates = [HasVendorXSiFivecdiscarddlone] in {
847847

848848
let Predicates = [HasVendorXSiFivecflushdlone] in {
849849
let hasNoSchedulingInfo = 1, hasSideEffects = 1, mayLoad = 0, mayStore = 0,
850-
DecoderNamespace = "XSiFivecflushdlone" in
850+
DecoderNamespace = "XSfsystem" in
851851
def SF_CFLUSH_D_L1
852852
: RVInstIUnary<0b111111000000, 0b000, OPC_SYSTEM, (outs), (ins GPR:$rs1),
853853
"sf.cflush.d.l1", "$rs1">, Sched<[]> {

0 commit comments

Comments
 (0)