VirtualBox

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


Ignore:
Timestamp:
Apr 15, 2022 1:10:57 AM (3 years ago)
Author:
vboxsync
Message:

VMM/IEM,libs/softfloat,iprt/types.h: The bias adjust value is applied to both unmasked underflows as as well as overflow, reworked the softfloat_roundPackToExtF80 function to do it correct so the new fmul_r80_by_r80 works right. bugref:9898

File:
1 edited

Legend:

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

    r94608 r94612  
    48304830        else
    48314831        {
    4832             iExponent += RTFLOAT80U_EXP_BIAS_UNDERFLOW_ADJUST;
     4832            iExponent += RTFLOAT80U_EXP_BIAS_ADJUST;
    48334833            fFsw |= X86_FSW_ES | X86_FSW_B;
    48344834        }
     
    49714971
    49724972
     4973/** Worker for iemAImpl_fmul_r80_by_r80. */
     4974static uint16_t iemAImpl_fmul_f80_r80_worker(PCRTFLOAT80U pr80Val1, PCRTFLOAT80U pr80Val2, PRTFLOAT80U pr80Result,
     4975                                             uint16_t fFcw, uint16_t fFsw, PCRTFLOAT80U pr80Val1Org)
     4976{
     4977    softfloat_state_t SoftState = IEM_SOFTFLOAT_STATE_INITIALIZER_FROM_FCW(fFcw);
     4978    extFloat80_t r80XResult = extF80_mul(iemFpuSoftF80FromIprt(pr80Val1), iemFpuSoftF80FromIprt(pr80Val2), &SoftState);
     4979    return iemFpuSoftStateAndF80ToFswAndIprtResult(&SoftState, r80XResult, pr80Result, fFcw, fFsw, pr80Val1Org);
     4980}
     4981
     4982
    49734983IEM_DECL_IMPL_DEF(void, iemAImpl_fmul_r80_by_r80,(PCX86FXSTATE pFpuState, PIEMFPURESULT pFpuRes,
    49744984                                                  PCRTFLOAT80U pr80Val1, PCRTFLOAT80U pr80Val2))
    49754985{
    4976     RT_NOREF(pFpuState, pFpuRes, pr80Val1, pr80Val2);
    4977     AssertReleaseFailed();
     4986    uint16_t const fFcw = pFpuState->FCW;
     4987    uint16_t fFsw       = (pFpuState->FSW & (X86_FSW_C0 | X86_FSW_C2 | X86_FSW_C3)) | (6 << X86_FSW_TOP_SHIFT);
     4988
     4989    /* SoftFloat does not check for Pseudo-Infinity, Pseudo-Nan and Unnormals. */
     4990    if (RTFLOAT80U_IS_387_INVALID(pr80Val1) || RTFLOAT80U_IS_387_INVALID(pr80Val2))
     4991    {
     4992        if (fFcw & X86_FCW_IM)
     4993            pFpuRes->r80Result = g_r80Indefinite;
     4994        else
     4995        {
     4996            pFpuRes->r80Result = *pr80Val1;
     4997            fFsw |= X86_FSW_ES | X86_FSW_B;
     4998        }
     4999        fFsw |= X86_FSW_IE;
     5000    }
     5001    /* SoftFloat does not check for denormals and certainly not report them to us. NaNs trumps denormals. */
     5002    else if (   (RTFLOAT80U_IS_DENORMAL_OR_PSEUDO_DENORMAL(pr80Val1) && !RTFLOAT80U_IS_NAN(pr80Val2))
     5003             || (RTFLOAT80U_IS_DENORMAL_OR_PSEUDO_DENORMAL(pr80Val2) && !RTFLOAT80U_IS_NAN(pr80Val1)) )
     5004    {
     5005        if (fFcw & X86_FCW_DM)
     5006        {
     5007            PCRTFLOAT80U const pr80Val1Org = pr80Val1;
     5008            IEM_NORMALIZE_PSEUDO_DENORMAL(pr80Val1, r80Val1Normalized);
     5009            IEM_NORMALIZE_PSEUDO_DENORMAL(pr80Val2, r80Val2Normalized);
     5010            fFsw = iemAImpl_fmul_f80_r80_worker(pr80Val1, pr80Val2, &pFpuRes->r80Result, fFcw, fFsw, pr80Val1Org);
     5011        }
     5012        else
     5013        {
     5014            pFpuRes->r80Result = *pr80Val1;
     5015            fFsw |= X86_FSW_ES | X86_FSW_B;
     5016        }
     5017        fFsw |= X86_FSW_DE;
     5018    }
     5019    /* SoftFloat can handle the rest: */
     5020    else
     5021        fFsw = iemAImpl_fmul_f80_r80_worker(pr80Val1, pr80Val2, &pFpuRes->r80Result, fFcw, fFsw, pr80Val1);
     5022
     5023    pFpuRes->FSW = fFsw;
    49785024}
    49795025
     
    51335179
    51345180
    5135 /** Worker for iemAImpl_fsub_r80_by_r80. */
     5181/** Worker for iemAImpl_fsub_r80_by_r80 and iemAImpl_fsubr_r80_by_r80. */
    51365182static uint16_t iemAImpl_fsub_f80_r80_worker(PCRTFLOAT80U pr80Val1, PCRTFLOAT80U pr80Val2, PRTFLOAT80U pr80Result,
    51375183                                             uint16_t fFcw, uint16_t fFsw, PCRTFLOAT80U pr80Val1Org)
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