1//===- MipsEVAInstrInfo.td - EVA ASE instructions -*- tablegen ------------*-=//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file describes Mips EVA ASE instructions.
11//
12//===----------------------------------------------------------------------===//
13
14//===----------------------------------------------------------------------===//
15//
16// Instruction encodings
17//
18//===----------------------------------------------------------------------===//
19
20// Memory Load/Store EVA encodings
21class LBE_ENC     : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_LBE>;
22class LBuE_ENC    : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_LBuE>;
23class LHE_ENC     : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_LHE>;
24class LHuE_ENC    : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_LHuE>;
25class LWE_ENC     : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_LWE>;
26
27class SBE_ENC     : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_SBE>;
28class SHE_ENC     : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_SHE>;
29class SWE_ENC     : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_SWE>;
30
31// load/store left/right EVA encodings
32class LWLE_ENC    : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_LWLE>;
33class LWRE_ENC    : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_LWRE>;
34class SWLE_ENC    : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_SWLE>;
35class SWRE_ENC    : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_SWRE>;
36
37// Load-linked EVA, Store-conditional EVA encodings
38class LLE_ENC     : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_LLE>;
39class SCE_ENC     : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_SCE>;
40
41class TLBINV_ENC  : TLB_FM<OPCODE6_TLBINV>;
42class TLBINVF_ENC : TLB_FM<OPCODE6_TLBINVF>;
43
44class CACHEE_ENC  : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_CACHEE>;
45class PREFE_ENC   : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_PREFE>;
46
47//===----------------------------------------------------------------------===//
48//
49// Instruction descriptions
50//
51//===----------------------------------------------------------------------===//
52
53// Memory Load/Store EVA descriptions
54class LOAD_EVA_DESC_BASE<string instr_asm, RegisterOperand GPROpnd,
55                         InstrItinClass itin = NoItinerary> {
56  dag OutOperandList = (outs GPROpnd:$rt);
57  dag InOperandList = (ins mem_simm9:$addr);
58  string AsmString = !strconcat(instr_asm, "\t$rt, $addr");
59  list<dag> Pattern = [];
60  string DecoderMethod = "DecodeMemEVA";
61  bit canFoldAsLoad = 1;
62  bit mayLoad = 1;
63  InstrItinClass Itinerary = itin;
64}
65
66class LBE_DESC  : LOAD_EVA_DESC_BASE<"lbe",  GPR32Opnd, II_LBE>;
67class LBuE_DESC : LOAD_EVA_DESC_BASE<"lbue", GPR32Opnd, II_LBUE>;
68class LHE_DESC  : LOAD_EVA_DESC_BASE<"lhe",  GPR32Opnd, II_LHE>;
69class LHuE_DESC : LOAD_EVA_DESC_BASE<"lhue", GPR32Opnd, II_LHUE>;
70class LWE_DESC  : LOAD_EVA_DESC_BASE<"lwe",  GPR32Opnd, II_LWE>;
71
72class STORE_EVA_DESC_BASE<string instr_asm, RegisterOperand GPROpnd,
73                          SDPatternOperator OpNode = null_frag,
74                          InstrItinClass itin = NoItinerary> {
75  dag OutOperandList = (outs);
76  dag InOperandList = (ins GPROpnd:$rt, mem_simm9:$addr);
77  string AsmString = !strconcat(instr_asm, "\t$rt, $addr");
78  list<dag> Pattern = [];
79  string DecoderMethod = "DecodeMemEVA";
80  bit mayStore = 1;
81  InstrItinClass Itinerary = itin;
82}
83
84class SBE_DESC  : STORE_EVA_DESC_BASE<"sbe",  GPR32Opnd, null_frag, II_SBE>;
85class SHE_DESC  : STORE_EVA_DESC_BASE<"she",  GPR32Opnd, null_frag, II_SHE>;
86class SWE_DESC  : STORE_EVA_DESC_BASE<"swe",  GPR32Opnd, null_frag, II_SWE>;
87
88// Load/Store Left/Right EVA descriptions
89class LOAD_LEFT_RIGHT_EVA_DESC_BASE<string instr_asm, RegisterOperand GPROpnd,
90                                    InstrItinClass itin = NoItinerary> {
91  dag OutOperandList = (outs GPROpnd:$rt);
92  dag InOperandList = (ins mem_simm9:$addr, GPROpnd:$src);
93  string AsmString = !strconcat(instr_asm, "\t$rt, $addr");
94  list<dag> Pattern = [];
95  string DecoderMethod = "DecodeMemEVA";
96  string Constraints = "$src = $rt";
97  bit canFoldAsLoad = 1;
98  InstrItinClass Itinerary = itin;
99}
100
101class LWLE_DESC  : LOAD_LEFT_RIGHT_EVA_DESC_BASE<"lwle",  GPR32Opnd, II_LWLE>;
102class LWRE_DESC  : LOAD_LEFT_RIGHT_EVA_DESC_BASE<"lwre",  GPR32Opnd, II_LWRE>;
103
104class STORE_LEFT_RIGHT_EVA_DESC_BASE<string instr_asm, RegisterOperand GPROpnd,
105                                     InstrItinClass itin = NoItinerary> {
106  dag OutOperandList = (outs);
107  dag InOperandList = (ins GPROpnd:$rt, mem_simm9:$addr);
108  string AsmString = !strconcat(instr_asm, "\t$rt, $addr");
109  list<dag> Pattern = [];
110  string DecoderMethod = "DecodeMemEVA";
111  InstrItinClass Itinerary = itin;
112}
113
114class SWLE_DESC  : LOAD_LEFT_RIGHT_EVA_DESC_BASE<"swle",  GPR32Opnd, II_SWLE>;
115class SWRE_DESC  : LOAD_LEFT_RIGHT_EVA_DESC_BASE<"swre",  GPR32Opnd, II_SWRE>;
116
117// Load-linked EVA, Store-conditional EVA descriptions
118class LLE_DESC_BASE<string instr_asm, RegisterOperand GPROpnd,
119                    InstrItinClass itin = NoItinerary> {
120  dag OutOperandList = (outs GPROpnd:$rt);
121  dag InOperandList = (ins mem_simm9:$addr);
122  string AsmString = !strconcat(instr_asm, "\t$rt, $addr");
123  list<dag> Pattern = [];
124  bit mayLoad = 1;
125  string DecoderMethod = "DecodeMemEVA";
126  InstrItinClass Itinerary = itin;
127}
128
129class LLE_DESC : LLE_DESC_BASE<"lle", GPR32Opnd, II_LLE>;
130
131class SCE_DESC_BASE<string instr_asm, RegisterOperand GPROpnd,
132                    InstrItinClass itin = NoItinerary> {
133  dag OutOperandList = (outs GPROpnd:$dst);
134  dag InOperandList = (ins GPROpnd:$rt, mem_simm9:$addr);
135  string AsmString = !strconcat(instr_asm, "\t$rt, $addr");
136  list<dag> Pattern = [];
137  bit mayStore = 1;
138  string Constraints = "$rt = $dst";
139  string DecoderMethod = "DecodeMemEVA";
140  InstrItinClass Itinerary = itin;
141}
142
143class SCE_DESC : SCE_DESC_BASE<"sce", GPR32Opnd, II_SCE>;
144
145class TLB_DESC_BASE<string instr_asm, InstrItinClass itin = NoItinerary> {
146  dag OutOperandList = (outs);
147  dag InOperandList = (ins);
148  string AsmString = instr_asm;
149  list<dag> Pattern = [];
150  InstrItinClass Itinerary = itin;
151}
152
153class TLBINV_DESC  : TLB_DESC_BASE<"tlbinv", II_TLBINV>;
154class TLBINVF_DESC : TLB_DESC_BASE<"tlbinvf", II_TLBINVF>;
155
156class CACHEE_DESC_BASE<string instr_asm, Operand MemOpnd,
157                       InstrItinClass itin = NoItinerary> {
158  dag OutOperandList = (outs);
159  dag InOperandList = (ins  MemOpnd:$addr, uimm5:$hint);
160  string AsmString = !strconcat(instr_asm, "\t$hint, $addr");
161  list<dag> Pattern = [];
162  string DecoderMethod = "DecodeCacheeOp_CacheOpR6";
163  InstrItinClass Itinerary = itin;
164}
165
166class CACHEE_DESC  : CACHEE_DESC_BASE<"cachee", mem_simm9, II_CACHEE>;
167class PREFE_DESC   : CACHEE_DESC_BASE<"prefe", mem_simm9, II_PREFE>;
168
169//===----------------------------------------------------------------------===//
170//
171// Instruction definitions
172//
173//===----------------------------------------------------------------------===//
174
175/// Load and Store EVA Instructions
176def LBE     : LBE_ENC, LBE_DESC, INSN_EVA;
177def LBuE    : LBuE_ENC, LBuE_DESC, INSN_EVA;
178def LHE     : LHE_ENC, LHE_DESC, INSN_EVA;
179def LHuE    : LHuE_ENC, LHuE_DESC, INSN_EVA;
180let AdditionalPredicates = [NotInMicroMips] in {
181def LWE     : LWE_ENC, LWE_DESC, INSN_EVA;
182}
183def SBE     : SBE_ENC, SBE_DESC, INSN_EVA;
184def SHE     : SHE_ENC, SHE_DESC, INSN_EVA;
185let AdditionalPredicates = [NotInMicroMips] in {
186def SWE     : SWE_ENC, SWE_DESC, INSN_EVA;
187}
188
189/// load/store left/right EVA
190let AdditionalPredicates = [NotInMicroMips] in {
191def LWLE    : LWLE_ENC, LWLE_DESC, INSN_EVA_NOT_32R6_64R6;
192def LWRE    : LWRE_ENC, LWRE_DESC, INSN_EVA_NOT_32R6_64R6;
193def SWLE    : SWLE_ENC, SWLE_DESC, INSN_EVA_NOT_32R6_64R6;
194def SWRE    : SWRE_ENC, SWRE_DESC, INSN_EVA_NOT_32R6_64R6;
195}
196
197/// Load-linked EVA, Store-conditional EVA
198let AdditionalPredicates = [NotInMicroMips] in {
199def LLE     : LLE_ENC, LLE_DESC, INSN_EVA;
200def SCE     : SCE_ENC, SCE_DESC, INSN_EVA;
201}
202
203let AdditionalPredicates = [NotInMicroMips] in {
204  def TLBINV  : TLBINV_ENC, TLBINV_DESC, INSN_EVA;
205  def TLBINVF : TLBINVF_ENC, TLBINVF_DESC, INSN_EVA;
206}
207
208def CACHEE  : CACHEE_ENC, CACHEE_DESC, INSN_EVA;
209def PREFE   : PREFE_ENC, PREFE_DESC, INSN_EVA;
210