LCOV - code coverage report
Current view: top level - asmjit - x86instdb_p.h (source / functions) Hit Total Coverage
Test: plumed test coverage (other modules) Lines: 0 2 0.0 %
Date: 2026-11-05 10:19:06 Functions: 0 0 -

          Line data    Source code
       1             : #ifdef __PLUMED_HAS_ASMJIT
       2             : // This file is part of AsmJit project <https://asmjit.com>
       3             : //
       4             : // See asmjit.h or LICENSE.md for license and copyright information
       5             : // SPDX-License-Identifier: Zlib
       6             : 
       7             : #ifndef ASMJIT_X86_X86INSTDB_P_H_INCLUDED
       8             : #define ASMJIT_X86_X86INSTDB_P_H_INCLUDED
       9             : 
      10             : #include "x86instdb.h"
      11             : 
      12             : ASMJIT_BEGIN_SUB_NAMESPACE(x86)
      13             : 
      14             : //! \cond INTERNAL
      15             : //! \addtogroup asmjit_x86
      16             : //! \{
      17             : 
      18             : namespace InstDB {
      19             : 
      20             : //! Instruction encoding (X86).
      21             : //!
      22             : //! This is a specific identifier that is used by AsmJit to describe the way each instruction is encoded. Some
      23             : //! encodings are special only for a single instruction as X86 instruction set contains a lot of legacy encodings,
      24             : //! and some encodings describe a group of instructions that share some commons, like MMX, SSE, AVX, AVX512
      25             : //! instructions, etc...
      26             : enum EncodingId : uint32_t {
      27             :   kEncodingNone = 0,                     //!< Never used.
      28             :   kEncodingX86Op,                        //!< X86 [OP].
      29             :   kEncodingX86Op_Mod11RM,                //!< X86 [OP] (opcode with ModRM byte where MOD must be 11b).
      30             :   kEncodingX86Op_Mod11RM_I8,             //!< X86 [OP] (opcode with ModRM byte + 8-bit immediate).
      31             :   kEncodingX86Op_xAddr,                  //!< X86 [OP] (implicit address in the first register operand).
      32             :   kEncodingX86Op_xAX,                    //!< X86 [OP] (implicit or explicit '?AX' form).
      33             :   kEncodingX86Op_xDX_xAX,                //!< X86 [OP] (implicit or explicit '?DX, ?AX' form).
      34             :   kEncodingX86Op_MemZAX,                 //!< X86 [OP] (implicit or explicit '[EAX|RAX]' form).
      35             :   kEncodingX86I_xAX,                     //!< X86 [I] (implicit or explicit '?AX' form).
      36             :   kEncodingX86M,                         //!< X86 [M] (handles 2|4|8-bytes size).
      37             :   kEncodingX86M_NoMemSize,               //!< X86 [M] (handles 2|4|8-bytes size, but doesn't consider memory size).
      38             :   kEncodingX86M_NoSize,                  //!< X86 [M] (doesn't handle any size).
      39             :   kEncodingX86M_GPB,                     //!< X86 [M] (handles single-byte size).
      40             :   kEncodingX86M_GPB_MulDiv,              //!< X86 [M] (like GPB, handles implicit|explicit MUL|DIV|IDIV).
      41             :   kEncodingX86M_Only,                    //!< X86 [M] (restricted to memory operand of any size).
      42             :   kEncodingX86M_Only_EDX_EAX,            //!< X86 [M] (memory operand only, followed by implicit <edx> and <eax>).
      43             :   kEncodingX86M_Nop,                     //!< X86 [M] (special case of NOP instruction).
      44             :   kEncodingX86R_Native,                  //!< X86 [R] (register must be either 32-bit or 64-bit depending on arch).
      45             :   kEncodingX86R_FromM,                   //!< X86 [R] - which specifies memory address.
      46             :   kEncodingX86R32_EDX_EAX,               //!< X86 [R32] followed by implicit EDX and EAX.
      47             :   kEncodingX86Rm,                        //!< X86 [RM] (doesn't handle single-byte size).
      48             :   kEncodingX86Rm_Raw66H,                 //!< X86 [RM] (used by LZCNT, POPCNT, and TZCNT).
      49             :   kEncodingX86Rm_NoSize,                 //!< X86 [RM] (doesn't add REX.W prefix if 64-bit reg is used).
      50             :   kEncodingX86Mr,                        //!< X86 [MR] (doesn't handle single-byte size).
      51             :   kEncodingX86Mr_NoSize,                 //!< X86 [MR] (doesn't handle any size).
      52             :   kEncodingX86Arith,                     //!< X86 adc, add, and, cmp, or, sbb, sub, xor.
      53             :   kEncodingX86Bswap,                     //!< X86 bswap.
      54             :   kEncodingX86Bt,                        //!< X86 bt, btc, btr, bts.
      55             :   kEncodingX86Call,                      //!< X86 call.
      56             :   kEncodingX86Cmpxchg,                   //!< X86 [MR] cmpxchg.
      57             :   kEncodingX86Cmpxchg8b_16b,             //!< X86 [MR] cmpxchg8b, cmpxchg16b.
      58             :   kEncodingX86Crc,                       //!< X86 crc32.
      59             :   kEncodingX86Enter,                     //!< X86 enter.
      60             :   kEncodingX86Imul,                      //!< X86 imul.
      61             :   kEncodingX86In,                        //!< X86 in.
      62             :   kEncodingX86Ins,                       //!< X86 ins[b|q|d].
      63             :   kEncodingX86IncDec,                    //!< X86 inc, dec.
      64             :   kEncodingX86Int,                       //!< X86 int (interrupt).
      65             :   kEncodingX86Jcc,                       //!< X86 jcc.
      66             :   kEncodingX86JecxzLoop,                 //!< X86 jcxz, jecxz, jrcxz, loop, loope, loopne.
      67             :   kEncodingX86Jmp,                       //!< X86 jmp.
      68             :   kEncodingX86JmpRel,                    //!< X86 xbegin.
      69             :   kEncodingX86LcallLjmp,                 //!< X86 lcall/ljmp.
      70             :   kEncodingX86Lea,                       //!< X86 lea.
      71             :   kEncodingX86Mov,                       //!< X86 mov (all possible cases).
      72             :   kEncodingX86Movabs,                    //!< X86 movabs.
      73             :   kEncodingX86MovsxMovzx,                //!< X86 movsx, movzx.
      74             :   kEncodingX86MovntiMovdiri,             //!< X86 movnti/movdiri.
      75             :   kEncodingX86EnqcmdMovdir64b,           //!< X86 enqcmd/enqcmds/movdir64b.
      76             :   kEncodingX86Out,                       //!< X86 out.
      77             :   kEncodingX86Outs,                      //!< X86 out[b|w|d].
      78             :   kEncodingX86Push,                      //!< X86 push.
      79             :   kEncodingX86Pop,                       //!< X86 pop.
      80             :   kEncodingX86Ret,                       //!< X86 ret.
      81             :   kEncodingX86Rot,                       //!< X86 rcl, rcr, rol, ror, sal, sar, shl, shr.
      82             :   kEncodingX86Set,                       //!< X86 setcc.
      83             :   kEncodingX86ShldShrd,                  //!< X86 shld, shrd.
      84             :   kEncodingX86StrRm,                     //!< X86 lods.
      85             :   kEncodingX86StrMr,                     //!< X86 scas, stos.
      86             :   kEncodingX86StrMm,                     //!< X86 cmps, movs.
      87             :   kEncodingX86Test,                      //!< X86 test.
      88             :   kEncodingX86Xadd,                      //!< X86 xadd.
      89             :   kEncodingX86Xchg,                      //!< X86 xchg.
      90             :   kEncodingX86Fence,                     //!< X86 lfence, mfence, sfence.
      91             :   kEncodingX86Bndmov,                    //!< X86 [RM|MR] (used by BNDMOV).
      92             :   kEncodingFpuOp,                        //!< FPU [OP].
      93             :   kEncodingFpuArith,                     //!< FPU fadd, fdiv, fdivr, fmul, fsub, fsubr.
      94             :   kEncodingFpuCom,                       //!< FPU fcom, fcomp.
      95             :   kEncodingFpuFldFst,                    //!< FPU fld, fst, fstp.
      96             :   kEncodingFpuM,                         //!< FPU fiadd, ficom, ficomp, fidiv, fidivr, fild, fimul, fist, fistp, fisttp, fisub, fisubr.
      97             :   kEncodingFpuR,                         //!< FPU fcmov, fcomi, fcomip, ffree, fucom, fucomi, fucomip, fucomp, fxch.
      98             :   kEncodingFpuRDef,                      //!< FPU faddp, fdivp, fdivrp, fmulp, fsubp, fsubrp.
      99             :   kEncodingFpuStsw,                      //!< FPU fnstsw, Fstsw.
     100             :   kEncodingExtRm,                        //!< EXT [RM].
     101             :   kEncodingExtRm_XMM0,                   //!< EXT [RM<XMM0>].
     102             :   kEncodingExtRm_ZDI,                    //!< EXT [RM<ZDI>].
     103             :   kEncodingExtRm_P,                      //!< EXT [RM] (propagates 66H if the instruction uses XMM register).
     104             :   kEncodingExtRm_Wx,                     //!< EXT [RM] (propagates REX.W if GPQ is used or the second operand is GPQ/QWORD_PTR).
     105             :   kEncodingExtRm_Wx_GpqOnly,             //!< EXT [RM] (propagates REX.W if the first operand is GPQ register).
     106             :   kEncodingExtRmRi,                      //!< EXT [RM|RI].
     107             :   kEncodingExtRmRi_P,                    //!< EXT [RM|RI] (propagates 66H if the instruction uses XMM register).
     108             :   kEncodingExtRmi,                       //!< EXT [RMI].
     109             :   kEncodingExtRmi_P,                     //!< EXT [RMI] (propagates 66H if the instruction uses XMM register).
     110             :   kEncodingExtPextrw,                    //!< EXT pextrw.
     111             :   kEncodingExtExtract,                   //!< EXT pextrb, pextrd, pextrq, extractps.
     112             :   kEncodingExtMov,                       //!< EXT mov?? - #1:[MM|XMM, MM|XMM|Mem] #2:[MM|XMM|Mem, MM|XMM].
     113             :   kEncodingExtMovbe,                     //!< EXT movbe.
     114             :   kEncodingExtMovd,                      //!< EXT movd.
     115             :   kEncodingExtMovq,                      //!< EXT movq.
     116             :   kEncodingExtExtrq,                     //!< EXT extrq (SSE4A).
     117             :   kEncodingExtInsertq,                   //!< EXT insrq (SSE4A).
     118             :   kEncodingExt3dNow,                     //!< EXT [RMI] (3DNOW specific).
     119             :   kEncodingVexOp,                        //!< VEX [OP].
     120             :   kEncodingVexOpMod,                     //!< VEX [OP] with MODR/M.
     121             :   kEncodingVexKmov,                      //!< VEX [RM|MR] (used by kmov[b|w|d|q]).
     122             :   kEncodingVexR_Wx,                      //!< VEX|EVEX [R] (propagatex VEX.W if GPQ used).
     123             :   kEncodingVexM,                         //!< VEX|EVEX [M].
     124             :   kEncodingVexM_VM,                      //!< VEX|EVEX [M] (propagates VEX|EVEX.L, VSIB support).
     125             :   kEncodingVexMr_Lx,                     //!< VEX|EVEX [MR] (propagates VEX|EVEX.L if YMM used).
     126             :   kEncodingVexMr_VM,                     //!< VEX|EVEX [MR] (VSIB support).
     127             :   kEncodingVexMri,                       //!< VEX|EVEX [MRI].
     128             :   kEncodingVexMri_Lx,                    //!< VEX|EVEX [MRI] (propagates VEX|EVEX.L if YMM used).
     129             :   kEncodingVexMri_Vpextrw,               //!< VEX|EVEX [MRI] (special case required by VPEXTRW instruction).
     130             :   kEncodingVexRm,                        //!< VEX|EVEX [RM].
     131             :   kEncodingVexRm_ZDI,                    //!< VEX|EVEX [RM<ZDI>].
     132             :   kEncodingVexRm_Wx,                     //!< VEX|EVEX [RM] (propagates VEX|EVEX.W if GPQ used).
     133             :   kEncodingVexRm_Lx,                     //!< VEX|EVEX [RM] (propagates VEX|EVEX.L if YMM used).
     134             :   kEncodingVexRm_Lx_Narrow,              //!< VEX|EVEX [RM] (the destination vector size is narrowed).
     135             :   kEncodingVexRm_Lx_Bcst,                //!< VEX|EVEX [RM] (can handle broadcast r32/r64).
     136             :   kEncodingVexRm_VM,                     //!< VEX|EVEX [RM] (propagates VEX|EVEX.L, VSIB support).
     137             :   kEncodingVexRm_T1_4X,                  //!<     EVEX [RM] (used by NN instructions that use RM-T1_4X encoding).
     138             :   kEncodingVexRmi,                       //!< VEX|EVEX [RMI].
     139             :   kEncodingVexRmi_Wx,                    //!< VEX|EVEX [RMI] (propagates VEX|EVEX.W if GPQ used).
     140             :   kEncodingVexRmi_Lx,                    //!< VEX|EVEX [RMI] (propagates VEX|EVEX.L if YMM used).
     141             :   kEncodingVexRvm,                       //!< VEX|EVEX [RVM].
     142             :   kEncodingVexRvm_Wx,                    //!< VEX|EVEX [RVM] (propagates VEX|EVEX.W if GPQ used).
     143             :   kEncodingVexRvm_ZDX_Wx,                //!< VEX|EVEX [RVM<ZDX>] (propagates VEX|EVEX.W if GPQ used).
     144             :   kEncodingVexRvm_Lx,                    //!< VEX|EVEX [RVM] (propagates VEX|EVEX.L if YMM used).
     145             :   kEncodingVexRvm_Lx_KEvex,              //!< VEX|EVEX [RVM] (forces EVEX prefix if K register is used on destination).
     146             :   kEncodingVexRvm_Lx_2xK,                //!< VEX|EVEX [RVM] (vp2intersectd/vp2intersectq).
     147             :   kEncodingVexRvmr,                      //!< VEX|EVEX [RVMR].
     148             :   kEncodingVexRvmr_Lx,                   //!< VEX|EVEX [RVMR] (propagates VEX|EVEX.L if YMM used).
     149             :   kEncodingVexRvmi,                      //!< VEX|EVEX [RVMI].
     150             :   kEncodingVexRvmi_KEvex,                //!< VEX|EVEX [RVMI] (forces EVEX prefix if K register is used on destination).
     151             :   kEncodingVexRvmi_Lx,                   //!< VEX|EVEX [RVMI] (propagates VEX|EVEX.L if YMM used).
     152             :   kEncodingVexRvmi_Lx_KEvex,             //!< VEX|EVEX [RVMI] (forces EVEX prefix if K register is used on destination).
     153             :   kEncodingVexRmv,                       //!< VEX|EVEX [RMV].
     154             :   kEncodingVexRmv_Wx,                    //!< VEX|EVEX [RMV] (propagates VEX|EVEX.W if GPQ used).
     155             :   kEncodingVexRmv_VM,                    //!< VEX|EVEX [RMV] (propagates VEX|EVEX.L, VSIB support).
     156             :   kEncodingVexRmvRm_VM,                  //!< VEX|EVEX [RMV|RM] (propagates VEX|EVEX.L, VSIB support).
     157             :   kEncodingVexRmvi,                      //!< VEX|EVEX [RMVI].
     158             :   kEncodingVexRmMr,                      //!< VEX|EVEX [RM|MR].
     159             :   kEncodingVexRmMr_Lx,                   //!< VEX|EVEX [RM|MR] (propagates VEX|EVEX.L if YMM used).
     160             :   kEncodingVexRvmRmv,                    //!< VEX|EVEX [RVM|RMV].
     161             :   kEncodingVexRvmRmi,                    //!< VEX|EVEX [RVM|RMI].
     162             :   kEncodingVexRvmRmi_Lx,                 //!< VEX|EVEX [RVM|RMI] (propagates VEX|EVEX.L if YMM used).
     163             :   kEncodingVexRvmRmvRmi,                 //!< VEX|EVEX [RVM|RMV|RMI].
     164             :   kEncodingVexRvmMr,                     //!< VEX|EVEX [RVM|MR].
     165             :   kEncodingVexRvmMvr,                    //!< VEX|EVEX [RVM|MVR].
     166             :   kEncodingVexRvmMvr_Lx,                 //!< VEX|EVEX [RVM|MVR] (propagates VEX|EVEX.L if YMM used).
     167             :   kEncodingVexRvmVmi,                    //!< VEX|EVEX [RVM|VMI].
     168             :   kEncodingVexRvmVmi_Lx,                 //!< VEX|EVEX [RVM|VMI] (propagates VEX|EVEX.L if YMM used).
     169             :   kEncodingVexRvmVmi_Lx_MEvex,           //!< VEX|EVEX [RVM|VMI] (propagates EVEX if the second operand is memory).
     170             :   kEncodingVexVm,                        //!< VEX|EVEX [VM].
     171             :   kEncodingVexVm_Wx,                     //!< VEX|EVEX [VM] (propagates VEX|EVEX.W if GPQ used).
     172             :   kEncodingVexVmi,                       //!< VEX|EVEX [VMI].
     173             :   kEncodingVexVmi_Lx,                    //!< VEX|EVEX [VMI] (propagates VEX|EVEX.L if YMM used).
     174             :   kEncodingVexVmi4_Wx,                   //!< VEX|EVEX [VMI] (propagates VEX|EVEX.W if GPQ used, DWORD Immediate).
     175             :   kEncodingVexVmi_Lx_MEvex,              //!< VEX|EVEX [VMI] (force EVEX prefix when the second operand is memory)
     176             :   kEncodingVexRvrmRvmr,                  //!< VEX|EVEX [RVRM|RVMR].
     177             :   kEncodingVexRvrmRvmr_Lx,               //!< VEX|EVEX [RVRM|RVMR] (propagates VEX|EVEX.L if YMM used).
     178             :   kEncodingVexRvrmiRvmri_Lx,             //!< VEX|EVEX [RVRMI|RVMRI] (propagates VEX|EVEX.L if YMM used).
     179             :   kEncodingVexMovdMovq,                  //!< VEX|EVEX vmovd, vmovq.
     180             :   kEncodingVexMovssMovsd,                //!< VEX|EVEX vmovss, vmovsd.
     181             :   kEncodingFma4,                         //!< FMA4 [R, R, R/M, R/M].
     182             :   kEncodingFma4_Lx,                      //!< FMA4 [R, R, R/M, R/M] (propagates AVX.L if YMM used).
     183             :   kEncodingAmxCfg,                       //!< AMX ldtilecfg/sttilecfg.
     184             :   kEncodingAmxR,                         //!< AMX [R] - tilezero.
     185             :   kEncodingAmxRm,                        //!< AMX tileloadd/tileloaddt1.
     186             :   kEncodingAmxMr,                        //!< AMX tilestored.
     187             :   kEncodingAmxRmv,                       //!< AMX instructions that use TMM registers.
     188             :   kEncodingCount                         //!< Count of instruction encodings.
     189             : };
     190             : 
     191             : //! Additional information table, provides CPU extensions required to execute an instruction and RW flags.
     192             : struct AdditionalInfo {
     193             :   //! Index to `_instFlagsTable`.
     194             :   uint8_t _instFlagsIndex;
     195             :   //! Index to `_rwFlagsTable`.
     196             :   uint8_t _rwFlagsIndex;
     197             :   //! Features vector.
     198             :   uint8_t _features[6];
     199             : 
     200           0 :   inline const uint8_t* featuresBegin() const noexcept { return _features; }
     201           0 :   inline const uint8_t* featuresEnd() const noexcept { return _features + ASMJIT_ARRAY_SIZE(_features); }
     202             : };
     203             : 
     204             : // ${NameLimits:Begin}
     205             : // ------------------- Automatically generated, do not edit -------------------
     206             : enum : uint32_t { kMaxNameSize = 17 };
     207             : // ----------------------------------------------------------------------------
     208             : // ${NameLimits:End}
     209             : 
     210             : struct InstNameIndex {
     211             :   uint16_t start;
     212             :   uint16_t end;
     213             : };
     214             : 
     215             : struct RWInfo {
     216             :   enum Category : uint8_t {
     217             :     kCategoryGeneric,
     218             :     kCategoryMov,
     219             :     kCategoryMovabs,
     220             :     kCategoryImul,
     221             :     kCategoryMovh64,
     222             :     kCategoryPunpcklxx,
     223             :     kCategoryVmaskmov,
     224             :     kCategoryVmovddup,
     225             :     kCategoryVmovmskpd,
     226             :     kCategoryVmovmskps,
     227             :     kCategoryVmov1_2,
     228             :     kCategoryVmov1_4,
     229             :     kCategoryVmov1_8,
     230             :     kCategoryVmov2_1,
     231             :     kCategoryVmov4_1,
     232             :     kCategoryVmov8_1
     233             :   };
     234             : 
     235             :   uint8_t category;
     236             :   uint8_t rmInfo;
     237             :   uint8_t opInfoIndex[6];
     238             : };
     239             : 
     240             : struct RWInfoOp {
     241             :   uint64_t rByteMask;
     242             :   uint64_t wByteMask;
     243             :   uint8_t physId;
     244             :   uint8_t consecutiveLeadCount;
     245             :   uint8_t reserved[2];
     246             :   OpRWFlags flags;
     247             : };
     248             : 
     249             : //! R/M information.
     250             : //!
     251             : //! This data is used to replace register operand by a memory operand reliably.
     252             : struct RWInfoRm {
     253             :   enum Category : uint8_t {
     254             :     kCategoryNone = 0,
     255             :     kCategoryFixed,
     256             :     kCategoryConsistent,
     257             :     kCategoryHalf,
     258             :     kCategoryQuarter,
     259             :     kCategoryEighth
     260             :   };
     261             : 
     262             :   enum Flags : uint8_t {
     263             :     kFlagAmbiguous = 0x01,
     264             :     //! Special semantics for PEXTRW - memory operand can only be used with SSE4.1 instruction and it's forbidden in MMX.
     265             :     kFlagPextrw = 0x02,
     266             :     //! Special semantics for MOVSS and MOVSD - doesn't zero extend the destination if the operation is a reg to reg move.
     267             :     kFlagMovssMovsd = 0x04,
     268             :     //! Special semantics for AVX shift instructions that do not provide reg/mem in AVX/AVX2 mode (AVX-512 is required).
     269             :     kFlagFeatureIfRMI = 0x08
     270             :   };
     271             : 
     272             :   uint8_t category;
     273             :   uint8_t rmOpsMask;
     274             :   uint8_t fixedSize;
     275             :   uint8_t flags;
     276             :   uint8_t rmFeature;
     277             : };
     278             : 
     279             : struct RWFlagsInfoTable {
     280             :   //! CPU/FPU flags read.
     281             :   uint32_t readFlags;
     282             :   //! CPU/FPU flags written or undefined.
     283             :   uint32_t writeFlags;
     284             : };
     285             : 
     286             : extern const uint8_t rwInfoIndexA[Inst::_kIdCount];
     287             : extern const uint8_t rwInfoIndexB[Inst::_kIdCount];
     288             : extern const RWInfo rwInfoA[];
     289             : extern const RWInfo rwInfoB[];
     290             : extern const RWInfoOp rwInfoOp[];
     291             : extern const RWInfoRm rwInfoRm[];
     292             : extern const RWFlagsInfoTable _rwFlagsInfoTable[];
     293             : extern const InstRWFlags _instFlagsTable[];
     294             : 
     295             : extern const uint32_t _mainOpcodeTable[];
     296             : extern const uint32_t _altOpcodeTable[];
     297             : 
     298             : #ifndef ASMJIT_NO_TEXT
     299             : extern const char _nameData[];
     300             : extern const InstNameIndex instNameIndex[26];
     301             : #endif // !ASMJIT_NO_TEXT
     302             : 
     303             : extern const AdditionalInfo _additionalInfoTable[];
     304             : 
     305             : } // {InstDB}
     306             : 
     307             : //! \}
     308             : //! \endcond
     309             : 
     310             : ASMJIT_END_SUB_NAMESPACE
     311             : 
     312             : #endif // ASMJIT_X86_X86INSTDB_P_H_INCLUDED
     313             : 
     314             : #endif // __PLUMED_HAS_ASMJIT

Generated by: LCOV version 1.16