VirtualBox

Changeset 103834 in vbox


Ignore:
Timestamp:
Mar 13, 2024 3:32:59 PM (13 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
162204
Message:

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

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

Legend:

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

    r103828 r103834  
    29972997    'IEM_MC_CLEAR_FSW_EX':                                       (McBlock.parseMcGeneric,           True,  True,  False, ),
    29982998    'IEM_MC_CLEAR_HIGH_GREG_U64':                                (McBlock.parseMcGeneric,           True,  True,  True,  ),
    2999     'IEM_MC_CLEAR_XREG_U32_MASK':                                (McBlock.parseMcGeneric,           True,  True,  False, ),
     2999    'IEM_MC_CLEAR_XREG_U32_MASK':                                (McBlock.parseMcGeneric,           True,  True,  g_fNativeSimd),
    30003000    'IEM_MC_CLEAR_YREG_128_UP':                                  (McBlock.parseMcGeneric,           True,  True,  g_fNativeSimd),
    30013001    'IEM_MC_COMMIT_EFLAGS':                                      (McBlock.parseMcGeneric,           True,  True,  True,  ),
  • trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompFuncs.h

    r103828 r103834  
    71057105}
    71067106
     7107
     7108#define IEM_MC_CLEAR_XREG_U32_MASK(a_iXReg, a_bMask) \
     7109    off = iemNativeEmitSimdClearXregU32Mask(pReNative, off, a_iXReg, a_bMask)
     7110
     7111
     7112/** Emits code for IEM_MC_CLEAR_XREG_U32_MASK. */
     7113DECL_INLINE_THROW(uint32_t)
     7114iemNativeEmitSimdClearXregU32Mask(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint8_t iXReg, uint8_t bImm8Mask)
     7115{
     7116    uint8_t const idxSimdRegDst = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(iXReg),
     7117                                                                          kIemNativeGstSimdRegLdStSz_Low128, kIemNativeGstRegUse_ForUpdate);
     7118
     7119    /** @todo r=aeichner For certain bit combinations we could reduce the number of emitted instructions. */
     7120    if (bImm8Mask & RT_BIT(0))
     7121        off = iemNativeEmitSimdZeroVecRegElemU32(pReNative, off, idxSimdRegDst, 0 /*iDWord*/);
     7122    if (bImm8Mask & RT_BIT(1))
     7123        off = iemNativeEmitSimdZeroVecRegElemU32(pReNative, off, idxSimdRegDst, 1 /*iDWord*/);
     7124    if (bImm8Mask & RT_BIT(2))
     7125        off = iemNativeEmitSimdZeroVecRegElemU32(pReNative, off, idxSimdRegDst, 2 /*iDWord*/);
     7126    if (bImm8Mask & RT_BIT(3))
     7127        off = iemNativeEmitSimdZeroVecRegElemU32(pReNative, off, idxSimdRegDst, 3 /*iDWord*/);
     7128    IEMNATIVE_SIMD_REG_STATE_SET_DIRTY_LO_U128(pReNative, iXReg);
     7129
     7130    /* Free but don't flush the destination register. */
     7131    iemNativeSimdRegFreeTmp(pReNative, idxSimdRegDst);
     7132
     7133    return off;
     7134}
     7135
    71077136#endif /* IEMNATIVE_WITH_SIMD_REG_ALLOCATOR */
    71087137
  • trunk/src/VBox/VMM/include/IEMN8veRecompilerEmit.h

    r103828 r103834  
    75387538
    75397539/**
     7540 * Emits a vecdst.au32[iDWord] = 0 store.
     7541 */
     7542DECL_FORCE_INLINE(uint32_t)
     7543iemNativeEmitSimdZeroVecRegElemU32Ex(PIEMNATIVEINSTR pCodeBuf, uint32_t off, uint8_t iVecReg, uint8_t iDWord)
     7544{
     7545    Assert(iDWord <= 7);
     7546
     7547#ifdef RT_ARCH_AMD64
     7548    /*
     7549     * xor tmp0, tmp0
     7550     * pinsrd xmm, tmp0, iDword
     7551     */
     7552    if (IEMNATIVE_REG_FIXED_TMP0 >= 8)
     7553        pCodeBuf[off++] = X86_OP_REX_R | X86_OP_REX_B;
     7554    pCodeBuf[off++] = 0x33;
     7555    pCodeBuf[off++] = X86_MODRM_MAKE(X86_MOD_REG, IEMNATIVE_REG_FIXED_TMP0 & 7, IEMNATIVE_REG_FIXED_TMP0 & 7);
     7556    off = iemNativeEmitSimdStoreGprToVecRegU32Ex(&pCodeBuf[off], off, iVecReg, IEMNATIVE_REG_FIXED_TMP0, iDWord);
     7557#elif defined(RT_ARCH_ARM64)
     7558    /* ASSUMES that there are two adjacent 128-bit registers available for the 256-bit value. */
     7559    Assert(!(iVecReg & 0x1));
     7560    /* ins vecsrc[iDWord], wzr */
     7561    if (iDWord >= 4)
     7562        pCodeBuf[off++] = Armv8A64MkVecInstrIns(iVecReg + 1, ARMV8_A64_REG_WZR, iDWord - 4, kArmv8InstrUmovInsSz_U32);
     7563    else
     7564        pCodeBuf[off++] = Armv8A64MkVecInstrIns(iVecReg, ARMV8_A64_REG_WZR, iDWord, kArmv8InstrUmovInsSz_U32);
     7565#else
     7566# error "port me"
     7567#endif
     7568    return off;
     7569}
     7570
     7571
     7572/**
     7573 * Emits a vecdst.au32[iDWord] = 0 store.
     7574 */
     7575DECL_INLINE_THROW(uint32_t)
     7576iemNativeEmitSimdZeroVecRegElemU32(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint8_t iVecReg, uint8_t iDWord)
     7577{
     7578
     7579#ifdef RT_ARCH_AMD64
     7580    off = iemNativeEmitSimdZeroVecRegElemU32Ex(iemNativeInstrBufEnsure(pReNative, off, 10), off, iVecReg, iDWord);
     7581#elif defined(RT_ARCH_ARM64)
     7582    off = iemNativeEmitSimdZeroVecRegElemU32Ex(iemNativeInstrBufEnsure(pReNative, off, 1), off, iVecReg, iDWord);
     7583#else
     7584# error "port me"
     7585#endif
     7586    IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off);
     7587    return off;
     7588}
     7589
     7590
     7591/**
    75407592 * Emits a vecdst[0:127] = 0 store.
    75417593 */
Note: See TracChangeset for help on using the changeset viewer.

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