xref: /freebsd/contrib/llvm-project/llvm/lib/Target/Mips/MipsMTInstrInfo.td (revision 0b57cec536236d46e3dba9bd041533462f33dbb7)
1*0b57cec5SDimitry Andric//===-- MipsMTInstrInfo.td - Mips MT Instruction Infos -----*- tablegen -*-===//
2*0b57cec5SDimitry Andric//
3*0b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*0b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
5*0b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*0b57cec5SDimitry Andric//
7*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
8*0b57cec5SDimitry Andric//
9*0b57cec5SDimitry Andric// This file describes the MIPS MT ASE as defined by MD00378 1.12.
10*0b57cec5SDimitry Andric//
11*0b57cec5SDimitry Andric// TODO: Add support for the microMIPS encodings for the MT ASE and add the
12*0b57cec5SDimitry Andric//       instruction mappings.
13*0b57cec5SDimitry Andric//
14*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
15*0b57cec5SDimitry Andric
16*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
17*0b57cec5SDimitry Andric// MIPS MT Instruction Encodings
18*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
19*0b57cec5SDimitry Andric
20*0b57cec5SDimitry Andricclass DMT_ENC : COP0_MFMC0_MT<FIELD5_1_DMT_EMT, FIELD5_2_DMT_EMT,
21*0b57cec5SDimitry Andric                              OPCODE_SC_D>;
22*0b57cec5SDimitry Andric
23*0b57cec5SDimitry Andricclass EMT_ENC : COP0_MFMC0_MT<FIELD5_1_DMT_EMT, FIELD5_2_DMT_EMT,
24*0b57cec5SDimitry Andric                              OPCODE_SC_E>;
25*0b57cec5SDimitry Andric
26*0b57cec5SDimitry Andricclass DVPE_ENC : COP0_MFMC0_MT<FIELD5_1_2_DVPE_EVPE, FIELD5_1_2_DVPE_EVPE,
27*0b57cec5SDimitry Andric                               OPCODE_SC_D>;
28*0b57cec5SDimitry Andric
29*0b57cec5SDimitry Andricclass EVPE_ENC : COP0_MFMC0_MT<FIELD5_1_2_DVPE_EVPE, FIELD5_1_2_DVPE_EVPE,
30*0b57cec5SDimitry Andric                               OPCODE_SC_E>;
31*0b57cec5SDimitry Andric
32*0b57cec5SDimitry Andricclass FORK_ENC : SPECIAL3_MT_FORK;
33*0b57cec5SDimitry Andric
34*0b57cec5SDimitry Andricclass YIELD_ENC : SPECIAL3_MT_YIELD;
35*0b57cec5SDimitry Andric
36*0b57cec5SDimitry Andricclass MFTR_ENC : COP0_MFTTR_MT<FIELD5_MFTR>;
37*0b57cec5SDimitry Andric
38*0b57cec5SDimitry Andricclass MTTR_ENC : COP0_MFTTR_MT<FIELD5_MTTR>;
39*0b57cec5SDimitry Andric
40*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
41*0b57cec5SDimitry Andric// MIPS MT Instruction Descriptions
42*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
43*0b57cec5SDimitry Andric
44*0b57cec5SDimitry Andricclass MT_1R_DESC_BASE<string instr_asm, InstrItinClass Itin = NoItinerary> {
45*0b57cec5SDimitry Andric  dag OutOperandList = (outs GPR32Opnd:$rt);
46*0b57cec5SDimitry Andric  dag InOperandList = (ins);
47*0b57cec5SDimitry Andric  string AsmString = !strconcat(instr_asm, "\t$rt");
48*0b57cec5SDimitry Andric  list<dag> Pattern = [];
49*0b57cec5SDimitry Andric  InstrItinClass Itinerary = Itin;
50*0b57cec5SDimitry Andric}
51*0b57cec5SDimitry Andric
52*0b57cec5SDimitry Andricclass MFTR_DESC {
53*0b57cec5SDimitry Andric  dag OutOperandList = (outs GPR32Opnd:$rd);
54*0b57cec5SDimitry Andric  dag InOperandList = (ins GPR32Opnd:$rt, uimm1:$u, uimm3:$sel, uimm1:$h);
55*0b57cec5SDimitry Andric  string AsmString = "mftr\t$rd, $rt, $u, $sel, $h";
56*0b57cec5SDimitry Andric  list<dag> Pattern = [];
57*0b57cec5SDimitry Andric  InstrItinClass Itinerary = II_MFTR;
58*0b57cec5SDimitry Andric}
59*0b57cec5SDimitry Andric
60*0b57cec5SDimitry Andricclass MTTR_DESC {
61*0b57cec5SDimitry Andric  dag OutOperandList = (outs GPR32Opnd:$rd);
62*0b57cec5SDimitry Andric  dag InOperandList = (ins GPR32Opnd:$rt, uimm1:$u, uimm3:$sel, uimm1:$h);
63*0b57cec5SDimitry Andric  string AsmString = "mttr\t$rt, $rd, $u, $sel, $h";
64*0b57cec5SDimitry Andric  list<dag> Pattern = [];
65*0b57cec5SDimitry Andric  InstrItinClass Itinerary = II_MTTR;
66*0b57cec5SDimitry Andric}
67*0b57cec5SDimitry Andric
68*0b57cec5SDimitry Andricclass FORK_DESC {
69*0b57cec5SDimitry Andric  dag OutOperandList = (outs GPR32Opnd:$rs, GPR32Opnd:$rd);
70*0b57cec5SDimitry Andric  dag InOperandList = (ins GPR32Opnd:$rt);
71*0b57cec5SDimitry Andric  string AsmString = "fork\t$rd, $rs, $rt";
72*0b57cec5SDimitry Andric  list<dag> Pattern = [];
73*0b57cec5SDimitry Andric  InstrItinClass Itinerary = II_FORK;
74*0b57cec5SDimitry Andric}
75*0b57cec5SDimitry Andric
76*0b57cec5SDimitry Andricclass YIELD_DESC {
77*0b57cec5SDimitry Andric  dag OutOperandList = (outs GPR32Opnd:$rd);
78*0b57cec5SDimitry Andric  dag InOperandList = (ins GPR32Opnd:$rs);
79*0b57cec5SDimitry Andric  string AsmString = "yield\t$rd, $rs";
80*0b57cec5SDimitry Andric  list<dag> Pattern = [];
81*0b57cec5SDimitry Andric  InstrItinClass Itinerary = II_YIELD;
82*0b57cec5SDimitry Andric}
83*0b57cec5SDimitry Andric
84*0b57cec5SDimitry Andricclass DMT_DESC : MT_1R_DESC_BASE<"dmt", II_DMT>;
85*0b57cec5SDimitry Andric
86*0b57cec5SDimitry Andricclass EMT_DESC : MT_1R_DESC_BASE<"emt", II_EMT>;
87*0b57cec5SDimitry Andric
88*0b57cec5SDimitry Andricclass DVPE_DESC : MT_1R_DESC_BASE<"dvpe", II_DVPE>;
89*0b57cec5SDimitry Andric
90*0b57cec5SDimitry Andricclass EVPE_DESC : MT_1R_DESC_BASE<"evpe", II_EVPE>;
91*0b57cec5SDimitry Andric
92*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
93*0b57cec5SDimitry Andric// MIPS MT Instruction Definitions
94*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
95*0b57cec5SDimitry Andriclet hasSideEffects = 1, isNotDuplicable = 1,
96*0b57cec5SDimitry Andric    AdditionalPredicates = [NotInMicroMips] in {
97*0b57cec5SDimitry Andric  def DMT : DMT_ENC, DMT_DESC, ASE_MT;
98*0b57cec5SDimitry Andric
99*0b57cec5SDimitry Andric  def EMT : EMT_ENC, EMT_DESC, ASE_MT;
100*0b57cec5SDimitry Andric
101*0b57cec5SDimitry Andric  def DVPE : DVPE_ENC, DVPE_DESC, ASE_MT;
102*0b57cec5SDimitry Andric
103*0b57cec5SDimitry Andric  def EVPE : EVPE_ENC, EVPE_DESC, ASE_MT;
104*0b57cec5SDimitry Andric
105*0b57cec5SDimitry Andric  def FORK : FORK_ENC, FORK_DESC, ASE_MT;
106*0b57cec5SDimitry Andric
107*0b57cec5SDimitry Andric  def YIELD : YIELD_ENC, YIELD_DESC, ASE_MT;
108*0b57cec5SDimitry Andric
109*0b57cec5SDimitry Andric  def MFTR : MFTR_ENC, MFTR_DESC, ASE_MT;
110*0b57cec5SDimitry Andric
111*0b57cec5SDimitry Andric  def MTTR : MTTR_ENC, MTTR_DESC, ASE_MT;
112*0b57cec5SDimitry Andric}
113*0b57cec5SDimitry Andric
114*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
115*0b57cec5SDimitry Andric// MIPS MT Pseudo Instructions - used to support mtfr & mttr aliases.
116*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
117*0b57cec5SDimitry Andricdef MFTC0 : MipsAsmPseudoInst<(outs GPR32Opnd:$rd), (ins COP0Opnd:$rt,
118*0b57cec5SDimitry Andric                                                        uimm3:$sel),
119*0b57cec5SDimitry Andric                              "mftc0 $rd, $rt, $sel">, ASE_MT;
120*0b57cec5SDimitry Andric
121*0b57cec5SDimitry Andricdef MFTGPR : MipsAsmPseudoInst<(outs GPR32Opnd:$rd), (ins GPR32Opnd:$rt,
122*0b57cec5SDimitry Andric                                                          uimm3:$sel),
123*0b57cec5SDimitry Andric                               "mftgpr $rd, $rt">, ASE_MT;
124*0b57cec5SDimitry Andric
125*0b57cec5SDimitry Andricdef MFTLO : MipsAsmPseudoInst<(outs GPR32Opnd:$rt), (ins ACC64DSPOpnd:$ac),
126*0b57cec5SDimitry Andric                              "mftlo $rt, $ac">, ASE_MT;
127*0b57cec5SDimitry Andric
128*0b57cec5SDimitry Andricdef MFTHI : MipsAsmPseudoInst<(outs GPR32Opnd:$rt), (ins ACC64DSPOpnd:$ac),
129*0b57cec5SDimitry Andric                              "mfthi $rt, $ac">, ASE_MT;
130*0b57cec5SDimitry Andric
131*0b57cec5SDimitry Andricdef MFTACX : MipsAsmPseudoInst<(outs GPR32Opnd:$rt), (ins ACC64DSPOpnd:$ac),
132*0b57cec5SDimitry Andric                               "mftacx $rt, $ac">, ASE_MT;
133*0b57cec5SDimitry Andric
134*0b57cec5SDimitry Andricdef MFTDSP : MipsAsmPseudoInst<(outs GPR32Opnd:$rt), (ins),
135*0b57cec5SDimitry Andric                               "mftdsp $rt">, ASE_MT;
136*0b57cec5SDimitry Andric
137*0b57cec5SDimitry Andricdef MFTC1 : MipsAsmPseudoInst<(outs GPR32Opnd:$rt), (ins FGR32Opnd:$ft),
138*0b57cec5SDimitry Andric                              "mftc1 $rt, $ft">, ASE_MT;
139*0b57cec5SDimitry Andric
140*0b57cec5SDimitry Andricdef MFTHC1 : MipsAsmPseudoInst<(outs GPR32Opnd:$rt), (ins FGR32Opnd:$ft),
141*0b57cec5SDimitry Andric                               "mfthc1 $rt, $ft">, ASE_MT;
142*0b57cec5SDimitry Andric
143*0b57cec5SDimitry Andricdef CFTC1 : MipsAsmPseudoInst<(outs GPR32Opnd:$rt), (ins FGRCCOpnd:$ft),
144*0b57cec5SDimitry Andric                              "cftc1 $rt, $ft">, ASE_MT;
145*0b57cec5SDimitry Andric
146*0b57cec5SDimitry Andric
147*0b57cec5SDimitry Andricdef MTTC0 : MipsAsmPseudoInst<(outs COP0Opnd:$rd), (ins GPR32Opnd:$rt,
148*0b57cec5SDimitry Andric                                                        uimm3:$sel),
149*0b57cec5SDimitry Andric                              "mttc0 $rt, $rd, $sel">, ASE_MT;
150*0b57cec5SDimitry Andric
151*0b57cec5SDimitry Andricdef MTTGPR : MipsAsmPseudoInst<(outs GPR32Opnd:$rt), (ins GPR32Opnd:$rd),
152*0b57cec5SDimitry Andric                               "mttgpr $rd, $rt">, ASE_MT;
153*0b57cec5SDimitry Andric
154*0b57cec5SDimitry Andricdef MTTLO : MipsAsmPseudoInst<(outs ACC64DSPOpnd:$ac), (ins GPR32Opnd:$rt),
155*0b57cec5SDimitry Andric                              "mttlo $rt, $ac">, ASE_MT;
156*0b57cec5SDimitry Andric
157*0b57cec5SDimitry Andricdef MTTHI : MipsAsmPseudoInst<(outs ACC64DSPOpnd:$ac), (ins GPR32Opnd:$rt),
158*0b57cec5SDimitry Andric                              "mtthi $rt, $ac">, ASE_MT;
159*0b57cec5SDimitry Andric
160*0b57cec5SDimitry Andricdef MTTACX : MipsAsmPseudoInst<(outs ACC64DSPOpnd:$ac), (ins GPR32Opnd:$rt),
161*0b57cec5SDimitry Andric                               "mttacx $rt, $ac">, ASE_MT;
162*0b57cec5SDimitry Andric
163*0b57cec5SDimitry Andricdef MTTDSP : MipsAsmPseudoInst<(outs), (ins GPR32Opnd:$rt),
164*0b57cec5SDimitry Andric                               "mttdsp $rt">, ASE_MT;
165*0b57cec5SDimitry Andric
166*0b57cec5SDimitry Andricdef MTTC1 : MipsAsmPseudoInst<(outs FGR32Opnd:$ft), (ins GPR32Opnd:$rt),
167*0b57cec5SDimitry Andric                              "mttc1 $rt, $ft">, ASE_MT;
168*0b57cec5SDimitry Andric
169*0b57cec5SDimitry Andricdef MTTHC1 : MipsAsmPseudoInst<(outs FGR32Opnd:$ft), (ins GPR32Opnd:$rt),
170*0b57cec5SDimitry Andric                               "mtthc1 $rt, $ft">, ASE_MT;
171*0b57cec5SDimitry Andric
172*0b57cec5SDimitry Andricdef CTTC1 : MipsAsmPseudoInst<(outs FGRCCOpnd:$ft), (ins GPR32Opnd:$rt),
173*0b57cec5SDimitry Andric                              "cttc1 $rt, $ft">, ASE_MT;
174*0b57cec5SDimitry Andric
175*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
176*0b57cec5SDimitry Andric// MIPS MT Instruction Definitions
177*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
178*0b57cec5SDimitry Andric
179*0b57cec5SDimitry Andriclet AdditionalPredicates = [NotInMicroMips] in {
180*0b57cec5SDimitry Andric  def : MipsInstAlias<"dmt", (DMT ZERO), 1>, ASE_MT;
181*0b57cec5SDimitry Andric
182*0b57cec5SDimitry Andric  def : MipsInstAlias<"emt", (EMT ZERO), 1>, ASE_MT;
183*0b57cec5SDimitry Andric
184*0b57cec5SDimitry Andric  def : MipsInstAlias<"dvpe", (DVPE ZERO), 1>, ASE_MT;
185*0b57cec5SDimitry Andric
186*0b57cec5SDimitry Andric  def : MipsInstAlias<"evpe", (EVPE ZERO), 1>, ASE_MT;
187*0b57cec5SDimitry Andric
188*0b57cec5SDimitry Andric  def : MipsInstAlias<"yield $rs", (YIELD ZERO, GPR32Opnd:$rs), 1>, ASE_MT;
189*0b57cec5SDimitry Andric
190*0b57cec5SDimitry Andric  def : MipsInstAlias<"mftc0 $rd, $rt", (MFTC0 GPR32Opnd:$rd, COP0Opnd:$rt, 0),
191*0b57cec5SDimitry Andric                      1>, ASE_MT;
192*0b57cec5SDimitry Andric
193*0b57cec5SDimitry Andric  def : MipsInstAlias<"mftlo $rt", (MFTLO GPR32Opnd:$rt, AC0), 1>, ASE_MT;
194*0b57cec5SDimitry Andric
195*0b57cec5SDimitry Andric  def : MipsInstAlias<"mfthi $rt", (MFTHI GPR32Opnd:$rt, AC0), 1>, ASE_MT;
196*0b57cec5SDimitry Andric
197*0b57cec5SDimitry Andric  def : MipsInstAlias<"mftacx $rt", (MFTACX GPR32Opnd:$rt, AC0), 1>, ASE_MT;
198*0b57cec5SDimitry Andric
199*0b57cec5SDimitry Andric  def : MipsInstAlias<"mttc0 $rd, $rt", (MTTC0 COP0Opnd:$rt, GPR32Opnd:$rd, 0),
200*0b57cec5SDimitry Andric                      1>, ASE_MT;
201*0b57cec5SDimitry Andric
202*0b57cec5SDimitry Andric  def : MipsInstAlias<"mttlo $rt", (MTTLO AC0, GPR32Opnd:$rt), 1>, ASE_MT;
203*0b57cec5SDimitry Andric
204*0b57cec5SDimitry Andric  def : MipsInstAlias<"mtthi $rt", (MTTHI AC0, GPR32Opnd:$rt), 1>, ASE_MT;
205*0b57cec5SDimitry Andric
206*0b57cec5SDimitry Andric  def : MipsInstAlias<"mttacx $rt", (MTTACX AC0, GPR32Opnd:$rt), 1>, ASE_MT;
207*0b57cec5SDimitry Andric}
208