1 //===- MipsEVAInstrInfo.td - EVA ASE instructions -*- tablegen ------------*-=//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This file describes Mips EVA ASE instructions.
11 //===----------------------------------------------------------------------===//
13 //===----------------------------------------------------------------------===//
15 // Instruction encodings
17 //===----------------------------------------------------------------------===//
19 // Memory Load/Store EVA encodings
20 class LBE_ENC : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_LBE>;
21 class LBuE_ENC : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_LBuE>;
22 class LHE_ENC : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_LHE>;
23 class LHuE_ENC : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_LHuE>;
24 class LWE_ENC : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_LWE>;
26 class SBE_ENC : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_SBE>;
27 class SHE_ENC : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_SHE>;
28 class SWE_ENC : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_SWE>;
30 // load/store left/right EVA encodings
31 class LWLE_ENC : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_LWLE>;
32 class LWRE_ENC : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_LWRE>;
33 class SWLE_ENC : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_SWLE>;
34 class SWRE_ENC : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_SWRE>;
36 // Load-linked EVA, Store-conditional EVA encodings
37 class LLE_ENC : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_LLE>;
38 class SCE_ENC : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_SCE>;
40 class TLBINV_ENC : TLB_FM<OPCODE6_TLBINV>;
41 class TLBINVF_ENC : TLB_FM<OPCODE6_TLBINVF>;
43 class CACHEE_ENC : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_CACHEE>;
44 class PREFE_ENC : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_PREFE>;
46 //===----------------------------------------------------------------------===//
48 // Instruction descriptions
50 //===----------------------------------------------------------------------===//
52 // Memory Load/Store EVA descriptions
53 class LOAD_EVA_DESC_BASE<string instr_asm, RegisterOperand GPROpnd,
54 InstrItinClass itin = NoItinerary> {
55 dag OutOperandList = (outs GPROpnd:$rt);
56 dag InOperandList = (ins mem_simm9:$addr);
57 string AsmString = !strconcat(instr_asm, "\t$rt, $addr");
58 list<dag> Pattern = [];
59 string DecoderMethod = "DecodeMemEVA";
60 bit canFoldAsLoad = 1;
61 string BaseOpcode = instr_asm;
63 InstrItinClass Itinerary = itin;
66 class LBE_DESC : LOAD_EVA_DESC_BASE<"lbe", GPR32Opnd, II_LBE>;
67 class LBuE_DESC : LOAD_EVA_DESC_BASE<"lbue", GPR32Opnd, II_LBUE>;
68 class LHE_DESC : LOAD_EVA_DESC_BASE<"lhe", GPR32Opnd, II_LHE>;
69 class LHuE_DESC : LOAD_EVA_DESC_BASE<"lhue", GPR32Opnd, II_LHUE>;
70 class LWE_DESC : LOAD_EVA_DESC_BASE<"lwe", GPR32Opnd, II_LWE>;
72 class STORE_EVA_DESC_BASE<string instr_asm, RegisterOperand GPROpnd,
73 InstrItinClass itin> {
74 dag OutOperandList = (outs);
75 dag InOperandList = (ins GPROpnd:$rt, mem_simm9:$addr);
76 string AsmString = !strconcat(instr_asm, "\t$rt, $addr");
77 list<dag> Pattern = [];
78 string DecoderMethod = "DecodeMemEVA";
79 string BaseOpcode = instr_asm;
81 InstrItinClass Itinerary = itin;
84 class SBE_DESC : STORE_EVA_DESC_BASE<"sbe", GPR32Opnd, II_SBE>;
85 class SHE_DESC : STORE_EVA_DESC_BASE<"she", GPR32Opnd, II_SHE>;
86 class SWE_DESC : STORE_EVA_DESC_BASE<"swe", GPR32Opnd, II_SWE>;
88 // Load/Store Left/Right EVA descriptions
89 class 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 BaseOpcode = instr_asm;
97 string Constraints = "$src = $rt";
98 bit canFoldAsLoad = 1;
99 InstrItinClass Itinerary = itin;
104 class LWLE_DESC : LOAD_LEFT_RIGHT_EVA_DESC_BASE<"lwle", GPR32Opnd, II_LWLE>;
105 class LWRE_DESC : LOAD_LEFT_RIGHT_EVA_DESC_BASE<"lwre", GPR32Opnd, II_LWRE>;
107 class STORE_LEFT_RIGHT_EVA_DESC_BASE<string instr_asm, RegisterOperand GPROpnd,
108 InstrItinClass itin = NoItinerary> {
109 dag OutOperandList = (outs);
110 dag InOperandList = (ins GPROpnd:$rt, mem_simm9:$addr);
111 string AsmString = !strconcat(instr_asm, "\t$rt, $addr");
112 list<dag> Pattern = [];
113 string DecoderMethod = "DecodeMemEVA";
114 string BaseOpcode = instr_asm;
115 InstrItinClass Itinerary = itin;
120 class SWLE_DESC : STORE_LEFT_RIGHT_EVA_DESC_BASE<"swle", GPR32Opnd, II_SWLE>;
121 class SWRE_DESC : STORE_LEFT_RIGHT_EVA_DESC_BASE<"swre", GPR32Opnd, II_SWRE>;
123 // Load-linked EVA, Store-conditional EVA descriptions
124 class LLE_DESC_BASE<string instr_asm, RegisterOperand GPROpnd,
125 InstrItinClass itin = NoItinerary> {
126 dag OutOperandList = (outs GPROpnd:$rt);
127 dag InOperandList = (ins mem_simm9:$addr);
128 string AsmString = !strconcat(instr_asm, "\t$rt, $addr");
129 list<dag> Pattern = [];
130 string BaseOpcode = instr_asm;
132 string DecoderMethod = "DecodeMemEVA";
133 InstrItinClass Itinerary = itin;
136 class LLE_DESC : LLE_DESC_BASE<"lle", GPR32Opnd, II_LLE>;
138 class SCE_DESC_BASE<string instr_asm, RegisterOperand GPROpnd,
139 InstrItinClass itin = NoItinerary> {
140 dag OutOperandList = (outs GPROpnd:$dst);
141 dag InOperandList = (ins GPROpnd:$rt, mem_simm9:$addr);
142 string AsmString = !strconcat(instr_asm, "\t$rt, $addr");
143 list<dag> Pattern = [];
144 string BaseOpcode = instr_asm;
146 string Constraints = "$rt = $dst";
147 string DecoderMethod = "DecodeMemEVA";
148 InstrItinClass Itinerary = itin;
151 class SCE_DESC : SCE_DESC_BASE<"sce", GPR32Opnd, II_SCE>;
153 class TLB_DESC_BASE<string instr_asm, InstrItinClass itin = NoItinerary> {
154 dag OutOperandList = (outs);
155 dag InOperandList = (ins);
156 string AsmString = instr_asm;
157 list<dag> Pattern = [];
158 InstrItinClass Itinerary = itin;
161 class TLBINV_DESC : TLB_DESC_BASE<"tlbinv", II_TLBINV>;
162 class TLBINVF_DESC : TLB_DESC_BASE<"tlbinvf", II_TLBINVF>;
164 class CACHEE_DESC_BASE<string instr_asm, Operand MemOpnd,
165 InstrItinClass itin = NoItinerary> {
166 // CACHEE puts the "hint" immediate where the encoding would otherwise have "rt"
170 dag OutOperandList = (outs);
171 dag InOperandList = (ins MemOpnd:$addr, uimm5:$hint);
172 string AsmString = !strconcat(instr_asm, "\t$hint, $addr");
173 list<dag> Pattern = [];
174 string BaseOpcode = instr_asm;
175 string DecoderMethod = "DecodeCacheeOp_CacheOpR6";
176 InstrItinClass Itinerary = itin;
179 class CACHEE_DESC : CACHEE_DESC_BASE<"cachee", mem_simm9, II_CACHEE>;
180 class PREFE_DESC : CACHEE_DESC_BASE<"prefe", mem_simm9, II_PREFE>;
182 //===----------------------------------------------------------------------===//
184 // Instruction definitions
186 //===----------------------------------------------------------------------===//
188 let AdditionalPredicates = [NotInMicroMips] in {
189 /// Load and Store EVA Instructions
190 def LBE : MMRel, LBE_ENC, LBE_DESC, ISA_MIPS32R2, ASE_EVA;
191 def LBuE : MMRel, LBuE_ENC, LBuE_DESC, ISA_MIPS32R2, ASE_EVA;
192 def LHE : MMRel, LHE_ENC, LHE_DESC, ISA_MIPS32R2, ASE_EVA;
193 def LHuE : MMRel, LHuE_ENC, LHuE_DESC, ISA_MIPS32R2, ASE_EVA;
194 def LWE : MMRel, LWE_ENC, LWE_DESC, ISA_MIPS32R2, ASE_EVA;
195 def SBE : MMRel, SBE_ENC, SBE_DESC, ISA_MIPS32R2, ASE_EVA;
196 def SHE : MMRel, SHE_ENC, SHE_DESC, ISA_MIPS32R2, ASE_EVA;
197 def SWE : MMRel, SWE_ENC, SWE_DESC, ISA_MIPS32R2, ASE_EVA;
199 /// load/store left/right EVA
200 def LWLE : MMRel, LWLE_ENC, LWLE_DESC, ISA_MIPS32R2_NOT_32R6_64R6, ASE_EVA;
201 def LWRE : MMRel, LWRE_ENC, LWRE_DESC, ISA_MIPS32R2_NOT_32R6_64R6, ASE_EVA;
202 def SWLE : MMRel, SWLE_ENC, SWLE_DESC, ISA_MIPS32R2_NOT_32R6_64R6, ASE_EVA;
203 def SWRE : MMRel, SWRE_ENC, SWRE_DESC, ISA_MIPS32R2_NOT_32R6_64R6, ASE_EVA;
205 /// Load-linked EVA, Store-conditional EVA
206 def LLE : MMRel, LLE_ENC, LLE_DESC, ISA_MIPS32R2, ASE_EVA;
207 def SCE : MMRel, SCE_ENC, SCE_DESC, ISA_MIPS32R2, ASE_EVA;
209 /// TLB invalidate instructions
210 def TLBINV : TLBINV_ENC, TLBINV_DESC, ISA_MIPS32R2, ASE_EVA;
211 def TLBINVF : TLBINVF_ENC, TLBINVF_DESC, ISA_MIPS32R2, ASE_EVA;
213 /// EVA versions of cache and pref
214 def CACHEE : MMRel, CACHEE_ENC, CACHEE_DESC, ISA_MIPS32R2, ASE_EVA;
215 def PREFE : MMRel, PREFE_ENC, PREFE_DESC, ISA_MIPS32R2, ASE_EVA;