VirtualBox

Changeset 97236 in vbox for trunk


Ignore:
Timestamp:
Oct 19, 2022 10:44:15 AM (2 years ago)
Author:
vboxsync
Message:

VMM/IEM: Rough implementation for fptan instruction in IEM, bugref:9898

File:
1 edited

Legend:

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

    r97161 r97236  
    61826182
    61836183#if defined(IEM_WITHOUT_ASSEMBLY)
     6184static uint16_t iemAImpl_fptan_r80_r80_normal(PIEMFPURESULTTWO pFpuResTwo, PCRTFLOAT80U pr80Val, uint16_t fFcw, uint16_t fFsw)
     6185{
     6186    softfloat_state_t SoftState = SOFTFLOAT_STATE_INIT_DEFAULTS();
     6187    extFloat80_t x = iemFpuSoftF80FromIprt(pr80Val);
     6188    extFloat80_t v;
     6189    (void)fFcw;
     6190
     6191    v = extF80_tan(x, &SoftState);
     6192
     6193    iemFpuSoftF80ToIprt(&pFpuResTwo->r80Result1, v);
     6194    return fFsw;
     6195}
     6196
    61846197IEM_DECL_IMPL_DEF(void, iemAImpl_fptan_r80_r80,(PCX86FXSTATE pFpuState, PIEMFPURESULTTWO pFpuResTwo, PCRTFLOAT80U pr80Val))
    61856198{
    6186     RT_NOREF(pFpuState, pFpuResTwo, pr80Val);
    6187     AssertReleaseFailed();
     6199    uint16_t const fFcw = pFpuState->FCW;
     6200    uint16_t fFsw       = (pFpuState->FSW & (X86_FSW_C0 | /*X86_FSW_C2 |*/ X86_FSW_C3)) | (6 << X86_FSW_TOP_SHIFT);
     6201
     6202    if (RTFLOAT80U_IS_NORMAL(pr80Val))
     6203    {
     6204        if (pr80Val->s.uExponent >= RTFLOAT80U_EXP_BIAS + 63)
     6205        {
     6206            fFsw |= X86_FSW_C2 | (7 << X86_FSW_TOP_SHIFT);
     6207            pFpuResTwo->r80Result1 = *pr80Val;
     6208        }
     6209        else
     6210        {
     6211            if (pr80Val->s.uExponent <= RTFLOAT80U_EXP_BIAS - 63)
     6212            {
     6213                pFpuResTwo->r80Result1 = *pr80Val;
     6214            }
     6215            else
     6216            {
     6217                fFsw = iemAImpl_fptan_r80_r80_normal(pFpuResTwo, pr80Val, fFcw, fFsw);
     6218            }
     6219
     6220            pFpuResTwo->r80Result2 = g_ar80One[0];
     6221
     6222            fFsw |= X86_FSW_PE;
     6223            if (!(fFcw & X86_FCW_PM))
     6224                fFsw |= X86_FSW_ES | X86_FSW_B;
     6225        }
     6226    }
     6227    else
     6228    {
     6229        fFsw |= X86_FSW_IE;
     6230        if (!(fFcw & X86_FCW_IM))
     6231            fFsw |= X86_FSW_ES | X86_FSW_B;
     6232    }
     6233
     6234    pFpuResTwo->FSW = fFsw;
    61886235}
    61896236#endif /* IEM_WITHOUT_ASSEMBLY */
     
    61986245    iemAImpl_fptan_r80_r80(pFpuState, pFpuResTwo, pr80Val);
    61996246}
    6200 
    62016247
    62026248#ifdef IEM_WITHOUT_ASSEMBLY
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