VirtualBox

Changeset 103800 in vbox


Ignore:
Timestamp:
Mar 11, 2024 10:31:33 PM (9 months ago)
Author:
vboxsync
Message:

VMM/IEM: Implemented iemNativeEmit_or_r_i_efl and enabled it for both hosts. bugref:10376

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/IEMAllInstOneByte.cpp.h

    r103799 r103800  
    12301230    IEMOP_MNEMONIC2(FIXED, OR, or, AL, Ib, DISOPTYPE_HARMLESS, IEMOPHINT_IGNORES_OP_SIZES);
    12311231    IEMOP_VERIFICATION_UNDEFINED_EFLAGS(X86_EFL_AF);
    1232     IEMOP_BODY_BINARY_AL_Ib(or, 0);
     1232    IEMOP_BODY_BINARY_AL_Ib(or, RT_ARCH_VAL_AMD64 | RT_ARCH_VAL_ARM64);
    12331233}
    12341234
     
    12501250    IEMOP_MNEMONIC2(FIXED, OR, or, rAX, Iz, DISOPTYPE_HARMLESS, 0);
    12511251    IEMOP_VERIFICATION_UNDEFINED_EFLAGS(X86_EFL_AF);
    1252     IEMOP_BODY_BINARY_rAX_Iz_RW(or, 0);
     1252    IEMOP_BODY_BINARY_rAX_Iz_RW(or, RT_ARCH_VAL_AMD64 | RT_ARCH_VAL_ARM64);
    12531253}
    12541254
     
    43924392{
    43934393    IEMOP_MNEMONIC(or_Eb_Ib, "or Eb,Ib");
    4394     IEMOP_BODY_BINARY_Eb_Ib_RW(or, 0, 0);
     4394    IEMOP_BODY_BINARY_Eb_Ib_RW(or, RT_ARCH_VAL_AMD64 | RT_ARCH_VAL_ARM64, 0);
    43954395}
    43964396
     
    49654965{
    49664966    IEMOP_MNEMONIC(or_Ev_Iz, "or Ev,Iz");
    4967     IEMOP_BODY_BINARY_Ev_Iz_RW(or, 0, 0);
     4967    IEMOP_BODY_BINARY_Ev_Iz_RW(or, RT_ARCH_VAL_AMD64 | RT_ARCH_VAL_ARM64, 0);
    49684968}
    49694969
     
    55235523{
    55245524    IEMOP_MNEMONIC(or_Ev_Ib, "or Ev,Ib");
    5525     IEMOP_BODY_BINARY_Ev_Ib_RW(or, 0, 0);
     5525    IEMOP_BODY_BINARY_Ev_Ib_RW(or, RT_ARCH_VAL_AMD64 | RT_ARCH_VAL_ARM64, 0);
    55265526}
    55275527
  • trunk/src/VBox/VMM/VMMAll/target-x86/IEMAllN8veEmit-x86.h

    r103799 r103800  
    508508
    509509#elif defined(RT_ARCH_ARM64)
    510     /* On ARM64 we use 32-bit AND for the 8-bit and 16-bit bit ones. */
     510    /* On ARM64 we use 32-bit AND for the 8-bit and 16-bit bit ones, and of
     511       course the immediate variant when possible to save a register load. */
    511512    uint32_t uImmSizeLen, uImmRotations;
    512513    if (  cOpBits > 32
     
    606607
    607608#elif defined(RT_ARCH_ARM64)
    608     /* On ARM64 we use 32-bit AND for the 8-bit and 16-bit bit ones.  We also
    609        need to keep the result in order to calculate the flags. */
     609    /* On ARM64 we use 32-bit AND for the 8-bit and 16-bit bit ones, and of
     610       course the immediate variant when possible to save a register load.
     611       We also need to keep the result in order to calculate the flags. */
    610612    uint8_t const         idxRegResult = iemNativeRegAllocTmp(pReNative, &off);
    611613    uint32_t uImmSizeLen, uImmRotations;
     
    688690                          uint8_t idxVarDst, uint64_t uImmOp, uint8_t idxVarEfl, uint8_t cOpBits, uint8_t cImmBits)
    689691{
    690     RT_NOREF(pReNative, off, idxVarDst, uImmOp, idxVarEfl, cOpBits, cImmBits);
     692    uint8_t const idxRegDst = iemNativeVarRegisterAcquire(pReNative, idxVarDst, &off, true /*fInitialized*/);
     693#ifdef RT_ARCH_AMD64
     694    /* On AMD64 we just use the correctly size OR instruction harvest the EFLAGS. */
     695    PIEMNATIVEINSTR const pCodeBuf = iemNativeInstrBufEnsure(pReNative, off, 8);
     696    off = iemNativeEmitAmd64OneByteModRmInstrRIEx(pCodeBuf, off, 0x80, 0x83, 0x81, cOpBits, cImmBits, 1, idxRegDst, uImmOp);
     697    IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off);
     698
     699    off = iemNativeEmitEFlagsForLogical(pReNative, off, idxVarEfl);
     700
     701#elif defined(RT_ARCH_ARM64)
     702    /* On ARM64 we use 32-bit OR for the 8-bit and 16-bit bit ones, and of
     703       course the immediate variant when possible to save a register load.  */
     704    uint32_t uImmSizeLen, uImmRotations;
     705    if (  cOpBits > 32
     706        ? Armv8A64ConvertMask64ToImmRImmS(uImmOp, &uImmSizeLen, &uImmRotations)
     707        : Armv8A64ConvertMask32ToImmRImmS(uImmOp, &uImmSizeLen, &uImmRotations))
     708    {
     709        PIEMNATIVEINSTR const pCodeBuf = iemNativeInstrBufEnsure(pReNative, off, 1);
     710        pCodeBuf[off++] = Armv8A64MkInstrOrrImm(idxRegDst, idxRegDst, uImmSizeLen, uImmRotations, cOpBits > 32 /*f64Bit*/);
     711    }
     712    else
     713    {
     714        uint8_t const idxRegTmpImm = iemNativeRegAllocTmpImm(pReNative, &off, uImmOp);
     715        PIEMNATIVEINSTR const pCodeBuf = iemNativeInstrBufEnsure(pReNative, off, 1);
     716        pCodeBuf[off++] = Armv8A64MkInstrOrr(idxRegDst, idxRegDst, idxRegTmpImm, cOpBits > 32 /*f64Bit*/);
     717        iemNativeRegFreeTmpImm(pReNative, idxRegTmpImm);
     718    }
     719    IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off);
     720
     721    off = iemNativeEmitEFlagsForLogical(pReNative, off, idxVarEfl, cOpBits, idxRegDst);
     722    RT_NOREF_PV(cImmBits)
     723
     724#else
     725# error "Port me"
     726#endif
     727    iemNativeVarRegisterRelease(pReNative, idxVarDst);
    691728    return off;
    692729}
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