Changeset 94677 in vbox
- Timestamp:
- Apr 21, 2022 11:51:12 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/softfloat-3e/source/s_roundPackToExtF80.c
r94641 r94677 217 217 } 218 218 if ( doIncrement ) { 219 softfloat_exceptionFlags |= softfloat_flag_c1; /* VBox: C1 */ 220 //RTAssertMsg2("softfloat_roundPackToExtF80: C1 #5\n"); /* VBox: C1 */ 219 uint64_t const uOldSig = sig; /* VBox: C1 */ 221 220 ++sig; 222 221 sig &= … … 224 223 (! (sigExtra & UINT64_C( 0x7FFFFFFFFFFFFFFF )) 225 224 & roundNearEven); 225 if (sig > uOldSig) { /* VBox: C1 */ 226 softfloat_exceptionFlags |= softfloat_flag_c1; /* VBox: C1 */ 227 //RTAssertMsg2("softfloat_roundPackToExtF80: C1 #5\n"); /* VBox: C1 */ 228 } /* VBox: C1 */ 226 229 exp = ((sig & UINT64_C( 0x8000000000000000 )) != 0); 227 230 } … … 296 299 } 297 300 301 /** 302 * VBox: Wrapper for implementing underflow and overflow bias adjustment. 303 */ 298 304 extFloat80_t 299 305 softfloat_roundPackToExtF80( … … 306 312 ) 307 313 { 314 static union extF80M_extF80 const s_aExtF80Zero[2] = 315 { 316 EXTF80M_EXTF80_INIT3_C( 0, 0, 0 ), EXTF80M_EXTF80_INIT3_C( 1, 0, 0 ), 317 }; 318 static union extF80M_extF80 const s_aExtF80Infinity[2] = 319 { 320 EXTF80M_EXTF80_INIT3( 0, RT_BIT_64( 63 ), RTFLOAT80U_EXP_MAX ), 321 EXTF80M_EXTF80_INIT3( 1, RT_BIT_64( 63 ), RTFLOAT80U_EXP_MAX ), 322 }; 323 308 324 uint8_t const exceptionFlagsSaved = softfloat_exceptionFlags; 309 325 softfloat_exceptionFlags = 0; 310 extFloat80_t r80Result = softfloat_roundPackToExtF80Inner( sign, exp, sig, sigExtra, roundingPrecision, pState);326 extFloat80_t r80Result = softfloat_roundPackToExtF80Inner( sign, exp, sig, sigExtra, roundingPrecision, pState ); 311 327 312 328 if ( !(softfloat_exceptionFlags & ~pState->exceptionMask & (softfloat_flag_underflow | softfloat_flag_overflow)) ) { 313 329 /* likely */ 330 } 331 /* On Intel 10980XE the FSCALE instruction can cause really large exponents 332 and the rounding changes when we exceed the bias adjust. */ 333 else if (exp >= RTFLOAT80U_EXP_BIAS_ADJUST + RTFLOAT80U_EXP_MAX) { 334 Assert( softfloat_exceptionFlags & softfloat_flag_overflow ); 335 softfloat_exceptionFlags |= softfloat_flag_inexact | softfloat_flag_c1; 336 r80Result = s_aExtF80Infinity[sign].f; 337 } else if (exp <= -RTFLOAT80U_EXP_BIAS_ADJUST) { 338 Assert( softfloat_exceptionFlags & softfloat_flag_underflow ); 339 softfloat_exceptionFlags &= ~softfloat_flag_c1; 340 softfloat_exceptionFlags |= softfloat_flag_inexact; 341 r80Result = s_aExtF80Zero[sign].f; 314 342 } else { 343 /* Redo the conversion with the bias applied. */ 315 344 softfloat_exceptionFlags &= softfloat_flag_underflow | softfloat_flag_overflow; 316 345 if ( softfloat_exceptionFlags & softfloat_flag_underflow ) { 317 exp = (exp + RTFLOAT80U_EXP_BIAS_ADJUST) & RTFLOAT80U_EXP_MAX; 346 exp += RTFLOAT80U_EXP_BIAS_ADJUST; 347 Assert( exp > 0 ); 318 348 } else { 319 exp = (exp - RTFLOAT80U_EXP_BIAS_ADJUST) & RTFLOAT80U_EXP_MAX; 320 } 321 r80Result = softfloat_roundPackToExtF80Inner(sign, exp, sig, sigExtra, roundingPrecision, pState); 349 exp -= RTFLOAT80U_EXP_BIAS_ADJUST; 350 Assert( exp < RTFLOAT80U_EXP_MAX ); 351 } 352 r80Result = softfloat_roundPackToExtF80Inner( sign, exp, sig, sigExtra, roundingPrecision, pState ); 322 353 } 323 354
Note:
See TracChangeset
for help on using the changeset viewer.