| Akira Hatanaka | c515bfb | 2012-05-08 19:08:58 +0000 | [diff] [blame^] | 1 | //===- Mips16InstrFormats.td - Mips Instruction Formats ----*- tablegen -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | //===----------------------------------------------------------------------===// |
| 11 | // Describe MIPS instructions format |
| 12 | // |
| 13 | // CPU INSTRUCTION FORMATS |
| 14 | // |
| 15 | // funct or f Function field |
| 16 | // |
| 17 | // immediate 4-,5-,8- or 11-bit immediate, branch displacemen, or |
| 18 | // or imm address displacement |
| 19 | // |
| 20 | // op 5-bit major operation code |
| 21 | // |
| 22 | // rx 3-bit source or destination register |
| 23 | // |
| 24 | // ry 3-bit source or destination register |
| 25 | // |
| 26 | // rz 3-bit source or destination register |
| 27 | // |
| 28 | // sa 3- or 5-bit shift amount |
| 29 | // |
| 30 | //===----------------------------------------------------------------------===// |
| 31 | |
| 32 | // Format specifies the encoding used by the instruction. This is part of the |
| 33 | // ad-hoc solution used to emit machine instruction encodings by our machine |
| 34 | // code emitter. |
| 35 | // |
| 36 | class Format16<bits<5> val> { |
| 37 | bits<5> Value = val; |
| 38 | } |
| 39 | |
| 40 | def Pseudo16 : Format16<0>; |
| 41 | def FrmI16 : Format16<1>; |
| 42 | def FrmRI16 : Format16<2>; |
| 43 | def FrmRR16 : Format16<3>; |
| 44 | def FrmRRI16 : Format16<4>; |
| 45 | def FrmRRR16 : Format16<5>; |
| 46 | def FrmRRI_A16 : Format16<6>; |
| 47 | def FrmSHIFT16 : Format16<7>; |
| 48 | def FrmI8_TYPE16 : Format16<8>; |
| 49 | def FrmI8_MOVR3216 : Format16<9>; |
| 50 | def FrmI8_MOV32R16 : Format16<10>; |
| 51 | def FrmI8_SVRS16 : Format16<11>; |
| 52 | def FrmJAL16 : Format16<12>; |
| 53 | def FrmJALX16 : Format16<13>; |
| 54 | def FrmEXT_I16 : Format16<14>; |
| 55 | def FrmASMACRO16 : Format16<15>; |
| 56 | def FrmEXT_RI16 : Format16<16>; |
| 57 | def FrmEXT_RRI16 : Format16<17>; |
| 58 | def FrmEXT_RRI_A16 : Format16<18>; |
| 59 | def FrmEXT_SHIFT16 : Format16<19>; |
| 60 | def FrmEXT_I816 : Format16<20>; |
| 61 | def FrmEXT_I8_SVRS16 : Format16<21>; |
| 62 | def FrmOther16 : Format16<22>; // Instruction w/ a custom format |
| 63 | |
| 64 | // Generic Mips 16 Format |
| 65 | class MipsInst16<dag outs, dag ins, string asmstr, list<dag> pattern, |
| 66 | InstrItinClass itin, Format16 f>: Instruction |
| 67 | { |
| 68 | field bits<16> Inst; |
| 69 | Format16 Form = f; |
| 70 | |
| 71 | let Namespace = "Mips"; |
| 72 | |
| 73 | bits<5> Opcode = 0; |
| 74 | |
| 75 | // Top 6 bits are the 'opcode' field |
| 76 | let Inst{15-11} = Opcode; |
| 77 | |
| 78 | let OutOperandList = outs; |
| 79 | let InOperandList = ins; |
| 80 | |
| 81 | let AsmString = asmstr; |
| 82 | let Pattern = pattern; |
| 83 | let Itinerary = itin; |
| 84 | |
| 85 | // |
| 86 | // Attributes specific to Mips instructions... |
| 87 | // |
| 88 | bits<5> FormBits = Form.Value; |
| 89 | |
| 90 | // TSFlags layout should be kept in sync with MipsInstrInfo.h. |
| 91 | let TSFlags{4-0} = FormBits; |
| 92 | } |
| 93 | |
| 94 | // |
| 95 | // TBD. Maybe MipsInst16 and Mips16_EXTEND should be derived from a single |
| 96 | // base class |
| 97 | // |
| 98 | |
| 99 | class MipsInst16_EXTEND<dag outs, dag ins, string asmstr, list<dag> pattern, |
| 100 | InstrItinClass itin, Format16 f>: Instruction |
| 101 | { |
| 102 | field bits<32> Inst; |
| 103 | Format16 Form = f; |
| 104 | |
| 105 | let Namespace = "Mips"; |
| 106 | |
| 107 | bits<5> Opcode = 0; |
| 108 | bits<5> extend; |
| 109 | |
| 110 | // Top 6 bits are the 'opcode' field |
| 111 | let Inst{31-27} = extend; |
| 112 | let Inst{15-11} = Opcode; |
| 113 | |
| 114 | let OutOperandList = outs; |
| 115 | let InOperandList = ins; |
| 116 | |
| 117 | let AsmString = asmstr; |
| 118 | let Pattern = pattern; |
| 119 | let Itinerary = itin; |
| 120 | |
| 121 | // |
| 122 | // Attributes specific to Mips instructions... |
| 123 | // |
| 124 | bits<5> FormBits = Form.Value; |
| 125 | |
| 126 | // TSFlags layout should be kept in sync with MipsInstrInfo.h. |
| 127 | let TSFlags{4-0} = FormBits; |
| 128 | } |
| 129 | |
| 130 | |
| 131 | |
| 132 | // Mips Pseudo Instructions Format |
| 133 | class MipsPseudo16<dag outs, dag ins, string asmstr, list<dag> pattern>: |
| 134 | MipsInst16<outs, ins, asmstr, pattern, IIPseudo, Pseudo16> { |
| 135 | let isCodeGenOnly = 1; |
| 136 | let isPseudo = 1; |
| 137 | } |
| 138 | |
| 139 | |
| 140 | //===----------------------------------------------------------------------===// |
| 141 | // Format I instruction class in Mips : <|opcode|immediate|> |
| 142 | //===----------------------------------------------------------------------===// |
| 143 | |
| 144 | class FI16<bits<5> op, dag outs, dag ins, string asmstr, list<dag> pattern, |
| 145 | InstrItinClass itin>: MipsInst16<outs, ins, asmstr, pattern, |
| 146 | itin, FrmI16> |
| 147 | { |
| 148 | bits<11> imm11; |
| 149 | |
| 150 | let Opcode = op; |
| 151 | |
| 152 | let Inst{10-0} = imm11; |
| 153 | } |
| 154 | |
| 155 | //===----------------------------------------------------------------------===// |
| 156 | // Format RI instruction class in Mips : <|opcode|rx|immed|> |
| 157 | //===----------------------------------------------------------------------===// |
| 158 | |
| 159 | class FRI16<bits<5> op, dag outs, dag ins, string asmstr, |
| 160 | list<dag> pattern, InstrItinClass itin>: |
| 161 | MipsInst16<outs, ins, asmstr, pattern, itin, FrmRI16> |
| 162 | { |
| 163 | bits<3> rx; |
| 164 | bits<8> imm8; |
| 165 | |
| 166 | let Opcode = op; |
| 167 | |
| 168 | let Inst{10-8} = rx; |
| 169 | let Inst{7-0} = imm8; |
| 170 | } |
| 171 | |
| 172 | //===----------------------------------------------------------------------===// |
| 173 | // Format RR instruction class in Mips : <|opcode|rx|ry|funct|> |
| 174 | //===----------------------------------------------------------------------===// |
| 175 | |
| 176 | class FRR16<bits<5> op, bits<5> _funct, dag outs, dag ins, string asmstr, |
| 177 | list<dag> pattern, InstrItinClass itin>: |
| 178 | MipsInst16<outs, ins, asmstr, pattern, itin, FrmRR16> |
| 179 | { |
| 180 | bits<3> rx; |
| 181 | bits<3> ry; |
| 182 | bits<5> funct; |
| 183 | |
| 184 | let Opcode = op; |
| 185 | let funct = _funct; |
| 186 | |
| 187 | let Inst{10-8} = rx; |
| 188 | let Inst{7-5} = ry; |
| 189 | let Inst{4-0} = funct; |
| 190 | } |
| 191 | |
| 192 | //===----------------------------------------------------------------------===// |
| 193 | // Format RRI instruction class in Mips : <|opcode|rx|ry|immed|> |
| 194 | //===----------------------------------------------------------------------===// |
| 195 | |
| 196 | class FRRI16<bits<5> op, dag outs, dag ins, string asmstr, |
| 197 | list<dag> pattern, InstrItinClass itin>: |
| 198 | MipsInst16<outs, ins, asmstr, pattern, itin, FrmRRI16> |
| 199 | { |
| 200 | bits<3> rx; |
| 201 | bits<3> ry; |
| 202 | bits<5> imm5; |
| 203 | |
| 204 | let Opcode = op; |
| 205 | |
| 206 | |
| 207 | let Inst{10-8} = rx; |
| 208 | let Inst{7-5} = ry; |
| 209 | let Inst{4-0} = imm5; |
| 210 | } |
| 211 | |
| 212 | //===----------------------------------------------------------------------===// |
| 213 | // Format RRR instruction class in Mips : <|opcode|rx|ry|rz|f|> |
| 214 | //===----------------------------------------------------------------------===// |
| 215 | |
| 216 | class FRRR16<bits<5> op, bits<2> _f, dag outs, dag ins, string asmstr, |
| 217 | list<dag> pattern, InstrItinClass itin>: |
| 218 | MipsInst16<outs, ins, asmstr, pattern, itin, FrmRRR16> |
| 219 | { |
| 220 | bits<3> rx; |
| 221 | bits<3> ry; |
| 222 | bits<3> rz; |
| 223 | bits<2> f; |
| 224 | |
| 225 | let Opcode = op; |
| 226 | let f = _f; |
| 227 | |
| 228 | let Inst{10-8} = rx; |
| 229 | let Inst{7-5} = ry; |
| 230 | let Inst{4-2} = rz; |
| 231 | let Inst{1-0} = f; |
| 232 | } |
| 233 | |
| 234 | //===----------------------------------------------------------------------===// |
| 235 | // Format RRI-A instruction class in Mips : <|opcode|rx|ry|f|immed|> |
| 236 | //===----------------------------------------------------------------------===// |
| 237 | |
| 238 | class FRRI_A16<bits<5> op, bits<1> _f, dag outs, dag ins, string asmstr, |
| 239 | list<dag> pattern, InstrItinClass itin>: |
| 240 | MipsInst16<outs, ins, asmstr, pattern, itin, FrmRRI_A16> |
| 241 | { |
| 242 | bits<3> rx; |
| 243 | bits<3> ry; |
| 244 | bits<1> f; |
| 245 | bits<4> imm4; |
| 246 | |
| 247 | let Opcode = op; |
| 248 | let f = _f; |
| 249 | |
| 250 | let Inst{10-8} = rx; |
| 251 | let Inst{7-5} = ry; |
| 252 | let Inst{4} = f; |
| 253 | let Inst{3-0} = imm4; |
| 254 | } |
| 255 | |
| 256 | //===----------------------------------------------------------------------===// |
| 257 | // Format Shift instruction class in Mips : <|opcode|rx|ry|sa|f|> |
| 258 | //===----------------------------------------------------------------------===// |
| 259 | |
| 260 | class FSHIFT16<bits<5> op, bits<2> _f, dag outs, dag ins, string asmstr, |
| 261 | list<dag> pattern, InstrItinClass itin>: |
| 262 | MipsInst16<outs, ins, asmstr, pattern, itin, FrmSHIFT16> |
| 263 | { |
| 264 | bits<3> rx; |
| 265 | bits<3> ry; |
| 266 | bits<3> sa; |
| 267 | bits<2> f; |
| 268 | |
| 269 | let Opcode = op; |
| 270 | let f = _f; |
| 271 | |
| 272 | let Inst{10-8} = rx; |
| 273 | let Inst{7-5} = ry; |
| 274 | let Inst{4-2} = sa; |
| 275 | let Inst{1-0} = f; |
| 276 | } |
| 277 | |
| 278 | //===----------------------------------------------------------------------===// |
| 279 | // Format i8 instruction class in Mips : <|opcode|funct|immed> |
| 280 | //===----------------------------------------------------------------------===// |
| 281 | |
| 282 | class FI816<bits<5> op, bits<3> _func, dag outs, dag ins, string asmstr, |
| 283 | list<dag> pattern, InstrItinClass itin>: |
| 284 | MipsInst16<outs, ins, asmstr, pattern, itin, FrmI8_TYPE16> |
| 285 | { |
| 286 | bits<3> func; |
| 287 | bits<8> immed8; |
| 288 | |
| 289 | let Opcode = op; |
| 290 | let func = _func; |
| 291 | |
| 292 | let Inst{10-8} = func; |
| 293 | let Inst{7-0} = immed8; |
| 294 | } |
| 295 | |
| 296 | //===----------------------------------------------------------------------===// |
| 297 | // Format i8_MOVR32 instruction class in Mips : <|opcode|func|ry|r32> |
| 298 | //===----------------------------------------------------------------------===// |
| 299 | |
| 300 | class FI8_MOVR3216<bits<5> op, bits<3> _func, dag outs, dag ins, string asmstr, |
| 301 | list<dag> pattern, InstrItinClass itin>: |
| 302 | MipsInst16<outs, ins, asmstr, pattern, itin, FrmI8_MOVR3216> |
| 303 | { |
| 304 | |
| 305 | bits<3> func; |
| 306 | bits<4> ry; |
| 307 | bits<4> r32; |
| 308 | |
| 309 | let Opcode = op; |
| 310 | let func = _func; |
| 311 | |
| 312 | let Inst{10-8} = func; |
| 313 | let Inst{7-4} = ry; |
| 314 | let Inst{3-0} = r32; |
| 315 | |
| 316 | } |
| 317 | |
| 318 | |
| 319 | |
| 320 | //===----------------------------------------------------------------------===// |
| 321 | // Format i8_MOV32R instruction class in Mips : <|opcode|func|ry|r32> |
| 322 | //===----------------------------------------------------------------------===// |
| 323 | |
| 324 | class FI8_MOV32R16<bits<5> op, bits<3> _func, dag outs, dag ins, string asmstr, |
| 325 | list<dag> pattern, InstrItinClass itin>: |
| 326 | MipsInst16<outs, ins, asmstr, pattern, itin, FrmI8_MOV32R16> |
| 327 | { |
| 328 | |
| 329 | bits<3> func; |
| 330 | bits<5> r32; |
| 331 | bits<3> rz; |
| 332 | |
| 333 | |
| 334 | let Opcode = op; |
| 335 | let func = _func; |
| 336 | |
| 337 | let Inst{10-8} = func; |
| 338 | let Inst{7-5} = r32{2-0}; |
| 339 | let Inst{4-3} = r32{4-3}; |
| 340 | let Inst{2-0} = rz; |
| 341 | |
| 342 | } |
| 343 | |
| 344 | //===----------------------------------------------------------------------===// |
| 345 | // Format i8_SVRS instruction class in Mips : |
| 346 | // <|opcode|svrs|s|ra|s0|s1|framesize> |
| 347 | //===----------------------------------------------------------------------===// |
| 348 | |
| 349 | class FI8_SVRS16<bits<5> op, bits<3> _SVRS, dag outs, dag ins, string asmstr, |
| 350 | list<dag> pattern, InstrItinClass itin>: |
| 351 | MipsInst16<outs, ins, asmstr, pattern, itin, FrmI8_SVRS16> |
| 352 | { |
| 353 | bits<3> SVRS; |
| 354 | bits<1> s; |
| 355 | bits<1> ra; |
| 356 | bits<1> s0; |
| 357 | bits<1> s1; |
| 358 | bits<4> framesize; |
| 359 | |
| 360 | let Opcode = op; |
| 361 | let SVRS = _SVRS; |
| 362 | |
| 363 | let Inst{10-8} = SVRS; |
| 364 | let Inst{7} = s; |
| 365 | let Inst{6} = ra; |
| 366 | let Inst{5} = s0; |
| 367 | let Inst{4} = s1; |
| 368 | let Inst{3-0} = framesize; |
| 369 | |
| 370 | } |
| 371 | |
| 372 | //===----------------------------------------------------------------------===// |
| 373 | // Format JAL instruction class in Mips16 : |
| 374 | // <|opcode|svrs|s|ra|s0|s1|framesize> |
| 375 | //===----------------------------------------------------------------------===// |
| 376 | |
| 377 | class FJAL16<bits<5> op, bits<1> _X, dag outs, dag ins, string asmstr, |
| 378 | list<dag> pattern, InstrItinClass itin>: |
| 379 | MipsInst16_EXTEND<outs, ins, asmstr, pattern, itin, FrmJAL16> |
| 380 | { |
| 381 | bits<1> X; |
| 382 | bits<26> immed26; |
| 383 | |
| 384 | |
| 385 | let Opcode = op; |
| 386 | let X = _X; |
| 387 | |
| 388 | let Inst{26} = X; |
| 389 | let Inst{25-21} = immed26{20-16}; |
| 390 | let Inst{20-16} = immed26{25-21}; |
| 391 | let Inst{15-0} = immed26{15-0}; |
| 392 | |
| 393 | } |
| 394 | |
| 395 | |
| 396 | //===----------------------------------------------------------------------===// |
| 397 | // Format EXT-I instruction class in Mips16 : |
| 398 | // <|opcode|immed10:5|immed15:1|op|0|0|0|0|0|0|immed4:0> |
| 399 | //===----------------------------------------------------------------------===// |
| 400 | |
| 401 | class FEXT_I16<bits<5> op, bits<5> _eop, dag outs, dag ins, string asmstr, |
| 402 | list<dag> pattern, InstrItinClass itin>: |
| 403 | MipsInst16_EXTEND<outs, ins, asmstr, pattern, itin, FrmEXT_I16> |
| 404 | { |
| 405 | bits<16> immed16; |
| 406 | bits<5> eop; |
| 407 | |
| 408 | let Opcode = op; |
| 409 | let eop = _eop; |
| 410 | |
| 411 | let Inst{26-21} = immed16{10-5}; |
| 412 | let Inst{20-16} = immed16{15-11}; |
| 413 | let Inst{15-11} = eop; |
| 414 | let Inst{10-5} = 0; |
| 415 | let Inst{4-0} = immed16{4-0}; |
| 416 | |
| 417 | } |
| 418 | |
| 419 | |
| 420 | |
| 421 | |
| 422 | |
| 423 | |
| 424 | //===----------------------------------------------------------------------===// |
| 425 | // Format ASMACRO instruction class in Mips16 : |
| 426 | // <EXTEND|select|p4|p3|RRR|p2|p1|p0> |
| 427 | //===----------------------------------------------------------------------===// |
| 428 | |
| 429 | class FASMACRO16<bits<5> op, dag outs, dag ins, string asmstr, |
| 430 | list<dag> pattern, InstrItinClass itin>: |
| 431 | MipsInst16_EXTEND<outs, ins, asmstr, pattern, itin, |
| 432 | FrmASMACRO16> |
| 433 | { |
| 434 | bits<3> select; |
| 435 | bits<3> p4; |
| 436 | bits<5> p3; |
| 437 | bits<5> RRR; |
| 438 | bits<3> p2; |
| 439 | bits<3> p1; |
| 440 | bits<5> p0; |
| 441 | |
| 442 | let Opcode = op; |
| 443 | |
| 444 | let Inst{26-24} = select; |
| 445 | let Inst{23-21} = p4; |
| 446 | let Inst{20-16} = p3; |
| 447 | let Inst{15-11} = RRR; |
| 448 | let Inst{10-8} = p2; |
| 449 | let Inst{7-5} = p1; |
| 450 | let Inst{4-0} = p0; |
| 451 | |
| 452 | } |
| 453 | |
| 454 | |
| 455 | //===----------------------------------------------------------------------===// |
| 456 | // Format EXT-RI instruction class in Mips16 : |
| 457 | // <|opcode|immed10:5|immed15:11|op|rx|0|0|0|immed4:0> |
| 458 | //===----------------------------------------------------------------------===// |
| 459 | |
| 460 | class FEXT_RI16<bits<5> op, bits<5> _eop, dag outs, dag ins, string asmstr, |
| 461 | list<dag> pattern, InstrItinClass itin>: |
| 462 | MipsInst16_EXTEND<outs, ins, asmstr, pattern, itin, |
| 463 | FrmEXT_RI16> |
| 464 | { |
| 465 | bits<16> immed16; |
| 466 | bits<5> eop; |
| 467 | bits<3> rx; |
| 468 | |
| 469 | let Opcode = op; |
| 470 | let eop = _eop; |
| 471 | |
| 472 | let Inst{26-21} = immed16{10-5}; |
| 473 | let Inst{20-16} = immed16{15-11}; |
| 474 | let Inst{15-11} = eop; |
| 475 | let Inst{10-8} = rx; |
| 476 | let Inst{7-5} = 0; |
| 477 | let Inst{4-0} = immed16{4-0}; |
| 478 | |
| 479 | } |
| 480 | |
| 481 | //===----------------------------------------------------------------------===// |
| 482 | // Format EXT-RRI instruction class in Mips16 : |
| 483 | // <|opcode|immed10:5|immed15:11|op|rx|ry|immed4:0> |
| 484 | //===----------------------------------------------------------------------===// |
| 485 | |
| 486 | class FEXT_RRI16<bits<5> op, bits<5> _eop, dag outs, dag ins, string asmstr, |
| 487 | list<dag> pattern, InstrItinClass itin>: |
| 488 | MipsInst16_EXTEND<outs, ins, asmstr, pattern, itin, |
| 489 | FrmEXT_RRI16> |
| 490 | { |
| 491 | bits<16> immed16; |
| 492 | bits<5> eop; |
| 493 | bits<3> rx; |
| 494 | bits<3> ry; |
| 495 | |
| 496 | let Opcode = op; |
| 497 | let eop = _eop; |
| 498 | |
| 499 | let Inst{26-21} = immed16{10-5}; |
| 500 | let Inst{20-16} = immed16{15-11}; |
| 501 | let Inst{15-11} = eop; |
| 502 | let Inst{10-8} = rx; |
| 503 | let Inst{7-5} = ry; |
| 504 | let Inst{4-0} = immed16{4-0}; |
| 505 | |
| 506 | } |
| 507 | |
| 508 | //===----------------------------------------------------------------------===// |
| 509 | // Format EXT-RRI-A instruction class in Mips16 : |
| 510 | // <|opcode|immed10:4|immed14:11|RRI-A|rx|ry|f|immed3:0> |
| 511 | //===----------------------------------------------------------------------===// |
| 512 | |
| 513 | class FEXT_RRI_A16<bits<5> op, bits<1> _f, dag outs, dag ins, string asmstr, |
| 514 | list<dag> pattern, InstrItinClass itin>: |
| 515 | MipsInst16_EXTEND<outs, ins, asmstr, pattern, itin, |
| 516 | FrmEXT_RRI_A16> |
| 517 | { |
| 518 | bits<15> immed15; |
| 519 | bits<5> RRI_A; |
| 520 | bits<3> rx; |
| 521 | bits<3> ry; |
| 522 | bits<1> f; |
| 523 | |
| 524 | let Opcode = op; |
| 525 | let f = _f; |
| 526 | |
| 527 | let Inst{26-20} = immed15{10-4}; |
| 528 | let Inst{19-16} = immed15{14-11}; |
| 529 | let Inst{15-11} = RRI_A; |
| 530 | let Inst{10-8} = rx; |
| 531 | let Inst{7-5} = ry; |
| 532 | let Inst{4} = f; |
| 533 | let Inst{3-0} = immed15{3-0}; |
| 534 | |
| 535 | } |
| 536 | |
| 537 | //===----------------------------------------------------------------------===// |
| 538 | // Format EXT-SHIFT instruction class in Mips16 : |
| 539 | // <|opcode|sa 4:0|s5|0|SHIFT|rx|ry|0|f> |
| 540 | //===----------------------------------------------------------------------===// |
| 541 | |
| 542 | class FEXT_SHIFT16<bits<5> op, bits<2> _f, dag outs, dag ins, string asmstr, |
| 543 | list<dag> pattern, InstrItinClass itin>: |
| 544 | MipsInst16_EXTEND<outs, ins, asmstr, pattern, itin, |
| 545 | FrmEXT_SHIFT16> |
| 546 | { |
| 547 | bits<6> sa6; |
| 548 | bits<5> shift; |
| 549 | bits<3> rx; |
| 550 | bits<3> ry; |
| 551 | bits<2> f; |
| 552 | |
| 553 | let Opcode = op; |
| 554 | let f = _f; |
| 555 | |
| 556 | let Inst{26-22} = sa6{4-0}; |
| 557 | let Inst{21} = sa6{5}; |
| 558 | let Inst{20-16} = 0; |
| 559 | let Inst{15-11} = shift; |
| 560 | let Inst{10-8} = rx; |
| 561 | let Inst{7-5} = ry; |
| 562 | let Inst{4-2} = 0; |
| 563 | let Inst{1-0} = f; |
| 564 | |
| 565 | } |
| 566 | |
| 567 | //===----------------------------------------------------------------------===// |
| 568 | // Format EXT-I8 instruction class in Mips16 : |
| 569 | // <|opcode|immed10:5|immed15:11|I8|funct|0|immed4:0> |
| 570 | //===----------------------------------------------------------------------===// |
| 571 | |
| 572 | class FEXT_I816<bits<5> op, bits<3> _funct, dag outs, dag ins, string asmstr, |
| 573 | list<dag> pattern, InstrItinClass itin>: |
| 574 | MipsInst16_EXTEND<outs, ins, asmstr, pattern, itin, |
| 575 | FrmEXT_I816> |
| 576 | { |
| 577 | bits<16> immed16; |
| 578 | bits<5> I8; |
| 579 | bits<3> funct; |
| 580 | |
| 581 | let Opcode = op; |
| 582 | let funct = _funct; |
| 583 | |
| 584 | let Inst{26-21} = immed16{10-5}; |
| 585 | let Inst{20-16} = immed16{15-11}; |
| 586 | let Inst{15-11} = I8; |
| 587 | let Inst{10-8} = funct; |
| 588 | let Inst{7-5} = 0; |
| 589 | let Inst{4-0} = immed16{4-0}; |
| 590 | |
| 591 | } |
| 592 | |
| 593 | //===----------------------------------------------------------------------===// |
| 594 | // Format EXT-I8_SVRS instruction class in Mips16 : |
| 595 | // <|opcode|xsregs|framesize7:4|aregs|I8|SVRS|s|ra|s0|s1|framesize3:0> |
| 596 | //===----------------------------------------------------------------------===// |
| 597 | |
| 598 | class FEXT_I8_SVRS16<bits<5> op, dag outs, dag ins, string asmstr, |
| 599 | list<dag> pattern, InstrItinClass itin>: |
| 600 | MipsInst16_EXTEND<outs, ins, asmstr, pattern, itin, |
| 601 | FrmI8_SVRS16> |
| 602 | { |
| 603 | bits<3> xsregs; |
| 604 | bits<8> framesize; |
| 605 | bits<3> aregs; |
| 606 | bits<5> I8; |
| 607 | bits<3> SVRS; |
| 608 | bits<1> s; |
| 609 | bits<1> ra; |
| 610 | bits<1> s0; |
| 611 | bits<1> s1; |
| 612 | |
| 613 | let Opcode = op; |
| 614 | |
| 615 | let Inst{26-24} = xsregs; |
| 616 | let Inst{23-20} = framesize{7-4}; |
| 617 | let Inst{19} = 0; |
| 618 | let Inst{18-16} = aregs; |
| 619 | let Inst{15-11} = I8; |
| 620 | let Inst{10-8} = SVRS; |
| 621 | let Inst{7} = s; |
| 622 | let Inst{6} = ra; |
| 623 | let Inst{5} = s0; |
| 624 | let Inst{4} = s1; |
| 625 | let Inst{3-0} = framesize{3-0}; |
| 626 | |
| 627 | |
| 628 | } |
| 629 | |
| 630 | |
| 631 | |