VirtualBox

Ignore:
Timestamp:
Mar 14, 2024 12:38:51 PM (11 months ago)
Author:
vboxsync
Message:

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

File:
1 edited

Legend:

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

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