diff options
-rw-r--r-- | fpu/softfloat-specialize.h | 50 | ||||
-rw-r--r-- | fpu/softfloat.c | 995 | ||||
-rw-r--r-- | include/fpu/softfloat.h | 9 | ||||
-rw-r--r-- | target-mips/msa_helper.c | 56 |
4 files changed, 617 insertions, 493 deletions
diff --git a/fpu/softfloat-specialize.h b/fpu/softfloat-specialize.h index 6b36492093..c2c0acd3fc 100644 --- a/fpu/softfloat-specialize.h +++ b/fpu/softfloat-specialize.h @@ -257,7 +257,9 @@ static commonNaNT float16ToCommonNaN(float16 a, float_status *status) { commonNaNT z; - if ( float16_is_signaling_nan( a ) ) float_raise( float_flag_invalid STATUS_VAR ); + if (float16_is_signaling_nan(a)) { + float_raise(float_flag_invalid, status); + } z.sign = float16_val(a) >> 15; z.low = 0; z.high = ((uint64_t) float16_val(a))<<54; @@ -360,7 +362,9 @@ static commonNaNT float32ToCommonNaN(float32 a, float_status *status) { commonNaNT z; - if ( float32_is_signaling_nan( a ) ) float_raise( float_flag_invalid STATUS_VAR ); + if (float32_is_signaling_nan(a)) { + float_raise(float_flag_invalid, status); + } z.sign = float32_val(a)>>31; z.low = 0; z.high = ( (uint64_t) float32_val(a) )<<41; @@ -514,7 +518,7 @@ static int pickNaNMulAdd(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN, * the default NaN */ if (infzero && cIsQNaN) { - float_raise(float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return 3; } @@ -544,7 +548,7 @@ static int pickNaNMulAdd(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN, * the default NaN */ if (infzero) { - float_raise(float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return 3; } @@ -573,7 +577,7 @@ static int pickNaNMulAdd(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN, * a default NaN */ if (infzero) { - float_raise(float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return 2; } @@ -625,7 +629,9 @@ static float32 propagateFloat32NaN(float32 a, float32 b, float_status *status) av = float32_val(a); bv = float32_val(b); - if ( aIsSignalingNaN | bIsSignalingNaN ) float_raise( float_flag_invalid STATUS_VAR); + if (aIsSignalingNaN | bIsSignalingNaN) { + float_raise(float_flag_invalid, status); + } if ( STATUS(default_nan_mode) ) return float32_default_nan; @@ -671,12 +677,12 @@ static float32 propagateFloat32MulAddNaN(float32 a, float32 b, cIsSignalingNaN = float32_is_signaling_nan(c); if (aIsSignalingNaN | bIsSignalingNaN | cIsSignalingNaN) { - float_raise(float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); } which = pickNaNMulAdd(aIsQuietNaN, aIsSignalingNaN, bIsQuietNaN, bIsSignalingNaN, - cIsQuietNaN, cIsSignalingNaN, infzero STATUS_VAR); + cIsQuietNaN, cIsSignalingNaN, infzero, status); if (STATUS(default_nan_mode)) { /* Note that this check is after pickNaNMulAdd so that function @@ -776,7 +782,9 @@ static commonNaNT float64ToCommonNaN(float64 a, float_status *status) { commonNaNT z; - if ( float64_is_signaling_nan( a ) ) float_raise( float_flag_invalid STATUS_VAR); + if (float64_is_signaling_nan(a)) { + float_raise(float_flag_invalid, status); + } z.sign = float64_val(a)>>63; z.low = 0; z.high = float64_val(a)<<12; @@ -824,7 +832,9 @@ static float64 propagateFloat64NaN(float64 a, float64 b, float_status *status) av = float64_val(a); bv = float64_val(b); - if ( aIsSignalingNaN | bIsSignalingNaN ) float_raise( float_flag_invalid STATUS_VAR); + if (aIsSignalingNaN | bIsSignalingNaN) { + float_raise(float_flag_invalid, status); + } if ( STATUS(default_nan_mode) ) return float64_default_nan; @@ -870,12 +880,12 @@ static float64 propagateFloat64MulAddNaN(float64 a, float64 b, cIsSignalingNaN = float64_is_signaling_nan(c); if (aIsSignalingNaN | bIsSignalingNaN | cIsSignalingNaN) { - float_raise(float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); } which = pickNaNMulAdd(aIsQuietNaN, aIsSignalingNaN, bIsQuietNaN, bIsSignalingNaN, - cIsQuietNaN, cIsSignalingNaN, infzero STATUS_VAR); + cIsQuietNaN, cIsSignalingNaN, infzero, status); if (STATUS(default_nan_mode)) { /* Note that this check is after pickNaNMulAdd so that function @@ -985,7 +995,9 @@ static commonNaNT floatx80ToCommonNaN(floatx80 a, float_status *status) { commonNaNT z; - if ( floatx80_is_signaling_nan( a ) ) float_raise( float_flag_invalid STATUS_VAR); + if (floatx80_is_signaling_nan(a)) { + float_raise(float_flag_invalid, status); + } if ( a.low >> 63 ) { z.sign = a.high >> 15; z.low = 0; @@ -1041,7 +1053,9 @@ static floatx80 propagateFloatx80NaN(floatx80 a, floatx80 b, bIsQuietNaN = floatx80_is_quiet_nan( b ); bIsSignalingNaN = floatx80_is_signaling_nan( b ); - if ( aIsSignalingNaN | bIsSignalingNaN ) float_raise( float_flag_invalid STATUS_VAR); + if (aIsSignalingNaN | bIsSignalingNaN) { + float_raise(float_flag_invalid, status); + } if ( STATUS(default_nan_mode) ) { a.low = floatx80_default_nan_low; @@ -1145,7 +1159,9 @@ static commonNaNT float128ToCommonNaN(float128 a, float_status *status) { commonNaNT z; - if ( float128_is_signaling_nan( a ) ) float_raise( float_flag_invalid STATUS_VAR); + if (float128_is_signaling_nan(a)) { + float_raise(float_flag_invalid, status); + } z.sign = a.high>>63; shortShift128Left( a.high, a.low, 16, &z.high, &z.low ); return z; @@ -1188,7 +1204,9 @@ static float128 propagateFloat128NaN(float128 a, float128 b, bIsQuietNaN = float128_is_quiet_nan( b ); bIsSignalingNaN = float128_is_signaling_nan( b ); - if ( aIsSignalingNaN | bIsSignalingNaN ) float_raise( float_flag_invalid STATUS_VAR); + if (aIsSignalingNaN | bIsSignalingNaN) { + float_raise(float_flag_invalid, status); + } if ( STATUS(default_nan_mode) ) { a.low = float128_default_nan_low; diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 6437b17749..f56c61888f 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -176,7 +176,7 @@ static int32 roundAndPackInt32(flag zSign, uint64_t absZ, float_status *status) z = absZ; if ( zSign ) z = - z; if ( ( absZ>>32 ) || ( z && ( ( z < 0 ) ^ zSign ) ) ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return zSign ? (int32_t) 0x80000000 : 0x7FFFFFFF; } if ( roundBits ) STATUS(float_exception_flags) |= float_flag_inexact; @@ -231,7 +231,7 @@ static int64 roundAndPackInt64(flag zSign, uint64_t absZ0, uint64_t absZ1, if ( zSign ) z = - z; if ( z && ( ( z < 0 ) ^ zSign ) ) { overflow: - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return zSign ? (int64_t) LIT64( 0x8000000000000000 ) : LIT64( 0x7FFFFFFFFFFFFFFF ); @@ -279,14 +279,14 @@ static int64 roundAndPackUint64(flag zSign, uint64_t absZ0, if (increment) { ++absZ0; if (absZ0 == 0) { - float_raise(float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return LIT64(0xFFFFFFFFFFFFFFFF); } absZ0 &= ~(((uint64_t)(absZ1<<1) == 0) & roundNearestEven); } if (zSign && absZ0) { - float_raise(float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return 0; } @@ -337,7 +337,7 @@ float32 float32_squash_input_denormal(float32 a, float_status *status) { if (STATUS(flush_inputs_to_zero)) { if (extractFloat32Exp(a) == 0 && extractFloat32Frac(a) != 0) { - float_raise(float_flag_input_denormal STATUS_VAR); + float_raise(float_flag_input_denormal, status); return make_float32(float32_val(a) & 0x80000000); } } @@ -437,12 +437,12 @@ static float32 roundAndPackFloat32(flag zSign, int_fast16_t zExp, uint32_t zSig, || ( ( zExp == 0xFD ) && ( (int32_t) ( zSig + roundIncrement ) < 0 ) ) ) { - float_raise( float_flag_overflow | float_flag_inexact STATUS_VAR); + float_raise(float_flag_overflow | float_flag_inexact, status); return packFloat32( zSign, 0xFF, - ( roundIncrement == 0 )); } if ( zExp < 0 ) { if (STATUS(flush_to_zero)) { - float_raise(float_flag_output_denormal STATUS_VAR); + float_raise(float_flag_output_denormal, status); return packFloat32(zSign, 0, 0); } isTiny = @@ -452,7 +452,9 @@ static float32 roundAndPackFloat32(flag zSign, int_fast16_t zExp, uint32_t zSig, shift32RightJamming( zSig, - zExp, &zSig ); zExp = 0; roundBits = zSig & 0x7F; - if ( isTiny && roundBits ) float_raise( float_flag_underflow STATUS_VAR); + if (isTiny && roundBits) { + float_raise(float_flag_underflow, status); + } } } if ( roundBits ) STATUS(float_exception_flags) |= float_flag_inexact; @@ -479,7 +481,8 @@ static float32 int8 shiftCount; shiftCount = countLeadingZeros32( zSig ) - 1; - return roundAndPackFloat32( zSign, zExp - shiftCount, zSig<<shiftCount STATUS_VAR); + return roundAndPackFloat32(zSign, zExp - shiftCount, zSig<<shiftCount, + status); } @@ -524,7 +527,7 @@ float64 float64_squash_input_denormal(float64 a, float_status *status) { if (STATUS(flush_inputs_to_zero)) { if (extractFloat64Exp(a) == 0 && extractFloat64Frac(a) != 0) { - float_raise(float_flag_input_denormal STATUS_VAR); + float_raise(float_flag_input_denormal, status); return make_float64(float64_val(a) & (1ULL << 63)); } } @@ -623,12 +626,12 @@ static float64 roundAndPackFloat64(flag zSign, int_fast16_t zExp, uint64_t zSig, || ( ( zExp == 0x7FD ) && ( (int64_t) ( zSig + roundIncrement ) < 0 ) ) ) { - float_raise( float_flag_overflow | float_flag_inexact STATUS_VAR); + float_raise(float_flag_overflow | float_flag_inexact, status); return packFloat64( zSign, 0x7FF, - ( roundIncrement == 0 )); } if ( zExp < 0 ) { if (STATUS(flush_to_zero)) { - float_raise(float_flag_output_denormal STATUS_VAR); + float_raise(float_flag_output_denormal, status); return packFloat64(zSign, 0, 0); } isTiny = @@ -638,7 +641,9 @@ static float64 roundAndPackFloat64(flag zSign, int_fast16_t zExp, uint64_t zSig, shift64RightJamming( zSig, - zExp, &zSig ); zExp = 0; roundBits = zSig & 0x3FF; - if ( isTiny && roundBits ) float_raise( float_flag_underflow STATUS_VAR); + if (isTiny && roundBits) { + float_raise(float_flag_underflow, status); + } } } if ( roundBits ) STATUS(float_exception_flags) |= float_flag_inexact; @@ -665,7 +670,8 @@ static float64 int8 shiftCount; shiftCount = countLeadingZeros64( zSig ) - 1; - return roundAndPackFloat64( zSign, zExp - shiftCount, zSig<<shiftCount STATUS_VAR); + return roundAndPackFloat64(zSign, zExp - shiftCount, zSig<<shiftCount, + status); } @@ -810,7 +816,7 @@ static floatx80 roundAndPackFloatx80(int8 roundingPrecision, flag zSign, } if ( zExp <= 0 ) { if (STATUS(flush_to_zero)) { - float_raise(float_flag_output_denormal STATUS_VAR); + float_raise(float_flag_output_denormal, status); return packFloatx80(zSign, 0, 0); } isTiny = @@ -820,7 +826,9 @@ static floatx80 roundAndPackFloatx80(int8 roundingPrecision, flag zSign, shift64RightJamming( zSig0, 1 - zExp, &zSig0 ); zExp = 0; roundBits = zSig0 & roundMask; - if ( isTiny && roundBits ) float_raise( float_flag_underflow STATUS_VAR); + if (isTiny && roundBits) { + float_raise(float_flag_underflow, status); + } if ( roundBits ) STATUS(float_exception_flags) |= float_flag_inexact; zSig0 += roundIncrement; if ( (int64_t) zSig0 < 0 ) zExp = 1; @@ -872,7 +880,7 @@ static floatx80 roundAndPackFloatx80(int8 roundingPrecision, flag zSign, ) { roundMask = 0; overflow: - float_raise( float_flag_overflow | float_flag_inexact STATUS_VAR); + float_raise(float_flag_overflow | float_flag_inexact, status); if ( ( roundingMode == float_round_to_zero ) || ( zSign && ( roundingMode == float_round_up ) ) || ( ! zSign && ( roundingMode == float_round_down ) ) @@ -889,7 +897,9 @@ static floatx80 roundAndPackFloatx80(int8 roundingPrecision, flag zSign, || ( zSig0 < LIT64( 0xFFFFFFFFFFFFFFFF ) ); shift64ExtraRightJamming( zSig0, zSig1, 1 - zExp, &zSig0, &zSig1 ); zExp = 0; - if ( isTiny && zSig1 ) float_raise( float_flag_underflow STATUS_VAR); + if (isTiny && zSig1) { + float_raise(float_flag_underflow, status); + } if ( zSig1 ) STATUS(float_exception_flags) |= float_flag_inexact; switch (roundingMode) { case float_round_nearest_even: @@ -959,8 +969,8 @@ static floatx80 normalizeRoundAndPackFloatx80(int8 roundingPrecision, shiftCount = countLeadingZeros64( zSig0 ); shortShift128Left( zSig0, zSig1, shiftCount, &zSig0, &zSig1 ); zExp -= shiftCount; - return - roundAndPackFloatx80( roundingPrecision, zSign, zExp, zSig0, zSig1 STATUS_VAR); + return roundAndPackFloatx80(roundingPrecision, zSign, zExp, + zSig0, zSig1, status); } @@ -1135,7 +1145,7 @@ static float128 roundAndPackFloat128(flag zSign, int32 zExp, && increment ) ) { - float_raise( float_flag_overflow | float_flag_inexact STATUS_VAR); + float_raise(float_flag_overflow | float_flag_inexact, status); if ( ( roundingMode == float_round_to_zero ) || ( zSign && ( roundingMode == float_round_up ) ) || ( ! zSign && ( roundingMode == float_round_down ) ) @@ -1152,7 +1162,7 @@ static float128 roundAndPackFloat128(flag zSign, int32 zExp, } if ( zExp < 0 ) { if (STATUS(flush_to_zero)) { - float_raise(float_flag_output_denormal STATUS_VAR); + float_raise(float_flag_output_denormal, status); return packFloat128(zSign, 0, 0, 0); } isTiny = @@ -1168,7 +1178,9 @@ static float128 roundAndPackFloat128(flag zSign, int32 zExp, shift128ExtraRightJamming( zSig0, zSig1, zSig2, - zExp, &zSig0, &zSig1, &zSig2 ); zExp = 0; - if ( isTiny && zSig2 ) float_raise( float_flag_underflow STATUS_VAR); + if (isTiny && zSig2) { + float_raise(float_flag_underflow, status); + } switch (roundingMode) { case float_round_nearest_even: case float_round_ties_away: @@ -1232,7 +1244,7 @@ static float128 normalizeRoundAndPackFloat128(flag zSign, int32 zExp, zSig0, zSig1, 0, - shiftCount, &zSig0, &zSig1, &zSig2 ); } zExp -= shiftCount; - return roundAndPackFloat128( zSign, zExp, zSig0, zSig1, zSig2 STATUS_VAR); + return roundAndPackFloat128(zSign, zExp, zSig0, zSig1, zSig2, status); } @@ -1249,8 +1261,7 @@ float32 int32_to_float32(int32_t a, float_status *status) if ( a == 0 ) return float32_zero; if ( a == (int32_t) 0x80000000 ) return packFloat32( 1, 0x9E, 0 ); zSign = ( a < 0 ); - return normalizeRoundAndPackFloat32( zSign, 0x9C, zSign ? - a : a STATUS_VAR ); - + return normalizeRoundAndPackFloat32(zSign, 0x9C, zSign ? -a : a, status); } /*---------------------------------------------------------------------------- @@ -1347,7 +1358,7 @@ float32 int64_to_float32(int64_t a, float_status *status) else { absA <<= shiftCount; } - return roundAndPackFloat32( zSign, 0x9C - shiftCount, absA STATUS_VAR ); + return roundAndPackFloat32(zSign, 0x9C - shiftCount, absA, status); } } @@ -1367,8 +1378,7 @@ float64 int64_to_float64(int64_t a, float_status *status) return packFloat64( 1, 0x43E, 0 ); } zSign = ( a < 0 ); - return normalizeRoundAndPackFloat64( zSign, 0x43C, zSign ? - a : a STATUS_VAR ); - + return normalizeRoundAndPackFloat64(zSign, 0x43C, zSign ? -a : a, status); } /*---------------------------------------------------------------------------- @@ -1457,7 +1467,7 @@ float32 uint64_to_float32(uint64_t a, float_status *status) a <<= shiftcount; } - return roundAndPackFloat32(0, 0x9c - shiftcount, a STATUS_VAR); + return roundAndPackFloat32(0, 0x9c - shiftcount, a, status); } /*---------------------------------------------------------------------------- @@ -1481,7 +1491,7 @@ float64 uint64_to_float64(uint64_t a, float_status *status) } else { a <<= shiftcount; } - return roundAndPackFloat64(0, exp - shiftcount, a STATUS_VAR); + return roundAndPackFloat64(0, exp - shiftcount, a, status); } /*---------------------------------------------------------------------------- @@ -1495,7 +1505,7 @@ float128 uint64_to_float128(uint64_t a, float_status *status) if (a == 0) { return float128_zero; } - return normalizeRoundAndPackFloat128(0, 0x406E, a, 0 STATUS_VAR); + return normalizeRoundAndPackFloat128(0, 0x406E, a, 0, status); } /*---------------------------------------------------------------------------- @@ -1515,7 +1525,7 @@ int32 float32_to_int32(float32 a, float_status *status) uint32_t aSig; uint64_t aSig64; - a = float32_squash_input_denormal(a STATUS_VAR); + a = float32_squash_input_denormal(a, status); aSig = extractFloat32Frac( a ); aExp = extractFloat32Exp( a ); aSign = extractFloat32Sign( a ); @@ -1525,7 +1535,7 @@ int32 float32_to_int32(float32 a, float_status *status) aSig64 = aSig; aSig64 <<= 32; if ( 0 < shiftCount ) shift64RightJamming( aSig64, shiftCount, &aSig64 ); - return roundAndPackInt32( aSign, aSig64 STATUS_VAR ); + return roundAndPackInt32(aSign, aSig64, status); } @@ -1545,7 +1555,7 @@ int32 float32_to_int32_round_to_zero(float32 a, float_status *status) int_fast16_t aExp, shiftCount; uint32_t aSig; int32_t z; - a = float32_squash_input_denormal(a STATUS_VAR); + a = float32_squash_input_denormal(a, status); aSig = extractFloat32Frac( a ); aExp = extractFloat32Exp( a ); @@ -1553,7 +1563,7 @@ int32 float32_to_int32_round_to_zero(float32 a, float_status *status) shiftCount = aExp - 0x9E; if ( 0 <= shiftCount ) { if ( float32_val(a) != 0xCF000000 ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); if ( ! aSign || ( ( aExp == 0xFF ) && aSig ) ) return 0x7FFFFFFF; } return (int32_t) 0x80000000; @@ -1595,7 +1605,7 @@ int_fast16_t float32_to_int16_round_to_zero(float32 a, float_status *status) shiftCount = aExp - 0x8E; if ( 0 <= shiftCount ) { if ( float32_val(a) != 0xC7000000 ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); if ( ! aSign || ( ( aExp == 0xFF ) && aSig ) ) { return 0x7FFF; } @@ -1637,14 +1647,14 @@ int64 float32_to_int64(float32 a, float_status *status) int_fast16_t aExp, shiftCount; uint32_t aSig; uint64_t aSig64, aSigExtra; - a = float32_squash_input_denormal(a STATUS_VAR); + a = float32_squash_input_denormal(a, status); aSig = extractFloat32Frac( a ); aExp = extractFloat32Exp( a ); aSign = extractFloat32Sign( a ); shiftCount = 0xBE - aExp; if ( shiftCount < 0 ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); if ( ! aSign || ( ( aExp == 0xFF ) && aSig ) ) { return LIT64( 0x7FFFFFFFFFFFFFFF ); } @@ -1654,7 +1664,7 @@ int64 float32_to_int64(float32 a, float_status *status) aSig64 = aSig; aSig64 <<= 40; shift64ExtraRightJamming( aSig64, 0, shiftCount, &aSig64, &aSigExtra ); - return roundAndPackInt64( aSign, aSig64, aSigExtra STATUS_VAR ); + return roundAndPackInt64(aSign, aSig64, aSigExtra, status); } @@ -1676,13 +1686,13 @@ uint64 float32_to_uint64(float32 a, float_status *status) int_fast16_t aExp, shiftCount; uint32_t aSig; uint64_t aSig64, aSigExtra; - a = float32_squash_input_denormal(a STATUS_VAR); + a = float32_squash_input_denormal(a, status); aSig = extractFloat32Frac(a); aExp = extractFloat32Exp(a); aSign = extractFloat32Sign(a); if ((aSign) && (aExp > 126)) { - float_raise(float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); if (float32_is_any_nan(a)) { return LIT64(0xFFFFFFFFFFFFFFFF); } else { @@ -1694,14 +1704,14 @@ uint64 float32_to_uint64(float32 a, float_status *status) aSig |= 0x00800000; } if (shiftCount < 0) { - float_raise(float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return LIT64(0xFFFFFFFFFFFFFFFF); } aSig64 = aSig; aSig64 <<= 40; shift64ExtraRightJamming(aSig64, 0, shiftCount, &aSig64, &aSigExtra); - return roundAndPackUint64(aSign, aSig64, aSigExtra STATUS_VAR); + return roundAndPackUint64(aSign, aSig64, aSigExtra, status); } /*---------------------------------------------------------------------------- @@ -1718,9 +1728,9 @@ uint64 float32_to_uint64(float32 a, float_status *status) uint64 float32_to_uint64_round_to_zero(float32 a, float_status *status) { signed char current_rounding_mode = STATUS(float_rounding_mode); - set_float_rounding_mode(float_round_to_zero STATUS_VAR); - int64_t v = float32_to_uint64(a STATUS_VAR); - set_float_rounding_mode(current_rounding_mode STATUS_VAR); + set_float_rounding_mode(float_round_to_zero, status); + int64_t v = float32_to_uint64(a, status); + set_float_rounding_mode(current_rounding_mode, status); return v; } @@ -1741,7 +1751,7 @@ int64 float32_to_int64_round_to_zero(float32 a, float_status *status) uint32_t aSig; uint64_t aSig64; int64 z; - a = float32_squash_input_denormal(a STATUS_VAR); + a = float32_squash_input_denormal(a, status); aSig = extractFloat32Frac( a ); aExp = extractFloat32Exp( a ); @@ -1749,7 +1759,7 @@ int64 float32_to_int64_round_to_zero(float32 a, float_status *status) shiftCount = aExp - 0xBE; if ( 0 <= shiftCount ) { if ( float32_val(a) != 0xDF000000 ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); if ( ! aSign || ( ( aExp == 0xFF ) && aSig ) ) { return LIT64( 0x7FFFFFFFFFFFFFFF ); } @@ -1783,13 +1793,15 @@ float64 float32_to_float64(float32 a, float_status *status) flag aSign; int_fast16_t aExp; uint32_t aSig; - a = float32_squash_input_denormal(a STATUS_VAR); + a = float32_squash_input_denormal(a, status); aSig = extractFloat32Frac( a ); aExp = extractFloat32Exp( a ); aSign = extractFloat32Sign( a ); if ( aExp == 0xFF ) { - if ( aSig ) return commonNaNToFloat64( float32ToCommonNaN( a STATUS_VAR ) STATUS_VAR ); + if (aSig) { + return commonNaNToFloat64(float32ToCommonNaN(a, status), status); + } return packFloat64( aSign, 0x7FF, 0 ); } if ( aExp == 0 ) { @@ -1814,12 +1826,14 @@ floatx80 float32_to_floatx80(float32 a, float_status *status) int_fast16_t aExp; uint32_t aSig; - a = float32_squash_input_denormal(a STATUS_VAR); + a = float32_squash_input_denormal(a, status); aSig = extractFloat32Frac( a ); aExp = extractFloat32Exp( a ); aSign = extractFloat32Sign( a ); if ( aExp == 0xFF ) { - if ( aSig ) return commonNaNToFloatx80( float32ToCommonNaN( a STATUS_VAR ) STATUS_VAR ); + if (aSig) { + return commonNaNToFloatx80(float32ToCommonNaN(a, status), status); + } return packFloatx80( aSign, 0x7FFF, LIT64( 0x8000000000000000 ) ); } if ( aExp == 0 ) { @@ -1844,12 +1858,14 @@ float128 float32_to_float128(float32 a, float_status *status) int_fast16_t aExp; uint32_t aSig; - a = float32_squash_input_denormal(a STATUS_VAR); + a = float32_squash_input_denormal(a, status); aSig = extractFloat32Frac( a ); aExp = extractFloat32Exp( a ); aSign = extractFloat32Sign( a ); if ( aExp == 0xFF ) { - if ( aSig ) return commonNaNToFloat128( float32ToCommonNaN( a STATUS_VAR ) STATUS_VAR ); + if (aSig) { + return commonNaNToFloat128(float32ToCommonNaN(a, status), status); + } return packFloat128( aSign, 0x7FFF, 0, 0 ); } if ( aExp == 0 ) { @@ -1874,12 +1890,12 @@ float32 float32_round_to_int(float32 a, float_status *status) int_fast16_t aExp; uint32_t lastBitMask, roundBitsMask; uint32_t z; - a = float32_squash_input_denormal(a STATUS_VAR); + a = float32_squash_input_denormal(a, status); aExp = extractFloat32Exp( a ); if ( 0x96 <= aExp ) { if ( ( aExp == 0xFF ) && extractFloat32Frac( a ) ) { - return propagateFloat32NaN( a, a STATUS_VAR ); + return propagateFloat32NaN(a, a, status); } return a; } @@ -1964,7 +1980,9 @@ static float32 addFloat32Sigs(float32 a, float32 b, flag zSign, bSig <<= 6; if ( 0 < expDiff ) { if ( aExp == 0xFF ) { - if ( aSig ) return propagateFloat32NaN( a, b STATUS_VAR ); + if (aSig) { + return propagateFloat32NaN(a, b, status); + } return a; } if ( bExp == 0 ) { @@ -1978,7 +1996,9 @@ static float32 addFloat32Sigs(float32 a, float32 b, flag zSign, } else if ( expDiff < 0 ) { if ( bExp == 0xFF ) { - if ( bSig ) return propagateFloat32NaN( a, b STATUS_VAR ); + if (bSig) { + return propagateFloat32NaN(a, b, status); + } return packFloat32( zSign, 0xFF, 0 ); } if ( aExp == 0 ) { @@ -1992,13 +2012,15 @@ static float32 addFloat32Sigs(float32 a, float32 b, flag zSign, } else { if ( aExp == 0xFF ) { - if ( aSig | bSig ) return propagateFloat32NaN( a, b STATUS_VAR ); + if (aSig | bSig) { + return propagateFloat32NaN(a, b, status); + } return a; } if ( aExp == 0 ) { if (STATUS(flush_to_zero)) { if (aSig | bSig) { - float_raise(float_flag_output_denormal STATUS_VAR); + float_raise(float_flag_output_denormal, status); } return packFloat32(zSign, 0, 0); } @@ -2016,7 +2038,7 @@ static float32 addFloat32Sigs(float32 a, float32 b, flag zSign, ++zExp; } roundAndPack: - return roundAndPackFloat32( zSign, zExp, zSig STATUS_VAR ); + return roundAndPackFloat32(zSign, zExp, zSig, status); } @@ -2045,8 +2067,10 @@ static float32 subFloat32Sigs(float32 a, float32 b, flag zSign, if ( 0 < expDiff ) goto aExpBigger; if ( expDiff < 0 ) goto bExpBigger; if ( aExp == 0xFF ) { - if ( aSig | bSig ) return propagateFloat32NaN( a, b STATUS_VAR ); - float_raise( float_flag_invalid STATUS_VAR); + if (aSig | bSig) { + return propagateFloat32NaN(a, b, status); + } + float_raise(float_flag_invalid, status); return float32_default_nan; } if ( aExp == 0 ) { @@ -2058,7 +2082,9 @@ static float32 subFloat32Sigs(float32 a, float32 b, flag zSign, return packFloat32( STATUS(float_rounding_mode) == float_round_down, 0, 0 ); bExpBigger: if ( bExp == 0xFF ) { - if ( bSig ) return propagateFloat32NaN( a, b STATUS_VAR ); + if (bSig) { + return propagateFloat32NaN(a, b, status); + } return packFloat32( zSign ^ 1, 0xFF, 0 ); } if ( aExp == 0 ) { @@ -2076,7 +2102,9 @@ static float32 subFloat32Sigs(float32 a, float32 b, flag zSign, goto normalizeRoundAndPack; aExpBigger: if ( aExp == 0xFF ) { - if ( aSig ) return propagateFloat32NaN( a, b STATUS_VAR ); + if (aSig) { + return propagateFloat32NaN(a, b, status); + } return a; } if ( bExp == 0 ) { @@ -2092,7 +2120,7 @@ static float32 subFloat32Sigs(float32 a, float32 b, flag zSign, zExp = aExp; normalizeRoundAndPack: --zExp; - return normalizeRoundAndPackFloat32( zSign, zExp, zSig STATUS_VAR ); + return normalizeRoundAndPackFloat32(zSign, zExp, zSig, status); } @@ -2105,16 +2133,16 @@ static float32 subFloat32Sigs(float32 a, float32 b, flag zSign, float32 float32_add(float32 a, float32 b, float_status *status) { flag aSign, bSign; - a = float32_squash_input_denormal(a STATUS_VAR); - b = float32_squash_input_denormal(b STATUS_VAR); + a = float32_squash_input_denormal(a, status); + b = float32_squash_input_denormal(b, status); aSign = extractFloat32Sign( a ); bSign = extractFloat32Sign( b ); if ( aSign == bSign ) { - return addFloat32Sigs( a, b, aSign STATUS_VAR); + return addFloat32Sigs(a, b, aSign, status); } else { - return subFloat32Sigs( a, b, aSign STATUS_VAR ); + return subFloat32Sigs(a, b, aSign, status); } } @@ -2128,16 +2156,16 @@ float32 float32_add(float32 a, float32 b, float_status *status) float32 float32_sub(float32 a, float32 b, float_status *status) { flag aSign, bSign; - a = float32_squash_input_denormal(a STATUS_VAR); - b = float32_squash_input_denormal(b STATUS_VAR); + a = float32_squash_input_denormal(a, status); + b = float32_squash_input_denormal(b, status); aSign = extractFloat32Sign( a ); bSign = extractFloat32Sign( b ); if ( aSign == bSign ) { - return subFloat32Sigs( a, b, aSign STATUS_VAR ); + return subFloat32Sigs(a, b, aSign, status); } else { - return addFloat32Sigs( a, b, aSign STATUS_VAR ); + return addFloat32Sigs(a, b, aSign, status); } } @@ -2156,8 +2184,8 @@ float32 float32_mul(float32 a, float32 b, float_status *status) uint64_t zSig64; uint32_t zSig; - a = float32_squash_input_denormal(a STATUS_VAR); - b = float32_squash_input_denormal(b STATUS_VAR); + a = float32_squash_input_denormal(a, status); + b = float32_squash_input_denormal(b, status); aSig = extractFloat32Frac( a ); aExp = extractFloat32Exp( a ); @@ -2168,18 +2196,20 @@ float32 float32_mul(float32 a, float32 b, float_status *status) zSign = aSign ^ bSign; if ( aExp == 0xFF ) { if ( aSig || ( ( bExp == 0xFF ) && bSig ) ) { - return propagateFloat32NaN( a, b STATUS_VAR ); + return propagateFloat32NaN(a, b, status); } if ( ( bExp | bSig ) == 0 ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return float32_default_nan; } return packFloat32( zSign, 0xFF, 0 ); } if ( bExp == 0xFF ) { - if ( bSig ) return propagateFloat32NaN( a, b STATUS_VAR ); + if (bSig) { + return propagateFloat32NaN(a, b, status); + } if ( ( aExp | aSig ) == 0 ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return float32_default_nan; } return packFloat32( zSign, 0xFF, 0 ); @@ -2201,7 +2231,7 @@ float32 float32_mul(float32 a, float32 b, float_status *status) zSig <<= 1; --zExp; } - return roundAndPackFloat32( zSign, zExp, zSig STATUS_VAR ); + return roundAndPackFloat32(zSign, zExp, zSig, status); } @@ -2216,8 +2246,8 @@ float32 float32_div(float32 a, float32 b, float_status *status) flag aSign, bSign, zSign; int_fast16_t aExp, bExp, zExp; uint32_t aSig, bSig, zSig; - a = float32_squash_input_denormal(a STATUS_VAR); - b = float32_squash_input_denormal(b STATUS_VAR); + a = float32_squash_input_denormal(a, status); + b = float32_squash_input_denormal(b, status); aSig = extractFloat32Frac( a ); aExp = extractFloat32Exp( a ); @@ -2227,25 +2257,31 @@ float32 float32_div(float32 a, float32 b, float_status *status) bSign = extractFloat32Sign( b ); zSign = aSign ^ bSign; if ( aExp == 0xFF ) { - if ( aSig ) return propagateFloat32NaN( a, b STATUS_VAR ); + if (aSig) { + return propagateFloat32NaN(a, b, status); + } if ( bExp == 0xFF ) { - if ( bSig ) return propagateFloat32NaN( a, b STATUS_VAR ); - float_raise( float_flag_invalid STATUS_VAR); + if (bSig) { + return propagateFloat32NaN(a, b, status); + } + float_raise(float_flag_invalid, status); return float32_default_nan; } return packFloat32( zSign, 0xFF, 0 ); } if ( bExp == 0xFF ) { - if ( bSig ) return propagateFloat32NaN( a, b STATUS_VAR ); + if (bSig) { + return propagateFloat32NaN(a, b, status); + } return packFloat32( zSign, 0, 0 ); } if ( bExp == 0 ) { if ( bSig == 0 ) { if ( ( aExp | aSig ) == 0 ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return float32_default_nan; } - float_raise( float_flag_divbyzero STATUS_VAR); + float_raise(float_flag_divbyzero, status); return packFloat32( zSign, 0xFF, 0 ); } normalizeFloat32Subnormal( bSig, &bExp, &bSig ); @@ -2265,7 +2301,7 @@ float32 float32_div(float32 a, float32 b, float_status *status) if ( ( zSig & 0x3F ) == 0 ) { zSig |= ( (uint64_t) bSig * zSig != ( (uint64_t) aSig )<<32 ); } - return roundAndPackFloat32( zSign, zExp, zSig STATUS_VAR ); + return roundAndPackFloat32(zSign, zExp, zSig, status); } @@ -2284,8 +2320,8 @@ float32 float32_rem(float32 a, float32 b, float_status *status) uint64_t aSig64, bSig64, q64; uint32_t alternateASig; int32_t sigMean; - a = float32_squash_input_denormal(a STATUS_VAR); - b = float32_squash_input_denormal(b STATUS_VAR); + a = float32_squash_input_denormal(a, status); + b = float32_squash_input_denormal(b, status); aSig = extractFloat32Frac( a ); aExp = extractFloat32Exp( a ); @@ -2294,18 +2330,20 @@ float32 float32_rem(float32 a, float32 b, float_status *status) bExp = extractFloat32Exp( b ); if ( aExp == 0xFF ) { if ( aSig || ( ( bExp == 0xFF ) && bSig ) ) { - return propagateFloat32NaN( a, b STATUS_VAR ); + return propagateFloat32NaN(a, b, status); } - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return float32_default_nan; } if ( bExp == 0xFF ) { - if ( bSig ) return propagateFloat32NaN( a, b STATUS_VAR ); + if (bSig) { + return propagateFloat32NaN(a, b, status); + } return a; } if ( bExp == 0 ) { if ( bSig == 0 ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return float32_default_nan; } normalizeFloat32Subnormal( bSig, &bExp, &bSig ); @@ -2366,8 +2404,7 @@ float32 float32_rem(float32 a, float32 b, float_status *status) } zSign = ( (int32_t) aSig < 0 ); if ( zSign ) aSig = - aSig; - return normalizeRoundAndPackFloat32( aSign ^ zSign, bExp, aSig STATUS_VAR ); - + return normalizeRoundAndPackFloat32(aSign ^ zSign, bExp, aSig, status); } /*---------------------------------------------------------------------------- @@ -2393,9 +2430,9 @@ float32 float32_muladd(float32 a, float32 b, float32 c, int flags, int shiftcount; flag signflip, infzero; - a = float32_squash_input_denormal(a STATUS_VAR); - b = float32_squash_input_denormal(b STATUS_VAR); - c = float32_squash_input_denormal(c STATUS_VAR); + a = float32_squash_input_denormal(a, status); + b = float32_squash_input_denormal(b, status); + c = float32_squash_input_denormal(c, status); aSig = extractFloat32Frac(a); aExp = extractFloat32Exp(a); aSign = extractFloat32Sign(a); @@ -2417,11 +2454,11 @@ float32 float32_muladd(float32 a, float32 b, float32 c, int flags, if (((aExp == 0xff) && aSig) || ((bExp == 0xff) && bSig) || ((cExp == 0xff) && cSig)) { - return propagateFloat32MulAddNaN(a, b, c, infzero STATUS_VAR); + return propagateFloat32MulAddNaN(a, b, c, infzero, status); } if (infzero) { - float_raise(float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return float32_default_nan; } @@ -2442,7 +2479,7 @@ float32 float32_muladd(float32 a, float32 b, float32 c, int flags, if (cExp == 0xff) { if (pInf && (pSign ^ cSign)) { /* addition of opposite-signed infinities => InvalidOperation */ - float_raise(float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return float32_default_nan; } /* Otherwise generate an infinity of the same sign */ @@ -2468,7 +2505,7 @@ float32 float32_muladd(float32 a, float32 b, float32 c, int flags, } /* Exact zero plus a denorm */ if (STATUS(flush_to_zero)) { - float_raise(float_flag_output_denormal STATUS_VAR); + float_raise(float_flag_output_denormal, status); return packFloat32(cSign ^ signflip, 0, 0); } } @@ -2482,7 +2519,7 @@ float32 float32_muladd(float32 a, float32 b, float32 c, int flags, */ cExp -= 2; cSig = (cSig | 0x00800000) << 7; - return roundAndPackFloat32(cSign ^ signflip, cExp, cSig STATUS_VAR); + return roundAndPackFloat32(cSign ^ signflip, cExp, cSig, status); } return packFloat32(cSign ^ signflip, cExp, cSig); } @@ -2524,7 +2561,7 @@ float32 float32_muladd(float32 a, float32 b, float32 c, int flags, pExp--; } return roundAndPackFloat32(zSign, pExp - 1, - pSig STATUS_VAR); + pSig, status); } normalizeFloat32Subnormal(cSig, &cExp, &cSig); } @@ -2592,7 +2629,7 @@ float32 float32_muladd(float32 a, float32 b, float32 c, int flags, } shift64RightJamming(zSig64, 32, &zSig64); - return roundAndPackFloat32(zSign, zExp, zSig64 STATUS_VAR); + return roundAndPackFloat32(zSign, zExp, zSig64, status); } @@ -2608,20 +2645,22 @@ float32 float32_sqrt(float32 a, float_status *status) int_fast16_t aExp, zExp; uint32_t aSig, zSig; uint64_t rem, term; - a = float32_squash_input_denormal(a STATUS_VAR); + a = float32_squash_input_denormal(a, status); aSig = extractFloat32Frac( a ); aExp = extractFloat32Exp( a ); aSign = extractFloat32Sign( a ); if ( aExp == 0xFF ) { - if ( aSig ) return propagateFloat32NaN( a, float32_zero STATUS_VAR ); + if (aSig) { + return propagateFloat32NaN(a, float32_zero, status); + } if ( ! aSign ) return a; - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return float32_default_nan; } if ( aSign ) { if ( ( aExp | aSig ) == 0 ) return a; - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return float32_default_nan; } if ( aExp == 0 ) { @@ -2647,7 +2686,7 @@ float32 float32_sqrt(float32 a, float_status *status) } shift32RightJamming( zSig, 1, &zSig ); roundAndPack: - return roundAndPackFloat32( 0, zExp, zSig STATUS_VAR ); + return roundAndPackFloat32(0, zExp, zSig, status); } @@ -2695,37 +2734,39 @@ float32 float32_exp2(float32 a, float_status *status) uint32_t aSig; float64 r, x, xn; int i; - a = float32_squash_input_denormal(a STATUS_VAR); + a = float32_squash_input_denormal(a, status); aSig = extractFloat32Frac( a ); aExp = extractFloat32Exp( a ); aSign = extractFloat32Sign( a ); if ( aExp == 0xFF) { - if ( aSig ) return propagateFloat32NaN( a, float32_zero STATUS_VAR ); + if (aSig) { + return propagateFloat32NaN(a, float32_zero, status); + } return (aSign) ? float32_zero : a; } if (aExp == 0) { if (aSig == 0) return float32_one; } - float_raise( float_flag_inexact STATUS_VAR); + float_raise(float_flag_inexact, status); /* ******************************* */ /* using float64 for approximation */ /* ******************************* */ - x = float32_to_float64(a STATUS_VAR); - x = float64_mul(x, float64_ln2 STATUS_VAR); + x = float32_to_float64(a, status); + x = float64_mul(x, float64_ln2, status); xn = x; r = float64_one; for (i = 0 ; i < 15 ; i++) { float64 f; - f = float64_mul(xn, float32_exp2_coefficients[i] STATUS_VAR); - r = float64_add(r, f STATUS_VAR); + f = float64_mul(xn, float32_exp2_coefficients[i], status); + r = float64_add(r, f, status); - xn = float64_mul(xn, x STATUS_VAR); + xn = float64_mul(xn, x, status); } return float64_to_float32(r, status); @@ -2742,7 +2783,7 @@ float32 float32_log2(float32 a, float_status *status) int_fast16_t aExp; uint32_t aSig, zSig, i; - a = float32_squash_input_denormal(a STATUS_VAR); + a = float32_squash_input_denormal(a, status); aSig = extractFloat32Frac( a ); aExp = extractFloat32Exp( a ); aSign = extractFloat32Sign( a ); @@ -2752,11 +2793,13 @@ float32 float32_log2(float32 a, float_status *status) normalizeFloat32Subnormal( aSig, &aExp, &aSig ); } if ( aSign ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return float32_default_nan; } if ( aExp == 0xFF ) { - if ( aSig ) return propagateFloat32NaN( a, float32_zero STATUS_VAR ); + if (aSig) { + return propagateFloat32NaN(a, float32_zero, status); + } return a; } @@ -2776,7 +2819,7 @@ float32 float32_log2(float32 a, float_status *status) if ( zSign ) zSig = -zSig; - return normalizeRoundAndPackFloat32( zSign, 0x85, zSig STATUS_VAR ); + return normalizeRoundAndPackFloat32(zSign, 0x85, zSig, status); } /*---------------------------------------------------------------------------- @@ -2789,13 +2832,13 @@ float32 float32_log2(float32 a, float_status *status) int float32_eq(float32 a, float32 b, float_status *status) { uint32_t av, bv; - a = float32_squash_input_denormal(a STATUS_VAR); - b = float32_squash_input_denormal(b STATUS_VAR); + a = float32_squash_input_denormal(a, status); + b = float32_squash_input_denormal(b, status); if ( ( ( extractFloat32Exp( a ) == 0xFF ) && extractFloat32Frac( a ) ) || ( ( extractFloat32Exp( b ) == 0xFF ) && extractFloat32Frac( b ) ) ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return 0; } av = float32_val(a); @@ -2814,13 +2857,13 @@ int float32_le(float32 a, float32 b, float_status *status) { flag aSign, bSign; uint32_t av, bv; - a = float32_squash_input_denormal(a STATUS_VAR); - b = float32_squash_input_denormal(b STATUS_VAR); + a = float32_squash_input_denormal(a, status); + b = float32_squash_input_denormal(b, status); if ( ( ( extractFloat32Exp( a ) == 0xFF ) && extractFloat32Frac( a ) ) || ( ( extractFloat32Exp( b ) == 0xFF ) && extractFloat32Frac( b ) ) ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return 0; } aSign = extractFloat32Sign( a ); @@ -2843,13 +2886,13 @@ int float32_lt(float32 a, float32 b, float_status *status) { flag aSign, bSign; uint32_t av, bv; - a = float32_squash_input_denormal(a STATUS_VAR); - b = float32_squash_input_denormal(b STATUS_VAR); + a = float32_squash_input_denormal(a, status); + b = float32_squash_input_denormal(b, status); if ( ( ( extractFloat32Exp( a ) == 0xFF ) && extractFloat32Frac( a ) ) || ( ( extractFloat32Exp( b ) == 0xFF ) && extractFloat32Frac( b ) ) ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return 0; } aSign = extractFloat32Sign( a ); @@ -2870,13 +2913,13 @@ int float32_lt(float32 a, float32 b, float_status *status) int float32_unordered(float32 a, float32 b, float_status *status) { - a = float32_squash_input_denormal(a STATUS_VAR); - b = float32_squash_input_denormal(b STATUS_VAR); + a = float32_squash_input_denormal(a, status); + b = float32_squash_input_denormal(b, status); if ( ( ( extractFloat32Exp( a ) == 0xFF ) && extractFloat32Frac( a ) ) || ( ( extractFloat32Exp( b ) == 0xFF ) && extractFloat32Frac( b ) ) ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return 1; } return 0; @@ -2891,14 +2934,14 @@ int float32_unordered(float32 a, float32 b, float_status *status) int float32_eq_quiet(float32 a, float32 b, float_status *status) { - a = float32_squash_input_denormal(a STATUS_VAR); - b = float32_squash_input_denormal(b STATUS_VAR); + a = float32_squash_input_denormal(a, status); + b = float32_squash_input_denormal(b, status); if ( ( ( extractFloat32Exp( a ) == 0xFF ) && extractFloat32Frac( a ) ) || ( ( extractFloat32Exp( b ) == 0xFF ) && extractFloat32Frac( b ) ) ) { if ( float32_is_signaling_nan( a ) || float32_is_signaling_nan( b ) ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); } return 0; } @@ -2917,14 +2960,14 @@ int float32_le_quiet(float32 a, float32 b, float_status *status) { flag aSign, bSign; uint32_t av, bv; - a = float32_squash_input_denormal(a STATUS_VAR); - b = float32_squash_input_denormal(b STATUS_VAR); + a = float32_squash_input_denormal(a, status); + b = float32_squash_input_denormal(b, status); if ( ( ( extractFloat32Exp( a ) == 0xFF ) && extractFloat32Frac( a ) ) || ( ( extractFloat32Exp( b ) == 0xFF ) && extractFloat32Frac( b ) ) ) { if ( float32_is_signaling_nan( a ) || float32_is_signaling_nan( b ) ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); } return 0; } @@ -2948,14 +2991,14 @@ int float32_lt_quiet(float32 a, float32 b, float_status *status) { flag aSign, bSign; uint32_t av, bv; - a = float32_squash_input_denormal(a STATUS_VAR); - b = float32_squash_input_denormal(b STATUS_VAR); + a = float32_squash_input_denormal(a, status); + b = float32_squash_input_denormal(b, status); if ( ( ( extractFloat32Exp( a ) == 0xFF ) && extractFloat32Frac( a ) ) || ( ( extractFloat32Exp( b ) == 0xFF ) && extractFloat32Frac( b ) ) ) { if ( float32_is_signaling_nan( a ) || float32_is_signaling_nan( b ) ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); } return 0; } @@ -2977,14 +3020,14 @@ int float32_lt_quiet(float32 a, float32 b, float_status *status) int float32_unordered_quiet(float32 a, float32 b, float_status *status) { - a = float32_squash_input_denormal(a STATUS_VAR); - b = float32_squash_input_denormal(b STATUS_VAR); + a = float32_squash_input_denormal(a, status); + b = float32_squash_input_denormal(b, status); if ( ( ( extractFloat32Exp( a ) == 0xFF ) && extractFloat32Frac( a ) ) || ( ( extractFloat32Exp( b ) == 0xFF ) && extractFloat32Frac( b ) ) ) { if ( float32_is_signaling_nan( a ) || float32_is_signaling_nan( b ) ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); } return 1; } @@ -3006,7 +3049,7 @@ int32 float64_to_int32(float64 a, float_status *status) flag aSign; int_fast16_t aExp, shiftCount; uint64_t aSig; - a = float64_squash_input_denormal(a STATUS_VAR); + a = float64_squash_input_denormal(a, status); aSig = extractFloat64Frac( a ); aExp = extractFloat64Exp( a ); @@ -3015,7 +3058,7 @@ int32 float64_to_int32(float64 a, float_status *status) if ( aExp ) aSig |= LIT64( 0x0010000000000000 ); shiftCount = 0x42C - aExp; if ( 0 < shiftCount ) shift64RightJamming( aSig, shiftCount, &aSig ); - return roundAndPackInt32( aSign, aSig STATUS_VAR ); + return roundAndPackInt32(aSign, aSig, status); } @@ -3035,7 +3078,7 @@ int32 float64_to_int32_round_to_zero(float64 a, float_status *status) int_fast16_t aExp, shiftCount; uint64_t aSig, savedASig; int32_t z; - a = float64_squash_input_denormal(a STATUS_VAR); + a = float64_squash_input_denormal(a, status); aSig = extractFloat64Frac( a ); aExp = extractFloat64Exp( a ); @@ -3056,7 +3099,7 @@ int32 float64_to_int32_round_to_zero(float64 a, float_status *status) if ( aSign ) z = - z; if ( ( z < 0 ) ^ aSign ) { invalid: - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return aSign ? (int32_t) 0x80000000 : 0x7FFFFFFF; } if ( ( aSig<<shiftCount ) != savedASig ) { @@ -3108,7 +3151,7 @@ int_fast16_t float64_to_int16_round_to_zero(float64 a, float_status *status) } if ( ( (int16_t)z < 0 ) ^ aSign ) { invalid: - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return aSign ? (int32_t) 0xffff8000 : 0x7FFF; } if ( ( aSig<<shiftCount ) != savedASig ) { @@ -3132,7 +3175,7 @@ int64 float64_to_int64(float64 a, float_status *status) flag aSign; int_fast16_t aExp, shiftCount; uint64_t aSig, aSigExtra; - a = float64_squash_input_denormal(a STATUS_VAR); + a = float64_squash_input_denormal(a, status); aSig = extractFloat64Frac( a ); aExp = extractFloat64Exp( a ); @@ -3141,7 +3184,7 @@ int64 float64_to_int64(float64 a, float_status *status) shiftCount = 0x433 - aExp; if ( shiftCount <= 0 ) { if ( 0x43E < aExp ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); if ( ! aSign || ( ( aExp == 0x7FF ) && ( aSig != LIT64( 0x0010000000000000 ) ) ) @@ -3156,7 +3199,7 @@ int64 float64_to_int64(float64 a, float_status *status) else { shift64ExtraRightJamming( aSig, 0, shiftCount, &aSig, &aSigExtra ); } - return roundAndPackInt64( aSign, aSig, aSigExtra STATUS_VAR ); + return roundAndPackInt64(aSign, aSig, aSigExtra, status); } @@ -3176,7 +3219,7 @@ int64 float64_to_int64_round_to_zero(float64 a, float_status *status) int_fast16_t aExp, shiftCount; uint64_t aSig; int64 z; - a = float64_squash_input_denormal(a STATUS_VAR); + a = float64_squash_input_denormal(a, status); aSig = extractFloat64Frac( a ); aExp = extractFloat64Exp( a ); @@ -3186,7 +3229,7 @@ int64 float64_to_int64_round_to_zero(float64 a, float_status *status) if ( 0 <= shiftCount ) { if ( 0x43E <= aExp ) { if ( float64_val(a) != LIT64( 0xC3E0000000000000 ) ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); if ( ! aSign || ( ( aExp == 0x7FF ) && ( aSig != LIT64( 0x0010000000000000 ) ) ) @@ -3226,13 +3269,15 @@ float32 float64_to_float32(float64 a, float_status *status) int_fast16_t aExp; uint64_t aSig; uint32_t zSig; - a = float64_squash_input_denormal(a STATUS_VAR); + a = float64_squash_input_denormal(a, status); aSig = extractFloat64Frac( a ); aExp = extractFloat64Exp( a ); aSign = extractFloat64Sign( a ); if ( aExp == 0x7FF ) { - if ( aSig ) return commonNaNToFloat32( float64ToCommonNaN( a STATUS_VAR ) STATUS_VAR ); + if (aSig) { + return commonNaNToFloat32(float64ToCommonNaN(a, status), status); + } return packFloat32( aSign, 0xFF, 0 ); } shift64RightJamming( aSig, 22, &aSig ); @@ -3241,7 +3286,7 @@ float32 float64_to_float32(float64 a, float_status *status) zSig |= 0x40000000; aExp -= 0x381; } - return roundAndPackFloat32( aSign, aExp, zSig STATUS_VAR ); + return roundAndPackFloat32(aSign, aExp, zSig, status); } @@ -3339,10 +3384,10 @@ static float32 roundAndPackFloat16(flag zSign, int_fast16_t zExp, if (zExp > maxexp || (zExp == maxexp && rounding_bumps_exp)) { if (ieee) { - float_raise(float_flag_overflow | float_flag_inexact STATUS_VAR); + float_raise(float_flag_overflow | float_flag_inexact, status); return packFloat16(zSign, 0x1f, 0); } else { - float_raise(float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return packFloat16(zSign, 0x1f, 0x3ff); } } @@ -3355,9 +3400,9 @@ static float32 roundAndPackFloat16(flag zSign, int_fast16_t zExp, || (!rounding_bumps_exp); } if (zSig & mask) { - float_raise(float_flag_inexact STATUS_VAR); + float_raise(float_flag_inexact, status); if (is_tiny) { - float_raise(float_flag_underflow STATUS_VAR); + float_raise(float_flag_underflow, status); } } @@ -3400,7 +3445,7 @@ float32 float16_to_float32(float16 a, flag ieee, float_status *status) if (aExp == 0x1f && ieee) { if (aSig) { - return commonNaNToFloat32(float16ToCommonNaN(a STATUS_VAR) STATUS_VAR); + return commonNaNToFloat32(float16ToCommonNaN(a, status), status); } return packFloat32(aSign, 0xff, 0); } @@ -3421,7 +3466,7 @@ float16 float32_to_float16(float32 a, flag ieee, float_status *status) int_fast16_t aExp; uint32_t aSig; - a = float32_squash_input_denormal(a STATUS_VAR); + a = float32_squash_input_denormal(a, status); aSig = extractFloat32Frac( a ); aExp = extractFloat32Exp( a ); @@ -3430,15 +3475,15 @@ float16 float32_to_float16(float32 a, flag ieee, float_status *status) if (aSig) { /* Input is a NaN */ if (!ieee) { - float_raise(float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return packFloat16(aSign, 0, 0); } return commonNaNToFloat16( - float32ToCommonNaN(a STATUS_VAR) STATUS_VAR); + float32ToCommonNaN(a, status), status); } /* Infinity */ if (!ieee) { - float_raise(float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return packFloat16(aSign, 0x1f, 0x3ff); } return packFloat16(aSign, 0x1f, 0); @@ -3456,7 +3501,7 @@ float16 float32_to_float16(float32 a, flag ieee, float_status *status) aSig |= 0x00800000; aExp -= 0x71; - return roundAndPackFloat16(aSign, aExp, aSig, ieee STATUS_VAR); + return roundAndPackFloat16(aSign, aExp, aSig, ieee, status); } float64 float16_to_float64(float16 a, flag ieee, float_status *status) @@ -3472,7 +3517,7 @@ float64 float16_to_float64(float16 a, flag ieee, float_status *status) if (aExp == 0x1f && ieee) { if (aSig) { return commonNaNToFloat64( - float16ToCommonNaN(a STATUS_VAR) STATUS_VAR); + float16ToCommonNaN(a, status), status); } return packFloat64(aSign, 0x7ff, 0); } @@ -3494,7 +3539,7 @@ float16 float64_to_float16(float64 a, flag ieee, float_status *status) uint64_t aSig; uint32_t zSig; - a = float64_squash_input_denormal(a STATUS_VAR); + a = float64_squash_input_denormal(a, status); aSig = extractFloat64Frac(a); aExp = extractFloat64Exp(a); @@ -3503,15 +3548,15 @@ float16 float64_to_float16(float64 a, flag ieee, float_status *status) if (aSig) { /* Input is a NaN */ if (!ieee) { - float_raise(float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return packFloat16(aSign, 0, 0); } return commonNaNToFloat16( - float64ToCommonNaN(a STATUS_VAR) STATUS_VAR); + float64ToCommonNaN(a, status), status); } /* Infinity */ if (!ieee) { - float_raise(float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return packFloat16(aSign, 0x1f, 0x3ff); } return packFloat16(aSign, 0x1f, 0); @@ -3531,7 +3576,7 @@ float16 float64_to_float16(float64 a, flag ieee, float_status *status) zSig |= 0x00800000; aExp -= 0x3F1; - return roundAndPackFloat16(aSign, aExp, zSig, ieee STATUS_VAR); + return roundAndPackFloat16(aSign, aExp, zSig, ieee, status); } /*---------------------------------------------------------------------------- @@ -3547,12 +3592,14 @@ floatx80 float64_to_floatx80(float64 a, float_status *status) int_fast16_t aExp; uint64_t aSig; - a = float64_squash_input_denormal(a STATUS_VAR); + a = float64_squash_input_denormal(a, status); aSig = extractFloat64Frac( a ); aExp = extractFloat64Exp( a ); aSign = extractFloat64Sign( a ); if ( aExp == 0x7FF ) { - if ( aSig ) return commonNaNToFloatx80( float64ToCommonNaN( a STATUS_VAR ) STATUS_VAR ); + if (aSig) { + return commonNaNToFloatx80(float64ToCommonNaN(a, status), status); + } return packFloatx80( aSign, 0x7FFF, LIT64( 0x8000000000000000 ) ); } if ( aExp == 0 ) { @@ -3578,12 +3625,14 @@ float128 float64_to_float128(float64 a, float_status *status) int_fast16_t aExp; uint64_t aSig, zSig0, zSig1; - a = float64_squash_input_denormal(a STATUS_VAR); + a = float64_squash_input_denormal(a, status); aSig = extractFloat64Frac( a ); aExp = extractFloat64Exp( a ); aSign = extractFloat64Sign( a ); if ( aExp == 0x7FF ) { - if ( aSig ) return commonNaNToFloat128( float64ToCommonNaN( a STATUS_VAR ) STATUS_VAR ); + if (aSig) { + return commonNaNToFloat128(float64ToCommonNaN(a, status), status); + } return packFloat128( aSign, 0x7FFF, 0, 0 ); } if ( aExp == 0 ) { @@ -3609,12 +3658,12 @@ float64 float64_round_to_int(float64 a, float_status *status) int_fast16_t aExp; uint64_t lastBitMask, roundBitsMask; uint64_t z; - a = float64_squash_input_denormal(a STATUS_VAR); + a = float64_squash_input_denormal(a, status); aExp = extractFloat64Exp( a ); if ( 0x433 <= aExp ) { if ( ( aExp == 0x7FF ) && extractFloat64Frac( a ) ) { - return propagateFloat64NaN( a, a STATUS_VAR ); + return propagateFloat64NaN(a, a, status); } return a; } @@ -3683,7 +3732,7 @@ float64 float64_trunc_to_int(float64 a, float_status *status) float64 res; oldmode = STATUS(float_rounding_mode); STATUS(float_rounding_mode) = float_round_to_zero; - res = float64_round_to_int(a STATUS_VAR); + res = float64_round_to_int(a, status); STATUS(float_rounding_mode) = oldmode; return res; } @@ -3712,7 +3761,9 @@ static float64 addFloat64Sigs(float64 a, float64 b, flag zSign, bSig <<= 9; if ( 0 < expDiff ) { if ( aExp == 0x7FF ) { - if ( aSig ) return propagateFloat64NaN( a, b STATUS_VAR ); + if (aSig) { + return propagateFloat64NaN(a, b, status); + } return a; } if ( bExp == 0 ) { @@ -3726,7 +3777,9 @@ static float64 addFloat64Sigs(float64 a, float64 b, flag zSign, } else if ( expDiff < 0 ) { if ( bExp == 0x7FF ) { - if ( bSig ) return propagateFloat64NaN( a, b STATUS_VAR ); + if (bSig) { + return propagateFloat64NaN(a, b, status); + } return packFloat64( zSign, 0x7FF, 0 ); } if ( aExp == 0 ) { @@ -3740,13 +3793,15 @@ static float64 addFloat64Sigs(float64 a, float64 b, flag zSign, } else { if ( aExp == 0x7FF ) { - if ( aSig | bSig ) return propagateFloat64NaN( a, b STATUS_VAR ); + if (aSig | bSig) { + return propagateFloat64NaN(a, b, status); + } return a; } if ( aExp == 0 ) { if (STATUS(flush_to_zero)) { if (aSig | bSig) { - float_raise(float_flag_output_denormal STATUS_VAR); + float_raise(float_flag_output_denormal, status); } return packFloat64(zSign, 0, 0); } @@ -3764,7 +3819,7 @@ static float64 addFloat64Sigs(float64 a, float64 b, flag zSign, ++zExp; } roundAndPack: - return roundAndPackFloat64( zSign, zExp, zSig STATUS_VAR ); + return roundAndPackFloat64(zSign, zExp, zSig, status); } @@ -3793,8 +3848,10 @@ static float64 subFloat64Sigs(float64 a, float64 b, flag zSign, if ( 0 < expDiff ) goto aExpBigger; if ( expDiff < 0 ) goto bExpBigger; if ( aExp == 0x7FF ) { - if ( aSig | bSig ) return propagateFloat64NaN( a, b STATUS_VAR ); - float_raise( float_flag_invalid STATUS_VAR); + if (aSig | bSig) { + return propagateFloat64NaN(a, b, status); + } + float_raise(float_flag_invalid, status); return float64_default_nan; } if ( aExp == 0 ) { @@ -3806,7 +3863,9 @@ static float64 subFloat64Sigs(float64 a, float64 b, flag zSign, return packFloat64( STATUS(float_rounding_mode) == float_round_down, 0, 0 ); bExpBigger: if ( bExp == 0x7FF ) { - if ( bSig ) return propagateFloat64NaN( a, b STATUS_VAR ); + if (bSig) { + return propagateFloat64NaN(a, b, status); + } return packFloat64( zSign ^ 1, 0x7FF, 0 ); } if ( aExp == 0 ) { @@ -3824,7 +3883,9 @@ static float64 subFloat64Sigs(float64 a, float64 b, flag zSign, goto normalizeRoundAndPack; aExpBigger: if ( aExp == 0x7FF ) { - if ( aSig ) return propagateFloat64NaN( a, b STATUS_VAR ); + if (aSig) { + return propagateFloat64NaN(a, b, status); + } return a; } if ( bExp == 0 ) { @@ -3840,7 +3901,7 @@ static float64 subFloat64Sigs(float64 a, float64 b, flag zSign, zExp = aExp; normalizeRoundAndPack: --zExp; - return normalizeRoundAndPackFloat64( zSign, zExp, zSig STATUS_VAR ); + return normalizeRoundAndPackFloat64(zSign, zExp, zSig, status); } @@ -3853,16 +3914,16 @@ static float64 subFloat64Sigs(float64 a, float64 b, flag zSign, float64 float64_add(float64 a, float64 b, float_status *status) { flag aSign, bSign; - a = float64_squash_input_denormal(a STATUS_VAR); - b = float64_squash_input_denormal(b STATUS_VAR); + a = float64_squash_input_denormal(a, status); + b = float64_squash_input_denormal(b, status); aSign = extractFloat64Sign( a ); bSign = extractFloat64Sign( b ); if ( aSign == bSign ) { - return addFloat64Sigs( a, b, aSign STATUS_VAR ); + return addFloat64Sigs(a, b, aSign, status); } else { - return subFloat64Sigs( a, b, aSign STATUS_VAR ); + return subFloat64Sigs(a, b, aSign, status); } } @@ -3876,16 +3937,16 @@ float64 float64_add(float64 a, float64 b, float_status *status) float64 float64_sub(float64 a, float64 b, float_status *status) { flag aSign, bSign; - a = float64_squash_input_denormal(a STATUS_VAR); - b = float64_squash_input_denormal(b STATUS_VAR); + a = float64_squash_input_denormal(a, status); + b = float64_squash_input_denormal(b, status); aSign = extractFloat64Sign( a ); bSign = extractFloat64Sign( b ); if ( aSign == bSign ) { - return subFloat64Sigs( a, b, aSign STATUS_VAR ); + return subFloat64Sigs(a, b, aSign, status); } else { - return addFloat64Sigs( a, b, aSign STATUS_VAR ); + return addFloat64Sigs(a, b, aSign, status); } } @@ -3902,8 +3963,8 @@ float64 float64_mul(float64 a, float64 b, float_status *status) int_fast16_t aExp, bExp, zExp; uint64_t aSig, bSig, zSig0, zSig1; - a = float64_squash_input_denormal(a STATUS_VAR); - b = float64_squash_input_denormal(b STATUS_VAR); + a = float64_squash_input_denormal(a, status); + b = float64_squash_input_denormal(b, status); aSig = extractFloat64Frac( a ); aExp = extractFloat64Exp( a ); @@ -3914,18 +3975,20 @@ float64 float64_mul(float64 a, float64 b, float_status *status) zSign = aSign ^ bSign; if ( aExp == 0x7FF ) { if ( aSig || ( ( bExp == 0x7FF ) && bSig ) ) { - return propagateFloat64NaN( a, b STATUS_VAR ); + return propagateFloat64NaN(a, b, status); } if ( ( bExp | bSig ) == 0 ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return float64_default_nan; } return packFloat64( zSign, 0x7FF, 0 ); } if ( bExp == 0x7FF ) { - if ( bSig ) return propagateFloat64NaN( a, b STATUS_VAR ); + if (bSig) { + return propagateFloat64NaN(a, b, status); + } if ( ( aExp | aSig ) == 0 ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return float64_default_nan; } return packFloat64( zSign, 0x7FF, 0 ); @@ -3947,7 +4010,7 @@ float64 float64_mul(float64 a, float64 b, float_status *status) zSig0 <<= 1; --zExp; } - return roundAndPackFloat64( zSign, zExp, zSig0 STATUS_VAR ); + return roundAndPackFloat64(zSign, zExp, zSig0, status); } @@ -3964,8 +4027,8 @@ float64 float64_div(float64 a, float64 b, float_status *status) uint64_t aSig, bSig, zSig; uint64_t rem0, rem1; uint64_t term0, term1; - a = float64_squash_input_denormal(a STATUS_VAR); - b = float64_squash_input_denormal(b STATUS_VAR); + a = float64_squash_input_denormal(a, status); + b = float64_squash_input_denormal(b, status); aSig = extractFloat64Frac( a ); aExp = extractFloat64Exp( a ); @@ -3975,25 +4038,31 @@ float64 float64_div(float64 a, float64 b, float_status *status) bSign = extractFloat64Sign( b ); zSign = aSign ^ bSign; if ( aExp == 0x7FF ) { - if ( aSig ) return propagateFloat64NaN( a, b STATUS_VAR ); + if (aSig) { + return propagateFloat64NaN(a, b, status); + } if ( bExp == 0x7FF ) { - if ( bSig ) return propagateFloat64NaN( a, b STATUS_VAR ); - float_raise( float_flag_invalid STATUS_VAR); + if (bSig) { + return propagateFloat64NaN(a, b, status); + } + float_raise(float_flag_invalid, status); return float64_default_nan; } return packFloat64( zSign, 0x7FF, 0 ); } if ( bExp == 0x7FF ) { - if ( bSig ) return propagateFloat64NaN( a, b STATUS_VAR ); + if (bSig) { + return propagateFloat64NaN(a, b, status); + } return packFloat64( zSign, 0, 0 ); } if ( bExp == 0 ) { if ( bSig == 0 ) { if ( ( aExp | aSig ) == 0 ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return float64_default_nan; } - float_raise( float_flag_divbyzero STATUS_VAR); + float_raise(float_flag_divbyzero, status); return packFloat64( zSign, 0x7FF, 0 ); } normalizeFloat64Subnormal( bSig, &bExp, &bSig ); @@ -4019,7 +4088,7 @@ float64 float64_div(float64 a, float64 b, float_status *status) } zSig |= ( rem1 != 0 ); } - return roundAndPackFloat64( zSign, zExp, zSig STATUS_VAR ); + return roundAndPackFloat64(zSign, zExp, zSig, status); } @@ -4037,8 +4106,8 @@ float64 float64_rem(float64 a, float64 b, float_status *status) uint64_t q, alternateASig; int64_t sigMean; - a = float64_squash_input_denormal(a STATUS_VAR); - b = float64_squash_input_denormal(b STATUS_VAR); + a = float64_squash_input_denormal(a, status); + b = float64_squash_input_denormal(b, status); aSig = extractFloat64Frac( a ); aExp = extractFloat64Exp( a ); aSign = extractFloat64Sign( a ); @@ -4046,18 +4115,20 @@ float64 float64_rem(float64 a, float64 b, float_status *status) bExp = extractFloat64Exp( b ); if ( aExp == 0x7FF ) { if ( aSig || ( ( bExp == 0x7FF ) && bSig ) ) { - return propagateFloat64NaN( a, b STATUS_VAR ); + return propagateFloat64NaN(a, b, status); } - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return float64_default_nan; } if ( bExp == 0x7FF ) { - if ( bSig ) return propagateFloat64NaN( a, b STATUS_VAR ); + if (bSig) { + return propagateFloat64NaN(a, b, status); + } return a; } if ( bExp == 0 ) { if ( bSig == 0 ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return float64_default_nan; } normalizeFloat64Subnormal( bSig, &bExp, &bSig ); @@ -4105,7 +4176,7 @@ float64 float64_rem(float64 a, float64 b, float_status *status) } zSign = ( (int64_t) aSig < 0 ); if ( zSign ) aSig = - aSig; - return normalizeRoundAndPackFloat64( aSign ^ zSign, bExp, aSig STATUS_VAR ); + return normalizeRoundAndPackFloat64(aSign ^ zSign, bExp, aSig, status); } @@ -4131,9 +4202,9 @@ float64 float64_muladd(float64 a, float64 b, float64 c, int flags, int shiftcount; flag signflip, infzero; - a = float64_squash_input_denormal(a STATUS_VAR); - b = float64_squash_input_denormal(b STATUS_VAR); - c = float64_squash_input_denormal(c STATUS_VAR); + a = float64_squash_input_denormal(a, status); + b = float64_squash_input_denormal(b, status); + c = float64_squash_input_denormal(c, status); aSig = extractFloat64Frac(a); aExp = extractFloat64Exp(a); aSign = extractFloat64Sign(a); @@ -4155,11 +4226,11 @@ float64 float64_muladd(float64 a, float64 b, float64 c, int flags, if (((aExp == 0x7ff) && aSig) || ((bExp == 0x7ff) && bSig) || ((cExp == 0x7ff) && cSig)) { - return propagateFloat64MulAddNaN(a, b, c, infzero STATUS_VAR); + return propagateFloat64MulAddNaN(a, b, c, infzero, status); } if (infzero) { - float_raise(float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return float64_default_nan; } @@ -4180,7 +4251,7 @@ float64 float64_muladd(float64 a, float64 b, float64 c, int flags, if (cExp == 0x7ff) { if (pInf && (pSign ^ cSign)) { /* addition of opposite-signed infinities => InvalidOperation */ - float_raise(float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return float64_default_nan; } /* Otherwise generate an infinity of the same sign */ @@ -4206,7 +4277,7 @@ float64 float64_muladd(float64 a, float64 b, float64 c, int flags, } /* Exact zero plus a denorm */ if (STATUS(flush_to_zero)) { - float_raise(float_flag_output_denormal STATUS_VAR); + float_raise(float_flag_output_denormal, status); return packFloat64(cSign ^ signflip, 0, 0); } } @@ -4220,7 +4291,7 @@ float64 float64_muladd(float64 a, float64 b, float64 c, int flags, */ cExp -= 2; cSig = (cSig | 0x0010000000000000ULL) << 10; - return roundAndPackFloat64(cSign ^ signflip, cExp, cSig STATUS_VAR); + return roundAndPackFloat64(cSign ^ signflip, cExp, cSig, status); } return packFloat64(cSign ^ signflip, cExp, cSig); } @@ -4261,7 +4332,7 @@ float64 float64_muladd(float64 a, float64 b, float64 c, int flags, pExp--; } return roundAndPackFloat64(zSign, pExp - 1, - pSig1 STATUS_VAR); + pSig1, status); } normalizeFloat64Subnormal(cSig, &cExp, &cSig); } @@ -4299,7 +4370,7 @@ float64 float64_muladd(float64 a, float64 b, float64 c, int flags, if (flags & float_muladd_halve_result) { zExp--; } - return roundAndPackFloat64(zSign, zExp, zSig1 STATUS_VAR); + return roundAndPackFloat64(zSign, zExp, zSig1, status); } else { /* Subtraction */ if (expDiff > 0) { @@ -4352,7 +4423,7 @@ float64 float64_muladd(float64 a, float64 b, float64 c, int flags, if (flags & float_muladd_halve_result) { zExp--; } - return roundAndPackFloat64(zSign, zExp, zSig0 STATUS_VAR); + return roundAndPackFloat64(zSign, zExp, zSig0, status); } } @@ -4368,20 +4439,22 @@ float64 float64_sqrt(float64 a, float_status *status) int_fast16_t aExp, zExp; uint64_t aSig, zSig, doubleZSig; uint64_t rem0, rem1, term0, term1; - a = float64_squash_input_denormal(a STATUS_VAR); + a = float64_squash_input_denormal(a, status); aSig = extractFloat64Frac( a ); aExp = extractFloat64Exp( a ); aSign = extractFloat64Sign( a ); if ( aExp == 0x7FF ) { - if ( aSig ) return propagateFloat64NaN( a, a STATUS_VAR ); + if (aSig) { + return propagateFloat64NaN(a, a, status); + } if ( ! aSign ) return a; - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return float64_default_nan; } if ( aSign ) { if ( ( aExp | aSig ) == 0 ) return a; - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return float64_default_nan; } if ( aExp == 0 ) { @@ -4404,7 +4477,7 @@ float64 float64_sqrt(float64 a, float_status *status) } zSig |= ( ( rem0 | rem1 ) != 0 ); } - return roundAndPackFloat64( 0, zExp, zSig STATUS_VAR ); + return roundAndPackFloat64(0, zExp, zSig, status); } @@ -4418,7 +4491,7 @@ float64 float64_log2(float64 a, float_status *status) flag aSign, zSign; int_fast16_t aExp; uint64_t aSig, aSig0, aSig1, zSig, i; - a = float64_squash_input_denormal(a STATUS_VAR); + a = float64_squash_input_denormal(a, status); aSig = extractFloat64Frac( a ); aExp = extractFloat64Exp( a ); @@ -4429,11 +4502,13 @@ float64 float64_log2(float64 a, float_status *status) normalizeFloat64Subnormal( aSig, &aExp, &aSig ); } if ( aSign ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return float64_default_nan; } if ( aExp == 0x7FF ) { - if ( aSig ) return propagateFloat64NaN( a, float64_zero STATUS_VAR ); + if (aSig) { + return propagateFloat64NaN(a, float64_zero, status); + } return a; } @@ -4452,7 +4527,7 @@ float64 float64_log2(float64 a, float_status *status) if ( zSign ) zSig = -zSig; - return normalizeRoundAndPackFloat64( zSign, 0x408, zSig STATUS_VAR ); + return normalizeRoundAndPackFloat64(zSign, 0x408, zSig, status); } /*---------------------------------------------------------------------------- @@ -4465,13 +4540,13 @@ float64 float64_log2(float64 a, float_status *status) int float64_eq(float64 a, float64 b, float_status *status) { uint64_t av, bv; - a = float64_squash_input_denormal(a STATUS_VAR); - b = float64_squash_input_denormal(b STATUS_VAR); + a = float64_squash_input_denormal(a, status); + b = float64_squash_input_denormal(b, status); if ( ( ( extractFloat64Exp( a ) == 0x7FF ) && extractFloat64Frac( a ) ) || ( ( extractFloat64Exp( b ) == 0x7FF ) && extractFloat64Frac( b ) ) ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return 0; } av = float64_val(a); @@ -4491,13 +4566,13 @@ int float64_le(float64 a, float64 b, float_status *status) { flag aSign, bSign; uint64_t av, bv; - a = float64_squash_input_denormal(a STATUS_VAR); - b = float64_squash_input_denormal(b STATUS_VAR); + a = float64_squash_input_denormal(a, status); + b = float64_squash_input_denormal(b, status); if ( ( ( extractFloat64Exp( a ) == 0x7FF ) && extractFloat64Frac( a ) ) || ( ( extractFloat64Exp( b ) == 0x7FF ) && extractFloat64Frac( b ) ) ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return 0; } aSign = extractFloat64Sign( a ); @@ -4521,12 +4596,12 @@ int float64_lt(float64 a, float64 b, float_status *status) flag aSign, bSign; uint64_t av, bv; - a = float64_squash_input_denormal(a STATUS_VAR); - b = float64_squash_input_denormal(b STATUS_VAR); + a = float64_squash_input_denormal(a, status); + b = float64_squash_input_denormal(b, status); if ( ( ( extractFloat64Exp( a ) == 0x7FF ) && extractFloat64Frac( a ) ) || ( ( extractFloat64Exp( b ) == 0x7FF ) && extractFloat64Frac( b ) ) ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return 0; } aSign = extractFloat64Sign( a ); @@ -4547,13 +4622,13 @@ int float64_lt(float64 a, float64 b, float_status *status) int float64_unordered(float64 a, float64 b, float_status *status) { - a = float64_squash_input_denormal(a STATUS_VAR); - b = float64_squash_input_denormal(b STATUS_VAR); + a = float64_squash_input_denormal(a, status); + b = float64_squash_input_denormal(b, status); if ( ( ( extractFloat64Exp( a ) == 0x7FF ) && extractFloat64Frac( a ) ) || ( ( extractFloat64Exp( b ) == 0x7FF ) && extractFloat64Frac( b ) ) ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return 1; } return 0; @@ -4569,14 +4644,14 @@ int float64_unordered(float64 a, float64 b, float_status *status) int float64_eq_quiet(float64 a, float64 b, float_status *status) { uint64_t av, bv; - a = float64_squash_input_denormal(a STATUS_VAR); - b = float64_squash_input_denormal(b STATUS_VAR); + a = float64_squash_input_denormal(a, status); + b = float64_squash_input_denormal(b, status); if ( ( ( extractFloat64Exp( a ) == 0x7FF ) && extractFloat64Frac( a ) ) || ( ( extractFloat64Exp( b ) == 0x7FF ) && extractFloat64Frac( b ) ) ) { if ( float64_is_signaling_nan( a ) || float64_is_signaling_nan( b ) ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); } return 0; } @@ -4597,14 +4672,14 @@ int float64_le_quiet(float64 a, float64 b, float_status *status) { flag aSign, bSign; uint64_t av, bv; - a = float64_squash_input_denormal(a STATUS_VAR); - b = float64_squash_input_denormal(b STATUS_VAR); + a = float64_squash_input_denormal(a, status); + b = float64_squash_input_denormal(b, status); if ( ( ( extractFloat64Exp( a ) == 0x7FF ) && extractFloat64Frac( a ) ) || ( ( extractFloat64Exp( b ) == 0x7FF ) && extractFloat64Frac( b ) ) ) { if ( float64_is_signaling_nan( a ) || float64_is_signaling_nan( b ) ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); } return 0; } @@ -4628,14 +4703,14 @@ int float64_lt_quiet(float64 a, float64 b, float_status *status) { flag aSign, bSign; uint64_t av, bv; - a = float64_squash_input_denormal(a STATUS_VAR); - b = float64_squash_input_denormal(b STATUS_VAR); + a = float64_squash_input_denormal(a, status); + b = float64_squash_input_denormal(b, status); if ( ( ( extractFloat64Exp( a ) == 0x7FF ) && extractFloat64Frac( a ) ) || ( ( extractFloat64Exp( b ) == 0x7FF ) && extractFloat64Frac( b ) ) ) { if ( float64_is_signaling_nan( a ) || float64_is_signaling_nan( b ) ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); } return 0; } @@ -4657,14 +4732,14 @@ int float64_lt_quiet(float64 a, float64 b, float_status *status) int float64_unordered_quiet(float64 a, float64 b, float_status *status) { - a = float64_squash_input_denormal(a STATUS_VAR); - b = float64_squash_input_denormal(b STATUS_VAR); + a = float64_squash_input_denormal(a, status); + b = float64_squash_input_denormal(b, status); if ( ( ( extractFloat64Exp( a ) == 0x7FF ) && extractFloat64Frac( a ) ) || ( ( extractFloat64Exp( b ) == 0x7FF ) && extractFloat64Frac( b ) ) ) { if ( float64_is_signaling_nan( a ) || float64_is_signaling_nan( b ) ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); } return 1; } @@ -4694,7 +4769,7 @@ int32 floatx80_to_int32(floatx80 a, float_status *status) shiftCount = 0x4037 - aExp; if ( shiftCount <= 0 ) shiftCount = 1; shift64RightJamming( aSig, shiftCount, &aSig ); - return roundAndPackInt32( aSign, aSig STATUS_VAR ); + return roundAndPackInt32(aSign, aSig, status); } @@ -4733,7 +4808,7 @@ int32 floatx80_to_int32_round_to_zero(floatx80 a, float_status *status) if ( aSign ) z = - z; if ( ( z < 0 ) ^ aSign ) { invalid: - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return aSign ? (int32_t) 0x80000000 : 0x7FFFFFFF; } if ( ( aSig<<shiftCount ) != savedASig ) { @@ -4765,7 +4840,7 @@ int64 floatx80_to_int64(floatx80 a, float_status *status) shiftCount = 0x403E - aExp; if ( shiftCount <= 0 ) { if ( shiftCount ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); if ( ! aSign || ( ( aExp == 0x7FFF ) && ( aSig != LIT64( 0x8000000000000000 ) ) ) @@ -4779,7 +4854,7 @@ int64 floatx80_to_int64(floatx80 a, float_status *status) else { shift64ExtraRightJamming( aSig, 0, shiftCount, &aSig, &aSigExtra ); } - return roundAndPackInt64( aSign, aSig, aSigExtra STATUS_VAR ); + return roundAndPackInt64(aSign, aSig, aSigExtra, status); } @@ -4807,7 +4882,7 @@ int64 floatx80_to_int64_round_to_zero(floatx80 a, float_status *status) if ( 0 <= shiftCount ) { aSig &= LIT64( 0x7FFFFFFFFFFFFFFF ); if ( ( a.high != 0xC03E ) || aSig ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); if ( ! aSign || ( ( aExp == 0x7FFF ) && aSig ) ) { return LIT64( 0x7FFFFFFFFFFFFFFF ); } @@ -4845,13 +4920,13 @@ float32 floatx80_to_float32(floatx80 a, float_status *status) aSign = extractFloatx80Sign( a ); if ( aExp == 0x7FFF ) { if ( (uint64_t) ( aSig<<1 ) ) { - return commonNaNToFloat32( floatx80ToCommonNaN( a STATUS_VAR ) STATUS_VAR ); + return commonNaNToFloat32(floatx80ToCommonNaN(a, status), status); } return packFloat32( aSign, 0xFF, 0 ); } shift64RightJamming( aSig, 33, &aSig ); if ( aExp || aSig ) aExp -= 0x3F81; - return roundAndPackFloat32( aSign, aExp, aSig STATUS_VAR ); + return roundAndPackFloat32(aSign, aExp, aSig, status); } @@ -4873,13 +4948,13 @@ float64 floatx80_to_float64(floatx80 a, float_status *status) aSign = extractFloatx80Sign( a ); if ( aExp == 0x7FFF ) { if ( (uint64_t) ( aSig<<1 ) ) { - return commonNaNToFloat64( floatx80ToCommonNaN( a STATUS_VAR ) STATUS_VAR ); + return commonNaNToFloat64(floatx80ToCommonNaN(a, status), status); } return packFloat64( aSign, 0x7FF, 0 ); } shift64RightJamming( aSig, 1, &zSig ); if ( aExp || aSig ) aExp -= 0x3C01; - return roundAndPackFloat64( aSign, aExp, zSig STATUS_VAR ); + return roundAndPackFloat64(aSign, aExp, zSig, status); } @@ -4900,7 +4975,7 @@ float128 floatx80_to_float128(floatx80 a, float_status *status) aExp = extractFloatx80Exp( a ); aSign = extractFloatx80Sign( a ); if ( ( aExp == 0x7FFF ) && (uint64_t) ( aSig<<1 ) ) { - return commonNaNToFloat128( floatx80ToCommonNaN( a STATUS_VAR ) STATUS_VAR ); + return commonNaNToFloat128(floatx80ToCommonNaN(a, status), status); } shift128Right( aSig<<1, 0, 16, &zSig0, &zSig1 ); return packFloat128( aSign, aExp, zSig0, zSig1 ); @@ -4924,7 +4999,7 @@ floatx80 floatx80_round_to_int(floatx80 a, float_status *status) aExp = extractFloatx80Exp( a ); if ( 0x403E <= aExp ) { if ( ( aExp == 0x7FFF ) && (uint64_t) ( extractFloatx80Frac( a )<<1 ) ) { - return propagateFloatx80NaN( a, a STATUS_VAR ); + return propagateFloatx80NaN(a, a, status); } return a; } @@ -5021,7 +5096,9 @@ static floatx80 addFloatx80Sigs(floatx80 a, floatx80 b, flag zSign, expDiff = aExp - bExp; if ( 0 < expDiff ) { if ( aExp == 0x7FFF ) { - if ( (uint64_t) ( aSig<<1 ) ) return propagateFloatx80NaN( a, b STATUS_VAR ); + if ((uint64_t)(aSig << 1)) { + return propagateFloatx80NaN(a, b, status); + } return a; } if ( bExp == 0 ) --expDiff; @@ -5030,7 +5107,9 @@ static floatx80 addFloatx80Sigs(floatx80 a, floatx80 b, flag zSign, } else if ( expDiff < 0 ) { if ( bExp == 0x7FFF ) { - if ( (uint64_t) ( bSig<<1 ) ) return propagateFloatx80NaN( a, b STATUS_VAR ); + if ((uint64_t)(bSig << 1)) { + return propagateFloatx80NaN(a, b, status); + } return packFloatx80( zSign, 0x7FFF, LIT64( 0x8000000000000000 ) ); } if ( aExp == 0 ) ++expDiff; @@ -5040,7 +5119,7 @@ static floatx80 addFloatx80Sigs(floatx80 a, floatx80 b, flag zSign, else { if ( aExp == 0x7FFF ) { if ( (uint64_t) ( ( aSig | bSig )<<1 ) ) { - return propagateFloatx80NaN( a, b STATUS_VAR ); + return propagateFloatx80NaN(a, b, status); } return a; } @@ -5060,10 +5139,8 @@ static floatx80 addFloatx80Sigs(floatx80 a, floatx80 b, flag zSign, zSig0 |= LIT64( 0x8000000000000000 ); ++zExp; roundAndPack: - return - roundAndPackFloatx80( - STATUS(floatx80_rounding_precision), zSign, zExp, zSig0, zSig1 STATUS_VAR ); - + return roundAndPackFloatx80(STATUS(floatx80_rounding_precision), + zSign, zExp, zSig0, zSig1, status); } /*---------------------------------------------------------------------------- @@ -5091,9 +5168,9 @@ static floatx80 subFloatx80Sigs(floatx80 a, floatx80 b, flag zSign, if ( expDiff < 0 ) goto bExpBigger; if ( aExp == 0x7FFF ) { if ( (uint64_t) ( ( aSig | bSig )<<1 ) ) { - return propagateFloatx80NaN( a, b STATUS_VAR ); + return propagateFloatx80NaN(a, b, status); } - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); z.low = floatx80_default_nan_low; z.high = floatx80_default_nan_high; return z; @@ -5108,7 +5185,9 @@ static floatx80 subFloatx80Sigs(floatx80 a, floatx80 b, flag zSign, return packFloatx80( STATUS(float_rounding_mode) == float_round_down, 0, 0 ); bExpBigger: if ( bExp == 0x7FFF ) { - if ( (uint64_t) ( bSig<<1 ) ) return propagateFloatx80NaN( a, b STATUS_VAR ); + if ((uint64_t)(bSig << 1)) { + return propagateFloatx80NaN(a, b, status); + } return packFloatx80( zSign ^ 1, 0x7FFF, LIT64( 0x8000000000000000 ) ); } if ( aExp == 0 ) ++expDiff; @@ -5120,7 +5199,9 @@ static floatx80 subFloatx80Sigs(floatx80 a, floatx80 b, flag zSign, goto normalizeRoundAndPack; aExpBigger: if ( aExp == 0x7FFF ) { - if ( (uint64_t) ( aSig<<1 ) ) return propagateFloatx80NaN( a, b STATUS_VAR ); + if ((uint64_t)(aSig << 1)) { + return propagateFloatx80NaN(a, b, status); + } return a; } if ( bExp == 0 ) --expDiff; @@ -5129,10 +5210,8 @@ static floatx80 subFloatx80Sigs(floatx80 a, floatx80 b, flag zSign, sub128( aSig, 0, bSig, zSig1, &zSig0, &zSig1 ); zExp = aExp; normalizeRoundAndPack: - return - normalizeRoundAndPackFloatx80( - STATUS(floatx80_rounding_precision), zSign, zExp, zSig0, zSig1 STATUS_VAR ); - + return normalizeRoundAndPackFloatx80(STATUS(floatx80_rounding_precision), + zSign, zExp, zSig0, zSig1, status); } /*---------------------------------------------------------------------------- @@ -5148,10 +5227,10 @@ floatx80 floatx80_add(floatx80 a, floatx80 b, float_status *status) aSign = extractFloatx80Sign( a ); bSign = extractFloatx80Sign( b ); if ( aSign == bSign ) { - return addFloatx80Sigs( a, b, aSign STATUS_VAR ); + return addFloatx80Sigs(a, b, aSign, status); } else { - return subFloatx80Sigs( a, b, aSign STATUS_VAR ); + return subFloatx80Sigs(a, b, aSign, status); } } @@ -5169,10 +5248,10 @@ floatx80 floatx80_sub(floatx80 a, floatx80 b, float_status *status) aSign = extractFloatx80Sign( a ); bSign = extractFloatx80Sign( b ); if ( aSign == bSign ) { - return subFloatx80Sigs( a, b, aSign STATUS_VAR ); + return subFloatx80Sigs(a, b, aSign, status); } else { - return addFloatx80Sigs( a, b, aSign STATUS_VAR ); + return addFloatx80Sigs(a, b, aSign, status); } } @@ -5200,16 +5279,18 @@ floatx80 floatx80_mul(floatx80 a, floatx80 b, float_status *status) if ( aExp == 0x7FFF ) { if ( (uint64_t) ( aSig<<1 ) || ( ( bExp == 0x7FFF ) && (uint64_t) ( bSig<<1 ) ) ) { - return propagateFloatx80NaN( a, b STATUS_VAR ); + return propagateFloatx80NaN(a, b, status); } if ( ( bExp | bSig ) == 0 ) goto invalid; return packFloatx80( zSign, 0x7FFF, LIT64( 0x8000000000000000 ) ); } if ( bExp == 0x7FFF ) { - if ( (uint64_t) ( bSig<<1 ) ) return propagateFloatx80NaN( a, b STATUS_VAR ); + if ((uint64_t)(bSig << 1)) { + return propagateFloatx80NaN(a, b, status); + } if ( ( aExp | aSig ) == 0 ) { invalid: - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); z.low = floatx80_default_nan_low; z.high = floatx80_default_nan_high; return z; @@ -5230,10 +5311,8 @@ floatx80 floatx80_mul(floatx80 a, floatx80 b, float_status *status) shortShift128Left( zSig0, zSig1, 1, &zSig0, &zSig1 ); --zExp; } - return - roundAndPackFloatx80( - STATUS(floatx80_rounding_precision), zSign, zExp, zSig0, zSig1 STATUS_VAR ); - + return roundAndPackFloatx80(STATUS(floatx80_rounding_precision), + zSign, zExp, zSig0, zSig1, status); } /*---------------------------------------------------------------------------- @@ -5258,27 +5337,33 @@ floatx80 floatx80_div(floatx80 a, floatx80 b, float_status *status) bSign = extractFloatx80Sign( b ); zSign = aSign ^ bSign; if ( aExp == 0x7FFF ) { - if ( (uint64_t) ( aSig<<1 ) ) return propagateFloatx80NaN( a, b STATUS_VAR ); + if ((uint64_t)(aSig << 1)) { + return propagateFloatx80NaN(a, b, status); + } if ( bExp == 0x7FFF ) { - if ( (uint64_t) ( bSig<<1 ) ) return propagateFloatx80NaN( a, b STATUS_VAR ); + if ((uint64_t)(bSig << 1)) { + return propagateFloatx80NaN(a, b, status); + } goto invalid; } return packFloatx80( zSign, 0x7FFF, LIT64( 0x8000000000000000 ) ); } if ( bExp == 0x7FFF ) { - if ( (uint64_t) ( bSig<<1 ) ) return propagateFloatx80NaN( a, b STATUS_VAR ); + if ((uint64_t)(bSig << 1)) { + return propagateFloatx80NaN(a, b, status); + } return packFloatx80( zSign, 0, 0 ); } if ( bExp == 0 ) { if ( bSig == 0 ) { if ( ( aExp | aSig ) == 0 ) { invalid: - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); z.low = floatx80_default_nan_low; z.high = floatx80_default_nan_high; return z; } - float_raise( float_flag_divbyzero STATUS_VAR); + float_raise(float_flag_divbyzero, status); return packFloatx80( zSign, 0x7FFF, LIT64( 0x8000000000000000 ) ); } normalizeFloatx80Subnormal( bSig, &bExp, &bSig ); @@ -5310,10 +5395,8 @@ floatx80 floatx80_div(floatx80 a, floatx80 b, float_status *status) } zSig1 |= ( ( rem1 | rem2 ) != 0 ); } - return - roundAndPackFloatx80( - STATUS(floatx80_rounding_precision), zSign, zExp, zSig0, zSig1 STATUS_VAR ); - + return roundAndPackFloatx80(STATUS(floatx80_rounding_precision), + zSign, zExp, zSig0, zSig1, status); } /*---------------------------------------------------------------------------- @@ -5338,18 +5421,20 @@ floatx80 floatx80_rem(floatx80 a, floatx80 b, float_status *status) if ( aExp == 0x7FFF ) { if ( (uint64_t) ( aSig0<<1 ) || ( ( bExp == 0x7FFF ) && (uint64_t) ( bSig<<1 ) ) ) { - return propagateFloatx80NaN( a, b STATUS_VAR ); + return propagateFloatx80NaN(a, b, status); } goto invalid; } if ( bExp == 0x7FFF ) { - if ( (uint64_t) ( bSig<<1 ) ) return propagateFloatx80NaN( a, b STATUS_VAR ); + if ((uint64_t)(bSig << 1)) { + return propagateFloatx80NaN(a, b, status); + } return a; } if ( bExp == 0 ) { if ( bSig == 0 ) { invalid: - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); z.low = floatx80_default_nan_low; z.high = floatx80_default_nan_high; return z; @@ -5408,7 +5493,7 @@ floatx80 floatx80_rem(floatx80 a, floatx80 b, float_status *status) } return normalizeRoundAndPackFloatx80( - 80, zSign, bExp + expDiff, aSig0, aSig1 STATUS_VAR ); + 80, zSign, bExp + expDiff, aSig0, aSig1, status); } @@ -5430,14 +5515,16 @@ floatx80 floatx80_sqrt(floatx80 a, float_status *status) aExp = extractFloatx80Exp( a ); aSign = extractFloatx80Sign( a ); if ( aExp == 0x7FFF ) { - if ( (uint64_t) ( aSig0<<1 ) ) return propagateFloatx80NaN( a, a STATUS_VAR ); + if ((uint64_t)(aSig0 << 1)) { + return propagateFloatx80NaN(a, a, status); + } if ( ! aSign ) return a; goto invalid; } if ( aSign ) { if ( ( aExp | aSig0 ) == 0 ) return a; invalid: - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); z.low = floatx80_default_nan_low; z.high = floatx80_default_nan_high; return z; @@ -5478,7 +5565,7 @@ floatx80 floatx80_sqrt(floatx80 a, float_status *status) zSig0 |= doubleZSig0; return roundAndPackFloatx80( - STATUS(floatx80_rounding_precision), 0, zExp, zSig0, zSig1 STATUS_VAR ); + STATUS(floatx80_rounding_precision), 0, zExp, zSig0, zSig1, status); } @@ -5497,7 +5584,7 @@ int floatx80_eq(floatx80 a, floatx80 b, float_status *status) || ( ( extractFloatx80Exp( b ) == 0x7FFF ) && (uint64_t) ( extractFloatx80Frac( b )<<1 ) ) ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return 0; } return @@ -5526,7 +5613,7 @@ int floatx80_le(floatx80 a, floatx80 b, float_status *status) || ( ( extractFloatx80Exp( b ) == 0x7FFF ) && (uint64_t) ( extractFloatx80Frac( b )<<1 ) ) ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return 0; } aSign = extractFloatx80Sign( a ); @@ -5559,7 +5646,7 @@ int floatx80_lt(floatx80 a, floatx80 b, float_status *status) || ( ( extractFloatx80Exp( b ) == 0x7FFF ) && (uint64_t) ( extractFloatx80Frac( b )<<1 ) ) ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return 0; } aSign = extractFloatx80Sign( a ); @@ -5589,7 +5676,7 @@ int floatx80_unordered(floatx80 a, floatx80 b, float_status *status) || ( ( extractFloatx80Exp( b ) == 0x7FFF ) && (uint64_t) ( extractFloatx80Frac( b )<<1 ) ) ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return 1; } return 0; @@ -5612,7 +5699,7 @@ int floatx80_eq_quiet(floatx80 a, floatx80 b, float_status *status) ) { if ( floatx80_is_signaling_nan( a ) || floatx80_is_signaling_nan( b ) ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); } return 0; } @@ -5643,7 +5730,7 @@ int floatx80_le_quiet(floatx80 a, floatx80 b, float_status *status) ) { if ( floatx80_is_signaling_nan( a ) || floatx80_is_signaling_nan( b ) ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); } return 0; } @@ -5679,7 +5766,7 @@ int floatx80_lt_quiet(floatx80 a, floatx80 b, float_status *status) ) { if ( floatx80_is_signaling_nan( a ) || floatx80_is_signaling_nan( b ) ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); } return 0; } @@ -5712,7 +5799,7 @@ int floatx80_unordered_quiet(floatx80 a, floatx80 b, float_status *status) ) { if ( floatx80_is_signaling_nan( a ) || floatx80_is_signaling_nan( b ) ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); } return 1; } @@ -5744,7 +5831,7 @@ int32 float128_to_int32(float128 a, float_status *status) aSig0 |= ( aSig1 != 0 ); shiftCount = 0x4028 - aExp; if ( 0 < shiftCount ) shift64RightJamming( aSig0, shiftCount, &aSig0 ); - return roundAndPackInt32( aSign, aSig0 STATUS_VAR ); + return roundAndPackInt32(aSign, aSig0, status); } @@ -5786,7 +5873,7 @@ int32 float128_to_int32_round_to_zero(float128 a, float_status *status) if ( aSign ) z = - z; if ( ( z < 0 ) ^ aSign ) { invalid: - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return aSign ? (int32_t) 0x80000000 : 0x7FFFFFFF; } if ( ( aSig0<<shiftCount ) != savedASig ) { @@ -5820,7 +5907,7 @@ int64 float128_to_int64(float128 a, float_status *status) shiftCount = 0x402F - aExp; if ( shiftCount <= 0 ) { if ( 0x403E < aExp ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); if ( ! aSign || ( ( aExp == 0x7FFF ) && ( aSig1 || ( aSig0 != LIT64( 0x0001000000000000 ) ) ) @@ -5835,7 +5922,7 @@ int64 float128_to_int64(float128 a, float_status *status) else { shift64ExtraRightJamming( aSig0, aSig1, shiftCount, &aSig0, &aSig1 ); } - return roundAndPackInt64( aSign, aSig0, aSig1 STATUS_VAR ); + return roundAndPackInt64(aSign, aSig0, aSig1, status); } @@ -5870,7 +5957,7 @@ int64 float128_to_int64_round_to_zero(float128 a, float_status *status) if ( aSig1 ) STATUS(float_exception_flags) |= float_flag_inexact; } else { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); if ( ! aSign || ( ( aExp == 0x7FFF ) && ( aSig0 | aSig1 ) ) ) { return LIT64( 0x7FFFFFFFFFFFFFFF ); } @@ -5920,7 +6007,7 @@ float32 float128_to_float32(float128 a, float_status *status) aSign = extractFloat128Sign( a ); if ( aExp == 0x7FFF ) { if ( aSig0 | aSig1 ) { - return commonNaNToFloat32( float128ToCommonNaN( a STATUS_VAR ) STATUS_VAR ); + return commonNaNToFloat32(float128ToCommonNaN(a, status), status); } return packFloat32( aSign, 0xFF, 0 ); } @@ -5931,7 +6018,7 @@ float32 float128_to_float32(float128 a, float_status *status) zSig |= 0x40000000; aExp -= 0x3F81; } - return roundAndPackFloat32( aSign, aExp, zSig STATUS_VAR ); + return roundAndPackFloat32(aSign, aExp, zSig, status); } @@ -5954,7 +6041,7 @@ float64 float128_to_float64(float128 a, float_status *status) aSign = extractFloat128Sign( a ); if ( aExp == 0x7FFF ) { if ( aSig0 | aSig1 ) { - return commonNaNToFloat64( float128ToCommonNaN( a STATUS_VAR ) STATUS_VAR ); + return commonNaNToFloat64(float128ToCommonNaN(a, status), status); } return packFloat64( aSign, 0x7FF, 0 ); } @@ -5964,7 +6051,7 @@ float64 float128_to_float64(float128 a, float_status *status) aSig0 |= LIT64( 0x4000000000000000 ); aExp -= 0x3C01; } - return roundAndPackFloat64( aSign, aExp, aSig0 STATUS_VAR ); + return roundAndPackFloat64(aSign, aExp, aSig0, status); } @@ -5987,7 +6074,7 @@ floatx80 float128_to_floatx80(float128 a, float_status *status) aSign = extractFloat128Sign( a ); if ( aExp == 0x7FFF ) { if ( aSig0 | aSig1 ) { - return commonNaNToFloatx80( float128ToCommonNaN( a STATUS_VAR ) STATUS_VAR ); + return commonNaNToFloatx80(float128ToCommonNaN(a, status), status); } return packFloatx80( aSign, 0x7FFF, LIT64( 0x8000000000000000 ) ); } @@ -5999,7 +6086,7 @@ floatx80 float128_to_floatx80(float128 a, float_status *status) aSig0 |= LIT64( 0x0001000000000000 ); } shortShift128Left( aSig0, aSig1, 15, &aSig0, &aSig1 ); - return roundAndPackFloatx80( 80, aSign, aExp, aSig0, aSig1 STATUS_VAR ); + return roundAndPackFloatx80(80, aSign, aExp, aSig0, aSig1, status); } @@ -6023,7 +6110,7 @@ float128 float128_round_to_int(float128 a, float_status *status) if ( ( aExp == 0x7FFF ) && ( extractFloat128Frac0( a ) | extractFloat128Frac1( a ) ) ) { - return propagateFloat128NaN( a, a STATUS_VAR ); + return propagateFloat128NaN(a, a, status); } return a; } @@ -6165,7 +6252,9 @@ static float128 addFloat128Sigs(float128 a, float128 b, flag zSign, expDiff = aExp - bExp; if ( 0 < expDiff ) { if ( aExp == 0x7FFF ) { - if ( aSig0 | aSig1 ) return propagateFloat128NaN( a, b STATUS_VAR ); + if (aSig0 | aSig1) { + return propagateFloat128NaN(a, b, status); + } return a; } if ( bExp == 0 ) { @@ -6180,7 +6269,9 @@ static float128 addFloat128Sigs(float128 a, float128 b, flag zSign, } else if ( expDiff < 0 ) { if ( bExp == 0x7FFF ) { - if ( bSig0 | bSig1 ) return propagateFloat128NaN( a, b STATUS_VAR ); + if (bSig0 | bSig1) { + return propagateFloat128NaN(a, b, status); + } return packFloat128( zSign, 0x7FFF, 0, 0 ); } if ( aExp == 0 ) { @@ -6196,7 +6287,7 @@ static float128 addFloat128Sigs(float128 a, float128 b, flag zSign, else { if ( aExp == 0x7FFF ) { if ( aSig0 | aSig1 | bSig0 | bSig1 ) { - return propagateFloat128NaN( a, b STATUS_VAR ); + return propagateFloat128NaN(a, b, status); } return a; } @@ -6204,7 +6295,7 @@ static float128 addFloat128Sigs(float128 a, float128 b, flag zSign, if ( aExp == 0 ) { if (STATUS(flush_to_zero)) { if (zSig0 | zSig1) { - float_raise(float_flag_output_denormal STATUS_VAR); + float_raise(float_flag_output_denormal, status); } return packFloat128(zSign, 0, 0, 0); } @@ -6224,7 +6315,7 @@ static float128 addFloat128Sigs(float128 a, float128 b, flag zSign, shift128ExtraRightJamming( zSig0, zSig1, zSig2, 1, &zSig0, &zSig1, &zSig2 ); roundAndPack: - return roundAndPackFloat128( zSign, zExp, zSig0, zSig1, zSig2 STATUS_VAR ); + return roundAndPackFloat128(zSign, zExp, zSig0, zSig1, zSig2, status); } @@ -6257,9 +6348,9 @@ static float128 subFloat128Sigs(float128 a, float128 b, flag zSign, if ( expDiff < 0 ) goto bExpBigger; if ( aExp == 0x7FFF ) { if ( aSig0 | aSig1 | bSig0 | bSig1 ) { - return propagateFloat128NaN( a, b STATUS_VAR ); + return propagateFloat128NaN(a, b, status); } - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); z.low = float128_default_nan_low; z.high = float128_default_nan_high; return z; @@ -6275,7 +6366,9 @@ static float128 subFloat128Sigs(float128 a, float128 b, flag zSign, return packFloat128( STATUS(float_rounding_mode) == float_round_down, 0, 0, 0 ); bExpBigger: if ( bExp == 0x7FFF ) { - if ( bSig0 | bSig1 ) return propagateFloat128NaN( a, b STATUS_VAR ); + if (bSig0 | bSig1) { + return propagateFloat128NaN(a, b, status); + } return packFloat128( zSign ^ 1, 0x7FFF, 0, 0 ); } if ( aExp == 0 ) { @@ -6293,7 +6386,9 @@ static float128 subFloat128Sigs(float128 a, float128 b, flag zSign, goto normalizeRoundAndPack; aExpBigger: if ( aExp == 0x7FFF ) { - if ( aSig0 | aSig1 ) return propagateFloat128NaN( a, b STATUS_VAR ); + if (aSig0 | aSig1) { + return propagateFloat128NaN(a, b, status); + } return a; } if ( bExp == 0 ) { @@ -6309,7 +6404,8 @@ static float128 subFloat128Sigs(float128 a, float128 b, flag zSign, zExp = aExp; normalizeRoundAndPack: --zExp; - return normalizeRoundAndPackFloat128( zSign, zExp - 14, zSig0, zSig1 STATUS_VAR ); + return normalizeRoundAndPackFloat128(zSign, zExp - 14, zSig0, zSig1, + status); } @@ -6326,10 +6422,10 @@ float128 float128_add(float128 a, float128 b, float_status *status) aSign = extractFloat128Sign( a ); bSign = extractFloat128Sign( b ); if ( aSign == bSign ) { - return addFloat128Sigs( a, b, aSign STATUS_VAR ); + return addFloat128Sigs(a, b, aSign, status); } else { - return subFloat128Sigs( a, b, aSign STATUS_VAR ); + return subFloat128Sigs(a, b, aSign, status); } } @@ -6347,10 +6443,10 @@ float128 float128_sub(float128 a, float128 b, float_status *status) aSign = extractFloat128Sign( a ); bSign = extractFloat128Sign( b ); if ( aSign == bSign ) { - return subFloat128Sigs( a, b, aSign STATUS_VAR ); + return subFloat128Sigs(a, b, aSign, status); } else { - return addFloat128Sigs( a, b, aSign STATUS_VAR ); + return addFloat128Sigs(a, b, aSign, status); } } @@ -6380,16 +6476,18 @@ float128 float128_mul(float128 a, float128 b, float_status *status) if ( aExp == 0x7FFF ) { if ( ( aSig0 | aSig1 ) || ( ( bExp == 0x7FFF ) && ( bSig0 | bSig1 ) ) ) { - return propagateFloat128NaN( a, b STATUS_VAR ); + return propagateFloat128NaN(a, b, status); } if ( ( bExp | bSig0 | bSig1 ) == 0 ) goto invalid; return packFloat128( zSign, 0x7FFF, 0, 0 ); } if ( bExp == 0x7FFF ) { - if ( bSig0 | bSig1 ) return propagateFloat128NaN( a, b STATUS_VAR ); + if (bSig0 | bSig1) { + return propagateFloat128NaN(a, b, status); + } if ( ( aExp | aSig0 | aSig1 ) == 0 ) { invalid: - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); z.low = float128_default_nan_low; z.high = float128_default_nan_high; return z; @@ -6415,7 +6513,7 @@ float128 float128_mul(float128 a, float128 b, float_status *status) zSig0, zSig1, zSig2, 1, &zSig0, &zSig1, &zSig2 ); ++zExp; } - return roundAndPackFloat128( zSign, zExp, zSig0, zSig1, zSig2 STATUS_VAR ); + return roundAndPackFloat128(zSign, zExp, zSig0, zSig1, zSig2, status); } @@ -6443,27 +6541,33 @@ float128 float128_div(float128 a, float128 b, float_status *status) bSign = extractFloat128Sign( b ); zSign = aSign ^ bSign; if ( aExp == 0x7FFF ) { - if ( aSig0 | aSig1 ) return propagateFloat128NaN( a, b STATUS_VAR ); + if (aSig0 | aSig1) { + return propagateFloat128NaN(a, b, status); + } if ( bExp == 0x7FFF ) { - if ( bSig0 | bSig1 ) return propagateFloat128NaN( a, b STATUS_VAR ); + if (bSig0 | bSig1) { + return propagateFloat128NaN(a, b, status); + } goto invalid; } return packFloat128( zSign, 0x7FFF, 0, 0 ); } if ( bExp == 0x7FFF ) { - if ( bSig0 | bSig1 ) return propagateFloat128NaN( a, b STATUS_VAR ); + if (bSig0 | bSig1) { + return propagateFloat128NaN(a, b, status); + } return packFloat128( zSign, 0, 0, 0 ); } if ( bExp == 0 ) { if ( ( bSig0 | bSig1 ) == 0 ) { if ( ( aExp | aSig0 | aSig1 ) == 0 ) { invalid: - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); z.low = float128_default_nan_low; z.high = float128_default_nan_high; return z; } - float_raise( float_flag_divbyzero STATUS_VAR); + float_raise(float_flag_divbyzero, status); return packFloat128( zSign, 0x7FFF, 0, 0 ); } normalizeFloat128Subnormal( bSig0, bSig1, &bExp, &bSig0, &bSig1 ); @@ -6499,7 +6603,7 @@ float128 float128_div(float128 a, float128 b, float_status *status) zSig1 |= ( ( rem1 | rem2 | rem3 ) != 0 ); } shift128ExtraRightJamming( zSig0, zSig1, 0, 15, &zSig0, &zSig1, &zSig2 ); - return roundAndPackFloat128( zSign, zExp, zSig0, zSig1, zSig2 STATUS_VAR ); + return roundAndPackFloat128(zSign, zExp, zSig0, zSig1, zSig2, status); } @@ -6528,18 +6632,20 @@ float128 float128_rem(float128 a, float128 b, float_status *status) if ( aExp == 0x7FFF ) { if ( ( aSig0 | aSig1 ) || ( ( bExp == 0x7FFF ) && ( bSig0 | bSig1 ) ) ) { - return propagateFloat128NaN( a, b STATUS_VAR ); + return propagateFloat128NaN(a, b, status); } goto invalid; } if ( bExp == 0x7FFF ) { - if ( bSig0 | bSig1 ) return propagateFloat128NaN( a, b STATUS_VAR ); + if (bSig0 | bSig1) { + return propagateFloat128NaN(a, b, status); + } return a; } if ( bExp == 0 ) { if ( ( bSig0 | bSig1 ) == 0 ) { invalid: - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); z.low = float128_default_nan_low; z.high = float128_default_nan_high; return z; @@ -6607,9 +6713,8 @@ float128 float128_rem(float128 a, float128 b, float_status *status) } zSign = ( (int64_t) aSig0 < 0 ); if ( zSign ) sub128( 0, 0, aSig0, aSig1, &aSig0, &aSig1 ); - return - normalizeRoundAndPackFloat128( aSign ^ zSign, bExp - 4, aSig0, aSig1 STATUS_VAR ); - + return normalizeRoundAndPackFloat128(aSign ^ zSign, bExp - 4, aSig0, aSig1, + status); } /*---------------------------------------------------------------------------- @@ -6631,14 +6736,16 @@ float128 float128_sqrt(float128 a, float_status *status) aExp = extractFloat128Exp( a ); aSign = extractFloat128Sign( a ); if ( aExp == 0x7FFF ) { - if ( aSig0 | aSig1 ) return propagateFloat128NaN( a, a STATUS_VAR ); + if (aSig0 | aSig1) { + return propagateFloat128NaN(a, a, status); + } if ( ! aSign ) return a; goto invalid; } if ( aSign ) { if ( ( aExp | aSig0 | aSig1 ) == 0 ) return a; invalid: - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); z.low = float128_default_nan_low; z.high = float128_default_nan_high; return z; @@ -6677,7 +6784,7 @@ float128 float128_sqrt(float128 a, float_status *status) zSig1 |= ( ( rem1 | rem2 | rem3 ) != 0 ); } shift128ExtraRightJamming( zSig0, zSig1, 0, 14, &zSig0, &zSig1, &zSig2 ); - return roundAndPackFloat128( 0, zExp, zSig0, zSig1, zSig2 STATUS_VAR ); + return roundAndPackFloat128(0, zExp, zSig0, zSig1, zSig2, status); } @@ -6696,7 +6803,7 @@ int float128_eq(float128 a, float128 b, float_status *status) || ( ( extractFloat128Exp( b ) == 0x7FFF ) && ( extractFloat128Frac0( b ) | extractFloat128Frac1( b ) ) ) ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return 0; } return @@ -6724,7 +6831,7 @@ int float128_le(float128 a, float128 b, float_status *status) || ( ( extractFloat128Exp( b ) == 0x7FFF ) && ( extractFloat128Frac0( b ) | extractFloat128Frac1( b ) ) ) ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return 0; } aSign = extractFloat128Sign( a ); @@ -6757,7 +6864,7 @@ int float128_lt(float128 a, float128 b, float_status *status) || ( ( extractFloat128Exp( b ) == 0x7FFF ) && ( extractFloat128Frac0( b ) | extractFloat128Frac1( b ) ) ) ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return 0; } aSign = extractFloat128Sign( a ); @@ -6788,7 +6895,7 @@ int float128_unordered(float128 a, float128 b, float_status *status) || ( ( extractFloat128Exp( b ) == 0x7FFF ) && ( extractFloat128Frac0( b ) | extractFloat128Frac1( b ) ) ) ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return 1; } return 0; @@ -6811,7 +6918,7 @@ int float128_eq_quiet(float128 a, float128 b, float_status *status) ) { if ( float128_is_signaling_nan( a ) || float128_is_signaling_nan( b ) ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); } return 0; } @@ -6842,7 +6949,7 @@ int float128_le_quiet(float128 a, float128 b, float_status *status) ) { if ( float128_is_signaling_nan( a ) || float128_is_signaling_nan( b ) ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); } return 0; } @@ -6878,7 +6985,7 @@ int float128_lt_quiet(float128 a, float128 b, float_status *status) ) { if ( float128_is_signaling_nan( a ) || float128_is_signaling_nan( b ) ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); } return 0; } @@ -6912,7 +7019,7 @@ int float128_unordered_quiet(float128 a, float128 b, float_status *status) ) { if ( float128_is_signaling_nan( a ) || float128_is_signaling_nan( b ) ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); } return 1; } @@ -6922,12 +7029,12 @@ int float128_unordered_quiet(float128 a, float128 b, float_status *status) /* misc functions */ float32 uint32_to_float32(uint32_t a, float_status *status) { - return int64_to_float32(a STATUS_VAR); + return int64_to_float32(a, status); } float64 uint32_to_float64(uint32_t a, float_status *status) { - return int64_to_float64(a STATUS_VAR); + return int64_to_float64(a, status); } uint32 float32_to_uint32(float32 a, float_status *status) @@ -6936,7 +7043,7 @@ uint32 float32_to_uint32(float32 a, float_status *status) uint32 res; int old_exc_flags = get_float_exception_flags(status); - v = float32_to_int64(a STATUS_VAR); + v = float32_to_int64(a, status); if (v < 0) { res = 0; } else if (v > 0xffffffff) { @@ -6945,7 +7052,7 @@ uint32 float32_to_uint32(float32 a, float_status *status) return v; } set_float_exception_flags(old_exc_flags, status); - float_raise(float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return res; } @@ -6955,7 +7062,7 @@ uint32 float32_to_uint32_round_to_zero(float32 a, float_status *status) uint32 res; int old_exc_flags = get_float_exception_flags(status); - v = float32_to_int64_round_to_zero(a STATUS_VAR); + v = float32_to_int64_round_to_zero(a, status); if (v < 0) { res = 0; } else if (v > 0xffffffff) { @@ -6964,7 +7071,7 @@ uint32 float32_to_uint32_round_to_zero(float32 a, float_status *status) return v; } set_float_exception_flags(old_exc_flags, status); - float_raise(float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return res; } @@ -6974,7 +7081,7 @@ int_fast16_t float32_to_int16(float32 a, float_status *status) int_fast16_t res; int old_exc_flags = get_float_exception_flags(status); - v = float32_to_int32(a STATUS_VAR); + v = float32_to_int32(a, status); if (v < -0x8000) { res = -0x8000; } else if (v > 0x7fff) { @@ -6984,7 +7091,7 @@ int_fast16_t float32_to_int16(float32 a, float_status *status) } set_float_exception_flags(old_exc_flags, status); - float_raise(float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return res; } @@ -6994,7 +7101,7 @@ uint_fast16_t float32_to_uint16(float32 a, float_status *status) uint_fast16_t res; int old_exc_flags = get_float_exception_flags(status); - v = float32_to_int32(a STATUS_VAR); + v = float32_to_int32(a, status); if (v < 0) { res = 0; } else if (v > 0xffff) { @@ -7004,7 +7111,7 @@ uint_fast16_t float32_to_uint16(float32 a, float_status *status) } set_float_exception_flags(old_exc_flags, status); - float_raise(float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return res; } @@ -7014,7 +7121,7 @@ uint_fast16_t float32_to_uint16_round_to_zero(float32 a, float_status *status) uint_fast16_t res; int old_exc_flags = get_float_exception_flags(status); - v = float32_to_int64_round_to_zero(a STATUS_VAR); + v = float32_to_int64_round_to_zero(a, status); if (v < 0) { res = 0; } else if (v > 0xffff) { @@ -7023,7 +7130,7 @@ uint_fast16_t float32_to_uint16_round_to_zero(float32 a, float_status *status) return v; } set_float_exception_flags(old_exc_flags, status); - float_raise(float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return res; } @@ -7033,14 +7140,14 @@ uint32 float64_to_uint32(float64 a, float_status *status) uint32 res; int old_exc_flags = get_float_exception_flags(status); - v = float64_to_uint64(a STATUS_VAR); + v = float64_to_uint64(a, status); if (v > 0xffffffff) { res = 0xffffffff; } else { return v; } set_float_exception_flags(old_exc_flags, status); - float_raise(float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return res; } @@ -7050,14 +7157,14 @@ uint32 float64_to_uint32_round_to_zero(float64 a, float_status *status) uint32 res; int old_exc_flags = get_float_exception_flags(status); - v = float64_to_uint64_round_to_zero(a STATUS_VAR); + v = float64_to_uint64_round_to_zero(a, status); if (v > 0xffffffff) { res = 0xffffffff; } else { return v; } set_float_exception_flags(old_exc_flags, status); - float_raise(float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return res; } @@ -7067,7 +7174,7 @@ int_fast16_t float64_to_int16(float64 a, float_status *status) int_fast16_t res; int old_exc_flags = get_float_exception_flags(status); - v = float64_to_int32(a STATUS_VAR); + v = float64_to_int32(a, status); if (v < -0x8000) { res = -0x8000; } else if (v > 0x7fff) { @@ -7077,7 +7184,7 @@ int_fast16_t float64_to_int16(float64 a, float_status *status) } set_float_exception_flags(old_exc_flags, status); - float_raise(float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return res; } @@ -7087,7 +7194,7 @@ uint_fast16_t float64_to_uint16(float64 a, float_status *status) uint_fast16_t res; int old_exc_flags = get_float_exception_flags(status); - v = float64_to_int32(a STATUS_VAR); + v = float64_to_int32(a, status); if (v < 0) { res = 0; } else if (v > 0xffff) { @@ -7097,7 +7204,7 @@ uint_fast16_t float64_to_uint16(float64 a, float_status *status) } set_float_exception_flags(old_exc_flags, status); - float_raise(float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return res; } @@ -7107,7 +7214,7 @@ uint_fast16_t float64_to_uint16_round_to_zero(float64 a, float_status *status) uint_fast16_t res; int old_exc_flags = get_float_exception_flags(status); - v = float64_to_int64_round_to_zero(a STATUS_VAR); + v = float64_to_int64_round_to_zero(a, status); if (v < 0) { res = 0; } else if (v > 0xffff) { @@ -7116,7 +7223,7 @@ uint_fast16_t float64_to_uint16_round_to_zero(float64 a, float_status *status) return v; } set_float_exception_flags(old_exc_flags, status); - float_raise(float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return res; } @@ -7137,13 +7244,13 @@ uint64_t float64_to_uint64(float64 a, float_status *status) flag aSign; int_fast16_t aExp, shiftCount; uint64_t aSig, aSigExtra; - a = float64_squash_input_denormal(a STATUS_VAR); + a = float64_squash_input_denormal(a, status); aSig = extractFloat64Frac(a); aExp = extractFloat64Exp(a); aSign = extractFloat64Sign(a); if (aSign && (aExp > 1022)) { - float_raise(float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); if (float64_is_any_nan(a)) { return LIT64(0xFFFFFFFFFFFFFFFF); } else { @@ -7156,7 +7263,7 @@ uint64_t float64_to_uint64(float64 a, float_status *status) shiftCount = 0x433 - aExp; if (shiftCount <= 0) { if (0x43E < aExp) { - float_raise(float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return LIT64(0xFFFFFFFFFFFFFFFF); } aSigExtra = 0; @@ -7164,15 +7271,15 @@ uint64_t float64_to_uint64(float64 a, float_status *status) } else { shift64ExtraRightJamming(aSig, 0, shiftCount, &aSig, &aSigExtra); } - return roundAndPackUint64(aSign, aSig, aSigExtra STATUS_VAR); + return roundAndPackUint64(aSign, aSig, aSigExtra, status); } uint64_t float64_to_uint64_round_to_zero(float64 a, float_status *status) { signed char current_rounding_mode = STATUS(float_rounding_mode); - set_float_rounding_mode(float_round_to_zero STATUS_VAR); - int64_t v = float64_to_uint64(a STATUS_VAR); - set_float_rounding_mode(current_rounding_mode STATUS_VAR); + set_float_rounding_mode(float_round_to_zero, status); + int64_t v = float64_to_uint64(a, status); + set_float_rounding_mode(current_rounding_mode, status); return v; } @@ -7182,8 +7289,8 @@ static inline int float ## s ## _compare_internal(float ## s a, float ## s b,\ { \ flag aSign, bSign; \ uint ## s ## _t av, bv; \ - a = float ## s ## _squash_input_denormal(a STATUS_VAR); \ - b = float ## s ## _squash_input_denormal(b STATUS_VAR); \ + a = float ## s ## _squash_input_denormal(a, status); \ + b = float ## s ## _squash_input_denormal(b, status); \ \ if (( ( extractFloat ## s ## Exp( a ) == nan_exp ) && \ extractFloat ## s ## Frac( a ) ) || \ @@ -7192,7 +7299,7 @@ static inline int float ## s ## _compare_internal(float ## s a, float ## s b,\ if (!is_quiet || \ float ## s ## _is_signaling_nan( a ) || \ float ## s ## _is_signaling_nan( b ) ) { \ - float_raise( float_flag_invalid STATUS_VAR); \ + float_raise(float_flag_invalid, status); \ } \ return float_relation_unordered; \ } \ @@ -7218,13 +7325,13 @@ static inline int float ## s ## _compare_internal(float ## s a, float ## s b,\ \ int float ## s ## _compare(float ## s a, float ## s b, float_status *status) \ { \ - return float ## s ## _compare_internal(a, b, 0 STATUS_VAR); \ + return float ## s ## _compare_internal(a, b, 0, status); \ } \ \ int float ## s ## _compare_quiet(float ## s a, float ## s b, \ float_status *status) \ { \ - return float ## s ## _compare_internal(a, b, 1 STATUS_VAR); \ + return float ## s ## _compare_internal(a, b, 1, status); \ } COMPARE(32, 0xff) @@ -7242,7 +7349,7 @@ static inline int floatx80_compare_internal(floatx80 a, floatx80 b, if (!is_quiet || floatx80_is_signaling_nan( a ) || floatx80_is_signaling_nan( b ) ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); } return float_relation_unordered; } @@ -7268,12 +7375,12 @@ static inline int floatx80_compare_internal(floatx80 a, floatx80 b, int floatx80_compare(floatx80 a, floatx80 b, float_status *status) { - return floatx80_compare_internal(a, b, 0 STATUS_VAR); + return floatx80_compare_internal(a, b, 0, status); } int floatx80_compare_quiet(floatx80 a, floatx80 b, float_status *status) { - return floatx80_compare_internal(a, b, 1 STATUS_VAR); + return floatx80_compare_internal(a, b, 1, status); } static inline int float128_compare_internal(float128 a, float128 b, @@ -7288,7 +7395,7 @@ static inline int float128_compare_internal(float128 a, float128 b, if (!is_quiet || float128_is_signaling_nan( a ) || float128_is_signaling_nan( b ) ) { - float_raise( float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); } return float_relation_unordered; } @@ -7312,12 +7419,12 @@ static inline int float128_compare_internal(float128 a, float128 b, int float128_compare(float128 a, float128 b, float_status *status) { - return float128_compare_internal(a, b, 0 STATUS_VAR); + return float128_compare_internal(a, b, 0, status); } int float128_compare_quiet(float128 a, float128 b, float_status *status) { - return float128_compare_internal(a, b, 1 STATUS_VAR); + return float128_compare_internal(a, b, 1, status); } /* min() and max() functions. These can't be implemented as @@ -7342,8 +7449,8 @@ static inline float ## s float ## s ## _minmax(float ## s a, float ## s b, \ { \ flag aSign, bSign; \ uint ## s ## _t av, bv, aav, abv; \ - a = float ## s ## _squash_input_denormal(a STATUS_VAR); \ - b = float ## s ## _squash_input_denormal(b STATUS_VAR); \ + a = float ## s ## _squash_input_denormal(a, status); \ + b = float ## s ## _squash_input_denormal(b, status); \ if (float ## s ## _is_any_nan(a) || \ float ## s ## _is_any_nan(b)) { \ if (isieee) { \ @@ -7355,7 +7462,7 @@ static inline float ## s float ## s ## _minmax(float ## s a, float ## s b, \ return a; \ } \ } \ - return propagateFloat ## s ## NaN(a, b STATUS_VAR); \ + return propagateFloat ## s ## NaN(a, b, status); \ } \ aSign = extractFloat ## s ## Sign(a); \ bSign = extractFloat ## s ## Sign(b); \ @@ -7390,37 +7497,37 @@ static inline float ## s float ## s ## _minmax(float ## s a, float ## s b, \ float ## s float ## s ## _min(float ## s a, float ## s b, \ float_status *status) \ { \ - return float ## s ## _minmax(a, b, 1, 0, 0 STATUS_VAR); \ + return float ## s ## _minmax(a, b, 1, 0, 0, status); \ } \ \ float ## s float ## s ## _max(float ## s a, float ## s b, \ float_status *status) \ { \ - return float ## s ## _minmax(a, b, 0, 0, 0 STATUS_VAR); \ + return float ## s ## _minmax(a, b, 0, 0, 0, status); \ } \ \ float ## s float ## s ## _minnum(float ## s a, float ## s b, \ float_status *status) \ { \ - return float ## s ## _minmax(a, b, 1, 1, 0 STATUS_VAR); \ + return float ## s ## _minmax(a, b, 1, 1, 0, status); \ } \ \ float ## s float ## s ## _maxnum(float ## s a, float ## s b, \ float_status *status) \ { \ - return float ## s ## _minmax(a, b, 0, 1, 0 STATUS_VAR); \ + return float ## s ## _minmax(a, b, 0, 1, 0, status); \ } \ \ float ## s float ## s ## _minnummag(float ## s a, float ## s b, \ float_status *status) \ { \ - return float ## s ## _minmax(a, b, 1, 1, 1 STATUS_VAR); \ + return float ## s ## _minmax(a, b, 1, 1, 1, status); \ } \ \ float ## s float ## s ## _maxnummag(float ## s a, float ## s b, \ float_status *status) \ { \ - return float ## s ## _minmax(a, b, 0, 1, 1 STATUS_VAR); \ + return float ## s ## _minmax(a, b, 0, 1, 1, status); \ } MINMAX(32) @@ -7434,14 +7541,14 @@ float32 float32_scalbn(float32 a, int n, float_status *status) int16_t aExp; uint32_t aSig; - a = float32_squash_input_denormal(a STATUS_VAR); + a = float32_squash_input_denormal(a, status); aSig = extractFloat32Frac( a ); aExp = extractFloat32Exp( a ); aSign = extractFloat32Sign( a ); if ( aExp == 0xFF ) { if ( aSig ) { - return propagateFloat32NaN( a, a STATUS_VAR ); + return propagateFloat32NaN(a, a, status); } return a; } @@ -7461,7 +7568,7 @@ float32 float32_scalbn(float32 a, int n, float_status *status) aExp += n - 1; aSig <<= 7; - return normalizeRoundAndPackFloat32( aSign, aExp, aSig STATUS_VAR ); + return normalizeRoundAndPackFloat32(aSign, aExp, aSig, status); } float64 float64_scalbn(float64 a, int n, float_status *status) @@ -7470,14 +7577,14 @@ float64 float64_scalbn(float64 a, int n, float_status *status) int16_t aExp; uint64_t aSig; - a = float64_squash_input_denormal(a STATUS_VAR); + a = float64_squash_input_denormal(a, status); aSig = extractFloat64Frac( a ); aExp = extractFloat64Exp( a ); aSign = extractFloat64Sign( a ); if ( aExp == 0x7FF ) { if ( aSig ) { - return propagateFloat64NaN( a, a STATUS_VAR ); + return propagateFloat64NaN(a, a, status); } return a; } @@ -7497,7 +7604,7 @@ float64 float64_scalbn(float64 a, int n, float_status *status) aExp += n - 1; aSig <<= 10; - return normalizeRoundAndPackFloat64( aSign, aExp, aSig STATUS_VAR ); + return normalizeRoundAndPackFloat64(aSign, aExp, aSig, status); } floatx80 floatx80_scalbn(floatx80 a, int n, float_status *status) @@ -7512,7 +7619,7 @@ floatx80 floatx80_scalbn(floatx80 a, int n, float_status *status) if ( aExp == 0x7FFF ) { if ( aSig<<1 ) { - return propagateFloatx80NaN( a, a STATUS_VAR ); + return propagateFloatx80NaN(a, a, status); } return a; } @@ -7532,7 +7639,7 @@ floatx80 floatx80_scalbn(floatx80 a, int n, float_status *status) aExp += n; return normalizeRoundAndPackFloatx80( STATUS(floatx80_rounding_precision), - aSign, aExp, aSig, 0 STATUS_VAR ); + aSign, aExp, aSig, 0, status); } float128 float128_scalbn(float128 a, int n, float_status *status) @@ -7547,7 +7654,7 @@ float128 float128_scalbn(float128 a, int n, float_status *status) aSign = extractFloat128Sign( a ); if ( aExp == 0x7FFF ) { if ( aSig0 | aSig1 ) { - return propagateFloat128NaN( a, a STATUS_VAR ); + return propagateFloat128NaN(a, a, status); } return a; } @@ -7567,6 +7674,6 @@ float128 float128_scalbn(float128 a, int n, float_status *status) aExp += n - 1; return normalizeRoundAndPackFloat128( aSign, aExp, aSig0, aSig1 - STATUS_VAR ); + , status); } diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index fab2aee1ad..d13fd0ee33 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -109,7 +109,6 @@ typedef int64_t int64; #define LIT64( a ) a##LL #define STATUS(field) status->field -#define STATUS_VAR , status /*---------------------------------------------------------------------------- | Software IEC/IEEE floating-point ordering relations @@ -329,22 +328,22 @@ float128 uint64_to_float128(uint64_t, float_status *status); /* We provide the int16 versions for symmetry of API with float-to-int */ static inline float32 int16_to_float32(int16_t v, float_status *status) { - return int32_to_float32(v STATUS_VAR); + return int32_to_float32(v, status); } static inline float32 uint16_to_float32(uint16_t v, float_status *status) { - return uint32_to_float32(v STATUS_VAR); + return uint32_to_float32(v, status); } static inline float64 int16_to_float64(int16_t v, float_status *status) { - return int32_to_float64(v STATUS_VAR); + return int32_to_float64(v, status); } static inline float64 uint16_to_float64(uint16_t v, float_status *status) { - return uint32_to_float64(v STATUS_VAR); + return uint32_to_float64(v, status); } /*---------------------------------------------------------------------------- diff --git a/target-mips/msa_helper.c b/target-mips/msa_helper.c index c9fc9f9dae..c2160a6a24 100644 --- a/target-mips/msa_helper.c +++ b/target-mips/msa_helper.c @@ -1619,7 +1619,7 @@ static inline float16 float16_from_float32(int32 a, flag ieee, { float16 f_val; - f_val = float32_to_float16((float32)a, ieee STATUS_VAR); + f_val = float32_to_float16((float32)a, ieee, status); f_val = float16_maybe_silence_nan(f_val); return a < 0 ? (f_val | (1 << 15)) : f_val; @@ -1629,7 +1629,7 @@ static inline float32 float32_from_float64(int64 a, float_status *status) { float32 f_val; - f_val = float64_to_float32((float64)a STATUS_VAR); + f_val = float64_to_float32((float64)a, status); f_val = float32_maybe_silence_nan(f_val); return a < 0 ? (f_val | (1 << 31)) : f_val; @@ -1640,7 +1640,7 @@ static inline float32 float32_from_float16(int16_t a, flag ieee, { float32 f_val; - f_val = float16_to_float32((float16)a, ieee STATUS_VAR); + f_val = float16_to_float32((float16)a, ieee, status); f_val = float32_maybe_silence_nan(f_val); return a < 0 ? (f_val | (1 << 31)) : f_val; @@ -1650,7 +1650,7 @@ static inline float64 float64_from_float32(int32 a, float_status *status) { float64 f_val; - f_val = float32_to_float64((float64)a STATUS_VAR); + f_val = float32_to_float64((float64)a, status); f_val = float64_maybe_silence_nan(f_val); return a < 0 ? (f_val | (1ULL << 63)) : f_val; @@ -1661,8 +1661,8 @@ static inline float32 float32_from_q16(int16_t a, float_status *status) float32 f_val; /* conversion as integer and scaling */ - f_val = int32_to_float32(a STATUS_VAR); - f_val = float32_scalbn(f_val, -15 STATUS_VAR); + f_val = int32_to_float32(a, status); + f_val = float32_scalbn(f_val, -15, status); return f_val; } @@ -1672,8 +1672,8 @@ static inline float64 float64_from_q32(int32 a, float_status *status) float64 f_val; /* conversion as integer and scaling */ - f_val = int32_to_float64(a STATUS_VAR); - f_val = float64_scalbn(f_val, -31 STATUS_VAR); + f_val = int32_to_float64(a, status); + f_val = float64_scalbn(f_val, -31, status); return f_val; } @@ -1687,43 +1687,43 @@ static inline int16_t float32_to_q16(float32 a, float_status *status) int ieee_ex; if (float32_is_any_nan(a)) { - float_raise(float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return 0; } /* scaling */ - a = float32_scalbn(a, 15 STATUS_VAR); + a = float32_scalbn(a, 15, status); ieee_ex = get_float_exception_flags(status); set_float_exception_flags(ieee_ex & (~float_flag_underflow) - STATUS_VAR); + , status); if (ieee_ex & float_flag_overflow) { - float_raise(float_flag_inexact STATUS_VAR); + float_raise(float_flag_inexact, status); return (int32)a < 0 ? q_min : q_max; } /* conversion to int */ - q_val = float32_to_int32(a STATUS_VAR); + q_val = float32_to_int32(a, status); ieee_ex = get_float_exception_flags(status); set_float_exception_flags(ieee_ex & (~float_flag_underflow) - STATUS_VAR); + , status); if (ieee_ex & float_flag_invalid) { set_float_exception_flags(ieee_ex & (~float_flag_invalid) - STATUS_VAR); - float_raise(float_flag_overflow | float_flag_inexact STATUS_VAR); + , status); + float_raise(float_flag_overflow | float_flag_inexact, status); return (int32)a < 0 ? q_min : q_max; } if (q_val < q_min) { - float_raise(float_flag_overflow | float_flag_inexact STATUS_VAR); + float_raise(float_flag_overflow | float_flag_inexact, status); return (int16_t)q_min; } if (q_max < q_val) { - float_raise(float_flag_overflow | float_flag_inexact STATUS_VAR); + float_raise(float_flag_overflow | float_flag_inexact, status); return (int16_t)q_max; } @@ -1739,43 +1739,43 @@ static inline int32 float64_to_q32(float64 a, float_status *status) int ieee_ex; if (float64_is_any_nan(a)) { - float_raise(float_flag_invalid STATUS_VAR); + float_raise(float_flag_invalid, status); return 0; } /* scaling */ - a = float64_scalbn(a, 31 STATUS_VAR); + a = float64_scalbn(a, 31, status); ieee_ex = get_float_exception_flags(status); set_float_exception_flags(ieee_ex & (~float_flag_underflow) - STATUS_VAR); + , status); if (ieee_ex & float_flag_overflow) { - float_raise(float_flag_inexact STATUS_VAR); + float_raise(float_flag_inexact, status); return (int64)a < 0 ? q_min : q_max; } /* conversion to integer */ - q_val = float64_to_int64(a STATUS_VAR); + q_val = float64_to_int64(a, status); ieee_ex = get_float_exception_flags(status); set_float_exception_flags(ieee_ex & (~float_flag_underflow) - STATUS_VAR); + , status); if (ieee_ex & float_flag_invalid) { set_float_exception_flags(ieee_ex & (~float_flag_invalid) - STATUS_VAR); - float_raise(float_flag_overflow | float_flag_inexact STATUS_VAR); + , status); + float_raise(float_flag_overflow | float_flag_inexact, status); return (int64)a < 0 ? q_min : q_max; } if (q_val < q_min) { - float_raise(float_flag_overflow | float_flag_inexact STATUS_VAR); + float_raise(float_flag_overflow | float_flag_inexact, status); return (int32)q_min; } if (q_max < q_val) { - float_raise(float_flag_overflow | float_flag_inexact STATUS_VAR); + float_raise(float_flag_overflow | float_flag_inexact, status); return (int32)q_max; } |