@@ -29,14 +29,88 @@ def uimm7_lsb000 : RISCVOp,
2929 }];
3030}
3131
32+ //===----------------------------------------------------------------------===//
33+ // MIPS custom instruction formats
34+ //===----------------------------------------------------------------------===//
35+
36+ // Load double pair format.
37+ class LDPFormat<dag outs, dag ins, string opcodestr, string argstr>
38+ : RVInst<outs, ins, opcodestr, argstr, [], InstFormatI> {
39+ bits<7> imm7;
40+ bits<5> rs1;
41+ bits<5> rd1;
42+ bits<5> rd2;
43+
44+ let Inst{31-27} = rd2;
45+ let Inst{26-23} = imm7{6-3};
46+ let Inst{22-20} = 0b000;
47+ let Inst{19-15} = rs1;
48+ let Inst{14-12} = 0b100;
49+ let Inst{11-7} = rd1;
50+ let Inst{6-0} = OPC_CUSTOM_0.Value;
51+ }
52+
53+ // Load word pair format.
54+ class LWPFormat<dag outs, dag ins, string opcodestr, string argstr>
55+ : RVInst<outs, ins, opcodestr, argstr, [], InstFormatI> {
56+ bits<7> imm7;
57+ bits<5> rs1;
58+ bits<5> rd1;
59+ bits<5> rd2;
60+
61+ let Inst{31-27} = rd2;
62+ let Inst{26-22} = imm7{6-2};
63+ let Inst{21-20} = 0b01;
64+ let Inst{19-15} = rs1;
65+ let Inst{14-12} = 0b100;
66+ let Inst{11-7} = rd1;
67+ let Inst{6-0} = OPC_CUSTOM_0.Value;
68+ }
69+
70+ // Store double pair format.
71+ class SDPFormat<dag outs, dag ins, string opcodestr, string argstr>
72+ : RVInst<outs, ins, opcodestr, argstr, [], InstFormatI> {
73+ bits<7> imm7;
74+ bits<5> rs3;
75+ bits<5> rs2;
76+ bits<5> rs1;
77+
78+ let Inst{31-27} = rs3;
79+ let Inst{26-25} = imm7{6-5};
80+ let Inst{24-20} = rs2;
81+ let Inst{19-15} = rs1;
82+ let Inst{14-12} = 0b101;
83+ let Inst{11-10} = imm7{4-3};
84+ let Inst{9-7} = 0b000;
85+ let Inst{6-0} = OPC_CUSTOM_0.Value;
86+ }
87+
88+ // Store word pair format.
89+ class SWPFormat<dag outs, dag ins, string opcodestr, string argstr>
90+ : RVInst<outs, ins, opcodestr, argstr, [], InstFormatI> {
91+ bits<7> imm7;
92+ bits<5> rs3;
93+ bits<5> rs2;
94+ bits<5> rs1;
95+
96+ let Inst{31-27} = rs3;
97+ let Inst{26-25} = imm7{6-5};
98+ let Inst{24-20} = rs2;
99+ let Inst{19-15} = rs1;
100+ let Inst{14-12} = 0b101;
101+ let Inst{11-9} = imm7{4-2};
102+ let Inst{8-7} = 0b01;
103+ let Inst{6-0} = OPC_CUSTOM_0.Value;
104+ }
105+
32106//===----------------------------------------------------------------------===//
33107// MIPS extensions
34108//===----------------------------------------------------------------------===//
35109
36110let Predicates = [HasVendorXMIPSCMove], hasSideEffects = 0, mayLoad = 0, mayStore = 0,
37111 DecoderNamespace = "Xmipscmove" in {
38112def CCMOV : RVInstR4<0b11, 0b011, OPC_CUSTOM_0, (outs GPR:$rd),
39- (ins GPR:$rs1, GPR:$rs2, GPR:$rs3),
113+ (ins GPR:$rs1, GPR:$rs2, GPR:$rs3),
40114 "mips.ccmov", "$rd, $rs2, $rs1, $rs3">,
41115 Sched<[]>;
42116}
0 commit comments