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 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 string BaseOpcode = instr_asm;
82 InstrItinClass Itinerary = itin;
85 class SBE_DESC : STORE_EVA_DESC_BASE<"sbe", GPR32Opnd, null_frag, II_SBE>;
86 class SHE_DESC : STORE_EVA_DESC_BASE<"she", GPR32Opnd, null_frag, II_SHE>;
87 class SWE_DESC : STORE_EVA_DESC_BASE<"swe", GPR32Opnd, null_frag, II_SWE>;
89 // Load/Store Left/Right EVA descriptions
90 class LOAD_LEFT_RIGHT_EVA_DESC_BASE<string instr_asm, RegisterOperand GPROpnd,
91 InstrItinClass itin = NoItinerary> {
92 dag OutOperandList = (outs GPROpnd:$rt);
93 dag InOperandList = (ins mem_simm9:$addr, GPROpnd:$src);
94 string AsmString = !strconcat(instr_asm, "\t$rt, $addr");
95 list<dag> Pattern = [];
96 string DecoderMethod = "DecodeMemEVA";
97 string BaseOpcode = instr_asm;
98 string Constraints = "$src = $rt";
99 bit canFoldAsLoad = 1;
100 InstrItinClass Itinerary = itin;
105 class LWLE_DESC : LOAD_LEFT_RIGHT_EVA_DESC_BASE<"lwle", GPR32Opnd, II_LWLE>;
106 class LWRE_DESC : LOAD_LEFT_RIGHT_EVA_DESC_BASE<"lwre", GPR32Opnd, II_LWRE>;
108 class STORE_LEFT_RIGHT_EVA_DESC_BASE<string instr_asm, RegisterOperand GPROpnd,
109 InstrItinClass itin = NoItinerary> {
110 dag OutOperandList = (outs);
111 dag InOperandList = (ins GPROpnd:$rt, mem_simm9:$addr);
112 string AsmString = !strconcat(instr_asm, "\t$rt, $addr");
113 list<dag> Pattern = [];
114 string DecoderMethod = "DecodeMemEVA";
115 string BaseOpcode = instr_asm;
116 InstrItinClass Itinerary = itin;
121 class SWLE_DESC : STORE_LEFT_RIGHT_EVA_DESC_BASE<"swle", GPR32Opnd, II_SWLE>;
122 class SWRE_DESC : STORE_LEFT_RIGHT_EVA_DESC_BASE<"swre", GPR32Opnd, II_SWRE>;
124 // Load-linked EVA, Store-conditional EVA descriptions
125 class LLE_DESC_BASE<string instr_asm, RegisterOperand GPROpnd,
126 InstrItinClass itin = NoItinerary> {
127 dag OutOperandList = (outs GPROpnd:$rt);
128 dag InOperandList = (ins mem_simm9:$addr);
129 string AsmString = !strconcat(instr_asm, "\t$rt, $addr");
130 list<dag> Pattern = [];
131 string BaseOpcode = instr_asm;
133 string DecoderMethod = "DecodeMemEVA";
134 InstrItinClass Itinerary = itin;
137 class LLE_DESC : LLE_DESC_BASE<"lle", GPR32Opnd, II_LLE>;
139 class SCE_DESC_BASE<string instr_asm, RegisterOperand GPROpnd,
140 InstrItinClass itin = NoItinerary> {
141 dag OutOperandList = (outs GPROpnd:$dst);
142 dag InOperandList = (ins GPROpnd:$rt, mem_simm9:$addr);
143 string AsmString = !strconcat(instr_asm, "\t$rt, $addr");
144 list<dag> Pattern = [];
145 string BaseOpcode = instr_asm;
147 string Constraints = "$rt = $dst";
148 string DecoderMethod = "DecodeMemEVA";
149 InstrItinClass Itinerary = itin;
152 class SCE_DESC : SCE_DESC_BASE<"sce", GPR32Opnd, II_SCE>;
154 class TLB_DESC_BASE<string instr_asm, InstrItinClass itin = NoItinerary> {
155 dag OutOperandList = (outs);
156 dag InOperandList = (ins);
157 string AsmString = instr_asm;
158 list<dag> Pattern = [];
159 InstrItinClass Itinerary = itin;
162 class TLBINV_DESC : TLB_DESC_BASE<"tlbinv", II_TLBINV>;
163 class TLBINVF_DESC : TLB_DESC_BASE<"tlbinvf", II_TLBINVF>;
165 class CACHEE_DESC_BASE<string instr_asm, Operand MemOpnd,
166 InstrItinClass itin = NoItinerary> {
167 dag OutOperandList = (outs);
168 dag InOperandList = (ins MemOpnd:$addr, uimm5:$hint);
169 string AsmString = !strconcat(instr_asm, "\t$hint, $addr");
170 list<dag> Pattern = [];
171 string BaseOpcode = instr_asm;
172 string DecoderMethod = "DecodeCacheeOp_CacheOpR6";
173 InstrItinClass Itinerary = itin;
176 class CACHEE_DESC : CACHEE_DESC_BASE<"cachee", mem_simm9, II_CACHEE>;
177 class PREFE_DESC : CACHEE_DESC_BASE<"prefe", mem_simm9, II_PREFE>;
179 //===----------------------------------------------------------------------===//
181 // Instruction definitions
183 //===----------------------------------------------------------------------===//
185 let AdditionalPredicates = [NotInMicroMips] in {
186 /// Load and Store EVA Instructions
187 def LBE : MMRel, LBE_ENC, LBE_DESC, ISA_MIPS32R2, ASE_EVA;
188 def LBuE : MMRel, LBuE_ENC, LBuE_DESC, ISA_MIPS32R2, ASE_EVA;
189 def LHE : MMRel, LHE_ENC, LHE_DESC, ISA_MIPS32R2, ASE_EVA;
190 def LHuE : MMRel, LHuE_ENC, LHuE_DESC, ISA_MIPS32R2, ASE_EVA;
191 def LWE : MMRel, LWE_ENC, LWE_DESC, ISA_MIPS32R2, ASE_EVA;
192 def SBE : MMRel, SBE_ENC, SBE_DESC, ISA_MIPS32R2, ASE_EVA;
193 def SHE : MMRel, SHE_ENC, SHE_DESC, ISA_MIPS32R2, ASE_EVA;
194 def SWE : MMRel, SWE_ENC, SWE_DESC, ISA_MIPS32R2, ASE_EVA;
196 /// load/store left/right EVA
197 def LWLE : MMRel, LWLE_ENC, LWLE_DESC, ISA_MIPS32R2_NOT_32R6_64R6, ASE_EVA;
198 def LWRE : MMRel, LWRE_ENC, LWRE_DESC, ISA_MIPS32R2_NOT_32R6_64R6, ASE_EVA;
199 def SWLE : MMRel, SWLE_ENC, SWLE_DESC, ISA_MIPS32R2_NOT_32R6_64R6, ASE_EVA;
200 def SWRE : MMRel, SWRE_ENC, SWRE_DESC, ISA_MIPS32R2_NOT_32R6_64R6, ASE_EVA;
202 /// Load-linked EVA, Store-conditional EVA
203 def LLE : MMRel, LLE_ENC, LLE_DESC, ISA_MIPS32R2, ASE_EVA;
204 def SCE : MMRel, SCE_ENC, SCE_DESC, ISA_MIPS32R2, ASE_EVA;
206 /// TLB invalidate instructions
207 def TLBINV : TLBINV_ENC, TLBINV_DESC, ISA_MIPS32R2, ASE_EVA;
208 def TLBINVF : TLBINVF_ENC, TLBINVF_DESC, ISA_MIPS32R2, ASE_EVA;
210 /// EVA versions of cache and pref
211 def CACHEE : MMRel, CACHEE_ENC, CACHEE_DESC, ISA_MIPS32R2, ASE_EVA;
212 def PREFE : MMRel, PREFE_ENC, PREFE_DESC, ISA_MIPS32R2, ASE_EVA;