xref: /freebsd/contrib/llvm-project/llvm/lib/Target/Mips/MipsEVAInstrInfo.td (revision bdd1243df58e60e85101c09001d9812a789b6bc4)
10b57cec5SDimitry Andric//===- MipsEVAInstrInfo.td - EVA ASE instructions -*- tablegen ------------*-=//
20b57cec5SDimitry Andric//
30b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric//
70b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric//
90b57cec5SDimitry Andric// This file describes Mips EVA ASE instructions.
100b57cec5SDimitry Andric//
110b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
120b57cec5SDimitry Andric
130b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
140b57cec5SDimitry Andric//
150b57cec5SDimitry Andric// Instruction encodings
160b57cec5SDimitry Andric//
170b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
180b57cec5SDimitry Andric
190b57cec5SDimitry Andric// Memory Load/Store EVA encodings
200b57cec5SDimitry Andricclass LBE_ENC     : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_LBE>;
210b57cec5SDimitry Andricclass LBuE_ENC    : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_LBuE>;
220b57cec5SDimitry Andricclass LHE_ENC     : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_LHE>;
230b57cec5SDimitry Andricclass LHuE_ENC    : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_LHuE>;
240b57cec5SDimitry Andricclass LWE_ENC     : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_LWE>;
250b57cec5SDimitry Andric
260b57cec5SDimitry Andricclass SBE_ENC     : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_SBE>;
270b57cec5SDimitry Andricclass SHE_ENC     : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_SHE>;
280b57cec5SDimitry Andricclass SWE_ENC     : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_SWE>;
290b57cec5SDimitry Andric
300b57cec5SDimitry Andric// load/store left/right EVA encodings
310b57cec5SDimitry Andricclass LWLE_ENC    : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_LWLE>;
320b57cec5SDimitry Andricclass LWRE_ENC    : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_LWRE>;
330b57cec5SDimitry Andricclass SWLE_ENC    : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_SWLE>;
340b57cec5SDimitry Andricclass SWRE_ENC    : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_SWRE>;
350b57cec5SDimitry Andric
360b57cec5SDimitry Andric// Load-linked EVA, Store-conditional EVA encodings
370b57cec5SDimitry Andricclass LLE_ENC     : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_LLE>;
380b57cec5SDimitry Andricclass SCE_ENC     : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_SCE>;
390b57cec5SDimitry Andric
400b57cec5SDimitry Andricclass TLBINV_ENC  : TLB_FM<OPCODE6_TLBINV>;
410b57cec5SDimitry Andricclass TLBINVF_ENC : TLB_FM<OPCODE6_TLBINVF>;
420b57cec5SDimitry Andric
430b57cec5SDimitry Andricclass CACHEE_ENC  : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_CACHEE>;
440b57cec5SDimitry Andricclass PREFE_ENC   : SPECIAL3_EVA_LOAD_STORE_FM<OPCODE6_PREFE>;
450b57cec5SDimitry Andric
460b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
470b57cec5SDimitry Andric//
480b57cec5SDimitry Andric// Instruction descriptions
490b57cec5SDimitry Andric//
500b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
510b57cec5SDimitry Andric
520b57cec5SDimitry Andric// Memory Load/Store EVA descriptions
530b57cec5SDimitry Andricclass LOAD_EVA_DESC_BASE<string instr_asm, RegisterOperand GPROpnd,
540b57cec5SDimitry Andric                         InstrItinClass itin = NoItinerary> {
550b57cec5SDimitry Andric  dag OutOperandList = (outs GPROpnd:$rt);
560b57cec5SDimitry Andric  dag InOperandList = (ins mem_simm9:$addr);
570b57cec5SDimitry Andric  string AsmString = !strconcat(instr_asm, "\t$rt, $addr");
580b57cec5SDimitry Andric  list<dag> Pattern = [];
590b57cec5SDimitry Andric  string DecoderMethod = "DecodeMemEVA";
600b57cec5SDimitry Andric  bit canFoldAsLoad = 1;
610b57cec5SDimitry Andric  string BaseOpcode = instr_asm;
620b57cec5SDimitry Andric  bit mayLoad = 1;
630b57cec5SDimitry Andric  InstrItinClass Itinerary = itin;
640b57cec5SDimitry Andric}
650b57cec5SDimitry Andric
660b57cec5SDimitry Andricclass LBE_DESC  : LOAD_EVA_DESC_BASE<"lbe",  GPR32Opnd, II_LBE>;
670b57cec5SDimitry Andricclass LBuE_DESC : LOAD_EVA_DESC_BASE<"lbue", GPR32Opnd, II_LBUE>;
680b57cec5SDimitry Andricclass LHE_DESC  : LOAD_EVA_DESC_BASE<"lhe",  GPR32Opnd, II_LHE>;
690b57cec5SDimitry Andricclass LHuE_DESC : LOAD_EVA_DESC_BASE<"lhue", GPR32Opnd, II_LHUE>;
700b57cec5SDimitry Andricclass LWE_DESC  : LOAD_EVA_DESC_BASE<"lwe",  GPR32Opnd, II_LWE>;
710b57cec5SDimitry Andric
720b57cec5SDimitry Andricclass STORE_EVA_DESC_BASE<string instr_asm, RegisterOperand GPROpnd,
73349cc55cSDimitry Andric                          InstrItinClass itin> {
740b57cec5SDimitry Andric  dag OutOperandList = (outs);
750b57cec5SDimitry Andric  dag InOperandList = (ins GPROpnd:$rt, mem_simm9:$addr);
760b57cec5SDimitry Andric  string AsmString = !strconcat(instr_asm, "\t$rt, $addr");
770b57cec5SDimitry Andric  list<dag> Pattern = [];
780b57cec5SDimitry Andric  string DecoderMethod = "DecodeMemEVA";
790b57cec5SDimitry Andric  string BaseOpcode = instr_asm;
800b57cec5SDimitry Andric  bit mayStore = 1;
810b57cec5SDimitry Andric  InstrItinClass Itinerary = itin;
820b57cec5SDimitry Andric}
830b57cec5SDimitry Andric
84349cc55cSDimitry Andricclass SBE_DESC : STORE_EVA_DESC_BASE<"sbe", GPR32Opnd, II_SBE>;
85349cc55cSDimitry Andricclass SHE_DESC : STORE_EVA_DESC_BASE<"she", GPR32Opnd, II_SHE>;
86349cc55cSDimitry Andricclass SWE_DESC : STORE_EVA_DESC_BASE<"swe", GPR32Opnd, II_SWE>;
870b57cec5SDimitry Andric
880b57cec5SDimitry Andric// Load/Store Left/Right EVA descriptions
890b57cec5SDimitry Andricclass LOAD_LEFT_RIGHT_EVA_DESC_BASE<string instr_asm, RegisterOperand GPROpnd,
900b57cec5SDimitry Andric                                    InstrItinClass itin = NoItinerary> {
910b57cec5SDimitry Andric  dag OutOperandList = (outs GPROpnd:$rt);
920b57cec5SDimitry Andric  dag InOperandList = (ins mem_simm9:$addr, GPROpnd:$src);
930b57cec5SDimitry Andric  string AsmString = !strconcat(instr_asm, "\t$rt, $addr");
940b57cec5SDimitry Andric  list<dag> Pattern = [];
950b57cec5SDimitry Andric  string DecoderMethod = "DecodeMemEVA";
960b57cec5SDimitry Andric  string BaseOpcode = instr_asm;
970b57cec5SDimitry Andric  string Constraints = "$src = $rt";
980b57cec5SDimitry Andric  bit canFoldAsLoad = 1;
990b57cec5SDimitry Andric  InstrItinClass Itinerary = itin;
1000b57cec5SDimitry Andric  bit mayLoad = 1;
1010b57cec5SDimitry Andric  bit mayStore = 0;
1020b57cec5SDimitry Andric}
1030b57cec5SDimitry Andric
1040b57cec5SDimitry Andricclass LWLE_DESC : LOAD_LEFT_RIGHT_EVA_DESC_BASE<"lwle", GPR32Opnd, II_LWLE>;
1050b57cec5SDimitry Andricclass LWRE_DESC : LOAD_LEFT_RIGHT_EVA_DESC_BASE<"lwre", GPR32Opnd, II_LWRE>;
1060b57cec5SDimitry Andric
1070b57cec5SDimitry Andricclass STORE_LEFT_RIGHT_EVA_DESC_BASE<string instr_asm, RegisterOperand GPROpnd,
1080b57cec5SDimitry Andric                                     InstrItinClass itin = NoItinerary> {
1090b57cec5SDimitry Andric  dag OutOperandList = (outs);
1100b57cec5SDimitry Andric  dag InOperandList = (ins GPROpnd:$rt, mem_simm9:$addr);
1110b57cec5SDimitry Andric  string AsmString = !strconcat(instr_asm, "\t$rt, $addr");
1120b57cec5SDimitry Andric  list<dag> Pattern = [];
1130b57cec5SDimitry Andric  string DecoderMethod = "DecodeMemEVA";
1140b57cec5SDimitry Andric  string BaseOpcode = instr_asm;
1150b57cec5SDimitry Andric  InstrItinClass Itinerary = itin;
1160b57cec5SDimitry Andric  bit mayLoad = 0;
1170b57cec5SDimitry Andric  bit mayStore = 1;
1180b57cec5SDimitry Andric}
1190b57cec5SDimitry Andric
1200b57cec5SDimitry Andricclass SWLE_DESC : STORE_LEFT_RIGHT_EVA_DESC_BASE<"swle", GPR32Opnd, II_SWLE>;
1210b57cec5SDimitry Andricclass SWRE_DESC : STORE_LEFT_RIGHT_EVA_DESC_BASE<"swre", GPR32Opnd, II_SWRE>;
1220b57cec5SDimitry Andric
1230b57cec5SDimitry Andric// Load-linked EVA, Store-conditional EVA descriptions
1240b57cec5SDimitry Andricclass LLE_DESC_BASE<string instr_asm, RegisterOperand GPROpnd,
1250b57cec5SDimitry Andric                    InstrItinClass itin = NoItinerary> {
1260b57cec5SDimitry Andric  dag OutOperandList = (outs GPROpnd:$rt);
1270b57cec5SDimitry Andric  dag InOperandList = (ins mem_simm9:$addr);
1280b57cec5SDimitry Andric  string AsmString = !strconcat(instr_asm, "\t$rt, $addr");
1290b57cec5SDimitry Andric  list<dag> Pattern = [];
1300b57cec5SDimitry Andric  string BaseOpcode = instr_asm;
1310b57cec5SDimitry Andric  bit mayLoad = 1;
1320b57cec5SDimitry Andric  string DecoderMethod = "DecodeMemEVA";
1330b57cec5SDimitry Andric  InstrItinClass Itinerary = itin;
1340b57cec5SDimitry Andric}
1350b57cec5SDimitry Andric
1360b57cec5SDimitry Andricclass LLE_DESC : LLE_DESC_BASE<"lle", GPR32Opnd, II_LLE>;
1370b57cec5SDimitry Andric
1380b57cec5SDimitry Andricclass SCE_DESC_BASE<string instr_asm, RegisterOperand GPROpnd,
1390b57cec5SDimitry Andric                    InstrItinClass itin = NoItinerary> {
1400b57cec5SDimitry Andric  dag OutOperandList = (outs GPROpnd:$dst);
1410b57cec5SDimitry Andric  dag InOperandList = (ins GPROpnd:$rt, mem_simm9:$addr);
1420b57cec5SDimitry Andric  string AsmString = !strconcat(instr_asm, "\t$rt, $addr");
1430b57cec5SDimitry Andric  list<dag> Pattern = [];
1440b57cec5SDimitry Andric  string BaseOpcode = instr_asm;
1450b57cec5SDimitry Andric  bit mayStore = 1;
1460b57cec5SDimitry Andric  string Constraints = "$rt = $dst";
1470b57cec5SDimitry Andric  string DecoderMethod = "DecodeMemEVA";
1480b57cec5SDimitry Andric  InstrItinClass Itinerary = itin;
1490b57cec5SDimitry Andric}
1500b57cec5SDimitry Andric
1510b57cec5SDimitry Andricclass SCE_DESC : SCE_DESC_BASE<"sce", GPR32Opnd, II_SCE>;
1520b57cec5SDimitry Andric
1530b57cec5SDimitry Andricclass TLB_DESC_BASE<string instr_asm, InstrItinClass itin = NoItinerary> {
1540b57cec5SDimitry Andric  dag OutOperandList = (outs);
1550b57cec5SDimitry Andric  dag InOperandList = (ins);
1560b57cec5SDimitry Andric  string AsmString = instr_asm;
1570b57cec5SDimitry Andric  list<dag> Pattern = [];
1580b57cec5SDimitry Andric  InstrItinClass Itinerary = itin;
1590b57cec5SDimitry Andric}
1600b57cec5SDimitry Andric
1610b57cec5SDimitry Andricclass TLBINV_DESC  : TLB_DESC_BASE<"tlbinv", II_TLBINV>;
1620b57cec5SDimitry Andricclass TLBINVF_DESC : TLB_DESC_BASE<"tlbinvf", II_TLBINVF>;
1630b57cec5SDimitry Andric
1640b57cec5SDimitry Andricclass CACHEE_DESC_BASE<string instr_asm, Operand MemOpnd,
1650b57cec5SDimitry Andric                       InstrItinClass itin = NoItinerary> {
166*bdd1243dSDimitry Andric  // CACHEE puts the "hint" immediate where the encoding would otherwise have "rt"
167*bdd1243dSDimitry Andric  bits<5> hint;
168*bdd1243dSDimitry Andric  bits<5> rt = hint;
169*bdd1243dSDimitry Andric
1700b57cec5SDimitry Andric  dag OutOperandList = (outs);
1710b57cec5SDimitry Andric  dag InOperandList = (ins  MemOpnd:$addr, uimm5:$hint);
1720b57cec5SDimitry Andric  string AsmString = !strconcat(instr_asm, "\t$hint, $addr");
1730b57cec5SDimitry Andric  list<dag> Pattern = [];
1740b57cec5SDimitry Andric  string BaseOpcode = instr_asm;
1750b57cec5SDimitry Andric  string DecoderMethod = "DecodeCacheeOp_CacheOpR6";
1760b57cec5SDimitry Andric  InstrItinClass Itinerary = itin;
1770b57cec5SDimitry Andric}
1780b57cec5SDimitry Andric
1790b57cec5SDimitry Andricclass CACHEE_DESC  : CACHEE_DESC_BASE<"cachee", mem_simm9, II_CACHEE>;
1800b57cec5SDimitry Andricclass PREFE_DESC   : CACHEE_DESC_BASE<"prefe", mem_simm9, II_PREFE>;
1810b57cec5SDimitry Andric
1820b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
1830b57cec5SDimitry Andric//
1840b57cec5SDimitry Andric// Instruction definitions
1850b57cec5SDimitry Andric//
1860b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
1870b57cec5SDimitry Andric
1880b57cec5SDimitry Andriclet AdditionalPredicates = [NotInMicroMips] in {
1890b57cec5SDimitry Andric  /// Load and Store EVA Instructions
1900b57cec5SDimitry Andric  def LBE     : MMRel, LBE_ENC, LBE_DESC, ISA_MIPS32R2, ASE_EVA;
1910b57cec5SDimitry Andric  def LBuE    : MMRel, LBuE_ENC, LBuE_DESC, ISA_MIPS32R2, ASE_EVA;
1920b57cec5SDimitry Andric  def LHE     : MMRel, LHE_ENC, LHE_DESC, ISA_MIPS32R2, ASE_EVA;
1930b57cec5SDimitry Andric  def LHuE    : MMRel, LHuE_ENC, LHuE_DESC, ISA_MIPS32R2, ASE_EVA;
1940b57cec5SDimitry Andric  def LWE     : MMRel, LWE_ENC, LWE_DESC, ISA_MIPS32R2, ASE_EVA;
1950b57cec5SDimitry Andric  def SBE     : MMRel, SBE_ENC, SBE_DESC, ISA_MIPS32R2, ASE_EVA;
1960b57cec5SDimitry Andric  def SHE     : MMRel, SHE_ENC, SHE_DESC, ISA_MIPS32R2, ASE_EVA;
1970b57cec5SDimitry Andric  def SWE     : MMRel, SWE_ENC, SWE_DESC, ISA_MIPS32R2, ASE_EVA;
1980b57cec5SDimitry Andric
1990b57cec5SDimitry Andric  /// load/store left/right EVA
2000b57cec5SDimitry Andric  def LWLE    : MMRel, LWLE_ENC, LWLE_DESC, ISA_MIPS32R2_NOT_32R6_64R6, ASE_EVA;
2010b57cec5SDimitry Andric  def LWRE    : MMRel, LWRE_ENC, LWRE_DESC, ISA_MIPS32R2_NOT_32R6_64R6, ASE_EVA;
2020b57cec5SDimitry Andric  def SWLE    : MMRel, SWLE_ENC, SWLE_DESC, ISA_MIPS32R2_NOT_32R6_64R6, ASE_EVA;
2030b57cec5SDimitry Andric  def SWRE    : MMRel, SWRE_ENC, SWRE_DESC, ISA_MIPS32R2_NOT_32R6_64R6, ASE_EVA;
2040b57cec5SDimitry Andric
2050b57cec5SDimitry Andric  /// Load-linked EVA, Store-conditional EVA
2060b57cec5SDimitry Andric  def LLE     : MMRel, LLE_ENC, LLE_DESC, ISA_MIPS32R2, ASE_EVA;
2070b57cec5SDimitry Andric  def SCE     : MMRel, SCE_ENC, SCE_DESC, ISA_MIPS32R2, ASE_EVA;
2080b57cec5SDimitry Andric
2090b57cec5SDimitry Andric  /// TLB invalidate instructions
2100b57cec5SDimitry Andric  def TLBINV  : TLBINV_ENC, TLBINV_DESC, ISA_MIPS32R2, ASE_EVA;
2110b57cec5SDimitry Andric  def TLBINVF : TLBINVF_ENC, TLBINVF_DESC, ISA_MIPS32R2, ASE_EVA;
2120b57cec5SDimitry Andric
2130b57cec5SDimitry Andric  /// EVA versions of cache and pref
2140b57cec5SDimitry Andric  def CACHEE  : MMRel, CACHEE_ENC, CACHEE_DESC, ISA_MIPS32R2, ASE_EVA;
2150b57cec5SDimitry Andric  def PREFE   : MMRel, PREFE_ENC, PREFE_DESC, ISA_MIPS32R2, ASE_EVA;
2160b57cec5SDimitry Andric}
217