VirtualBox

Changeset 103846 in vbox


Ignore:
Timestamp:
Mar 14, 2024 11:28:41 AM (11 months ago)
Author:
vboxsync
Message:

VMM/IEM: Implement native emitter for IEM_MC_FETCH_XREG_U8(), bugref:10614

Location:
trunk/src/VBox/VMM
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/IEMAllInstPython.py

    r103843 r103846  
    30923092    'IEM_MC_FETCH_XREG_U32':                                     (McBlock.parseMcGeneric,           False, False, g_fNativeSimd),
    30933093    'IEM_MC_FETCH_XREG_U64':                                     (McBlock.parseMcGeneric,           False, False, g_fNativeSimd),
    3094     'IEM_MC_FETCH_XREG_U8':                                      (McBlock.parseMcGeneric,           False, False, False, ),
     3094    'IEM_MC_FETCH_XREG_U8':                                      (McBlock.parseMcGeneric,           False, False, g_fNativeSimd),
    30953095    'IEM_MC_FETCH_XREG_XMM':                                     (McBlock.parseMcGeneric,           False, False, False, ),
    30963096    'IEM_MC_FETCH_XREG_PAIR_U128':                               (McBlock.parseMcGeneric,           False, False, False, ),
  • trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompFuncs.h

    r103843 r103846  
    68656865
    68666866
     6867#define IEM_MC_FETCH_XREG_U8(a_u64Value, a_iXReg, a_iByte) \
     6868    off = iemNativeEmitSimdFetchXregU8(pReNative, off, a_u64Value, a_iXReg, a_iByte)
     6869
     6870/** Emits code for IEM_MC_FETCH_XREG_U8. */
     6871DECL_INLINE_THROW(uint32_t)
     6872iemNativeEmitSimdFetchXregU8(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint8_t idxDstVar, uint8_t iXReg, uint8_t iByte)
     6873{
     6874    IEMNATIVE_ASSERT_VAR_IDX(pReNative, idxDstVar);
     6875    IEMNATIVE_ASSERT_VAR_SIZE(pReNative, idxDstVar, sizeof(uint8_t));
     6876
     6877    uint8_t const idxSimdRegSrc = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(iXReg),
     6878                                                                          kIemNativeGstSimdRegLdStSz_Low128, kIemNativeGstRegUse_ReadOnly);
     6879
     6880    iemNativeVarSetKindToStack(pReNative, idxDstVar);
     6881    uint8_t const idxVarReg = iemNativeVarRegisterAcquire(pReNative, idxDstVar, &off);
     6882
     6883    off = iemNativeEmitSimdLoadGprFromVecRegU8(pReNative, off, idxVarReg, idxSimdRegSrc, iByte);
     6884
     6885    /* Free but don't flush the source register. */
     6886    iemNativeSimdRegFreeTmp(pReNative, idxSimdRegSrc);
     6887    iemNativeVarRegisterRelease(pReNative, idxDstVar);
     6888
     6889    return off;
     6890}
     6891
     6892
    68676893#define IEM_MC_STORE_XREG_U64(a_iXReg, a_iQWord, a_u64Value) \
    68686894    off = iemNativeEmitSimdStoreXregU64(pReNative, off, a_iXReg, a_u64Value, a_iQWord)
  • trunk/src/VBox/VMM/include/IEMN8veRecompilerEmit.h

    r103845 r103846  
    75537553
    75547554/**
     7555 * Emits a gprdst = vecsrc[x] load, 8-bit.
     7556 */
     7557DECL_FORCE_INLINE(uint32_t)
     7558iemNativeEmitSimdLoadGprFromVecRegU8Ex(PIEMNATIVEINSTR pCodeBuf, uint32_t off, uint8_t iGprDst, uint8_t iVecRegSrc, uint8_t iByte)
     7559{
     7560#ifdef RT_ARCH_AMD64
     7561    if (iByte >= 16)
     7562    {
     7563        /** @todo Currently not used. */
     7564        AssertReleaseFailed();
     7565    }
     7566    else
     7567    {
     7568        /* pextrb gpr, vecsrc, #iByte */
     7569        pCodeBuf[off++] = X86_OP_PRF_SIZE_OP;
     7570        if (iGprDst >= 8 || iVecRegSrc >= 8)
     7571            pCodeBuf[off++] =   (iVecRegSrc < 8 ? 0 : X86_OP_REX_R)
     7572                              | (iGprDst < 8 ? 0 : X86_OP_REX_B);
     7573        pCodeBuf[off++] = 0x0f;
     7574        pCodeBuf[off++] = 0x3a;
     7575        pCodeBuf[off++] = 0x14;
     7576        pCodeBuf[off++] = X86_MODRM_MAKE(X86_MOD_REG, iVecRegSrc & 7, iGprDst & 7);
     7577        pCodeBuf[off++] = iByte;
     7578    }
     7579#elif defined(RT_ARCH_ARM64)
     7580    /* umov gprdst, vecsrc[iByte] */
     7581    pCodeBuf[off++] = Armv8A64MkVecInstrUmov(iGprDst, iVecRegSrc, iByte, kArmv8InstrUmovInsSz_U8, false /*fDst64Bit*/);
     7582#else
     7583# error "port me"
     7584#endif
     7585    return off;
     7586}
     7587
     7588
     7589/**
     7590 * Emits a gprdst = vecsrc[x] load, 8-bit.
     7591 */
     7592DECL_INLINE_THROW(uint32_t)
     7593iemNativeEmitSimdLoadGprFromVecRegU8(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint8_t iGprDst, uint8_t iVecRegSrc, uint8_t iByte)
     7594{
     7595    Assert(iByte <= 32);
     7596
     7597#ifdef RT_ARCH_AMD64
     7598    off = iemNativeEmitSimdLoadGprFromVecRegU16Ex(iemNativeInstrBufEnsure(pReNative, off, 6), off, iGprDst, iVecRegSrc, iByte);
     7599#elif defined(RT_ARCH_ARM64)
     7600    /* ASSUMES that there are two adjacent 128-bit registers available for the 256-bit value. */
     7601    Assert(!(iVecRegSrc & 0x1));
     7602    /* Need to access the "high" 128-bit vector register. */
     7603    if (iByte >= 32)
     7604        off = iemNativeEmitSimdLoadGprFromVecRegU8Ex(iemNativeInstrBufEnsure(pReNative, off, 1), off, iGprDst, iVecRegSrc + 1, iByte - 32);
     7605    else
     7606        off = iemNativeEmitSimdLoadGprFromVecRegU8Ex(iemNativeInstrBufEnsure(pReNative, off, 1), off, iGprDst, iVecRegSrc, iByte);
     7607#else
     7608# error "port me"
     7609#endif
     7610    IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off);
     7611    return off;
     7612}
     7613
     7614
     7615/**
    75557616 * Emits a vecdst[x] = gprsrc store, 64-bit.
    75567617 */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette