1 //===-- MipsMTInstrInfo.td - Mips MT Instruction Infos -----*- tablegen -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file describes the MIPS MT ASE as defined by MD00378 1.12.
12 // TODO: Add support for the microMIPS encodings for the MT ASE and add the
13 // instruction mappings.
15 //===----------------------------------------------------------------------===//
17 //===----------------------------------------------------------------------===//
18 // MIPS MT Instruction Encodings
19 //===----------------------------------------------------------------------===//
21 class DMT_ENC : COP0_MFMC0_MT<FIELD5_1_DMT_EMT, FIELD5_2_DMT_EMT,
24 class EMT_ENC : COP0_MFMC0_MT<FIELD5_1_DMT_EMT, FIELD5_2_DMT_EMT,
27 class DVPE_ENC : COP0_MFMC0_MT<FIELD5_1_2_DVPE_EVPE, FIELD5_1_2_DVPE_EVPE,
30 class EVPE_ENC : COP0_MFMC0_MT<FIELD5_1_2_DVPE_EVPE, FIELD5_1_2_DVPE_EVPE,
33 class FORK_ENC : SPECIAL3_MT_FORK;
35 class YIELD_ENC : SPECIAL3_MT_YIELD;
37 class MFTR_ENC : COP0_MFTTR_MT<FIELD5_MFTR>;
39 class MTTR_ENC : COP0_MFTTR_MT<FIELD5_MTTR>;
41 //===----------------------------------------------------------------------===//
42 // MIPS MT Instruction Descriptions
43 //===----------------------------------------------------------------------===//
45 class MT_1R_DESC_BASE<string instr_asm, InstrItinClass Itin = NoItinerary> {
46 dag OutOperandList = (outs GPR32Opnd:$rt);
47 dag InOperandList = (ins);
48 string AsmString = !strconcat(instr_asm, "\t$rt");
49 list<dag> Pattern = [];
50 InstrItinClass Itinerary = Itin;
54 dag OutOperandList = (outs GPR32Opnd:$rd);
55 dag InOperandList = (ins GPR32Opnd:$rt, uimm1:$u, uimm3:$sel, uimm1:$h);
56 string AsmString = "mftr\t$rd, $rt, $u, $sel, $h";
57 list<dag> Pattern = [];
58 InstrItinClass Itinerary = II_MFTR;
62 dag OutOperandList = (outs GPR32Opnd:$rd);
63 dag InOperandList = (ins GPR32Opnd:$rt, uimm1:$u, uimm3:$sel, uimm1:$h);
64 string AsmString = "mttr\t$rt, $rd, $u, $sel, $h";
65 list<dag> Pattern = [];
66 InstrItinClass Itinerary = II_MTTR;
70 dag OutOperandList = (outs GPR32Opnd:$rs, GPR32Opnd:$rd);
71 dag InOperandList = (ins GPR32Opnd:$rt);
72 string AsmString = "fork\t$rd, $rs, $rt";
73 list<dag> Pattern = [];
74 InstrItinClass Itinerary = II_FORK;
78 dag OutOperandList = (outs GPR32Opnd:$rd);
79 dag InOperandList = (ins GPR32Opnd:$rs);
80 string AsmString = "yield\t$rd, $rs";
81 list<dag> Pattern = [];
82 InstrItinClass Itinerary = II_YIELD;
85 class DMT_DESC : MT_1R_DESC_BASE<"dmt", II_DMT>;
87 class EMT_DESC : MT_1R_DESC_BASE<"emt", II_EMT>;
89 class DVPE_DESC : MT_1R_DESC_BASE<"dvpe", II_DVPE>;
91 class EVPE_DESC : MT_1R_DESC_BASE<"evpe", II_EVPE>;
93 //===----------------------------------------------------------------------===//
94 // MIPS MT Instruction Definitions
95 //===----------------------------------------------------------------------===//
96 let hasSideEffects = 1, isNotDuplicable = 1,
97 AdditionalPredicates = [NotInMicroMips] in {
98 def DMT : DMT_ENC, DMT_DESC, ASE_MT;
100 def EMT : EMT_ENC, EMT_DESC, ASE_MT;
102 def DVPE : DVPE_ENC, DVPE_DESC, ASE_MT;
104 def EVPE : EVPE_ENC, EVPE_DESC, ASE_MT;
106 def FORK : FORK_ENC, FORK_DESC, ASE_MT;
108 def YIELD : YIELD_ENC, YIELD_DESC, ASE_MT;
110 def MFTR : MFTR_ENC, MFTR_DESC, ASE_MT;
112 def MTTR : MTTR_ENC, MTTR_DESC, ASE_MT;
115 //===----------------------------------------------------------------------===//
116 // MIPS MT Pseudo Instructions - used to support mtfr & mttr aliases.
117 //===----------------------------------------------------------------------===//
118 def MFTC0 : MipsAsmPseudoInst<(outs GPR32Opnd:$rd), (ins COP0Opnd:$rt,
120 "mftc0 $rd, $rt, $sel">, ASE_MT;
122 def MFTGPR : MipsAsmPseudoInst<(outs GPR32Opnd:$rd), (ins GPR32Opnd:$rt,
124 "mftgpr $rd, $rt">, ASE_MT;
126 def MFTLO : MipsAsmPseudoInst<(outs GPR32Opnd:$rt), (ins ACC64DSPOpnd:$ac),
127 "mftlo $rt, $ac">, ASE_MT;
129 def MFTHI : MipsAsmPseudoInst<(outs GPR32Opnd:$rt), (ins ACC64DSPOpnd:$ac),
130 "mfthi $rt, $ac">, ASE_MT;
132 def MFTACX : MipsAsmPseudoInst<(outs GPR32Opnd:$rt), (ins ACC64DSPOpnd:$ac),
133 "mftacx $rt, $ac">, ASE_MT;
135 def MFTDSP : MipsAsmPseudoInst<(outs GPR32Opnd:$rt), (ins),
136 "mftdsp $rt">, ASE_MT;
138 def MFTC1 : MipsAsmPseudoInst<(outs GPR32Opnd:$rt), (ins FGR32Opnd:$ft),
139 "mftc1 $rt, $ft">, ASE_MT;
141 def MFTHC1 : MipsAsmPseudoInst<(outs GPR32Opnd:$rt), (ins FGR32Opnd:$ft),
142 "mfthc1 $rt, $ft">, ASE_MT;
144 def CFTC1 : MipsAsmPseudoInst<(outs GPR32Opnd:$rt), (ins FGRCCOpnd:$ft),
145 "cftc1 $rt, $ft">, ASE_MT;
148 def MTTC0 : MipsAsmPseudoInst<(outs COP0Opnd:$rd), (ins GPR32Opnd:$rt,
150 "mttc0 $rt, $rd, $sel">, ASE_MT;
152 def MTTGPR : MipsAsmPseudoInst<(outs GPR32Opnd:$rt), (ins GPR32Opnd:$rd),
153 "mttgpr $rd, $rt">, ASE_MT;
155 def MTTLO : MipsAsmPseudoInst<(outs ACC64DSPOpnd:$ac), (ins GPR32Opnd:$rt),
156 "mttlo $rt, $ac">, ASE_MT;
158 def MTTHI : MipsAsmPseudoInst<(outs ACC64DSPOpnd:$ac), (ins GPR32Opnd:$rt),
159 "mtthi $rt, $ac">, ASE_MT;
161 def MTTACX : MipsAsmPseudoInst<(outs ACC64DSPOpnd:$ac), (ins GPR32Opnd:$rt),
162 "mttacx $rt, $ac">, ASE_MT;
164 def MTTDSP : MipsAsmPseudoInst<(outs), (ins GPR32Opnd:$rt),
165 "mttdsp $rt">, ASE_MT;
167 def MTTC1 : MipsAsmPseudoInst<(outs FGR32Opnd:$ft), (ins GPR32Opnd:$rt),
168 "mttc1 $rt, $ft">, ASE_MT;
170 def MTTHC1 : MipsAsmPseudoInst<(outs FGR32Opnd:$ft), (ins GPR32Opnd:$rt),
171 "mtthc1 $rt, $ft">, ASE_MT;
173 def CTTC1 : MipsAsmPseudoInst<(outs FGRCCOpnd:$ft), (ins GPR32Opnd:$rt),
174 "cttc1 $rt, $ft">, ASE_MT;
176 //===----------------------------------------------------------------------===//
177 // MIPS MT Instruction Definitions
178 //===----------------------------------------------------------------------===//
180 let AdditionalPredicates = [NotInMicroMips] in {
181 def : MipsInstAlias<"dmt", (DMT ZERO), 1>, ASE_MT;
183 def : MipsInstAlias<"emt", (EMT ZERO), 1>, ASE_MT;
185 def : MipsInstAlias<"dvpe", (DVPE ZERO), 1>, ASE_MT;
187 def : MipsInstAlias<"evpe", (EVPE ZERO), 1>, ASE_MT;
189 def : MipsInstAlias<"yield $rs", (YIELD ZERO, GPR32Opnd:$rs), 1>, ASE_MT;
191 def : MipsInstAlias<"mftc0 $rd, $rt", (MFTC0 GPR32Opnd:$rd, COP0Opnd:$rt, 0),
194 def : MipsInstAlias<"mftlo $rt", (MFTLO GPR32Opnd:$rt, AC0), 1>, ASE_MT;
196 def : MipsInstAlias<"mfthi $rt", (MFTHI GPR32Opnd:$rt, AC0), 1>, ASE_MT;
198 def : MipsInstAlias<"mftacx $rt", (MFTACX GPR32Opnd:$rt, AC0), 1>, ASE_MT;
200 def : MipsInstAlias<"mttc0 $rd, $rt", (MTTC0 COP0Opnd:$rt, GPR32Opnd:$rd, 0),
203 def : MipsInstAlias<"mttlo $rt", (MTTLO AC0, GPR32Opnd:$rt), 1>, ASE_MT;
205 def : MipsInstAlias<"mtthi $rt", (MTTHI AC0, GPR32Opnd:$rt), 1>, ASE_MT;
207 def : MipsInstAlias<"mttacx $rt", (MTTACX AC0, GPR32Opnd:$rt), 1>, ASE_MT;