1 //=- Mips32r6InstrFormats.td - Mips32r6 Instruction Formats -*- 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 Mips32r6 instruction formats.
12 //===----------------------------------------------------------------------===//
14 class MipsR6Inst : MipsInst<(outs), (ins), "", [], NoItinerary, FrmOther>,
16 let DecoderNamespace = "Mips32r6_64r6";
17 let EncodingPredicates = [HasStdEnc];
20 //===----------------------------------------------------------------------===//
24 //===----------------------------------------------------------------------===//
26 def OPGROUP_COP1 { bits<6> Value = 0b010001; }
27 def OPGROUP_AUI { bits<6> Value = 0b001111; }
28 def OPGROUP_DAUI { bits<6> Value = 0b011101; }
29 def OPGROUP_PCREL { bits<6> Value = 0b111011; }
30 def OPGROUP_REGIMM { bits<6> Value = 0b000001; }
31 def OPGROUP_SPECIAL { bits<6> Value = 0b000000; }
32 def OPGROUP_SPECIAL3 { bits<6> Value = 0b011111; }
34 class OPCODE2<bits<2> Val> {
37 def OPCODE2_ADDIUPC : OPCODE2<0b00>;
39 class OPCODE5<bits<5> Val> {
42 def OPCODE5_ALUIPC : OPCODE5<0b11111>;
43 def OPCODE5_AUIPC : OPCODE5<0b11110>;
44 def OPCODE5_DAHI : OPCODE5<0b00110>;
45 def OPCODE5_DATI : OPCODE5<0b11110>;
47 class OPCODE6<bits<6> Val> {
50 def OPCODE6_ALIGN : OPCODE6<0b100000>;
51 def OPCODE6_DALIGN : OPCODE6<0b100100>;
52 def OPCODE6_BITSWAP : OPCODE6<0b100000>;
53 def OPCODE6_DBITSWAP : OPCODE6<0b100100>;
55 class FIELD_FMT<bits<5> Val> {
58 def FIELD_FMT_S : FIELD_FMT<0b10000>;
59 def FIELD_FMT_D : FIELD_FMT<0b10001>;
61 //===----------------------------------------------------------------------===//
65 //===----------------------------------------------------------------------===//
67 class AUI_FM : MipsR6Inst {
74 let Inst{31-26} = OPGROUP_AUI.Value;
80 class DAUI_FM : AUI_FM {
81 let Inst{31-26} = OPGROUP_DAUI.Value;
84 class COP1_3R_FM<bits<6> funct, FIELD_FMT Format> : MipsR6Inst {
91 let Inst{31-26} = OPGROUP_COP1.Value;
92 let Inst{25-21} = Format.Value;
96 let Inst{5-0} = funct;
99 class PCREL16_FM<OPCODE5 Operation> : MipsR6Inst {
105 let Inst{31-26} = OPGROUP_PCREL.Value;
106 let Inst{25-21} = rs;
107 let Inst{20-16} = Operation.Value;
108 let Inst{15-0} = imm;
111 class PCREL19_FM<OPCODE2 Operation> : MipsR6Inst {
117 let Inst{31-26} = OPGROUP_PCREL.Value;
118 let Inst{25-21} = rs;
119 let Inst{20-19} = Operation.Value;
120 let Inst{18-0} = imm;
123 class SPECIAL3_2R_FM<OPCODE6 Operation> : MipsR6Inst {
129 let Inst{31-26} = OPGROUP_SPECIAL3.Value;
130 let Inst{25-21} = 0b00000;
131 let Inst{20-16} = rt;
132 let Inst{15-11} = rd;
133 let Inst{10-6} = 0b00000;
134 let Inst{5-0} = Operation.Value;
137 class SPECIAL_3R_FM<bits<5> mulop, bits<6> funct> : MipsR6Inst {
144 let Inst{31-26} = OPGROUP_SPECIAL.Value;
145 let Inst{25-21} = rs;
146 let Inst{20-16} = rt;
147 let Inst{15-11} = rd;
148 let Inst{10-6} = mulop;
149 let Inst{5-0} = funct;
152 class SPECIAL3_ALIGN_FM<OPCODE6 Operation> : MipsR6Inst {
160 let Inst{31-26} = OPGROUP_SPECIAL3.Value;
161 let Inst{25-21} = rs;
162 let Inst{20-16} = rt;
163 let Inst{15-11} = rd;
164 let Inst{10-8} = 0b010;
166 let Inst{5-0} = Operation.Value;
169 class SPECIAL3_DALIGN_FM<OPCODE6 Operation> : MipsR6Inst {
177 let Inst{31-26} = OPGROUP_SPECIAL3.Value;
178 let Inst{25-21} = rs;
179 let Inst{20-16} = rt;
180 let Inst{15-11} = rd;
181 let Inst{10-9} = 0b01;
183 let Inst{5-0} = Operation.Value;
186 class REGIMM_FM<OPCODE5 Operation> : MipsR6Inst {
192 let Inst{31-26} = OPGROUP_REGIMM.Value;
193 let Inst{25-21} = rs;
194 let Inst{20-16} = Operation.Value;
195 let Inst{15-0} = imm;