VirtualBox

Changeset 101589 in vbox for trunk


Ignore:
Timestamp:
Oct 25, 2023 12:34:28 PM (14 months ago)
Author:
vboxsync
Message:

VMM/IEM: Native IEM_MC_IF_ECX_IS_NZ_AND_EFL_BIT_SET, IEM_MC_IF_ECX_IS_NZ_AND_EFL_BIT_NOT_SET, IEM_MC_IF_RCX_IS_NZ_AND_EFL_BIT_SET, and IEM_MC_IF_RCX_IS_NZ_AND_EFL_BIT_NOT_SET translations. Loop related. bugref:10371

Location:
trunk/src/VBox/VMM/VMMAll
Files:
2 edited

Legend:

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

    r101587 r101589  
    28802880    'IEM_MC_FPU_TO_MMX_MODE':                                    (McBlock.parseMcGeneric,           True,  False, ),
    28812881    'IEM_MC_IF_CX_IS_NZ':                                        (McBlock.parseMcGenericCond,       True,  True,  ),
    2882     'IEM_MC_IF_CX_IS_NZ_AND_EFL_BIT_NOT_SET':                    (McBlock.parseMcGenericCond,       True,  True, ),
    2883     'IEM_MC_IF_CX_IS_NZ_AND_EFL_BIT_SET':                        (McBlock.parseMcGenericCond,       True,  True, ),
     2882    'IEM_MC_IF_CX_IS_NZ_AND_EFL_BIT_NOT_SET':                    (McBlock.parseMcGenericCond,       True,  True,  ),
     2883    'IEM_MC_IF_CX_IS_NZ_AND_EFL_BIT_SET':                        (McBlock.parseMcGenericCond,       True,  True,  ),
    28842884    'IEM_MC_IF_ECX_IS_NZ':                                       (McBlock.parseMcGenericCond,       True,  True,  ),
    2885     'IEM_MC_IF_ECX_IS_NZ_AND_EFL_BIT_NOT_SET':                   (McBlock.parseMcGenericCond,       True,  False, ),
    2886     'IEM_MC_IF_ECX_IS_NZ_AND_EFL_BIT_SET':                       (McBlock.parseMcGenericCond,       True,  False, ),
     2885    'IEM_MC_IF_ECX_IS_NZ_AND_EFL_BIT_NOT_SET':                   (McBlock.parseMcGenericCond,       True,  True, ),
     2886    'IEM_MC_IF_ECX_IS_NZ_AND_EFL_BIT_SET':                       (McBlock.parseMcGenericCond,       True,  True, ),
    28872887    'IEM_MC_IF_EFL_ANY_BITS_SET':                                (McBlock.parseMcGenericCond,       True,  True,  ),
    28882888    'IEM_MC_IF_EFL_BIT_NOT_SET':                                 (McBlock.parseMcGenericCond,       True,  True,  ),
     
    29012901    'IEM_MC_IF_MXCSR_XCPT_PENDING':                              (McBlock.parseMcGenericCond,       True,  False, ),
    29022902    'IEM_MC_IF_RCX_IS_NZ':                                       (McBlock.parseMcGenericCond,       True,  True,  ),
    2903     'IEM_MC_IF_RCX_IS_NZ_AND_EFL_BIT_NOT_SET':                   (McBlock.parseMcGenericCond,       True,  False, ),
    2904     'IEM_MC_IF_RCX_IS_NZ_AND_EFL_BIT_SET':                       (McBlock.parseMcGenericCond,       True,  False, ),
     2903    'IEM_MC_IF_RCX_IS_NZ_AND_EFL_BIT_NOT_SET':                   (McBlock.parseMcGenericCond,       True,  True, ),
     2904    'IEM_MC_IF_RCX_IS_NZ_AND_EFL_BIT_SET':                       (McBlock.parseMcGenericCond,       True,  True, ),
    29052905    'IEM_MC_IF_TWO_FPUREGS_NOT_EMPTY_REF_R80':                   (McBlock.parseMcGenericCond,       True,  False, ),
    29062906    'IEM_MC_IF_TWO_FPUREGS_NOT_EMPTY_REF_R80_FIRST':             (McBlock.parseMcGenericCond,       True,  False, ),
  • trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompiler.cpp

    r101587 r101589  
    46064606}
    46074607
     4608
    46084609#define IEM_MC_IF_CX_IS_NZ_AND_EFL_BIT_SET(a_fBit) \
    46094610    off = iemNativeEmitIfCxIsNotZeroAndTestEflagsBit(pReNative, off, a_fBit, true /*fCheckIfSet*/); \
     
    46414642    /* Check CX. */
    46424643    off = iemNativeEmitTestAnyBitsInGprAndJmpToLabelIfNoneSet(pReNative, off, idxGstRcxReg, UINT16_MAX, pEntry->idxLabelElse);
     4644
     4645    /* Check the EFlags bit. */
     4646    unsigned const iBitNo = ASMBitFirstSetU32(fBitInEfl) - 1;
     4647    Assert(RT_BIT_32(iBitNo) == fBitInEfl);
     4648    off = iemNativeEmitTestBitInGprAndJmpToLabelIfCc(pReNative, off, idxEflReg, iBitNo, pEntry->idxLabelElse,
     4649                                                     !fCheckIfSet /*fJmpIfSet*/);
     4650
     4651    iemNativeRegFreeTmp(pReNative, idxGstRcxReg);
     4652    iemNativeRegFreeTmp(pReNative, idxEflReg);
     4653
     4654    iemNativeCondStartIfBlock(pReNative, off);
     4655    return off;
     4656}
     4657
     4658
     4659#define IEM_MC_IF_ECX_IS_NZ_AND_EFL_BIT_SET(a_fBit) \
     4660    off = iemNativeEmitIfRcxEcxIsNotZeroAndTestEflagsBit(pReNative, off, a_fBit, true /*fCheckIfSet*/, false /*f64Bit*/); \
     4661    AssertReturn(off != UINT32_MAX, UINT32_MAX); \
     4662    do {
     4663
     4664#define IEM_MC_IF_ECX_IS_NZ_AND_EFL_BIT_NOT_SET(a_fBit) \
     4665    off = iemNativeEmitIfRcxEcxIsNotZeroAndTestEflagsBit(pReNative, off, a_fBit, false /*fCheckIfSet*/, false /*f64Bit*/); \
     4666    AssertReturn(off != UINT32_MAX, UINT32_MAX); \
     4667    do {
     4668
     4669#define IEM_MC_IF_RCX_IS_NZ_AND_EFL_BIT_SET(a_fBit) \
     4670    off = iemNativeEmitIfRcxEcxIsNotZeroAndTestEflagsBit(pReNative, off, a_fBit, true /*fCheckIfSet*/, true /*f64Bit*/); \
     4671    AssertReturn(off != UINT32_MAX, UINT32_MAX); \
     4672    do {
     4673
     4674#define IEM_MC_IF_RCX_IS_NZ_AND_EFL_BIT_NOT_SET(a_fBit) \
     4675    off = iemNativeEmitIfRcxEcxIsNotZeroAndTestEflagsBit(pReNative, off, a_fBit, false /*fCheckIfSet*/, true /*f64Bit*/); \
     4676    AssertReturn(off != UINT32_MAX, UINT32_MAX); \
     4677    do {
     4678
     4679/** Emits code for IEM_MC_IF_ECX_IS_NZ_AND_EFL_BIT_SET,
     4680 *  IEM_MC_IF_ECX_IS_NZ_AND_EFL_BIT_NOT_SET,
     4681 *  IEM_MC_IF_RCX_IS_NZ_AND_EFL_BIT_SET and
     4682 *  IEM_MC_IF_RCX_IS_NZ_AND_EFL_BIT_NOT_SET. */
     4683DECLINLINE(uint32_t) iemNativeEmitIfRcxEcxIsNotZeroAndTestEflagsBit(PIEMRECOMPILERSTATE pReNative, uint32_t off,
     4684                                                                    uint32_t fBitInEfl, bool fCheckIfSet, bool f64Bit)
     4685{
     4686    PIEMNATIVECOND pEntry = iemNativeCondPushIf(pReNative);
     4687    AssertReturn(pEntry, UINT32_MAX);
     4688
     4689    /* We have to load both RCX and EFLAGS before we can start branching,
     4690       otherwise we'll end up in the else-block with an inconsistent
     4691       register allocator state.
     4692       Doing EFLAGS first as it's more likely to be loaded, right? */
     4693    uint8_t const idxEflReg = iemNativeRegAllocTmpForGuestReg(pReNative, &off, kIemNativeGstReg_EFlags,
     4694                                                              kIemNativeGstRegUse_ReadOnly);
     4695    AssertReturn(idxEflReg != UINT8_MAX, UINT32_MAX);
     4696
     4697    uint8_t const idxGstRcxReg = iemNativeRegAllocTmpForGuestReg(pReNative, &off,
     4698                                                                 (IEMNATIVEGSTREG)(kIemNativeGstReg_GprFirst + X86_GREG_xCX),
     4699                                                                 kIemNativeGstRegUse_ReadOnly);
     4700    AssertReturn(idxGstRcxReg != UINT8_MAX, UINT32_MAX);
     4701
     4702    /** @todo we could reduce this to a single branch instruction by spending a
     4703     *        temporary register and some setnz stuff.  Not sure if loops are
     4704     *        worth it. */
     4705    /* Check RCX/ECX. */
     4706    off = iemNativeEmitTestIfGprIsZeroAndJmpToLabel(pReNative, off, idxGstRcxReg, f64Bit, pEntry->idxLabelElse);
    46434707
    46444708    /* Check the EFlags bit. */
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