10b57cec5SDimitry Andric//=- Mips32r6InstrFormats.td - Mips32r6 Instruction Formats -*- 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 Mips32r6 instruction formats. 100b57cec5SDimitry Andric// 110b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 120b57cec5SDimitry Andric 130b57cec5SDimitry Andricclass R6MMR6Rel; 140b57cec5SDimitry Andric 150b57cec5SDimitry Andricdef MipsR62MicroMipsR6 : InstrMapping { 160b57cec5SDimitry Andric let FilterClass = "R6MMR6Rel"; 170b57cec5SDimitry Andric // Instructions with the same BaseOpcode and isNVStore values form a row. 180b57cec5SDimitry Andric let RowFields = ["BaseOpcode"]; 190b57cec5SDimitry Andric // Instructions with the same predicate sense form a column. 200b57cec5SDimitry Andric let ColFields = ["Arch"]; 210b57cec5SDimitry Andric // The key column is the unpredicated instructions. 220b57cec5SDimitry Andric let KeyCol = ["mipsr6"]; 230b57cec5SDimitry Andric // Value columns are PredSense=true and PredSense=false 240b57cec5SDimitry Andric let ValueCols = [["mipsr6"], ["micromipsr6"]]; 250b57cec5SDimitry Andric} 260b57cec5SDimitry Andric 270b57cec5SDimitry Andricclass MipsR6Arch<string opstr> { 280b57cec5SDimitry Andric string Arch = "mipsr6"; 290b57cec5SDimitry Andric string BaseOpcode = opstr; 300b57cec5SDimitry Andric} 310b57cec5SDimitry Andric 320b57cec5SDimitry Andricclass MipsR6Inst : MipsInst<(outs), (ins), "", [], NoItinerary, FrmOther> { 330b57cec5SDimitry Andric let DecoderNamespace = "Mips32r6_64r6"; 340b57cec5SDimitry Andric let EncodingPredicates = [HasStdEnc]; 350b57cec5SDimitry Andric} 360b57cec5SDimitry Andric 370b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 380b57cec5SDimitry Andric// 390b57cec5SDimitry Andric// Field Values 400b57cec5SDimitry Andric// 410b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 420b57cec5SDimitry Andric 430b57cec5SDimitry Andricclass OPGROUP<bits<6> Val> { 440b57cec5SDimitry Andric bits<6> Value = Val; 450b57cec5SDimitry Andric} 460b57cec5SDimitry Andricdef OPGROUP_COP0 : OPGROUP<0b010000>; 470b57cec5SDimitry Andricdef OPGROUP_COP1 : OPGROUP<0b010001>; 480b57cec5SDimitry Andricdef OPGROUP_COP2 : OPGROUP<0b010010>; 490b57cec5SDimitry Andricdef OPGROUP_ADDI : OPGROUP<0b001000>; 500b57cec5SDimitry Andricdef OPGROUP_AUI : OPGROUP<0b001111>; 510b57cec5SDimitry Andricdef OPGROUP_BLEZ : OPGROUP<0b000110>; 520b57cec5SDimitry Andricdef OPGROUP_BGTZ : OPGROUP<0b000111>; 530b57cec5SDimitry Andricdef OPGROUP_BLEZL : OPGROUP<0b010110>; 540b57cec5SDimitry Andricdef OPGROUP_BGTZL : OPGROUP<0b010111>; 550b57cec5SDimitry Andricdef OPGROUP_DADDI : OPGROUP<0b011000>; 560b57cec5SDimitry Andricdef OPGROUP_DAUI : OPGROUP<0b011101>; 570b57cec5SDimitry Andricdef OPGROUP_PCREL : OPGROUP<0b111011>; 580b57cec5SDimitry Andricdef OPGROUP_REGIMM : OPGROUP<0b000001>; 590b57cec5SDimitry Andricdef OPGROUP_SPECIAL : OPGROUP<0b000000>; 600b57cec5SDimitry Andric// The spec occasionally names this value LL, LLD, SC, or SCD. 610b57cec5SDimitry Andricdef OPGROUP_SPECIAL3 : OPGROUP<0b011111>; 620b57cec5SDimitry Andric// The spec names this constant LWC2, LDC2, SWC2, and SDC2 in different places. 630b57cec5SDimitry Andricdef OPGROUP_COP2LDST : OPGROUP<0b010010>; 640b57cec5SDimitry Andric 650b57cec5SDimitry Andricclass OPCODE2<bits<2> Val> { 660b57cec5SDimitry Andric bits<2> Value = Val; 670b57cec5SDimitry Andric} 680b57cec5SDimitry Andricdef OPCODE2_ADDIUPC : OPCODE2<0b00>; 690b57cec5SDimitry Andricdef OPCODE2_LWPC : OPCODE2<0b01>; 700b57cec5SDimitry Andricdef OPCODE2_LWUPC : OPCODE2<0b10>; 710b57cec5SDimitry Andric 720b57cec5SDimitry Andricclass OPCODE3<bits<3> Val> { 730b57cec5SDimitry Andric bits<3> Value = Val; 740b57cec5SDimitry Andric} 750b57cec5SDimitry Andricdef OPCODE3_LDPC : OPCODE3<0b110>; 760b57cec5SDimitry Andric 770b57cec5SDimitry Andricclass OPCODE5<bits<5> Val> { 780b57cec5SDimitry Andric bits<5> Value = Val; 790b57cec5SDimitry Andric} 800b57cec5SDimitry Andricdef OPCODE5_ALUIPC : OPCODE5<0b11111>; 810b57cec5SDimitry Andricdef OPCODE5_AUIPC : OPCODE5<0b11110>; 820b57cec5SDimitry Andricdef OPCODE5_DAHI : OPCODE5<0b00110>; 830b57cec5SDimitry Andricdef OPCODE5_DATI : OPCODE5<0b11110>; 840b57cec5SDimitry Andricdef OPCODE5_BC1EQZ : OPCODE5<0b01001>; 850b57cec5SDimitry Andricdef OPCODE5_BC1NEZ : OPCODE5<0b01101>; 860b57cec5SDimitry Andricdef OPCODE5_BC2EQZ : OPCODE5<0b01001>; 870b57cec5SDimitry Andricdef OPCODE5_BC2NEZ : OPCODE5<0b01101>; 880b57cec5SDimitry Andricdef OPCODE5_BGEZAL : OPCODE5<0b10001>; 89*0fca6ea1SDimitry Andricdef OPCODE5_NAL : OPCODE5<0b10000>; 900b57cec5SDimitry Andricdef OPCODE5_SIGRIE : OPCODE5<0b10111>; 910b57cec5SDimitry Andric// The next four constants are unnamed in the spec. These names are taken from 920b57cec5SDimitry Andric// the OPGROUP names they are used with. 930b57cec5SDimitry Andricdef OPCODE5_LDC2 : OPCODE5<0b01110>; 940b57cec5SDimitry Andricdef OPCODE5_LWC2 : OPCODE5<0b01010>; 950b57cec5SDimitry Andricdef OPCODE5_SDC2 : OPCODE5<0b01111>; 960b57cec5SDimitry Andricdef OPCODE5_SWC2 : OPCODE5<0b01011>; 970b57cec5SDimitry Andric 980b57cec5SDimitry Andricclass OPCODE6<bits<6> Val> { 990b57cec5SDimitry Andric bits<6> Value = Val; 1000b57cec5SDimitry Andric} 1010b57cec5SDimitry Andricdef OPCODE6_ALIGN : OPCODE6<0b100000>; 1020b57cec5SDimitry Andricdef OPCODE6_DALIGN : OPCODE6<0b100100>; 1030b57cec5SDimitry Andricdef OPCODE6_BITSWAP : OPCODE6<0b100000>; 1040b57cec5SDimitry Andricdef OPCODE6_DBITSWAP : OPCODE6<0b100100>; 1050b57cec5SDimitry Andricdef OPCODE6_JALR : OPCODE6<0b001001>; 1060b57cec5SDimitry Andricdef OPCODE6_CACHE : OPCODE6<0b100101>; 1070b57cec5SDimitry Andricdef OPCODE6_PREF : OPCODE6<0b110101>; 1080b57cec5SDimitry Andric// The next four constants are unnamed in the spec. These names are taken from 1090b57cec5SDimitry Andric// the OPGROUP names they are used with. 1100b57cec5SDimitry Andricdef OPCODE6_LL : OPCODE6<0b110110>; 1110b57cec5SDimitry Andricdef OPCODE6_LLD : OPCODE6<0b110111>; 1120b57cec5SDimitry Andricdef OPCODE6_SC : OPCODE6<0b100110>; 1130b57cec5SDimitry Andricdef OPCODE6_SCD : OPCODE6<0b100111>; 1140b57cec5SDimitry Andricdef OPCODE6_CLO : OPCODE6<0b010001>; 1150b57cec5SDimitry Andricdef OPCODE6_CLZ : OPCODE6<0b010000>; 1160b57cec5SDimitry Andricdef OPCODE6_DCLO : OPCODE6<0b010011>; 1170b57cec5SDimitry Andricdef OPCODE6_DCLZ : OPCODE6<0b010010>; 1180b57cec5SDimitry Andricdef OPCODE6_LSA : OPCODE6<0b000101>; 1190b57cec5SDimitry Andricdef OPCODE6_DLSA : OPCODE6<0b010101>; 1200b57cec5SDimitry Andricdef OPCODE6_SDBBP : OPCODE6<0b001110>; 1210b57cec5SDimitry Andric 1220b57cec5SDimitry Andricclass FIELD_FMT<bits<5> Val> { 1230b57cec5SDimitry Andric bits<5> Value = Val; 1240b57cec5SDimitry Andric} 1250b57cec5SDimitry Andricdef FIELD_FMT_S : FIELD_FMT<0b10000>; 1260b57cec5SDimitry Andricdef FIELD_FMT_D : FIELD_FMT<0b10001>; 1270b57cec5SDimitry Andric 1280b57cec5SDimitry Andricclass FIELD_CMP_COND<bits<5> Val> { 1290b57cec5SDimitry Andric bits<5> Value = Val; 1300b57cec5SDimitry Andric} 1310b57cec5SDimitry Andric// Note: The CMP_COND_FMT names differ from the C_COND_FMT names. 1320b57cec5SDimitry Andricdef FIELD_CMP_COND_AF : FIELD_CMP_COND<0b00000>; 1330b57cec5SDimitry Andricdef FIELD_CMP_COND_UN : FIELD_CMP_COND<0b00001>; 1340b57cec5SDimitry Andricdef FIELD_CMP_COND_EQ : FIELD_CMP_COND<0b00010>; 1350b57cec5SDimitry Andricdef FIELD_CMP_COND_UEQ : FIELD_CMP_COND<0b00011>; 1360b57cec5SDimitry Andricdef FIELD_CMP_COND_LT : FIELD_CMP_COND<0b00100>; 1370b57cec5SDimitry Andricdef FIELD_CMP_COND_ULT : FIELD_CMP_COND<0b00101>; 1380b57cec5SDimitry Andricdef FIELD_CMP_COND_LE : FIELD_CMP_COND<0b00110>; 1390b57cec5SDimitry Andricdef FIELD_CMP_COND_ULE : FIELD_CMP_COND<0b00111>; 1400b57cec5SDimitry Andricdef FIELD_CMP_COND_SAF : FIELD_CMP_COND<0b01000>; 1410b57cec5SDimitry Andricdef FIELD_CMP_COND_SUN : FIELD_CMP_COND<0b01001>; 1420b57cec5SDimitry Andricdef FIELD_CMP_COND_SEQ : FIELD_CMP_COND<0b01010>; 1430b57cec5SDimitry Andricdef FIELD_CMP_COND_SUEQ : FIELD_CMP_COND<0b01011>; 1440b57cec5SDimitry Andricdef FIELD_CMP_COND_SLT : FIELD_CMP_COND<0b01100>; 1450b57cec5SDimitry Andricdef FIELD_CMP_COND_SULT : FIELD_CMP_COND<0b01101>; 1460b57cec5SDimitry Andricdef FIELD_CMP_COND_SLE : FIELD_CMP_COND<0b01110>; 1470b57cec5SDimitry Andricdef FIELD_CMP_COND_SULE : FIELD_CMP_COND<0b01111>; 1480b57cec5SDimitry Andric 1490b57cec5SDimitry Andricclass FIELD_CMP_FORMAT<bits<5> Val> { 1500b57cec5SDimitry Andric bits<5> Value = Val; 1510b57cec5SDimitry Andric} 1520b57cec5SDimitry Andricdef FIELD_CMP_FORMAT_S : FIELD_CMP_FORMAT<0b10100>; 1530b57cec5SDimitry Andricdef FIELD_CMP_FORMAT_D : FIELD_CMP_FORMAT<0b10101>; 1540b57cec5SDimitry Andric 1550b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 1560b57cec5SDimitry Andric// 1570b57cec5SDimitry Andric// Disambiguators 1580b57cec5SDimitry Andric// 1590b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 1600b57cec5SDimitry Andric// 1610b57cec5SDimitry Andric// Some encodings are ambiguous except by comparing field values. 1620b57cec5SDimitry Andric 1630b57cec5SDimitry Andricclass DecodeDisambiguates<string Name> { 1640b57cec5SDimitry Andric string DecoderMethod = !strconcat("Decode", Name); 1650b57cec5SDimitry Andric} 1660b57cec5SDimitry Andric 1670b57cec5SDimitry Andricclass DecodeDisambiguatedBy<string Name> : DecodeDisambiguates<Name> { 1680b57cec5SDimitry Andric string DecoderNamespace = "Mips32r6_64r6_Ambiguous"; 1690b57cec5SDimitry Andric} 1700b57cec5SDimitry Andric 1710b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 1720b57cec5SDimitry Andric// 1730b57cec5SDimitry Andric// Encoding Formats 1740b57cec5SDimitry Andric// 1750b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 1760b57cec5SDimitry Andric 1770b57cec5SDimitry Andricclass AUI_FM : MipsR6Inst { 1780b57cec5SDimitry Andric bits<5> rs; 1790b57cec5SDimitry Andric bits<5> rt; 1800b57cec5SDimitry Andric bits<16> imm; 1810b57cec5SDimitry Andric 1820b57cec5SDimitry Andric bits<32> Inst; 1830b57cec5SDimitry Andric 1840b57cec5SDimitry Andric let Inst{31-26} = OPGROUP_AUI.Value; 1850b57cec5SDimitry Andric let Inst{25-21} = rs; 1860b57cec5SDimitry Andric let Inst{20-16} = rt; 1870b57cec5SDimitry Andric let Inst{15-0} = imm; 1880b57cec5SDimitry Andric} 1890b57cec5SDimitry Andric 1900b57cec5SDimitry Andricclass DAUI_FM : AUI_FM { 1910b57cec5SDimitry Andric let Inst{31-26} = OPGROUP_DAUI.Value; 1920b57cec5SDimitry Andric} 1930b57cec5SDimitry Andric 1940b57cec5SDimitry Andricclass BAL_FM : MipsR6Inst { 1950b57cec5SDimitry Andric bits<16> offset; 1960b57cec5SDimitry Andric 1970b57cec5SDimitry Andric bits<32> Inst; 1980b57cec5SDimitry Andric 1990b57cec5SDimitry Andric let Inst{31-26} = OPGROUP_REGIMM.Value; 2000b57cec5SDimitry Andric let Inst{25-21} = 0b00000; 2010b57cec5SDimitry Andric let Inst{20-16} = OPCODE5_BGEZAL.Value; 2020b57cec5SDimitry Andric let Inst{15-0} = offset; 2030b57cec5SDimitry Andric} 2040b57cec5SDimitry Andric 205*0fca6ea1SDimitry Andric// NAL for Release 6 206*0fca6ea1SDimitry Andricclass NAL_FM : MipsR6Inst { 207*0fca6ea1SDimitry Andric bits<32> Inst; 208*0fca6ea1SDimitry Andric 209*0fca6ea1SDimitry Andric let Inst{31-26} = OPGROUP_REGIMM.Value; 210*0fca6ea1SDimitry Andric let Inst{25-21} = 0b00000; 211*0fca6ea1SDimitry Andric let Inst{20-16} = OPCODE5_NAL.Value; 212*0fca6ea1SDimitry Andric let Inst{15-0} = 0x00; 213*0fca6ea1SDimitry Andric} 214*0fca6ea1SDimitry Andric 2150b57cec5SDimitry Andricclass COP0_EVP_DVP_FM<bits<1> sc> : MipsR6Inst { 2160b57cec5SDimitry Andric bits<5> rt; 2170b57cec5SDimitry Andric 2180b57cec5SDimitry Andric bits<32> Inst; 2190b57cec5SDimitry Andric 2200b57cec5SDimitry Andric let Inst{31-26} = OPGROUP_COP0.Value; 2210b57cec5SDimitry Andric let Inst{25-21} = 0b01011; 2220b57cec5SDimitry Andric let Inst{20-16} = rt; 2230b57cec5SDimitry Andric let Inst{15-11} = 0b00000; 2240b57cec5SDimitry Andric let Inst{10-6} = 0b00000; 2250b57cec5SDimitry Andric let Inst{5} = sc; 2260b57cec5SDimitry Andric let Inst{4-3} = 0b00; 2270b57cec5SDimitry Andric let Inst{2-0} = 0b100; 2280b57cec5SDimitry Andric} 2290b57cec5SDimitry Andric 2300b57cec5SDimitry Andricclass COP1_2R_FM<bits<6> funct, FIELD_FMT Format> : MipsR6Inst { 2310b57cec5SDimitry Andric bits<5> fs; 2320b57cec5SDimitry Andric bits<5> fd; 2330b57cec5SDimitry Andric 2340b57cec5SDimitry Andric bits<32> Inst; 2350b57cec5SDimitry Andric 2360b57cec5SDimitry Andric let Inst{31-26} = OPGROUP_COP1.Value; 2370b57cec5SDimitry Andric let Inst{25-21} = Format.Value; 2380b57cec5SDimitry Andric let Inst{20-16} = 0b00000; 2390b57cec5SDimitry Andric let Inst{15-11} = fs; 2400b57cec5SDimitry Andric let Inst{10-6} = fd; 2410b57cec5SDimitry Andric let Inst{5-0} = funct; 2420b57cec5SDimitry Andric} 2430b57cec5SDimitry Andric 2440b57cec5SDimitry Andricclass COP1_3R_FM<bits<6> funct, FIELD_FMT Format> : MipsR6Inst { 2450b57cec5SDimitry Andric bits<5> ft; 2460b57cec5SDimitry Andric bits<5> fs; 2470b57cec5SDimitry Andric bits<5> fd; 2480b57cec5SDimitry Andric 2490b57cec5SDimitry Andric bits<32> Inst; 2500b57cec5SDimitry Andric 2510b57cec5SDimitry Andric let Inst{31-26} = OPGROUP_COP1.Value; 2520b57cec5SDimitry Andric let Inst{25-21} = Format.Value; 2530b57cec5SDimitry Andric let Inst{20-16} = ft; 2540b57cec5SDimitry Andric let Inst{15-11} = fs; 2550b57cec5SDimitry Andric let Inst{10-6} = fd; 2560b57cec5SDimitry Andric let Inst{5-0} = funct; 2570b57cec5SDimitry Andric} 2580b57cec5SDimitry Andric 2590b57cec5SDimitry Andricclass COP1_BCCZ_FM<OPCODE5 Operation> : MipsR6Inst { 2600b57cec5SDimitry Andric bits<5> ft; 2610b57cec5SDimitry Andric bits<16> offset; 2620b57cec5SDimitry Andric 2630b57cec5SDimitry Andric bits<32> Inst; 2640b57cec5SDimitry Andric 2650b57cec5SDimitry Andric let Inst{31-26} = OPGROUP_COP1.Value; 2660b57cec5SDimitry Andric let Inst{25-21} = Operation.Value; 2670b57cec5SDimitry Andric let Inst{20-16} = ft; 2680b57cec5SDimitry Andric let Inst{15-0} = offset; 2690b57cec5SDimitry Andric} 2700b57cec5SDimitry Andric 2710b57cec5SDimitry Andricclass COP2_BCCZ_FM<OPCODE5 Operation> : MipsR6Inst { 2720b57cec5SDimitry Andric bits<5> ct; 2730b57cec5SDimitry Andric bits<16> offset; 2740b57cec5SDimitry Andric 2750b57cec5SDimitry Andric bits<32> Inst; 2760b57cec5SDimitry Andric 2770b57cec5SDimitry Andric let Inst{31-26} = OPGROUP_COP2.Value; 2780b57cec5SDimitry Andric let Inst{25-21} = Operation.Value; 2790b57cec5SDimitry Andric let Inst{20-16} = ct; 2800b57cec5SDimitry Andric let Inst{15-0} = offset; 2810b57cec5SDimitry Andric} 2820b57cec5SDimitry Andric 2830b57cec5SDimitry Andricclass PCREL16_FM<OPCODE5 Operation> : MipsR6Inst { 2840b57cec5SDimitry Andric bits<5> rs; 2850b57cec5SDimitry Andric bits<16> imm; 2860b57cec5SDimitry Andric 2870b57cec5SDimitry Andric bits<32> Inst; 2880b57cec5SDimitry Andric 2890b57cec5SDimitry Andric let Inst{31-26} = OPGROUP_PCREL.Value; 2900b57cec5SDimitry Andric let Inst{25-21} = rs; 2910b57cec5SDimitry Andric let Inst{20-16} = Operation.Value; 2920b57cec5SDimitry Andric let Inst{15-0} = imm; 2930b57cec5SDimitry Andric} 2940b57cec5SDimitry Andric 2950b57cec5SDimitry Andricclass PCREL19_FM<OPCODE2 Operation> : MipsR6Inst { 2960b57cec5SDimitry Andric bits<5> rs; 2970b57cec5SDimitry Andric bits<19> imm; 2980b57cec5SDimitry Andric 2990b57cec5SDimitry Andric bits<32> Inst; 3000b57cec5SDimitry Andric 3010b57cec5SDimitry Andric let Inst{31-26} = OPGROUP_PCREL.Value; 3020b57cec5SDimitry Andric let Inst{25-21} = rs; 3030b57cec5SDimitry Andric let Inst{20-19} = Operation.Value; 3040b57cec5SDimitry Andric let Inst{18-0} = imm; 3050b57cec5SDimitry Andric} 3060b57cec5SDimitry Andric 3070b57cec5SDimitry Andricclass PCREL18_FM<OPCODE3 Operation> : MipsR6Inst { 3080b57cec5SDimitry Andric bits<5> rs; 3090b57cec5SDimitry Andric bits<18> imm; 3100b57cec5SDimitry Andric 3110b57cec5SDimitry Andric bits<32> Inst; 3120b57cec5SDimitry Andric 3130b57cec5SDimitry Andric let Inst{31-26} = OPGROUP_PCREL.Value; 3140b57cec5SDimitry Andric let Inst{25-21} = rs; 3150b57cec5SDimitry Andric let Inst{20-18} = Operation.Value; 3160b57cec5SDimitry Andric let Inst{17-0} = imm; 3170b57cec5SDimitry Andric} 3180b57cec5SDimitry Andric 3190b57cec5SDimitry Andricclass SPECIAL3_2R_FM<OPCODE6 Operation> : MipsR6Inst { 3200b57cec5SDimitry Andric bits<5> rd; 3210b57cec5SDimitry Andric bits<5> rt; 3220b57cec5SDimitry Andric 3230b57cec5SDimitry Andric bits<32> Inst; 3240b57cec5SDimitry Andric 3250b57cec5SDimitry Andric let Inst{31-26} = OPGROUP_SPECIAL3.Value; 3260b57cec5SDimitry Andric let Inst{25-21} = 0b00000; 3270b57cec5SDimitry Andric let Inst{20-16} = rt; 3280b57cec5SDimitry Andric let Inst{15-11} = rd; 3290b57cec5SDimitry Andric let Inst{10-6} = 0b00000; 3300b57cec5SDimitry Andric let Inst{5-0} = Operation.Value; 3310b57cec5SDimitry Andric} 3320b57cec5SDimitry Andric 3330b57cec5SDimitry Andricclass SPECIAL3_MEM_FM<OPCODE6 Operation> : MipsR6Inst { 3340b57cec5SDimitry Andric bits<21> addr; 3350b57cec5SDimitry Andric bits<5> hint; 3360b57cec5SDimitry Andric bits<5> base = addr{20-16}; 3370b57cec5SDimitry Andric bits<9> offset = addr{8-0}; 3380b57cec5SDimitry Andric 3390b57cec5SDimitry Andric bits<32> Inst; 3400b57cec5SDimitry Andric 3410b57cec5SDimitry Andric let Inst{31-26} = OPGROUP_SPECIAL3.Value; 3420b57cec5SDimitry Andric let Inst{25-21} = base; 3430b57cec5SDimitry Andric let Inst{20-16} = hint; 3440b57cec5SDimitry Andric let Inst{15-7} = offset; 3450b57cec5SDimitry Andric let Inst{6} = 0; 3460b57cec5SDimitry Andric let Inst{5-0} = Operation.Value; 3470b57cec5SDimitry Andric} 3480b57cec5SDimitry Andric 3490b57cec5SDimitry Andricclass SPECIAL_2R_FM<OPCODE6 Operation> : MipsR6Inst { 3500b57cec5SDimitry Andric bits<5> rd; 3510b57cec5SDimitry Andric bits<5> rs; 3520b57cec5SDimitry Andric 3530b57cec5SDimitry Andric bits<32> Inst; 3540b57cec5SDimitry Andric 3550b57cec5SDimitry Andric let Inst{31-26} = OPGROUP_SPECIAL.Value; 3560b57cec5SDimitry Andric let Inst{25-21} = rs; 3570b57cec5SDimitry Andric let Inst{20-16} = 0b00000; 3580b57cec5SDimitry Andric let Inst{15-11} = rd; 3590b57cec5SDimitry Andric let Inst{10-6} = 0b00001; 3600b57cec5SDimitry Andric let Inst{5-0} = Operation.Value; 3610b57cec5SDimitry Andric} 3620b57cec5SDimitry Andric 3630b57cec5SDimitry Andricclass SPECIAL_3R_FM<bits<5> mulop, bits<6> funct> : MipsR6Inst { 3640b57cec5SDimitry Andric bits<5> rd; 3650b57cec5SDimitry Andric bits<5> rs; 3660b57cec5SDimitry Andric bits<5> rt; 3670b57cec5SDimitry Andric 3680b57cec5SDimitry Andric bits<32> Inst; 3690b57cec5SDimitry Andric 3700b57cec5SDimitry Andric let Inst{31-26} = OPGROUP_SPECIAL.Value; 3710b57cec5SDimitry Andric let Inst{25-21} = rs; 3720b57cec5SDimitry Andric let Inst{20-16} = rt; 3730b57cec5SDimitry Andric let Inst{15-11} = rd; 3740b57cec5SDimitry Andric let Inst{10-6} = mulop; 3750b57cec5SDimitry Andric let Inst{5-0} = funct; 3760b57cec5SDimitry Andric} 3770b57cec5SDimitry Andric 3780b57cec5SDimitry Andricclass SPECIAL_SDBBP_FM : MipsR6Inst { 3790b57cec5SDimitry Andric bits<20> code_; 3800b57cec5SDimitry Andric 3810b57cec5SDimitry Andric bits<32> Inst; 3820b57cec5SDimitry Andric 3830b57cec5SDimitry Andric let Inst{31-26} = OPGROUP_SPECIAL.Value; 3840b57cec5SDimitry Andric let Inst{25-6} = code_; 3850b57cec5SDimitry Andric let Inst{5-0} = OPCODE6_SDBBP.Value; 3860b57cec5SDimitry Andric} 3870b57cec5SDimitry Andric 3880b57cec5SDimitry Andric// This class is ambiguous with other branches: 3890b57cec5SDimitry Andric// BEQC/BNEC require that rs < rt && rs != 0 3900b57cec5SDimitry Andricclass CMP_BRANCH_2R_OFF16_FM<OPGROUP funct> : MipsR6Inst { 3910b57cec5SDimitry Andric bits<5> rs; 3920b57cec5SDimitry Andric bits<5> rt; 3930b57cec5SDimitry Andric bits<16> offset; 3940b57cec5SDimitry Andric 3950b57cec5SDimitry Andric bits<32> Inst; 3960b57cec5SDimitry Andric 3970b57cec5SDimitry Andric let Inst{31-26} = funct.Value; 3980b57cec5SDimitry Andric let Inst{25-21} = rs; 3990b57cec5SDimitry Andric let Inst{20-16} = rt; 4000b57cec5SDimitry Andric let Inst{15-0} = offset; 4010b57cec5SDimitry Andric} 4020b57cec5SDimitry Andric 4030b57cec5SDimitry Andric// This class is ambiguous with other branches: 4040b57cec5SDimitry Andric// BLEZC/BGEZC/BEQZALC/BNEZALC/BGTZALC require that rs == 0 && rt != 0 4050b57cec5SDimitry Andric// The '1R_RT' in the name means 1 register in the rt field. 4060b57cec5SDimitry Andricclass CMP_BRANCH_1R_RT_OFF16_FM<OPGROUP funct> : MipsR6Inst { 4070b57cec5SDimitry Andric bits<5> rt; 4080b57cec5SDimitry Andric bits<16> offset; 4090b57cec5SDimitry Andric 4100b57cec5SDimitry Andric bits<32> Inst; 4110b57cec5SDimitry Andric 4120b57cec5SDimitry Andric let Inst{31-26} = funct.Value; 4130b57cec5SDimitry Andric let Inst{25-21} = 0b00000; 4140b57cec5SDimitry Andric let Inst{20-16} = rt; 4150b57cec5SDimitry Andric let Inst{15-0} = offset; 4160b57cec5SDimitry Andric} 4170b57cec5SDimitry Andric 4180b57cec5SDimitry Andric// This class is ambiguous with other branches: 4190b57cec5SDimitry Andric// BLTZC/BGTZC/BLTZALC/BGEZALC require that rs == rt && rt != 0 4200b57cec5SDimitry Andric// The '1R_BOTH' in the name means 1 register in both the rs and rt fields. 4210b57cec5SDimitry Andricclass CMP_BRANCH_1R_BOTH_OFF16_FM<OPGROUP funct> : MipsR6Inst { 4220b57cec5SDimitry Andric bits<5> rt; 4230b57cec5SDimitry Andric bits<16> offset; 4240b57cec5SDimitry Andric 4250b57cec5SDimitry Andric bits<32> Inst; 4260b57cec5SDimitry Andric 4270b57cec5SDimitry Andric let Inst{31-26} = funct.Value; 4280b57cec5SDimitry Andric let Inst{25-21} = rt; 4290b57cec5SDimitry Andric let Inst{20-16} = rt; 4300b57cec5SDimitry Andric let Inst{15-0} = offset; 4310b57cec5SDimitry Andric} 4320b57cec5SDimitry Andric 4330b57cec5SDimitry Andricclass CMP_BRANCH_OFF21_FM<bits<6> funct> : MipsR6Inst { 4340b57cec5SDimitry Andric bits<5> rs; // rs != 0 4350b57cec5SDimitry Andric bits<21> offset; 4360b57cec5SDimitry Andric 4370b57cec5SDimitry Andric bits<32> Inst; 4380b57cec5SDimitry Andric 4390b57cec5SDimitry Andric let Inst{31-26} = funct; 4400b57cec5SDimitry Andric let Inst{25-21} = rs; 4410b57cec5SDimitry Andric let Inst{20-0} = offset; 4420b57cec5SDimitry Andric} 4430b57cec5SDimitry Andric 4440b57cec5SDimitry Andricclass JMP_IDX_COMPACT_FM<bits<6> funct> : MipsR6Inst { 4450b57cec5SDimitry Andric bits<5> rt; 4460b57cec5SDimitry Andric bits<16> offset; 4470b57cec5SDimitry Andric 4480b57cec5SDimitry Andric bits<32> Inst; 4490b57cec5SDimitry Andric 4500b57cec5SDimitry Andric let Inst{31-26} = funct; 4510b57cec5SDimitry Andric let Inst{25-21} = 0b00000; 4520b57cec5SDimitry Andric let Inst{20-16} = rt; 4530b57cec5SDimitry Andric let Inst{15-0} = offset; 4540b57cec5SDimitry Andric} 4550b57cec5SDimitry Andric 4560b57cec5SDimitry Andricclass BRANCH_OFF26_FM<bits<6> funct> : MipsR6Inst { 4570b57cec5SDimitry Andric bits<32> Inst; 4580b57cec5SDimitry Andric bits<26> offset; 4590b57cec5SDimitry Andric 4600b57cec5SDimitry Andric let Inst{31-26} = funct; 4610b57cec5SDimitry Andric let Inst{25-0} = offset; 4620b57cec5SDimitry Andric} 4630b57cec5SDimitry Andric 4640b57cec5SDimitry Andricclass SPECIAL3_ALIGN_FM<OPCODE6 Operation> : MipsR6Inst { 4650b57cec5SDimitry Andric bits<5> rd; 4660b57cec5SDimitry Andric bits<5> rs; 4670b57cec5SDimitry Andric bits<5> rt; 4680b57cec5SDimitry Andric bits<2> bp; 4690b57cec5SDimitry Andric 4700b57cec5SDimitry Andric bits<32> Inst; 4710b57cec5SDimitry Andric 4720b57cec5SDimitry Andric let Inst{31-26} = OPGROUP_SPECIAL3.Value; 4730b57cec5SDimitry Andric let Inst{25-21} = rs; 4740b57cec5SDimitry Andric let Inst{20-16} = rt; 4750b57cec5SDimitry Andric let Inst{15-11} = rd; 4760b57cec5SDimitry Andric let Inst{10-8} = 0b010; 4770b57cec5SDimitry Andric let Inst{7-6} = bp; 4780b57cec5SDimitry Andric let Inst{5-0} = Operation.Value; 4790b57cec5SDimitry Andric} 4800b57cec5SDimitry Andric 4810b57cec5SDimitry Andricclass SPECIAL3_DALIGN_FM<OPCODE6 Operation> : MipsR6Inst { 4820b57cec5SDimitry Andric bits<5> rd; 4830b57cec5SDimitry Andric bits<5> rs; 4840b57cec5SDimitry Andric bits<5> rt; 4850b57cec5SDimitry Andric bits<3> bp; 4860b57cec5SDimitry Andric 4870b57cec5SDimitry Andric bits<32> Inst; 4880b57cec5SDimitry Andric 4890b57cec5SDimitry Andric let Inst{31-26} = OPGROUP_SPECIAL3.Value; 4900b57cec5SDimitry Andric let Inst{25-21} = rs; 4910b57cec5SDimitry Andric let Inst{20-16} = rt; 4920b57cec5SDimitry Andric let Inst{15-11} = rd; 4930b57cec5SDimitry Andric let Inst{10-9} = 0b01; 4940b57cec5SDimitry Andric let Inst{8-6} = bp; 4950b57cec5SDimitry Andric let Inst{5-0} = Operation.Value; 4960b57cec5SDimitry Andric} 4970b57cec5SDimitry Andric 4980b57cec5SDimitry Andricclass SPECIAL3_LL_SC_FM<OPCODE6 Operation> : MipsR6Inst { 4990b57cec5SDimitry Andric bits<5> rt; 5000b57cec5SDimitry Andric bits<21> addr; 5010b57cec5SDimitry Andric bits<5> base = addr{20-16}; 5020b57cec5SDimitry Andric bits<9> offset = addr{8-0}; 5030b57cec5SDimitry Andric 5040b57cec5SDimitry Andric bits<32> Inst; 5050b57cec5SDimitry Andric 5060b57cec5SDimitry Andric let Inst{31-26} = OPGROUP_SPECIAL3.Value; 5070b57cec5SDimitry Andric let Inst{25-21} = base; 5080b57cec5SDimitry Andric let Inst{20-16} = rt; 5090b57cec5SDimitry Andric let Inst{15-7} = offset; 5100b57cec5SDimitry Andric let Inst{5-0} = Operation.Value; 5110b57cec5SDimitry Andric 5120b57cec5SDimitry Andric string DecoderMethod = "DecodeSpecial3LlSc"; 5130b57cec5SDimitry Andric} 5140b57cec5SDimitry Andric 5150b57cec5SDimitry Andricclass SPECIAL_LSA_FM<OPCODE6 Operation> : MipsR6Inst { 5160b57cec5SDimitry Andric bits<5> rd; 5170b57cec5SDimitry Andric bits<5> rs; 5180b57cec5SDimitry Andric bits<5> rt; 5190b57cec5SDimitry Andric bits<2> imm2; 5200b57cec5SDimitry Andric 5210b57cec5SDimitry Andric bits<32> Inst; 5220b57cec5SDimitry Andric 5230b57cec5SDimitry Andric let Inst{31-26} = OPGROUP_SPECIAL.Value; 5240b57cec5SDimitry Andric let Inst{25-21} = rs; 5250b57cec5SDimitry Andric let Inst{20-16} = rt; 5260b57cec5SDimitry Andric let Inst{15-11} = rd; 5270b57cec5SDimitry Andric let Inst{10-8} = 0b000; 5280b57cec5SDimitry Andric let Inst{7-6} = imm2; 5290b57cec5SDimitry Andric let Inst{5-0} = Operation.Value; 5300b57cec5SDimitry Andric} 5310b57cec5SDimitry Andric 5320b57cec5SDimitry Andricclass REGIMM_FM<OPCODE5 Operation> : MipsR6Inst { 5330b57cec5SDimitry Andric bits<5> rs; 5340b57cec5SDimitry Andric bits<16> imm; 5350b57cec5SDimitry Andric 5360b57cec5SDimitry Andric bits<32> Inst; 5370b57cec5SDimitry Andric 5380b57cec5SDimitry Andric let Inst{31-26} = OPGROUP_REGIMM.Value; 5390b57cec5SDimitry Andric let Inst{25-21} = rs; 5400b57cec5SDimitry Andric let Inst{20-16} = Operation.Value; 5410b57cec5SDimitry Andric let Inst{15-0} = imm; 5420b57cec5SDimitry Andric} 5430b57cec5SDimitry Andric 5440b57cec5SDimitry Andricclass COP1_CMP_CONDN_FM<FIELD_CMP_FORMAT Format, 5450b57cec5SDimitry Andric FIELD_CMP_COND Cond> : MipsR6Inst { 5460b57cec5SDimitry Andric bits<5> fd; 5470b57cec5SDimitry Andric bits<5> fs; 5480b57cec5SDimitry Andric bits<5> ft; 5490b57cec5SDimitry Andric 5500b57cec5SDimitry Andric bits<32> Inst; 5510b57cec5SDimitry Andric 5520b57cec5SDimitry Andric let Inst{31-26} = OPGROUP_COP1.Value; 5530b57cec5SDimitry Andric let Inst{25-21} = Format.Value; 5540b57cec5SDimitry Andric let Inst{20-16} = ft; 5550b57cec5SDimitry Andric let Inst{15-11} = fs; 5560b57cec5SDimitry Andric let Inst{10-6} = fd; 5570b57cec5SDimitry Andric let Inst{5} = 0; 5580b57cec5SDimitry Andric let Inst{4-0} = Cond.Value; 5590b57cec5SDimitry Andric} 5600b57cec5SDimitry Andric 5610b57cec5SDimitry Andricclass JR_HB_R6_FM<OPCODE6 Operation> : MipsR6Inst { 5620b57cec5SDimitry Andric bits<5> rs; 5630b57cec5SDimitry Andric 5640b57cec5SDimitry Andric bits<32> Inst; 5650b57cec5SDimitry Andric 5660b57cec5SDimitry Andric let Inst{31-26} = OPGROUP_SPECIAL.Value; 5670b57cec5SDimitry Andric let Inst{25-21} = rs; 5680b57cec5SDimitry Andric let Inst{20-16} = 0; 5690b57cec5SDimitry Andric let Inst{15-11} = 0; 5700b57cec5SDimitry Andric let Inst{10} = 1; 5710b57cec5SDimitry Andric let Inst{9-6} = 0; 5720b57cec5SDimitry Andric let Inst{5-0} = Operation.Value; 5730b57cec5SDimitry Andric} 5740b57cec5SDimitry Andric 5750b57cec5SDimitry Andricclass COP2LDST_FM<OPCODE5 Operation> : MipsR6Inst { 5760b57cec5SDimitry Andric bits<5> rt; 5770b57cec5SDimitry Andric bits<21> addr; 5780b57cec5SDimitry Andric bits<5> base = addr{20-16}; 5790b57cec5SDimitry Andric bits<11> offset = addr{10-0}; 5800b57cec5SDimitry Andric 5810b57cec5SDimitry Andric bits<32> Inst; 5820b57cec5SDimitry Andric 5830b57cec5SDimitry Andric let Inst{31-26} = OPGROUP_COP2LDST.Value; 5840b57cec5SDimitry Andric let Inst{25-21} = Operation.Value; 5850b57cec5SDimitry Andric let Inst{20-16} = rt; 5860b57cec5SDimitry Andric let Inst{15-11} = base; 5870b57cec5SDimitry Andric let Inst{10-0} = offset; 5880b57cec5SDimitry Andric} 5890b57cec5SDimitry Andric 5900b57cec5SDimitry Andricclass SPECIAL3_2R_SZ_CRC<bits<2> sz, bits<3> direction> : MipsR6Inst { 5910b57cec5SDimitry Andric bits<5> rs; 5920b57cec5SDimitry Andric bits<5> rt; 5930b57cec5SDimitry Andric 5940b57cec5SDimitry Andric let Inst{31-26} = OPGROUP_SPECIAL3.Value; 5950b57cec5SDimitry Andric let Inst{25-21} = rs; 5960b57cec5SDimitry Andric let Inst{20-16} = rt; 5970b57cec5SDimitry Andric let Inst{15-11} = 0b00000; 5980b57cec5SDimitry Andric let Inst{10-8} = direction; 5990b57cec5SDimitry Andric let Inst{7-6} = sz; 6000b57cec5SDimitry Andric let Inst{5-0} = 0b001111; 6010b57cec5SDimitry Andric 6020b57cec5SDimitry Andric string DecoderMethod = "DecodeCRC"; 6030b57cec5SDimitry Andric} 6040b57cec5SDimitry Andric 6050b57cec5SDimitry Andricclass SPECIAL3_GINV<bits<2> ginv> : MipsR6Inst { 6060b57cec5SDimitry Andric bits<5> rs; 6070b57cec5SDimitry Andric bits<2> type_; 6080b57cec5SDimitry Andric 6090b57cec5SDimitry Andric let Inst{31-26} = OPGROUP_SPECIAL3.Value; 6100b57cec5SDimitry Andric let Inst{25-21} = rs; 6110b57cec5SDimitry Andric let Inst{20-10} = 0x0; 6120b57cec5SDimitry Andric let Inst{9-8} = type_; 6130b57cec5SDimitry Andric let Inst{7-6} = ginv; 6140b57cec5SDimitry Andric let Inst{5-0} = 0b111101; 6150b57cec5SDimitry Andric} 6160b57cec5SDimitry Andric 6170b57cec5SDimitry Andricclass SIGRIE_FM : MipsR6Inst { 6180b57cec5SDimitry Andric bits<16> code_; 6190b57cec5SDimitry Andric 6200b57cec5SDimitry Andric let Inst{31-26} = OPGROUP_REGIMM.Value; 6210b57cec5SDimitry Andric let Inst{25-21} = 0; 6220b57cec5SDimitry Andric let Inst{20-16} = OPCODE5_SIGRIE.Value; 6230b57cec5SDimitry Andric let Inst{15-0} = code_; 6240b57cec5SDimitry Andric} 625