VirtualBox

Changeset 96382 in vbox


Ignore:
Timestamp:
Aug 20, 2022 7:52:07 PM (2 years ago)
Author:
vboxsync
Message:

VMM/IEM: Implement haddps/haddpd/hsubps/hsubpd instructions, bugref:9898

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

Legend:

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

    r96379 r96382  
    45974597IEMIMPL_FP_F2 maxps
    45984598IEMIMPL_FP_F2 maxpd
     4599IEMIMPL_FP_F2 haddps
     4600IEMIMPL_FP_F2 haddpd
     4601IEMIMPL_FP_F2 hsubps
     4602IEMIMPL_FP_F2 hsubpd
    45994603
    46004604
  • trunk/src/VBox/VMM/VMMAll/IEMAllAImplC.cpp

    r96379 r96382  
    1475914759}
    1476014760#endif
     14761
     14762
     14763/**
     14764 * HADDPS
     14765 */
     14766#ifdef IEM_WITHOUT_ASSEMBLY
     14767IEM_DECL_IMPL_DEF(void, iemAImpl_haddps_u128,(PX86FXSTATE pFpuState, PIEMSSERESULT pResult, PCX86XMMREG puSrc1, PCX86XMMREG puSrc2))
     14768{
     14769    pResult->MXCSR  = iemAImpl_addps_u128_worker(&pResult->uResult.ar32[0], pFpuState->MXCSR, &puSrc1->ar32[0], &puSrc1->ar32[1]);
     14770    pResult->MXCSR |= iemAImpl_addps_u128_worker(&pResult->uResult.ar32[1], pFpuState->MXCSR, &puSrc1->ar32[2], &puSrc1->ar32[3]);
     14771    pResult->MXCSR |= iemAImpl_addps_u128_worker(&pResult->uResult.ar32[2], pFpuState->MXCSR, &puSrc2->ar32[0], &puSrc2->ar32[1]);
     14772    pResult->MXCSR |= iemAImpl_addps_u128_worker(&pResult->uResult.ar32[3], pFpuState->MXCSR, &puSrc2->ar32[2], &puSrc2->ar32[3]);
     14773}
     14774#endif
     14775
     14776
     14777/**
     14778 * HADDPD
     14779 */
     14780#ifdef IEM_WITHOUT_ASSEMBLY
     14781IEM_DECL_IMPL_DEF(void, iemAImpl_haddpd_u128,(PX86FXSTATE pFpuState, PIEMSSERESULT pResult, PCX86XMMREG puSrc1, PCX86XMMREG puSrc2))
     14782{
     14783    pResult->MXCSR  = iemAImpl_addpd_u128_worker(&pResult->uResult.ar64[0], pFpuState->MXCSR, &puSrc1->ar64[0], &puSrc1->ar64[1]);
     14784    pResult->MXCSR |= iemAImpl_addpd_u128_worker(&pResult->uResult.ar64[1], pFpuState->MXCSR, &puSrc2->ar64[0], &puSrc2->ar64[1]);
     14785}
     14786#endif
     14787
     14788
     14789/**
     14790 * HSUBPS
     14791 */
     14792#ifdef IEM_WITHOUT_ASSEMBLY
     14793IEM_DECL_IMPL_DEF(void, iemAImpl_hsubps_u128,(PX86FXSTATE pFpuState, PIEMSSERESULT pResult, PCX86XMMREG puSrc1, PCX86XMMREG puSrc2))
     14794{
     14795    pResult->MXCSR  = iemAImpl_subps_u128_worker(&pResult->uResult.ar32[0], pFpuState->MXCSR, &puSrc1->ar32[0], &puSrc1->ar32[1]);
     14796    pResult->MXCSR |= iemAImpl_subps_u128_worker(&pResult->uResult.ar32[1], pFpuState->MXCSR, &puSrc1->ar32[2], &puSrc1->ar32[3]);
     14797    pResult->MXCSR |= iemAImpl_subps_u128_worker(&pResult->uResult.ar32[2], pFpuState->MXCSR, &puSrc2->ar32[0], &puSrc2->ar32[1]);
     14798    pResult->MXCSR |= iemAImpl_subps_u128_worker(&pResult->uResult.ar32[3], pFpuState->MXCSR, &puSrc2->ar32[2], &puSrc2->ar32[3]);
     14799}
     14800#endif
     14801
     14802
     14803/**
     14804 * HSUBPD
     14805 */
     14806#ifdef IEM_WITHOUT_ASSEMBLY
     14807IEM_DECL_IMPL_DEF(void, iemAImpl_hsubpd_u128,(PX86FXSTATE pFpuState, PIEMSSERESULT pResult, PCX86XMMREG puSrc1, PCX86XMMREG puSrc2))
     14808{
     14809    pResult->MXCSR  = iemAImpl_subpd_u128_worker(&pResult->uResult.ar64[0], pFpuState->MXCSR, &puSrc1->ar64[0], &puSrc1->ar64[1]);
     14810    pResult->MXCSR |= iemAImpl_subpd_u128_worker(&pResult->uResult.ar64[1], pFpuState->MXCSR, &puSrc2->ar64[0], &puSrc2->ar64[1]);
     14811}
     14812#endif
  • trunk/src/VBox/VMM/VMMAll/IEMAllInstructionsTwoByte0f.cpp.h

    r96379 r96382  
    10491049        IEM_MC_REF_XREG_U128(puDst, IEM_GET_MODRM_REG(pVCpu, bRm));
    10501050        IEM_MC_CALL_VOID_AIMPL_2(pfnU128, puDst, puSrc);
     1051
     1052        IEM_MC_ADVANCE_RIP();
     1053        IEM_MC_END();
     1054    }
     1055    return VINF_SUCCESS;
     1056}
     1057
     1058
     1059/**
     1060 * Common worker for SSE3 instructions on the forms:
     1061 *      hxxx      xmm1, xmm2/mem128
     1062 *
     1063 * Proper alignment of the 128-bit operand is enforced.
     1064 * Exceptions type 2. SSE3 cpuid checks.
     1065 *
     1066 * @sa iemOpCommonSse41_FullFull_To_Full, iemOpCommonSse2_FullFull_To_Full
     1067 */
     1068FNIEMOP_DEF_1(iemOpCommonSse3Fp_FullFull_To_Full, PFNIEMAIMPLFPSSEF2U128, pfnU128)
     1069{
     1070    uint8_t bRm; IEM_OPCODE_GET_NEXT_U8(&bRm);
     1071    if (IEM_IS_MODRM_REG_MODE(bRm))
     1072    {
     1073        /*
     1074         * Register, register.
     1075         */
     1076        IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX();
     1077        IEM_MC_BEGIN(3, 1);
     1078        IEM_MC_LOCAL(IEMSSERESULT,          SseRes);
     1079        IEM_MC_ARG_LOCAL_REF(PIEMSSERESULT, pSseRes,        SseRes,     0);
     1080        IEM_MC_ARG(PCX86XMMREG,             pSrc1,                      1);
     1081        IEM_MC_ARG(PCX86XMMREG,             pSrc2,                      2);
     1082        IEM_MC_MAYBE_RAISE_SSE3_RELATED_XCPT();
     1083        IEM_MC_PREPARE_SSE_USAGE();
     1084        IEM_MC_REF_XREG_XMM_CONST(pSrc1, IEM_GET_MODRM_REG(pVCpu, bRm));
     1085        IEM_MC_REF_XREG_XMM_CONST(pSrc2, IEM_GET_MODRM_RM(pVCpu, bRm));
     1086        IEM_MC_CALL_SSE_AIMPL_3(pfnU128, pSseRes, pSrc1, pSrc2);
     1087        IEM_MC_STORE_SSE_RESULT(SseRes, IEM_GET_MODRM_REG(pVCpu, bRm));
     1088        IEM_MC_MAYBE_RAISE_SSE_AVX_SIMD_FP_OR_UD_XCPT();
     1089
     1090        IEM_MC_ADVANCE_RIP();
     1091        IEM_MC_END();
     1092    }
     1093    else
     1094    {
     1095        /*
     1096         * Register, memory.
     1097         */
     1098        IEM_MC_BEGIN(3, 2);
     1099        IEM_MC_LOCAL(IEMSSERESULT,          SseRes);
     1100        IEM_MC_LOCAL(X86XMMREG,             uSrc2);
     1101        IEM_MC_ARG_LOCAL_REF(PIEMSSERESULT, pSseRes,        SseRes,     0);
     1102        IEM_MC_ARG(PCX86XMMREG,             pSrc1,                      1);
     1103        IEM_MC_ARG_LOCAL_REF(PCX86XMMREG,   pSrc2, uSrc2,               2);
     1104        IEM_MC_LOCAL(RTGCPTR, GCPtrEffSrc);
     1105
     1106        IEM_MC_CALC_RM_EFF_ADDR(GCPtrEffSrc, bRm, 0);
     1107        IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX();
     1108        IEM_MC_MAYBE_RAISE_SSE3_RELATED_XCPT();
     1109        IEM_MC_FETCH_MEM_XMM_ALIGN_SSE(uSrc2, pVCpu->iem.s.iEffSeg, GCPtrEffSrc);
     1110
     1111        IEM_MC_PREPARE_SSE_USAGE();
     1112        IEM_MC_REF_XREG_XMM_CONST(pSrc1, IEM_GET_MODRM_REG(pVCpu, bRm));
     1113        IEM_MC_CALL_SSE_AIMPL_3(pfnU128, pSseRes, pSrc1, pSrc2);
     1114        IEM_MC_STORE_SSE_RESULT(SseRes, IEM_GET_MODRM_REG(pVCpu, bRm));
     1115        IEM_MC_MAYBE_RAISE_SSE_AVX_SIMD_FP_OR_UD_XCPT();
    10511116
    10521117        IEM_MC_ADVANCE_RIP();
     
    56265691
    56275692/*  Opcode      0x0f 0x7c - invalid */
     5693
     5694
    56285695/** Opcode 0x66 0x0f 0x7c - haddpd Vpd, Wpd */
    5629 FNIEMOP_STUB(iemOp_haddpd_Vpd_Wpd);
     5696FNIEMOP_DEF(iemOp_haddpd_Vpd_Wpd)
     5697{
     5698    IEMOP_MNEMONIC2(RM, HADDPD, haddpd, Vpd, Wpd, DISOPTYPE_HARMLESS, 0);
     5699    return FNIEMOP_CALL_1(iemOpCommonSse3Fp_FullFull_To_Full, iemAImpl_haddpd_u128);
     5700}
     5701
     5702
    56305703/*  Opcode 0xf3 0x0f 0x7c - invalid */
     5704
     5705
    56315706/** Opcode 0xf2 0x0f 0x7c - haddps Vps, Wps */
    5632 FNIEMOP_STUB(iemOp_haddps_Vps_Wps);
     5707FNIEMOP_DEF(iemOp_haddps_Vps_Wps)
     5708{
     5709    IEMOP_MNEMONIC2(RM, HADDPS, haddps, Vps, Wps, DISOPTYPE_HARMLESS, 0);
     5710    return FNIEMOP_CALL_1(iemOpCommonSse3Fp_FullFull_To_Full, iemAImpl_haddps_u128);
     5711}
     5712
    56335713
    56345714/*  Opcode      0x0f 0x7d - invalid */
     5715
     5716
    56355717/** Opcode 0x66 0x0f 0x7d - hsubpd Vpd, Wpd */
    5636 FNIEMOP_STUB(iemOp_hsubpd_Vpd_Wpd);
     5718FNIEMOP_DEF(iemOp_hsubpd_Vpd_Wpd)
     5719{
     5720    IEMOP_MNEMONIC2(RM, HSUBPD, hsubpd, Vpd, Wpd, DISOPTYPE_HARMLESS, 0);
     5721    return FNIEMOP_CALL_1(iemOpCommonSse3Fp_FullFull_To_Full, iemAImpl_hsubpd_u128);
     5722}
     5723
     5724
    56375725/*  Opcode 0xf3 0x0f 0x7d - invalid */
     5726
     5727
    56385728/** Opcode 0xf2 0x0f 0x7d - hsubps Vps, Wps */
    5639 FNIEMOP_STUB(iemOp_hsubps_Vps_Wps);
     5729FNIEMOP_DEF(iemOp_hsubps_Vps_Wps)
     5730{
     5731    IEMOP_MNEMONIC2(RM, HSUBPS, hsubps, Vps, Wps, DISOPTYPE_HARMLESS, 0);
     5732    return FNIEMOP_CALL_1(iemOpCommonSse3Fp_FullFull_To_Full, iemAImpl_hsubps_u128);
     5733}
    56405734
    56415735
  • trunk/src/VBox/VMM/include/IEMInternal.h

    r96379 r96382  
    24382438FNIEMAIMPLFPSSEF2U128 iemAImpl_maxps_u128;
    24392439FNIEMAIMPLFPSSEF2U128 iemAImpl_maxpd_u128;
     2440FNIEMAIMPLFPSSEF2U128 iemAImpl_haddps_u128;
     2441FNIEMAIMPLFPSSEF2U128 iemAImpl_haddpd_u128;
     2442FNIEMAIMPLFPSSEF2U128 iemAImpl_hsubps_u128;
     2443FNIEMAIMPLFPSSEF2U128 iemAImpl_hsubpd_u128;
    24402444
    24412445FNIEMAIMPLFPSSEF2U128R32 iemAImpl_addss_u128_r32;
     
    24662470FNIEMAIMPLFPAVXF3U128 iemAImpl_vmaxps_u128, iemAImpl_vmaxps_u128_fallback;
    24672471FNIEMAIMPLFPAVXF3U128 iemAImpl_vmaxpd_u128, iemAImpl_vmaxpd_u128_fallback;
     2472FNIEMAIMPLFPAVXF3U128 iemAImpl_vhaddps_u128, iemAImpl_vhaddps_u128_fallback;
     2473FNIEMAIMPLFPAVXF3U128 iemAImpl_vhaddpd_u128, iemAImpl_vhaddpd_u128_fallback;
     2474FNIEMAIMPLFPAVXF3U128 iemAImpl_vhsubps_u128, iemAImpl_vhsubps_u128_fallback;
     2475FNIEMAIMPLFPAVXF3U128 iemAImpl_vhsubpd_u128, iemAImpl_vhsubpd_u128_fallback;
    24682476
    24692477FNIEMAIMPLFPAVXF3U128R32 iemAImpl_vaddss_u128_r32, iemAImpl_vaddss_u128_r32_fallback;
     
    24922500FNIEMAIMPLFPAVXF3U256 iemAImpl_vmaxps_u256, iemAImpl_vmaxps_u256_fallback;
    24932501FNIEMAIMPLFPAVXF3U256 iemAImpl_vmaxpd_u256, iemAImpl_vmaxpd_u256_fallback;
     2502FNIEMAIMPLFPAVXF3U256 iemAImpl_vhaddps_u256, iemAImpl_vhaddps_u256_fallback;
     2503FNIEMAIMPLFPAVXF3U256 iemAImpl_vhaddpd_u256, iemAImpl_vhaddpd_u256_fallback;
     2504FNIEMAIMPLFPAVXF3U256 iemAImpl_vhsubps_u256, iemAImpl_vhsubps_u256_fallback;
     2505FNIEMAIMPLFPAVXF3U256 iemAImpl_vhsubpd_u256, iemAImpl_vhsubpd_u256_fallback;
    24942506/** @} */
    24952507
  • trunk/src/VBox/VMM/testcase/tstIEMCheckMc.cpp

    r96379 r96382  
    474474#define iemAImpl_maxps_u128             NULL
    475475#define iemAImpl_maxpd_u128             NULL
     476#define iemAImpl_haddps_u128            NULL
     477#define iemAImpl_haddpd_u128            NULL
     478#define iemAImpl_hsubps_u128            NULL
     479#define iemAImpl_hsubpd_u128            NULL
    476480
    477481#define iemAImpl_addss_u128_r32         NULL
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