VirtualBox

Changeset 101376 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Oct 6, 2023 8:24:35 AM (14 months ago)
Author:
vboxsync
Message:

VMM/IEM: Implement vmpsadbw instruction emulations, bugref:9898

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/IEMAllAImpl.asm

    r100851 r101376  
    54205420IEMIMPL_MEDIA_AVX_INSN_IMM8_6 vperm2i128, 0, 1
    54215421IEMIMPL_MEDIA_AVX_INSN_IMM8_6 vperm2f128, 0, 1
     5422IEMIMPL_MEDIA_AVX_INSN_IMM8_6 vmpsadbw,   1, 1
    54225423
    54235424
  • trunk/src/VBox/VMM/VMMAll/IEMAllAImplC.cpp

    r100840 r101376  
    1844618446
    1844718447
     18448IEM_DECL_IMPL_DEF(void, iemAImpl_vmpsadbw_u128_fallback,(PRTUINT128U puDst, PCRTUINT128U puSrc1, PCRTUINT128U puSrc2, uint8_t bEvil))
     18449{
     18450    uint8_t idxSrc2 = (bEvil & 0x3) * sizeof(uint32_t);
     18451    uint8_t idxSrc1 = ((bEvil >> 2) & 0x1) * sizeof(uint32_t);
     18452    int16_t ai16Src1[11];
     18453    int16_t ai16Src2[4];
     18454
     18455    for (uint32_t i = 0; i < RT_ELEMENTS(ai16Src1); i++)
     18456        ai16Src1[i] = puSrc1->au8[idxSrc1 + i];
     18457
     18458    for (uint32_t i = 0; i < RT_ELEMENTS(ai16Src2); i++)
     18459        ai16Src2[i] = puSrc2->au8[idxSrc2 + i];
     18460
     18461    for (uint8_t i = 0; i < RT_ELEMENTS(puDst->au16); i++)
     18462        puDst->au16[i] =   RT_ABS(ai16Src1[i]     - ai16Src2[0])
     18463                         + RT_ABS(ai16Src1[i + 1] - ai16Src2[1])
     18464                         + RT_ABS(ai16Src1[i + 2] - ai16Src2[2])
     18465                         + RT_ABS(ai16Src1[i + 3] - ai16Src2[3]);
     18466}
     18467
     18468
     18469IEM_DECL_IMPL_DEF(void, iemAImpl_vmpsadbw_u256_fallback,(PRTUINT256U puDst, PCRTUINT256U puSrc1, PCRTUINT256U puSrc2, uint8_t bEvil))
     18470{
     18471    RTUINT256U const uSrc1 = *puSrc1; /* Might overlap with destination. */
     18472    RTUINT256U const uSrc2 = *puSrc2;
     18473//? ASMCompilerBarrier();
     18474
     18475    iemAImpl_vmpsadbw_u128_fallback(&puDst->au128[0], &uSrc1.au128[0], &uSrc2.au128[0], bEvil);
     18476    iemAImpl_vmpsadbw_u128_fallback(&puDst->au128[1], &uSrc1.au128[1], &uSrc2.au128[1], bEvil >> 3);
     18477}
     18478
     18479
    1844818480/**
    1844918481 * VPERM2I128
  • trunk/src/VBox/VMM/VMMAll/IEMAllInstVexMap3.cpp.h

    r100854 r101376  
    570570/** Opcode VEX.66.0F3A 0x41, */
    571571FNIEMOP_STUB(iemOp_vdppd_Vdq_Hdq_Wdq_Ib);
    572 /** Opcode VEX.66.0F3A 0x42. */
    573 FNIEMOP_STUB(iemOp_vmpsadbw_Vx_Hx_Wx_Ib);
     572
     573/** Opcode VEX.66.0F3A 0x42.
     574 * AVX,AVX2 */
     575FNIEMOP_DEF(iemOp_vmpsadbw_Vx_Hx_Wx_Ib)
     576{
     577    IEMOP_MNEMONIC3(VEX_RVM, VMPSADBW, vmpsadbw, Vx, Hx, Wx, DISOPTYPE_HARMLESS, 0); /** @todo */
     578    IEMOPMEDIAOPTF3IMM8_INIT_VARS(vmpsadbw);
     579    return FNIEMOP_CALL_1(iemOpCommonAvxAvx_Vx_Hx_Wx_Ib_Opt, IEM_SELECT_HOST_OR_FALLBACK(fAvx, &s_Host, &s_Fallback));
     580}
     581
     582
    574583/*  Opcode VEX.66.0F3A 0x43 - invalid */
    575584
  • trunk/src/VBox/VMM/include/IEMInternal.h

    r101304 r101376  
    31913191
    31923192FNIEMAIMPLMEDIAOPTF2U128IMM8 iemAImpl_mpsadbw_u128, iemAImpl_mpsadbw_u128_fallback;
     3193FNIEMAIMPLMEDIAOPTF3U128IMM8 iemAImpl_vmpsadbw_u128, iemAImpl_vmpsadbw_u128_fallback;
     3194FNIEMAIMPLMEDIAOPTF3U256IMM8 iemAImpl_vmpsadbw_u256, iemAImpl_vmpsadbw_u256_fallback;
    31933195/** @} */
    31943196
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