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 class FIELD_CMP_COND<bits<5> Val> {
64 def FIELD_CMP_COND_F : FIELD_CMP_COND<0b00000>;
65 def FIELD_CMP_COND_UN : FIELD_CMP_COND<0b00001>;
66 def FIELD_CMP_COND_EQ : FIELD_CMP_COND<0b00010>;
67 def FIELD_CMP_COND_UEQ : FIELD_CMP_COND<0b00011>;
68 def FIELD_CMP_COND_OLT : FIELD_CMP_COND<0b00100>;
69 def FIELD_CMP_COND_ULT : FIELD_CMP_COND<0b00101>;
70 def FIELD_CMP_COND_OLE : FIELD_CMP_COND<0b00110>;
71 def FIELD_CMP_COND_ULE : FIELD_CMP_COND<0b00111>;
72 def FIELD_CMP_COND_SF : FIELD_CMP_COND<0b01000>;
73 def FIELD_CMP_COND_NGLE : FIELD_CMP_COND<0b01001>;
74 def FIELD_CMP_COND_SEQ : FIELD_CMP_COND<0b01010>;
75 def FIELD_CMP_COND_NGL : FIELD_CMP_COND<0b01011>;
76 def FIELD_CMP_COND_LT : FIELD_CMP_COND<0b01100>;
77 def FIELD_CMP_COND_NGE : FIELD_CMP_COND<0b01101>;
78 def FIELD_CMP_COND_LE : FIELD_CMP_COND<0b01110>;
79 def FIELD_CMP_COND_NGT : FIELD_CMP_COND<0b01111>;
81 class FIELD_CMP_FORMAT<bits<5> Val> {
84 def FIELD_CMP_FORMAT_S : FIELD_CMP_FORMAT<0b10100>;
85 def FIELD_CMP_FORMAT_D : FIELD_CMP_FORMAT<0b10101>;
87 //===----------------------------------------------------------------------===//
91 //===----------------------------------------------------------------------===//
93 class AUI_FM : MipsR6Inst {
100 let Inst{31-26} = OPGROUP_AUI.Value;
101 let Inst{25-21} = rs;
102 let Inst{20-16} = rt;
103 let Inst{15-0} = imm;
106 class DAUI_FM : AUI_FM {
107 let Inst{31-26} = OPGROUP_DAUI.Value;
110 class COP1_2R_FM<bits<6> funct, FIELD_FMT Format> : MipsR6Inst {
116 let Inst{31-26} = OPGROUP_COP1.Value;
117 let Inst{25-21} = Format.Value;
118 let Inst{20-16} = 0b00000;
119 let Inst{15-11} = fs;
121 let Inst{5-0} = funct;
124 class COP1_3R_FM<bits<6> funct, FIELD_FMT Format> : MipsR6Inst {
131 let Inst{31-26} = OPGROUP_COP1.Value;
132 let Inst{25-21} = Format.Value;
133 let Inst{20-16} = ft;
134 let Inst{15-11} = fs;
136 let Inst{5-0} = funct;
139 class PCREL16_FM<OPCODE5 Operation> : MipsR6Inst {
145 let Inst{31-26} = OPGROUP_PCREL.Value;
146 let Inst{25-21} = rs;
147 let Inst{20-16} = Operation.Value;
148 let Inst{15-0} = imm;
151 class PCREL19_FM<OPCODE2 Operation> : MipsR6Inst {
157 let Inst{31-26} = OPGROUP_PCREL.Value;
158 let Inst{25-21} = rs;
159 let Inst{20-19} = Operation.Value;
160 let Inst{18-0} = imm;
163 class SPECIAL3_2R_FM<OPCODE6 Operation> : MipsR6Inst {
169 let Inst{31-26} = OPGROUP_SPECIAL3.Value;
170 let Inst{25-21} = 0b00000;
171 let Inst{20-16} = rt;
172 let Inst{15-11} = rd;
173 let Inst{10-6} = 0b00000;
174 let Inst{5-0} = Operation.Value;
177 class SPECIAL_3R_FM<bits<5> mulop, bits<6> funct> : MipsR6Inst {
184 let Inst{31-26} = OPGROUP_SPECIAL.Value;
185 let Inst{25-21} = rs;
186 let Inst{20-16} = rt;
187 let Inst{15-11} = rd;
188 let Inst{10-6} = mulop;
189 let Inst{5-0} = funct;
192 class SPECIAL3_ALIGN_FM<OPCODE6 Operation> : MipsR6Inst {
200 let Inst{31-26} = OPGROUP_SPECIAL3.Value;
201 let Inst{25-21} = rs;
202 let Inst{20-16} = rt;
203 let Inst{15-11} = rd;
204 let Inst{10-8} = 0b010;
206 let Inst{5-0} = Operation.Value;
209 class SPECIAL3_DALIGN_FM<OPCODE6 Operation> : MipsR6Inst {
217 let Inst{31-26} = OPGROUP_SPECIAL3.Value;
218 let Inst{25-21} = rs;
219 let Inst{20-16} = rt;
220 let Inst{15-11} = rd;
221 let Inst{10-9} = 0b01;
223 let Inst{5-0} = Operation.Value;
226 class REGIMM_FM<OPCODE5 Operation> : MipsR6Inst {
232 let Inst{31-26} = OPGROUP_REGIMM.Value;
233 let Inst{25-21} = rs;
234 let Inst{20-16} = Operation.Value;
235 let Inst{15-0} = imm;
238 class COP1_CMP_CONDN_FM<FIELD_CMP_FORMAT Format,
239 FIELD_CMP_COND Cond> : MipsR6Inst {
246 let Inst{31-26} = OPGROUP_COP1.Value;
247 let Inst{25-21} = Format.Value;
248 let Inst{20-16} = ft;
249 let Inst{15-11} = fs;
252 let Inst{4-0} = Cond.Value;