xref: /freebsd/contrib/llvm-project/llvm/lib/Target/X86/X86InstrFormats.td (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
10b57cec5SDimitry Andric//===-- X86InstrFormats.td - X86 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//===----------------------------------------------------------------------===//
100b57cec5SDimitry Andric// X86 Instruction Format Definitions.
110b57cec5SDimitry Andric//
120b57cec5SDimitry Andric
130b57cec5SDimitry Andric// Format specifies the encoding used by the instruction.  This is part of the
140b57cec5SDimitry Andric// ad-hoc solution used to emit machine instruction encodings by our machine
150b57cec5SDimitry Andric// code emitter.
160b57cec5SDimitry Andricclass Format<bits<7> val> {
170b57cec5SDimitry Andric  bits<7> Value = val;
180b57cec5SDimitry Andric}
190b57cec5SDimitry Andric
200b57cec5SDimitry Andricdef Pseudo        : Format<0>;
210b57cec5SDimitry Andricdef RawFrm        : Format<1>;
220b57cec5SDimitry Andricdef AddRegFrm     : Format<2>;
230b57cec5SDimitry Andricdef RawFrmMemOffs : Format<3>;
240b57cec5SDimitry Andricdef RawFrmSrc     : Format<4>;
250b57cec5SDimitry Andricdef RawFrmDst     : Format<5>;
260b57cec5SDimitry Andricdef RawFrmDstSrc  : Format<6>;
270b57cec5SDimitry Andricdef RawFrmImm8    : Format<7>;
280b57cec5SDimitry Andricdef RawFrmImm16   : Format<8>;
290b57cec5SDimitry Andricdef AddCCFrm      : Format<9>;
305ffd83dbSDimitry Andricdef PrefixByte    : Format<10>;
31*0fca6ea1SDimitry Andricdef MRMDestRegCC  : Format<18>;
32*0fca6ea1SDimitry Andricdef MRMDestMemCC  : Format<19>;
33bdd1243dSDimitry Andricdef MRMDestMem4VOp3CC : Format<20>;
345ffd83dbSDimitry Andricdef MRMr0          : Format<21>;
355ffd83dbSDimitry Andricdef MRMSrcMemFSIB  : Format<22>;
365ffd83dbSDimitry Andricdef MRMDestMemFSIB : Format<23>;
375ffd83dbSDimitry Andricdef MRMDestMem     : Format<24>;
385ffd83dbSDimitry Andricdef MRMSrcMem      : Format<25>;
395ffd83dbSDimitry Andricdef MRMSrcMem4VOp3 : Format<26>;
405ffd83dbSDimitry Andricdef MRMSrcMemOp4   : Format<27>;
415ffd83dbSDimitry Andricdef MRMSrcMemCC    : Format<28>;
425ffd83dbSDimitry Andricdef MRMXmCC: Format<30>;
435ffd83dbSDimitry Andricdef MRMXm  : Format<31>;
445ffd83dbSDimitry Andricdef MRM0m  : Format<32>;  def MRM1m  : Format<33>;  def MRM2m  : Format<34>;
455ffd83dbSDimitry Andricdef MRM3m  : Format<35>;  def MRM4m  : Format<36>;  def MRM5m  : Format<37>;
465ffd83dbSDimitry Andricdef MRM6m  : Format<38>;  def MRM7m  : Format<39>;
475ffd83dbSDimitry Andricdef MRMDestReg     : Format<40>;
485ffd83dbSDimitry Andricdef MRMSrcReg      : Format<41>;
495ffd83dbSDimitry Andricdef MRMSrcReg4VOp3 : Format<42>;
505ffd83dbSDimitry Andricdef MRMSrcRegOp4   : Format<43>;
515ffd83dbSDimitry Andricdef MRMSrcRegCC    : Format<44>;
525ffd83dbSDimitry Andricdef MRMXrCC: Format<46>;
535ffd83dbSDimitry Andricdef MRMXr  : Format<47>;
545ffd83dbSDimitry Andricdef MRM0r  : Format<48>;  def MRM1r  : Format<49>;  def MRM2r  : Format<50>;
555ffd83dbSDimitry Andricdef MRM3r  : Format<51>;  def MRM4r  : Format<52>;  def MRM5r  : Format<53>;
565ffd83dbSDimitry Andricdef MRM6r  : Format<54>;  def MRM7r  : Format<55>;
575ffd83dbSDimitry Andricdef MRM0X  : Format<56>;  def MRM1X  : Format<57>;  def MRM2X  : Format<58>;
585ffd83dbSDimitry Andricdef MRM3X  : Format<59>;  def MRM4X  : Format<60>;  def MRM5X  : Format<61>;
595ffd83dbSDimitry Andricdef MRM6X  : Format<62>;  def MRM7X  : Format<63>;
600b57cec5SDimitry Andricdef MRM_C0 : Format<64>;  def MRM_C1 : Format<65>;  def MRM_C2 : Format<66>;
610b57cec5SDimitry Andricdef MRM_C3 : Format<67>;  def MRM_C4 : Format<68>;  def MRM_C5 : Format<69>;
620b57cec5SDimitry Andricdef MRM_C6 : Format<70>;  def MRM_C7 : Format<71>;  def MRM_C8 : Format<72>;
630b57cec5SDimitry Andricdef MRM_C9 : Format<73>;  def MRM_CA : Format<74>;  def MRM_CB : Format<75>;
640b57cec5SDimitry Andricdef MRM_CC : Format<76>;  def MRM_CD : Format<77>;  def MRM_CE : Format<78>;
650b57cec5SDimitry Andricdef MRM_CF : Format<79>;  def MRM_D0 : Format<80>;  def MRM_D1 : Format<81>;
660b57cec5SDimitry Andricdef MRM_D2 : Format<82>;  def MRM_D3 : Format<83>;  def MRM_D4 : Format<84>;
670b57cec5SDimitry Andricdef MRM_D5 : Format<85>;  def MRM_D6 : Format<86>;  def MRM_D7 : Format<87>;
680b57cec5SDimitry Andricdef MRM_D8 : Format<88>;  def MRM_D9 : Format<89>;  def MRM_DA : Format<90>;
690b57cec5SDimitry Andricdef MRM_DB : Format<91>;  def MRM_DC : Format<92>;  def MRM_DD : Format<93>;
700b57cec5SDimitry Andricdef MRM_DE : Format<94>;  def MRM_DF : Format<95>;  def MRM_E0 : Format<96>;
710b57cec5SDimitry Andricdef MRM_E1 : Format<97>;  def MRM_E2 : Format<98>;  def MRM_E3 : Format<99>;
720b57cec5SDimitry Andricdef MRM_E4 : Format<100>; def MRM_E5 : Format<101>; def MRM_E6 : Format<102>;
730b57cec5SDimitry Andricdef MRM_E7 : Format<103>; def MRM_E8 : Format<104>; def MRM_E9 : Format<105>;
740b57cec5SDimitry Andricdef MRM_EA : Format<106>; def MRM_EB : Format<107>; def MRM_EC : Format<108>;
750b57cec5SDimitry Andricdef MRM_ED : Format<109>; def MRM_EE : Format<110>; def MRM_EF : Format<111>;
760b57cec5SDimitry Andricdef MRM_F0 : Format<112>; def MRM_F1 : Format<113>; def MRM_F2 : Format<114>;
770b57cec5SDimitry Andricdef MRM_F3 : Format<115>; def MRM_F4 : Format<116>; def MRM_F5 : Format<117>;
780b57cec5SDimitry Andricdef MRM_F6 : Format<118>; def MRM_F7 : Format<119>; def MRM_F8 : Format<120>;
790b57cec5SDimitry Andricdef MRM_F9 : Format<121>; def MRM_FA : Format<122>; def MRM_FB : Format<123>;
800b57cec5SDimitry Andricdef MRM_FC : Format<124>; def MRM_FD : Format<125>; def MRM_FE : Format<126>;
810b57cec5SDimitry Andricdef MRM_FF : Format<127>;
820b57cec5SDimitry Andric
830b57cec5SDimitry Andric// ImmType - This specifies the immediate type used by an instruction. This is
840b57cec5SDimitry Andric// part of the ad-hoc solution used to emit machine instruction encodings by our
850b57cec5SDimitry Andric// machine code emitter.
860b57cec5SDimitry Andricclass ImmType<bits<4> val> {
870b57cec5SDimitry Andric  bits<4> Value = val;
880b57cec5SDimitry Andric}
890b57cec5SDimitry Andricdef NoImm      : ImmType<0>;
900b57cec5SDimitry Andricdef Imm8       : ImmType<1>;
910b57cec5SDimitry Andricdef Imm8PCRel  : ImmType<2>;
920b57cec5SDimitry Andricdef Imm8Reg    : ImmType<3>; // Register encoded in [7:4].
930b57cec5SDimitry Andricdef Imm16      : ImmType<4>;
940b57cec5SDimitry Andricdef Imm16PCRel : ImmType<5>;
950b57cec5SDimitry Andricdef Imm32      : ImmType<6>;
960b57cec5SDimitry Andricdef Imm32PCRel : ImmType<7>;
970b57cec5SDimitry Andricdef Imm32S     : ImmType<8>;
980b57cec5SDimitry Andricdef Imm64      : ImmType<9>;
990b57cec5SDimitry Andric
1000b57cec5SDimitry Andric// FPFormat - This specifies what form this FP instruction has.  This is used by
1010b57cec5SDimitry Andric// the Floating-Point stackifier pass.
1020b57cec5SDimitry Andricclass FPFormat<bits<3> val> {
1030b57cec5SDimitry Andric  bits<3> Value = val;
1040b57cec5SDimitry Andric}
1050b57cec5SDimitry Andricdef NotFP      : FPFormat<0>;
1060b57cec5SDimitry Andricdef ZeroArgFP  : FPFormat<1>;
1070b57cec5SDimitry Andricdef OneArgFP   : FPFormat<2>;
1080b57cec5SDimitry Andricdef OneArgFPRW : FPFormat<3>;
1090b57cec5SDimitry Andricdef TwoArgFP   : FPFormat<4>;
1100b57cec5SDimitry Andricdef CompareFP  : FPFormat<5>;
1110b57cec5SDimitry Andricdef CondMovFP  : FPFormat<6>;
1120b57cec5SDimitry Andricdef SpecialFP  : FPFormat<7>;
1130b57cec5SDimitry Andric
1140b57cec5SDimitry Andric// Class specifying the SSE execution domain, used by the SSEDomainFix pass.
1150b57cec5SDimitry Andric// Keep in sync with tables in X86InstrInfo.cpp.
1160b57cec5SDimitry Andricclass Domain<bits<2> val> {
1170b57cec5SDimitry Andric  bits<2> Value = val;
1180b57cec5SDimitry Andric}
1190b57cec5SDimitry Andricdef GenericDomain   : Domain<0>;
1200b57cec5SDimitry Andricdef SSEPackedSingle : Domain<1>;
1210b57cec5SDimitry Andricdef SSEPackedDouble : Domain<2>;
1220b57cec5SDimitry Andricdef SSEPackedInt    : Domain<3>;
1230b57cec5SDimitry Andric
1240b57cec5SDimitry Andric// Class specifying the vector form of the decompressed
1250b57cec5SDimitry Andric// displacement of 8-bit.
1260b57cec5SDimitry Andricclass CD8VForm<bits<3> val> {
1270b57cec5SDimitry Andric  bits<3> Value = val;
1280b57cec5SDimitry Andric}
1290b57cec5SDimitry Andricdef CD8VF  : CD8VForm<0>;  // v := VL
1300b57cec5SDimitry Andricdef CD8VH  : CD8VForm<1>;  // v := VL/2
1310b57cec5SDimitry Andricdef CD8VQ  : CD8VForm<2>;  // v := VL/4
1320b57cec5SDimitry Andricdef CD8VO  : CD8VForm<3>;  // v := VL/8
1330b57cec5SDimitry Andric// The tuple (subvector) forms.
1340b57cec5SDimitry Andricdef CD8VT1 : CD8VForm<4>;  // v := 1
1350b57cec5SDimitry Andricdef CD8VT2 : CD8VForm<5>;  // v := 2
1360b57cec5SDimitry Andricdef CD8VT4 : CD8VForm<6>;  // v := 4
1370b57cec5SDimitry Andricdef CD8VT8 : CD8VForm<7>;  // v := 8
1380b57cec5SDimitry Andric
1390b57cec5SDimitry Andric// Class specifying the prefix used an opcode extension.
1400b57cec5SDimitry Andricclass Prefix<bits<3> val> {
1410b57cec5SDimitry Andric  bits<3> Value = val;
1420b57cec5SDimitry Andric}
1430b57cec5SDimitry Andricdef NoPrfx : Prefix<0>;
1440b57cec5SDimitry Andricdef PD     : Prefix<1>;
1450b57cec5SDimitry Andricdef XS     : Prefix<2>;
1460b57cec5SDimitry Andricdef XD     : Prefix<3>;
1470b57cec5SDimitry Andricdef PS     : Prefix<4>; // Similar to NoPrfx, but disassembler uses this to know
1480b57cec5SDimitry Andric                        // that other instructions with this opcode use PD/XS/XD
1490b57cec5SDimitry Andric                        // and if any of those is not supported they shouldn't
1500b57cec5SDimitry Andric                        // decode to this instruction. e.g. ANDSS/ANDSD don't
1510b57cec5SDimitry Andric                        // exist, but the 0xf2/0xf3 encoding shouldn't
1520b57cec5SDimitry Andric                        // disable to ANDPS.
1530b57cec5SDimitry Andric
1540b57cec5SDimitry Andric// Class specifying the opcode map.
155349cc55cSDimitry Andricclass Map<bits<4> val> {
156349cc55cSDimitry Andric  bits<4> Value = val;
1570b57cec5SDimitry Andric}
1580b57cec5SDimitry Andricdef OB        : Map<0>;
1590b57cec5SDimitry Andricdef TB        : Map<1>;
1600b57cec5SDimitry Andricdef T8        : Map<2>;
1610b57cec5SDimitry Andricdef TA        : Map<3>;
1620b57cec5SDimitry Andricdef XOP8      : Map<4>;
1630b57cec5SDimitry Andricdef XOP9      : Map<5>;
1640b57cec5SDimitry Andricdef XOPA      : Map<6>;
1650b57cec5SDimitry Andricdef ThreeDNow : Map<7>;
1665f757f3fSDimitry Andricdef T_MAP4    : Map<8>;
1675f757f3fSDimitry Andricdef T_MAP5    : Map<9>;
1685f757f3fSDimitry Andricdef T_MAP6    : Map<10>;
1695f757f3fSDimitry Andricdef T_MAP7    : Map<11>;
1700b57cec5SDimitry Andric
1710b57cec5SDimitry Andric// Class specifying the encoding
1720b57cec5SDimitry Andricclass Encoding<bits<2> val> {
1730b57cec5SDimitry Andric  bits<2> Value = val;
1740b57cec5SDimitry Andric}
1750b57cec5SDimitry Andricdef EncNormal : Encoding<0>;
1760b57cec5SDimitry Andricdef EncVEX    : Encoding<1>;
1770b57cec5SDimitry Andricdef EncXOP    : Encoding<2>;
1780b57cec5SDimitry Andricdef EncEVEX   : Encoding<3>;
1790b57cec5SDimitry Andric
1800b57cec5SDimitry Andric// Operand size for encodings that change based on mode.
1810b57cec5SDimitry Andricclass OperandSize<bits<2> val> {
1820b57cec5SDimitry Andric  bits<2> Value = val;
1830b57cec5SDimitry Andric}
1840b57cec5SDimitry Andricdef OpSizeFixed  : OperandSize<0>; // Never needs a 0x66 prefix.
185cb14a3feSDimitry Andricdef OpSize16     : OperandSize<1>; // Needs 0x66 prefix in 32/64-bit mode.
1860b57cec5SDimitry Andricdef OpSize32     : OperandSize<2>; // Needs 0x66 prefix in 16-bit mode.
1870b57cec5SDimitry Andric
1880b57cec5SDimitry Andric// Address size for encodings that change based on mode.
1890b57cec5SDimitry Andricclass AddressSize<bits<2> val> {
1900b57cec5SDimitry Andric  bits<2> Value = val;
1910b57cec5SDimitry Andric}
1920b57cec5SDimitry Andricdef AdSizeX  : AddressSize<0>; // Address size determined using addr operand.
1930b57cec5SDimitry Andricdef AdSize16 : AddressSize<1>; // Encodes a 16-bit address.
1940b57cec5SDimitry Andricdef AdSize32 : AddressSize<2>; // Encodes a 32-bit address.
1950b57cec5SDimitry Andricdef AdSize64 : AddressSize<3>; // Encodes a 64-bit address.
1960b57cec5SDimitry Andric
1975f757f3fSDimitry Andric// Force the instruction to use REX2/VEX/EVEX encoding.
1985f757f3fSDimitry Andricclass ExplicitOpPrefix<bits<2> val> {
1995f757f3fSDimitry Andric  bits<2> Value = val;
2000b57cec5SDimitry Andric}
2015f757f3fSDimitry Andricdef NoExplicitOpPrefix : ExplicitOpPrefix<0>;
2025f757f3fSDimitry Andricdef ExplicitREX2       : ExplicitOpPrefix<1>;
2035f757f3fSDimitry Andricdef ExplicitVEX        : ExplicitOpPrefix<2>;
2045f757f3fSDimitry Andricdef ExplicitEVEX       : ExplicitOpPrefix<3>;
205e8d8bef9SDimitry Andric
2060b57cec5SDimitry Andricclass X86Inst<bits<8> opcod, Format f, ImmType i, dag outs, dag ins,
2070b57cec5SDimitry Andric              string AsmStr, Domain d = GenericDomain>
2080b57cec5SDimitry Andric  : Instruction {
2090b57cec5SDimitry Andric  let Namespace = "X86";
2100b57cec5SDimitry Andric
2110b57cec5SDimitry Andric  bits<8> Opcode = opcod;
2120b57cec5SDimitry Andric  Format Form = f;
2130b57cec5SDimitry Andric  bits<7> FormBits = Form.Value;
2140b57cec5SDimitry Andric  ImmType ImmT = i;
2150b57cec5SDimitry Andric
2160b57cec5SDimitry Andric  dag OutOperandList = outs;
2170b57cec5SDimitry Andric  dag InOperandList = ins;
2180b57cec5SDimitry Andric  string AsmString = AsmStr;
2190b57cec5SDimitry Andric
2200b57cec5SDimitry Andric  // If this is a pseudo instruction, mark it isCodeGenOnly.
2210b57cec5SDimitry Andric  let isCodeGenOnly = !eq(!cast<string>(f), "Pseudo");
2220b57cec5SDimitry Andric
223349cc55cSDimitry Andric  let HasPositionOrder = 1;
224349cc55cSDimitry Andric
2250b57cec5SDimitry Andric  //
2260b57cec5SDimitry Andric  // Attributes specific to X86 instructions...
2270b57cec5SDimitry Andric  //
2280b57cec5SDimitry Andric  bit ForceDisassemble = 0; // Force instruction to disassemble even though it's
2290b57cec5SDimitry Andric                            // isCodeGenonly. Needed to hide an ambiguous
2300b57cec5SDimitry Andric                            // AsmString from the parser, but still disassemble.
2310b57cec5SDimitry Andric
2320b57cec5SDimitry Andric  OperandSize OpSize = OpSizeFixed; // Does this instruction's encoding change
2330b57cec5SDimitry Andric                                    // based on operand size of the mode?
2340b57cec5SDimitry Andric  bits<2> OpSizeBits = OpSize.Value;
2350b57cec5SDimitry Andric  AddressSize AdSize = AdSizeX; // Does this instruction's encoding change
2360b57cec5SDimitry Andric                                // based on address size of the mode?
2370b57cec5SDimitry Andric  bits<2> AdSizeBits = AdSize.Value;
2380b57cec5SDimitry Andric
239cb14a3feSDimitry Andric  Encoding OpEnc = EncNormal; // Encoding used by this instruction
240cb14a3feSDimitry Andric  // Which prefix byte does this inst have?
241cb14a3feSDimitry Andric  Prefix OpPrefix = !if(!eq(OpEnc, EncNormal), NoPrfx, PS);
2420b57cec5SDimitry Andric  bits<3> OpPrefixBits = OpPrefix.Value;
2430b57cec5SDimitry Andric  Map OpMap = OB;           // Which opcode map does this inst have?
244349cc55cSDimitry Andric  bits<4> OpMapBits = OpMap.Value;
24581ad6265SDimitry Andric  bit hasREX_W  = 0;  // Does this inst require the REX.W prefix?
2460b57cec5SDimitry Andric  FPFormat FPForm = NotFP;  // What flavor of FP instruction is this?
2470b57cec5SDimitry Andric  bit hasLockPrefix = 0;    // Does this inst have a 0xF0 prefix?
2480b57cec5SDimitry Andric  Domain ExeDomain = d;
2490b57cec5SDimitry Andric  bit hasREPPrefix = 0;     // Does this inst have a REP prefix?
2500b57cec5SDimitry Andric  bits<2> OpEncBits = OpEnc.Value;
25106c3fb27SDimitry Andric  bit IgnoresW = 0;         // Does this inst ignore REX_W field?
2520b57cec5SDimitry Andric  bit hasVEX_4V = 0;        // Does this inst require the VEX.VVVV field?
2530b57cec5SDimitry Andric  bit hasVEX_L = 0;         // Does this inst use large (256-bit) registers?
2540b57cec5SDimitry Andric  bit ignoresVEX_L = 0;     // Does this instruction ignore the L-bit
2550b57cec5SDimitry Andric  bit hasEVEX_K = 0;        // Does this inst require masking?
2560b57cec5SDimitry Andric  bit hasEVEX_Z = 0;        // Does this inst set the EVEX_Z field?
2570b57cec5SDimitry Andric  bit hasEVEX_L2 = 0;       // Does this inst set the EVEX_L2 field?
2580b57cec5SDimitry Andric  bit hasEVEX_B = 0;        // Does this inst set the EVEX_B field?
259647cbc5dSDimitry Andric  bit hasEVEX_NF = 0;       // Does this inst set the EVEX_NF field?
260*0fca6ea1SDimitry Andric  bit hasTwoConditionalOps = 0;   // Does this inst have two conditional operands?
2610b57cec5SDimitry Andric  bits<3> CD8_Form = 0;     // Compressed disp8 form - vector-width.
2620b57cec5SDimitry Andric  // Declare it int rather than bits<4> so that all bits are defined when
2630b57cec5SDimitry Andric  // assigning to bits<7>.
2640b57cec5SDimitry Andric  int CD8_EltSize = 0;      // Compressed disp8 form - element-size in bytes.
2650b57cec5SDimitry Andric  bit hasEVEX_RC = 0;       // Explicitly specified rounding control in FP instruction.
2660b57cec5SDimitry Andric  bit hasNoTrackPrefix = 0; // Does this inst has 0x3E (NoTrack) prefix?
2670b57cec5SDimitry Andric
2680b57cec5SDimitry Andric  // Vector size in bytes.
2690b57cec5SDimitry Andric  bits<7> VectSize = !if(hasEVEX_L2, 64, !if(hasVEX_L, 32, 16));
2700b57cec5SDimitry Andric
2710b57cec5SDimitry Andric  // The scaling factor for AVX512's compressed displacement is either
2720b57cec5SDimitry Andric  //   - the size of a  power-of-two number of elements or
2730b57cec5SDimitry Andric  //   - the size of a single element for broadcasts or
2740b57cec5SDimitry Andric  //   - the total vector size divided by a power-of-two number.
2750b57cec5SDimitry Andric  // Possible values are: 0 (non-AVX512 inst), 1, 2, 4, 8, 16, 32 and 64.
2760b57cec5SDimitry Andric  bits<7> CD8_Scale = !if (!eq (OpEnc.Value, EncEVEX.Value),
2770b57cec5SDimitry Andric                           !if (CD8_Form{2},
2780b57cec5SDimitry Andric                                !shl(CD8_EltSize, CD8_Form{1-0}),
2790b57cec5SDimitry Andric                                !if (hasEVEX_B,
2800b57cec5SDimitry Andric                                     CD8_EltSize,
2810b57cec5SDimitry Andric                                     !srl(VectSize, CD8_Form{1-0}))), 0);
2820b57cec5SDimitry Andric
2835f757f3fSDimitry Andric  ExplicitOpPrefix explicitOpPrefix = NoExplicitOpPrefix;
2845f757f3fSDimitry Andric  bits<2> explicitOpPrefixBits = explicitOpPrefix.Value;
2850b57cec5SDimitry Andric  // TSFlags layout should be kept in sync with X86BaseInfo.h.
2860b57cec5SDimitry Andric  let TSFlags{6-0}   = FormBits;
2870b57cec5SDimitry Andric  let TSFlags{8-7}   = OpSizeBits;
2880b57cec5SDimitry Andric  let TSFlags{10-9}  = AdSizeBits;
2890b57cec5SDimitry Andric  // No need for 3rd bit, we don't need to distinguish NoPrfx from PS.
2900b57cec5SDimitry Andric  let TSFlags{12-11} = OpPrefixBits{1-0};
291349cc55cSDimitry Andric  let TSFlags{16-13} = OpMapBits;
29281ad6265SDimitry Andric  let TSFlags{17}    = hasREX_W;
293349cc55cSDimitry Andric  let TSFlags{21-18} = ImmT.Value;
294349cc55cSDimitry Andric  let TSFlags{24-22} = FPForm.Value;
295349cc55cSDimitry Andric  let TSFlags{25}    = hasLockPrefix;
296349cc55cSDimitry Andric  let TSFlags{26}    = hasREPPrefix;
297349cc55cSDimitry Andric  let TSFlags{28-27} = ExeDomain.Value;
298349cc55cSDimitry Andric  let TSFlags{30-29} = OpEncBits;
299349cc55cSDimitry Andric  let TSFlags{38-31} = Opcode;
30006c3fb27SDimitry Andric  let TSFlags{39}    = hasVEX_4V;
30106c3fb27SDimitry Andric  let TSFlags{40}    = hasVEX_L;
30206c3fb27SDimitry Andric  let TSFlags{41}    = hasEVEX_K;
30306c3fb27SDimitry Andric  let TSFlags{42}    = hasEVEX_Z;
30406c3fb27SDimitry Andric  let TSFlags{43}    = hasEVEX_L2;
30506c3fb27SDimitry Andric  let TSFlags{44}    = hasEVEX_B;
30606c3fb27SDimitry Andric  let TSFlags{47-45} = !if(!eq(CD8_Scale, 0), 0, !add(!logtwo(CD8_Scale), 1));
30706c3fb27SDimitry Andric  let TSFlags{48}    = hasEVEX_RC;
30806c3fb27SDimitry Andric  let TSFlags{49}    = hasNoTrackPrefix;
3095f757f3fSDimitry Andric  let TSFlags{51-50} = explicitOpPrefixBits;
310647cbc5dSDimitry Andric  let TSFlags{52}    = hasEVEX_NF;
311*0fca6ea1SDimitry Andric  let TSFlags{53}    = hasTwoConditionalOps;
3120b57cec5SDimitry Andric}
313