VirtualBox

Changeset 96294 in vbox


Ignore:
Timestamp:
Aug 18, 2022 10:07:28 AM (2 years ago)
Author:
vboxsync
Message:

VMM/IEM: Implement subps/subpd instructions, bugref:9898

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

Legend:

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

    r96286 r96294  
    45894589IEMIMPL_FP_F2 mulps
    45904590IEMIMPL_FP_F2 mulpd
     4591IEMIMPL_FP_F2 subps
     4592IEMIMPL_FP_F2 subpd
  • trunk/src/VBox/VMM/VMMAll/IEMAllAImplC.cpp

    r96293 r96294  
    1417814178}
    1417914179#endif
     14180
     14181
     14182/**
     14183 * SUBPS
     14184 */
     14185#ifdef IEM_WITHOUT_ASSEMBLY
     14186static uint32_t iemAImpl_subps_u128_worker(PRTFLOAT32U pr32Res, uint32_t fMxcsr, PCRTFLOAT32U pr32Val1, PCRTFLOAT32U pr32Val2)
     14187{
     14188    if (iemSseBinaryValIsNaNR32(pr32Res, pr32Val1, pr32Val2, &fMxcsr))
     14189        return fMxcsr;
     14190
     14191    RTFLOAT32U r32Src1, r32Src2;
     14192    iemSsePrepareValueR32(&r32Src1, fMxcsr, pr32Val1);
     14193    iemSsePrepareValueR32(&r32Src2, fMxcsr, pr32Val2);
     14194    softfloat_state_t SoftState = IEM_SOFTFLOAT_STATE_INITIALIZER_FROM_MXCSR(fMxcsr);
     14195    float32_t r32Result = f32_sub(iemFpSoftF32FromIprt(&r32Src1), iemFpSoftF32FromIprt(&r32Src2), &SoftState);
     14196    return iemSseSoftStateAndR32ToMxcsrAndIprtResult(&SoftState, r32Result, pr32Res, fMxcsr, &r32Src1, &r32Src2);
     14197}
     14198
     14199
     14200IEM_DECL_IMPL_DEF(void, iemAImpl_subps_u128,(PX86FXSTATE pFpuState, PIEMSSERESULT pResult, PCX86XMMREG puSrc1, PCX86XMMREG puSrc2))
     14201{
     14202    pResult->MXCSR |= iemAImpl_subps_u128_worker(&pResult->uResult.ar32[0], pFpuState->MXCSR, &puSrc1->ar32[0], &puSrc2->ar32[0]);
     14203    pResult->MXCSR |= iemAImpl_subps_u128_worker(&pResult->uResult.ar32[1], pFpuState->MXCSR, &puSrc1->ar32[1], &puSrc2->ar32[1]);
     14204    pResult->MXCSR |= iemAImpl_subps_u128_worker(&pResult->uResult.ar32[2], pFpuState->MXCSR, &puSrc1->ar32[2], &puSrc2->ar32[2]);
     14205    pResult->MXCSR |= iemAImpl_subps_u128_worker(&pResult->uResult.ar32[3], pFpuState->MXCSR, &puSrc1->ar32[3], &puSrc2->ar32[3]);
     14206}
     14207#endif
     14208
     14209
     14210/**
     14211 * SUBPD
     14212 */
     14213#ifdef IEM_WITHOUT_ASSEMBLY
     14214static uint32_t iemAImpl_subpd_u128_worker(PRTFLOAT64U pr64Res, uint32_t fMxcsr, PCRTFLOAT64U pr64Val1, PCRTFLOAT64U pr64Val2)
     14215{
     14216    if (iemSseBinaryValIsNaNR64(pr64Res, pr64Val1, pr64Val2, &fMxcsr))
     14217        return fMxcsr;
     14218
     14219    RTFLOAT64U r64Src1, r64Src2;
     14220    iemSsePrepareValueR64(&r64Src1, fMxcsr, pr64Val1);
     14221    iemSsePrepareValueR64(&r64Src2, fMxcsr, pr64Val2);
     14222    softfloat_state_t SoftState = IEM_SOFTFLOAT_STATE_INITIALIZER_FROM_MXCSR(fMxcsr);
     14223    float64_t r64Result = f64_sub(iemFpSoftF64FromIprt(&r64Src1), iemFpSoftF64FromIprt(&r64Src2), &SoftState);
     14224    return iemSseSoftStateAndR64ToMxcsrAndIprtResult(&SoftState, r64Result, pr64Res, fMxcsr, &r64Src1, &r64Src2);
     14225}
     14226
     14227
     14228IEM_DECL_IMPL_DEF(void, iemAImpl_subpd_u128,(PX86FXSTATE pFpuState, PIEMSSERESULT pResult, PCX86XMMREG puSrc1, PCX86XMMREG puSrc2))
     14229{
     14230    pResult->MXCSR |= iemAImpl_subpd_u128_worker(&pResult->uResult.ar64[0], pFpuState->MXCSR, &puSrc1->ar64[0], &puSrc2->ar64[0]);
     14231    pResult->MXCSR |= iemAImpl_subpd_u128_worker(&pResult->uResult.ar64[1], pFpuState->MXCSR, &puSrc1->ar64[1], &puSrc2->ar64[1]);
     14232}
     14233#endif
  • trunk/src/VBox/VMM/VMMAll/IEMAllInstructionsTwoByte0f.cpp.h

    r96286 r96294  
    39183918/*  Opcode 0xf2 0x0f 0x5b - invalid */
    39193919
     3920
    39203921/** Opcode      0x0f 0x5c - subps Vps, Wps */
    3921 FNIEMOP_STUB(iemOp_subps_Vps_Wps);
     3922FNIEMOP_DEF(iemOp_subps_Vps_Wps)
     3923{
     3924    IEMOP_MNEMONIC2(RM, SUBPS, subps, Vps, Wps, DISOPTYPE_HARMLESS, 0);
     3925    return FNIEMOP_CALL_1(iemOpCommonSseFp_FullFull_To_Full, iemAImpl_subps_u128);
     3926}
     3927
     3928
    39223929/** Opcode 0x66 0x0f 0x5c - subpd Vpd, Wpd */
    3923 FNIEMOP_STUB(iemOp_subpd_Vpd_Wpd);
     3930FNIEMOP_DEF(iemOp_subpd_Vpd_Wpd)
     3931{
     3932    IEMOP_MNEMONIC2(RM, SUBPD, subpd, Vpd, Wpd, DISOPTYPE_HARMLESS, 0);
     3933    return FNIEMOP_CALL_1(iemOpCommonSseFp_FullFull_To_Full, iemAImpl_subpd_u128);
     3934}
     3935
     3936
    39243937/** Opcode 0xf3 0x0f 0x5c - subss Vss, Wss */
    39253938FNIEMOP_STUB(iemOp_subss_Vss_Wss);
  • trunk/src/VBox/VMM/include/IEMInternal.h

    r96286 r96294  
    24202420FNIEMAIMPLFPSSEF2U128 iemAImpl_mulps_u128;
    24212421FNIEMAIMPLFPSSEF2U128 iemAImpl_mulpd_u128;
     2422FNIEMAIMPLFPSSEF2U128 iemAImpl_subps_u128;
     2423FNIEMAIMPLFPSSEF2U128 iemAImpl_subpd_u128;
    24222424
    24232425FNIEMAIMPLFPAVXF3U128 iemAImpl_vaddps_u128, iemAImpl_vaddps_u128_fallback;
     
    24252427FNIEMAIMPLFPAVXF3U128 iemAImpl_vmulps_u128, iemAImpl_vmulps_u128_fallback;
    24262428FNIEMAIMPLFPAVXF3U128 iemAImpl_vmulpd_u128, iemAImpl_vmulpd_u128_fallback;
     2429FNIEMAIMPLFPAVXF3U128 iemAImpl_vsubps_u128, iemAImpl_vsubps_u128_fallback;
     2430FNIEMAIMPLFPAVXF3U128 iemAImpl_vsubpd_u128, iemAImpl_vsubpd_u128_fallback;
    24272431
    24282432FNIEMAIMPLFPAVXF3U256 iemAImpl_vaddps_u256, iemAImpl_vaddps_u256_fallback;
     
    24302434FNIEMAIMPLFPAVXF3U256 iemAImpl_vmulps_u256, iemAImpl_vmulps_u256_fallback;
    24312435FNIEMAIMPLFPAVXF3U256 iemAImpl_vmulpd_u256, iemAImpl_vmulpd_u256_fallback;
     2436FNIEMAIMPLFPAVXF3U256 iemAImpl_vsubps_u256, iemAImpl_vsubps_u256_fallback;
     2437FNIEMAIMPLFPAVXF3U256 iemAImpl_vsubpd_u256, iemAImpl_vsubpd_u256_fallback;
    24322438/** @} */
    24332439
  • trunk/src/VBox/VMM/testcase/tstIEMCheckMc.cpp

    r96287 r96294  
    466466#define iemAImpl_mulps_u128             NULL
    467467#define iemAImpl_mulpd_u128             NULL
     468#define iemAImpl_subps_u128             NULL
     469#define iemAImpl_subpd_u128             NULL
    468470
    469471/** @}  */
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