- Timestamp:
- Apr 11, 2022 8:38:57 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAllAImplC.cpp
r94565 r94567 5290 5290 *********************************************************************************************************************************/ 5291 5291 5292 /** 5293 * Helper for iemAImpl_frndint_r80, called both on normal and denormal numbers. 5294 */ 5295 static uint16_t iemAImpl_frndint_r80_normal(PCRTFLOAT80U pr80Val, PRTFLOAT80U pr80Result, uint16_t fFcw, uint16_t fFsw) 5296 { 5297 softfloat_state_t SoftState = IEM_SOFTFLOAT_STATE_INITIALIZER_FROM_FCW(fFcw); 5298 iemFpuSoftF80ToIprt(pr80Result, extF80_roundToInt(iemFpuSoftF80FromIprt(pr80Val), SoftState.roundingMode, 5299 true /*exact / generate #PE */, &SoftState)); 5300 return IEM_SOFTFLOAT_STATE_TO_FSW(fFsw, &SoftState, fFcw); 5301 } 5302 5292 5303 5293 5304 IEM_DECL_IMPL_DEF(void, iemAImpl_frndint_r80,(PCX86FXSTATE pFpuState, PIEMFPURESULT pFpuRes, PCRTFLOAT80U pr80Val)) 5294 5305 { 5295 RT_NOREF(pFpuState, pFpuRes, pr80Val); 5296 AssertReleaseFailed(); 5306 uint16_t const fFcw = pFpuState->FCW; 5307 uint16_t fFsw = (pFpuState->FSW & (X86_FSW_C0 | X86_FSW_C2 | X86_FSW_C3)) | (7 << X86_FSW_TOP_SHIFT); 5308 5309 if (RTFLOAT80U_IS_NORMAL(pr80Val)) 5310 fFsw = iemAImpl_frndint_r80_normal(pr80Val, &pFpuRes->r80Result, fFcw, fFsw); 5311 else if ( RTFLOAT80U_IS_ZERO(pr80Val) 5312 || RTFLOAT80U_IS_QUIET_NAN(pr80Val) 5313 || RTFLOAT80U_IS_INDEFINITE(pr80Val) 5314 || RTFLOAT80U_IS_INF(pr80Val)) 5315 pFpuRes->r80Result = *pr80Val; 5316 else if (RTFLOAT80U_IS_DENORMAL_OR_PSEUDO_DENORMAL(pr80Val)) 5317 { 5318 fFsw |= X86_FSW_DE; 5319 if (fFcw & X86_FCW_DM) 5320 fFsw = iemAImpl_frndint_r80_normal(pr80Val, &pFpuRes->r80Result, fFcw, fFsw); 5321 else 5322 { 5323 pFpuRes->r80Result = *pr80Val; 5324 fFsw |= X86_FSW_ES | X86_FSW_B; 5325 } 5326 } 5327 else 5328 { 5329 if (fFcw & X86_FCW_IM) 5330 { 5331 if (!RTFLOAT80U_IS_SIGNALLING_NAN(pr80Val)) 5332 pFpuRes->r80Result = g_r80Indefinite; 5333 else 5334 { 5335 pFpuRes->r80Result = *pr80Val; 5336 pFpuRes->r80Result.s.uMantissa |= RT_BIT_64(62); /* make it quiet */ 5337 } 5338 } 5339 else 5340 { 5341 pFpuRes->r80Result = *pr80Val; 5342 fFsw |= X86_FSW_ES | X86_FSW_B; 5343 } 5344 fFsw |= X86_FSW_IE; 5345 } 5346 pFpuRes->FSW = fFsw; 5297 5347 } 5298 5348
Note:
See TracChangeset
for help on using the changeset viewer.