VirtualBox

Ignore:
Timestamp:
Mar 27, 2024 2:23:52 PM (10 months ago)
Author:
vboxsync
Message:

VMM/IEM: Implement native emitters for IEM_MC_STORE_XREG_U8() and IEM_MC_STORE_XREG_U16(), bugref:10614

File:
1 edited

Legend:

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

    r104058 r104087  
    86138613
    86148614/**
     8615 * Emits a vecdst[x] = gprsrc store, 16-bit.
     8616 */
     8617DECL_FORCE_INLINE(uint32_t)
     8618iemNativeEmitSimdStoreGprToVecRegU16Ex(PIEMNATIVEINSTR pCodeBuf, uint32_t off, uint8_t iVecRegDst, uint8_t iGprSrc, uint8_t iWord)
     8619{
     8620#ifdef RT_ARCH_AMD64
     8621    /* pinsrw vecsrc, gpr, #iWord. */
     8622    pCodeBuf[off++] = X86_OP_PRF_SIZE_OP;
     8623    if (iVecRegDst >= 8 || iGprSrc >= 8)
     8624        pCodeBuf[off++] =   (iVecRegDst < 8 ? 0 : X86_OP_REX_R)
     8625                          | (iGprSrc < 8 ? 0 : X86_OP_REX_B);
     8626    pCodeBuf[off++] = 0x0f;
     8627    pCodeBuf[off++] = 0xc4;
     8628    pCodeBuf[off++] = X86_MODRM_MAKE(X86_MOD_REG, iVecRegDst & 7, iGprSrc & 7);
     8629    pCodeBuf[off++] = iWord;
     8630#elif defined(RT_ARCH_ARM64)
     8631    /* ins vecsrc[iWord], gpr */
     8632    pCodeBuf[off++] = Armv8A64MkVecInstrIns(iVecRegDst, iGprSrc, iWord, kArmv8InstrUmovInsSz_U16);
     8633#else
     8634# error "port me"
     8635#endif
     8636    return off;
     8637}
     8638
     8639
     8640/**
     8641 * Emits a vecdst[x] = gprsrc store, 16-bit.
     8642 */
     8643DECL_INLINE_THROW(uint32_t)
     8644iemNativeEmitSimdStoreGprToVecRegU16(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint8_t iVecRegDst, uint8_t iGprSrc, uint8_t iWord)
     8645{
     8646    Assert(iWord <= 15);
     8647
     8648#ifdef RT_ARCH_AMD64
     8649    off = iemNativeEmitSimdStoreGprToVecRegU16Ex(iemNativeInstrBufEnsure(pReNative, off, 6), off, iVecRegDst, iGprSrc, iWord);
     8650#elif defined(RT_ARCH_ARM64)
     8651    off = iemNativeEmitSimdStoreGprToVecRegU16Ex(iemNativeInstrBufEnsure(pReNative, off, 1), off, iVecRegDst, iGprSrc, iWord);
     8652#else
     8653# error "port me"
     8654#endif
     8655    IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off);
     8656    return off;
     8657}
     8658
     8659
     8660/**
     8661 * Emits a vecdst[x] = gprsrc store, 8-bit.
     8662 */
     8663DECL_FORCE_INLINE(uint32_t)
     8664iemNativeEmitSimdStoreGprToVecRegU8Ex(PIEMNATIVEINSTR pCodeBuf, uint32_t off, uint8_t iVecRegDst, uint8_t iGprSrc, uint8_t iByte)
     8665{
     8666#ifdef RT_ARCH_AMD64
     8667    /* pinsrb vecsrc, gpr, #iByte (ASSUMES SSE4.1). */
     8668    pCodeBuf[off++] = X86_OP_PRF_SIZE_OP;
     8669    if (iVecRegDst >= 8 || iGprSrc >= 8)
     8670        pCodeBuf[off++] =   (iVecRegDst < 8 ? 0 : X86_OP_REX_R)
     8671                          | (iGprSrc < 8 ? 0 : X86_OP_REX_B);
     8672    pCodeBuf[off++] = 0x0f;
     8673    pCodeBuf[off++] = 0x3a;
     8674    pCodeBuf[off++] = 0x20;
     8675    pCodeBuf[off++] = X86_MODRM_MAKE(X86_MOD_REG, iVecRegDst & 7, iGprSrc & 7);
     8676    pCodeBuf[off++] = iByte;
     8677#elif defined(RT_ARCH_ARM64)
     8678    /* ins vecsrc[iByte], gpr */
     8679    pCodeBuf[off++] = Armv8A64MkVecInstrIns(iVecRegDst, iGprSrc, iByte, kArmv8InstrUmovInsSz_U8);
     8680#else
     8681# error "port me"
     8682#endif
     8683    return off;
     8684}
     8685
     8686
     8687/**
     8688 * Emits a vecdst[x] = gprsrc store, 8-bit.
     8689 */
     8690DECL_INLINE_THROW(uint32_t)
     8691iemNativeEmitSimdStoreGprToVecRegU8(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint8_t iVecRegDst, uint8_t iGprSrc, uint8_t iByte)
     8692{
     8693    Assert(iByte <= 15);
     8694
     8695#ifdef RT_ARCH_AMD64
     8696    off = iemNativeEmitSimdStoreGprToVecRegU8Ex(iemNativeInstrBufEnsure(pReNative, off, 7), off, iVecRegDst, iGprSrc, iByte);
     8697#elif defined(RT_ARCH_ARM64)
     8698    off = iemNativeEmitSimdStoreGprToVecRegU8Ex(iemNativeInstrBufEnsure(pReNative, off, 1), off, iVecRegDst, iGprSrc, iByte);
     8699#else
     8700# error "port me"
     8701#endif
     8702    IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off);
     8703    return off;
     8704}
     8705
     8706
     8707/**
    86158708 * Emits a vecdst.au32[iDWord] = 0 store.
    86168709 */
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