VirtualBox

Changeset 97161 in vbox


Ignore:
Timestamp:
Oct 14, 2022 7:25:34 PM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
154134
Message:

VMM/IEM: Implementation for fpatan instruction, bugref:9898

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/IEMAllAImplC.cpp

    r97153 r97161  
    61216121*   x87 FPU Trigometric Operations                                                                                               *
    61226122*********************************************************************************************************************************/
    6123 
     6123static uint16_t iemAImpl_fpatan_r80_by_r80_normal(PCRTFLOAT80U pr80Val1, PCRTFLOAT80U pr80Val2, PIEMFPURESULT pFpuRes, uint16_t fFcw, uint16_t fFsw)
     6124{
     6125    softfloat_state_t SoftState = SOFTFLOAT_STATE_INIT_DEFAULTS();
     6126    extFloat80_t y = iemFpuSoftF80FromIprt(pr80Val1);
     6127    extFloat80_t x = iemFpuSoftF80FromIprt(pr80Val2);
     6128    extFloat80_t v;
     6129    (void)fFcw;
     6130
     6131    v = extF80_atan2(y, x, &SoftState);
     6132
     6133    iemFpuSoftF80ToIprt(&pFpuRes->r80Result, v);
     6134    return fFsw;
     6135}
    61246136
    61256137IEM_DECL_IMPL_DEF(void, iemAImpl_fpatan_r80_by_r80,(PCX86FXSTATE pFpuState, PIEMFPURESULT pFpuRes,
    61266138                                                    PCRTFLOAT80U pr80Val1, PCRTFLOAT80U pr80Val2))
    61276139{
    6128     RT_NOREF(pFpuState, pFpuRes, pr80Val1, pr80Val2);
    6129     AssertReleaseFailed();
    6130 }
    6131 
     6140    uint16_t const fFcw = pFpuState->FCW;
     6141    uint16_t fFsw       = pFpuState->FSW & (X86_FSW_C0 | X86_FSW_C2 | X86_FSW_C3);
     6142
     6143    if (RTFLOAT80U_IS_NORMAL(pr80Val1) && RTFLOAT80U_IS_NORMAL(pr80Val2))
     6144    {
     6145        fFsw = iemAImpl_fpatan_r80_by_r80_normal(pr80Val1, pr80Val2, pFpuRes, fFcw, fFsw);
     6146
     6147        fFsw |= X86_FSW_PE | (7 << X86_FSW_TOP_SHIFT);
     6148        if (!(fFcw & X86_FCW_PM))
     6149            fFsw |= X86_FSW_ES | X86_FSW_B;
     6150    }
     6151    else
     6152    {
     6153        fFsw |= X86_FSW_IE;
     6154        if (!(fFcw & X86_FCW_IM))
     6155        {
     6156            pFpuRes->r80Result = *pr80Val2;
     6157            fFsw |= X86_FSW_ES | X86_FSW_B | (6 << X86_FSW_TOP_SHIFT);
     6158        }
     6159        else
     6160        {
     6161            pFpuRes->r80Result = g_r80Indefinite;
     6162            fFsw |= (7 << X86_FSW_TOP_SHIFT);
     6163        }
     6164    }
     6165
     6166    pFpuRes->FSW = fFsw;
     6167}
    61326168#endif /* IEM_WITHOUT_ASSEMBLY */
    61336169
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette