VirtualBox

Ignore:
Timestamp:
Mar 16, 2024 1:27:39 AM (11 months ago)
Author:
vboxsync
Message:

VMM/IEM: Reworked iemNativeEmitMaybeRaiseAvxRelatedXcpt to avoid relative 14-bit jumps on arm, optimizing it to a single branch while at it. bugref:10614 bugref:10370

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/include/IEMN8veRecompilerEmit.h

    r103872 r103875  
    52615261
    52625262
     5263#if defined(RT_ARCH_AMD64)
     5264/**
     5265 * Emits code for rotating a 32-bit GPR a fixed number of bits to the left via carry.
     5266 */
     5267DECL_FORCE_INLINE(uint32_t)
     5268iemNativeEmitAmd64RotateGpr32LeftViaCarryEx(PIEMNATIVEINSTR pCodeBuf, uint32_t off, uint8_t iGprDst, uint8_t cShift)
     5269{
     5270    Assert(cShift > 0 && cShift < 32);
     5271
     5272    /* rcl dst, cShift */
     5273    if (iGprDst >= 8)
     5274        pCodeBuf[off++] = X86_OP_REX_B;
     5275    if (cShift != 1)
     5276    {
     5277        pCodeBuf[off++] = 0xc1;
     5278        pCodeBuf[off++] = X86_MODRM_MAKE(X86_MOD_REG, 2, iGprDst & 7);
     5279        pCodeBuf[off++] = cShift;
     5280    }
     5281    else
     5282    {
     5283        pCodeBuf[off++] = 0xd1;
     5284        pCodeBuf[off++] = X86_MODRM_MAKE(X86_MOD_REG, 2, iGprDst & 7);
     5285    }
     5286
     5287    return off;
     5288}
     5289#endif /* RT_ARCH_AMD64 */
     5290
     5291
     5292
    52635293/**
    52645294 * Emits code for reversing the byte order for a 16-bit value in a 32-bit GPR.
     
    63246354#endif
    63256355}
     6356
     6357
     6358#ifdef RT_ARCH_AMD64
     6359/**
     6360 * For doing bt on a register.
     6361 */
     6362DECL_INLINE_THROW(uint32_t)
     6363iemNativeEmitAmd64TestBitInGprEx(PIEMNATIVEINSTR pCodeBuf, uint32_t off, uint8_t iGprSrc, uint8_t iBitNo)
     6364{
     6365    Assert(iBitNo < 64);
     6366    /* bt Ev, imm8 */
     6367    if (iBitNo >= 32)
     6368        pCodeBuf[off++] = X86_OP_REX_W | (iGprSrc < 8 ? 0 : X86_OP_REX_B);
     6369    else if (iGprSrc >= 8)
     6370        pCodeBuf[off++] = X86_OP_REX_B;
     6371    pCodeBuf[off++] = 0x0f;
     6372    pCodeBuf[off++] = 0xba;
     6373    pCodeBuf[off++] = X86_MODRM_MAKE(X86_MOD_REG, 4, iGprSrc & 7);
     6374    pCodeBuf[off++] = iBitNo;
     6375    return off;
     6376}
     6377#endif /* RT_ARCH_AMD64 */
    63266378
    63276379
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