VirtualBox

Changeset 103849 in vbox


Ignore:
Timestamp:
Mar 14, 2024 12:04:43 PM (9 months ago)
Author:
vboxsync
Message:

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

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

Legend:

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

    r103846 r103849  
    29592959    'IEM_MC_ASSIGN_TO_SMALLER':                                  (McBlock.parseMcGeneric,           False, False, True,  ),
    29602960    'IEM_MC_BEGIN':                                              (McBlock.parseMcBegin,             False, False, True,  ),
    2961     'IEM_MC_BROADCAST_XREG_U16_ZX_VLMAX':                        (McBlock.parseMcGeneric,           True,  True,  False, ),
     2961    'IEM_MC_BROADCAST_XREG_U16_ZX_VLMAX':                        (McBlock.parseMcGeneric,           True,  True,  g_fNativeSimd),
    29622962    'IEM_MC_BROADCAST_XREG_U32_ZX_VLMAX':                        (McBlock.parseMcGeneric,           True,  True,  g_fNativeSimd),
    29632963    'IEM_MC_BROADCAST_XREG_U64_ZX_VLMAX':                        (McBlock.parseMcGeneric,           True,  True,  g_fNativeSimd),
  • trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompFuncs.h

    r103846 r103849  
    70777077
    70787078
     7079#define IEM_MC_BROADCAST_XREG_U16_ZX_VLMAX(a_iXRegDst, a_u16Src) \
     7080    off = iemNativeEmitSimdBroadcastXregU16ZxVlmax(pReNative, off, a_iXRegDst, a_u16Src)
     7081
     7082/** Emits code for IEM_MC_BROADCAST_XREG_U16_ZX_VLMAX. */
     7083DECL_INLINE_THROW(uint32_t)
     7084iemNativeEmitSimdBroadcastXregU16ZxVlmax(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint8_t iXReg, uint8_t idxSrcVar)
     7085{
     7086    IEMNATIVE_ASSERT_VAR_IDX(pReNative, idxSrcVar);
     7087    IEMNATIVE_ASSERT_VAR_SIZE(pReNative, idxSrcVar, sizeof(uint16_t));
     7088
     7089    uint8_t const idxSimdRegDst = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(iXReg),
     7090                                                                          kIemNativeGstSimdRegLdStSz_256, kIemNativeGstRegUse_ForFullWrite);
     7091
     7092    uint8_t const idxVarReg = iemNativeVarRegisterAcquire(pReNative, idxSrcVar, &off);
     7093
     7094    off = iemNativeEmitSimdBroadcastGprToVecRegU16(pReNative, off, idxSimdRegDst, idxVarReg, false /*f256Bit*/);
     7095    off = iemNativeEmitSimdZeroVecRegHighU128(pReNative, off, idxSimdRegDst);
     7096    IEMNATIVE_SIMD_REG_STATE_SET_DIRTY_LO_U128(pReNative, iXReg);
     7097    IEMNATIVE_SIMD_REG_STATE_SET_DIRTY_HI_U128(pReNative, iXReg);
     7098
     7099    /* Free but don't flush the source register. */
     7100    iemNativeSimdRegFreeTmp(pReNative, idxSimdRegDst);
     7101    iemNativeVarRegisterRelease(pReNative, idxSrcVar);
     7102
     7103    return off;
     7104}
     7105
     7106
    70797107#define IEM_MC_BROADCAST_XREG_U32_ZX_VLMAX(a_iXRegDst, a_u32Src) \
    70807108    off = iemNativeEmitSimdBroadcastXregU32ZxVlmax(pReNative, off, a_iXRegDst, a_u32Src)
  • trunk/src/VBox/VMM/include/IEMN8veRecompilerEmit.h

    r103848 r103849  
    79077907
    79087908/**
     7909 * Emits a vecdst = gprsrc broadcast, 16-bit.
     7910 */
     7911DECL_FORCE_INLINE(uint32_t)
     7912iemNativeEmitSimdBroadcastGprToVecRegU16Ex(PIEMNATIVEINSTR pCodeBuf, uint32_t off, uint8_t iVecRegDst, uint8_t iGprSrc, bool f256Bit = false)
     7913{
     7914#ifdef RT_ARCH_AMD64
     7915    /* pinsrw vecdst, gpr, #0 */
     7916    pCodeBuf[off++] = X86_OP_PRF_SIZE_OP;
     7917    if (iVecRegDst >= 8 || iGprSrc >= 8)
     7918        pCodeBuf[off++] =   (iVecRegDst < 8 ? 0 : X86_OP_REX_R)
     7919                          | (iGprSrc < 8 ? 0 : X86_OP_REX_B);
     7920    pCodeBuf[off++] = 0x0f;
     7921    pCodeBuf[off++] = 0xc4;
     7922    pCodeBuf[off++] = X86_MODRM_MAKE(X86_MOD_REG, iVecRegDst & 7, iGprSrc & 7);
     7923    pCodeBuf[off++] = 0x00;
     7924
     7925    /* vpbroadcastd {y,x}mm, xmm (ASSUMES AVX2). */
     7926    pCodeBuf[off++] = X86_OP_VEX3;
     7927    pCodeBuf[off++] =   X86_OP_VEX3_BYTE1_X
     7928                      | 0x02                 /* opcode map. */
     7929                      | (  iVecRegDst >= 8
     7930                         ? 0
     7931                         : X86_OP_VEX3_BYTE1_B | X86_OP_VEX3_BYTE1_R);
     7932    pCodeBuf[off++] = X86_OP_VEX3_BYTE2_MAKE_NO_VVVV(false, f256Bit, X86_OP_VEX3_BYTE2_P_066H);
     7933    pCodeBuf[off++] = 0x79;
     7934    pCodeBuf[off++] = X86_MODRM_MAKE(X86_MOD_REG, iVecRegDst & 7, iVecRegDst & 7);
     7935#elif defined(RT_ARCH_ARM64)
     7936    /* ASSUMES that there are two adjacent 128-bit registers available for the 256-bit value. */
     7937    Assert(!(iVecRegDst & 0x1) || !f256Bit);
     7938
     7939    /* dup vecsrc, gpr */
     7940    pCodeBuf[off++] = Armv8A64MkVecInstrDup(iVecRegDst, iGprSrc, kArmv8InstrUmovInsSz_U16);
     7941    if (f256Bit)
     7942        pCodeBuf[off++] = Armv8A64MkVecInstrDup(iVecRegDst + 1, iGprSrc, kArmv8InstrUmovInsSz_U16);
     7943#else
     7944# error "port me"
     7945#endif
     7946    return off;
     7947}
     7948
     7949
     7950/**
     7951 * Emits a vecdst[x] = gprsrc broadcast, 16-bit.
     7952 */
     7953DECL_INLINE_THROW(uint32_t)
     7954iemNativeEmitSimdBroadcastGprToVecRegU16(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint8_t iVecRegDst, uint8_t iGprSrc, bool f256Bit = false)
     7955{
     7956#ifdef RT_ARCH_AMD64
     7957    off = iemNativeEmitSimdBroadcastGprToVecRegU16Ex(iemNativeInstrBufEnsure(pReNative, off, 12), off, iVecRegDst, iGprSrc, f256Bit);
     7958#elif defined(RT_ARCH_ARM64)
     7959    off = iemNativeEmitSimdBroadcastGprToVecRegU16Ex(iemNativeInstrBufEnsure(pReNative, off, f256Bit ? 2 : 1), off, iVecRegDst, iGprSrc, f256Bit);
     7960#else
     7961# error "port me"
     7962#endif
     7963    IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off);
     7964    return off;
     7965}
     7966
     7967
     7968/**
    79097969 * Emits a vecdst = gprsrc broadcast, 32-bit.
    79107970 */
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