Misc cleanups

-----BEGIN PGP SIGNATURE-----
 
 iQFRBAABCgA7FiEEekgeeIaLTbaoWgXAZN846K9+IV8FAl7EAIodHHJpY2hhcmQu
 aGVuZGVyc29uQGxpbmFyby5vcmcACgkQZN846K9+IV/Mogf/Rl6XJtcQWBwLDjs2
 BpXQQczSu7ORddQOAijx2Arhm810a4Du+pSZAT+GriSY4+gaNFyc0hqpWgdSOOvN
 YyQhY+tODwH14y/b2zrCl+OA32GL5JeGelowOo90zZwl5hPzK9NndXahN5tOOcmL
 yyXS0yobQ5RDynYG3pYPo9beFo4e7VwV+V2bLH6H1CRZu/wOW/sLYE4FHNzM+yTh
 wET8pMHTaRAKty/RscqJlTpTvfgfaH5M7/Wzkz9oTQCrqzwYoSuCAMyzDMT7xL3/
 IBJwRwxojKlICqe5cINeiyksfhOlJGWpQke6Np0t43JvLFMx8scubOrcLANph3uu
 PPjO7g==
 =K1tF
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/rth/tags/pull-fpu-20200519' into staging

Misc cleanups

# gpg: Signature made Tue 19 May 2020 16:51:38 BST
# gpg:                using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F
# gpg:                issuer "richard.henderson@linaro.org"
# gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>" [full]
# Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A  05C0 64DF 38E8 AF7E 215F

* remotes/rth/tags/pull-fpu-20200519:
  softfloat: Return bool from all classification predicates
  softfloat: Inline floatx80 compare specializations
  softfloat: Inline float128 compare specializations
  softfloat: Inline float64 compare specializations
  softfloat: Inline float32 compare specializations
  softfloat: Name compare relation enum
  softfloat: Name rounding mode enum
  softfloat: Change tininess_before_rounding to bool
  softfloat: Replace flag with bool
  softfloat: Use post test for floatN_mul

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2020-05-19 19:18:41 +01:00
commit 956ae3e926
22 changed files with 547 additions and 1395 deletions

View File

@ -93,7 +93,7 @@ this code that are retained.
* 2008 revision and backward compatibility with their original choice.
* Thus for MIPS we must make the choice at runtime.
*/
static inline flag snan_bit_is_one(float_status *status)
static inline bool snan_bit_is_one(float_status *status)
{
#if defined(TARGET_MIPS)
return status->snan_bit_is_one;
@ -114,7 +114,7 @@ static bool parts_is_snan_frac(uint64_t frac, float_status *status)
#ifdef NO_SIGNALING_NANS
return false;
#else
flag msb = extract64(frac, DECOMPOSED_BINARY_POINT - 1, 1);
bool msb = extract64(frac, DECOMPOSED_BINARY_POINT - 1, 1);
return msb == snan_bit_is_one(status);
#endif
}
@ -236,7 +236,7 @@ void float_raise(uint8_t flags, float_status *status)
| Internal canonical NaN format.
*----------------------------------------------------------------------------*/
typedef struct {
flag sign;
bool sign;
uint64_t high, low;
} commonNaNT;
@ -245,7 +245,7 @@ typedef struct {
| NaN; otherwise returns 0.
*----------------------------------------------------------------------------*/
int float16_is_quiet_nan(float16 a_, float_status *status)
bool float16_is_quiet_nan(float16 a_, float_status *status)
{
#ifdef NO_SIGNALING_NANS
return float16_is_any_nan(a_);
@ -264,7 +264,7 @@ int float16_is_quiet_nan(float16 a_, float_status *status)
| NaN; otherwise returns 0.
*----------------------------------------------------------------------------*/
int float16_is_signaling_nan(float16 a_, float_status *status)
bool float16_is_signaling_nan(float16 a_, float_status *status)
{
#ifdef NO_SIGNALING_NANS
return 0;
@ -283,7 +283,7 @@ int float16_is_signaling_nan(float16 a_, float_status *status)
| NaN; otherwise returns 0.
*----------------------------------------------------------------------------*/
int float32_is_quiet_nan(float32 a_, float_status *status)
bool float32_is_quiet_nan(float32 a_, float_status *status)
{
#ifdef NO_SIGNALING_NANS
return float32_is_any_nan(a_);
@ -302,7 +302,7 @@ int float32_is_quiet_nan(float32 a_, float_status *status)
| NaN; otherwise returns 0.
*----------------------------------------------------------------------------*/
int float32_is_signaling_nan(float32 a_, float_status *status)
bool float32_is_signaling_nan(float32 a_, float_status *status)
{
#ifdef NO_SIGNALING_NANS
return 0;
@ -374,7 +374,7 @@ static float32 commonNaNToFloat32(commonNaNT a, float_status *status)
*----------------------------------------------------------------------------*/
static int pickNaN(FloatClass a_cls, FloatClass b_cls,
flag aIsLargerSignificand)
bool aIsLargerSignificand)
{
#if defined(TARGET_ARM) || defined(TARGET_MIPS) || defined(TARGET_HPPA)
/* ARM mandated NaN propagation rules (see FPProcessNaNs()), take
@ -584,7 +584,7 @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
static float32 propagateFloat32NaN(float32 a, float32 b, float_status *status)
{
flag aIsLargerSignificand;
bool aIsLargerSignificand;
uint32_t av, bv;
FloatClass a_cls, b_cls;
@ -637,7 +637,7 @@ static float32 propagateFloat32NaN(float32 a, float32 b, float_status *status)
| NaN; otherwise returns 0.
*----------------------------------------------------------------------------*/
int float64_is_quiet_nan(float64 a_, float_status *status)
bool float64_is_quiet_nan(float64 a_, float_status *status)
{
#ifdef NO_SIGNALING_NANS
return float64_is_any_nan(a_);
@ -657,7 +657,7 @@ int float64_is_quiet_nan(float64 a_, float_status *status)
| NaN; otherwise returns 0.
*----------------------------------------------------------------------------*/
int float64_is_signaling_nan(float64 a_, float_status *status)
bool float64_is_signaling_nan(float64 a_, float_status *status)
{
#ifdef NO_SIGNALING_NANS
return 0;
@ -722,7 +722,7 @@ static float64 commonNaNToFloat64(commonNaNT a, float_status *status)
static float64 propagateFloat64NaN(float64 a, float64 b, float_status *status)
{
flag aIsLargerSignificand;
bool aIsLargerSignificand;
uint64_t av, bv;
FloatClass a_cls, b_cls;
@ -890,7 +890,7 @@ static floatx80 commonNaNToFloatx80(commonNaNT a, float_status *status)
floatx80 propagateFloatx80NaN(floatx80 a, floatx80 b, float_status *status)
{
flag aIsLargerSignificand;
bool aIsLargerSignificand;
FloatClass a_cls, b_cls;
/* This is not complete, but is good enough for pickNaN. */
@ -939,7 +939,7 @@ floatx80 propagateFloatx80NaN(floatx80 a, floatx80 b, float_status *status)
| NaN; otherwise returns 0.
*----------------------------------------------------------------------------*/
int float128_is_quiet_nan(float128 a, float_status *status)
bool float128_is_quiet_nan(float128 a, float_status *status)
{
#ifdef NO_SIGNALING_NANS
return float128_is_any_nan(a);
@ -959,7 +959,7 @@ int float128_is_quiet_nan(float128 a, float_status *status)
| signaling NaN; otherwise returns 0.
*----------------------------------------------------------------------------*/
int float128_is_signaling_nan(float128 a, float_status *status)
bool float128_is_signaling_nan(float128 a, float_status *status)
{
#ifdef NO_SIGNALING_NANS
return 0;
@ -1038,7 +1038,7 @@ static float128 commonNaNToFloat128(commonNaNT a, float_status *status)
static float128 propagateFloat128NaN(float128 a, float128 b,
float_status *status)
{
flag aIsLargerSignificand;
bool aIsLargerSignificand;
FloatClass a_cls, b_cls;
/* This is not complete, but is good enough for pickNaN. */

File diff suppressed because it is too large Load Diff

View File

@ -53,12 +53,13 @@ this code that are retained.
#include "fpu/softfloat-types.h"
static inline void set_float_detect_tininess(int val, float_status *status)
static inline void set_float_detect_tininess(bool val, float_status *status)
{
status->float_detect_tininess = val;
status->tininess_before_rounding = val;
}
static inline void set_float_rounding_mode(int val, float_status *status)
static inline void set_float_rounding_mode(FloatRoundMode val,
float_status *status)
{
status->float_rounding_mode = val;
}
@ -74,32 +75,32 @@ static inline void set_floatx80_rounding_precision(int val,
status->floatx80_rounding_precision = val;
}
static inline void set_flush_to_zero(flag val, float_status *status)
static inline void set_flush_to_zero(bool val, float_status *status)
{
status->flush_to_zero = val;
}
static inline void set_flush_inputs_to_zero(flag val, float_status *status)
static inline void set_flush_inputs_to_zero(bool val, float_status *status)
{
status->flush_inputs_to_zero = val;
}
static inline void set_default_nan_mode(flag val, float_status *status)
static inline void set_default_nan_mode(bool val, float_status *status)
{
status->default_nan_mode = val;
}
static inline void set_snan_bit_is_one(flag val, float_status *status)
static inline void set_snan_bit_is_one(bool val, float_status *status)
{
status->snan_bit_is_one = val;
}
static inline int get_float_detect_tininess(float_status *status)
static inline bool get_float_detect_tininess(float_status *status)
{
return status->float_detect_tininess;
return status->tininess_before_rounding;
}
static inline int get_float_rounding_mode(float_status *status)
static inline FloatRoundMode get_float_rounding_mode(float_status *status)
{
return status->float_rounding_mode;
}
@ -114,17 +115,17 @@ static inline int get_floatx80_rounding_precision(float_status *status)
return status->floatx80_rounding_precision;
}
static inline flag get_flush_to_zero(float_status *status)
static inline bool get_flush_to_zero(float_status *status)
{
return status->flush_to_zero;
}
static inline flag get_flush_inputs_to_zero(float_status *status)
static inline bool get_flush_inputs_to_zero(float_status *status)
{
return status->flush_inputs_to_zero;
}
static inline flag get_default_nan_mode(float_status *status)
static inline bool get_default_nan_mode(float_status *status)
{
return status->default_nan_mode;
}

View File

@ -756,11 +756,9 @@ static inline uint32_t estimateSqrt32(int aExp, uint32_t a)
| Otherwise, returns 0.
*----------------------------------------------------------------------------*/
static inline flag eq128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
static inline bool eq128(uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1)
{
return ( a0 == b0 ) && ( a1 == b1 );
return a0 == b0 && a1 == b1;
}
/*----------------------------------------------------------------------------
@ -769,11 +767,9 @@ static inline flag eq128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
| Otherwise, returns 0.
*----------------------------------------------------------------------------*/
static inline flag le128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
static inline bool le128(uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1)
{
return ( a0 < b0 ) || ( ( a0 == b0 ) && ( a1 <= b1 ) );
return a0 < b0 || (a0 == b0 && a1 <= b1);
}
/*----------------------------------------------------------------------------
@ -782,11 +778,9 @@ static inline flag le128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
| returns 0.
*----------------------------------------------------------------------------*/
static inline flag lt128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
static inline bool lt128(uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1)
{
return ( a0 < b0 ) || ( ( a0 == b0 ) && ( a1 < b1 ) );
return a0 < b0 || (a0 == b0 && a1 < b1);
}
/*----------------------------------------------------------------------------
@ -795,11 +789,9 @@ static inline flag lt128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
| Otherwise, returns 0.
*----------------------------------------------------------------------------*/
static inline flag ne128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
static inline bool ne128(uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1)
{
return ( a0 != b0 ) || ( a1 != b1 );
return a0 != b0 || a1 != b1;
}
#endif

View File

@ -80,12 +80,6 @@ this code that are retained.
#ifndef SOFTFLOAT_TYPES_H
#define SOFTFLOAT_TYPES_H
/* This 'flag' type must be able to hold at least 0 and 1. It should
* probably be replaced with 'bool' but the uses would need to be audited
* to check that they weren't accidentally relying on it being a larger type.
*/
typedef uint8_t flag;
/*
* Software IEC/IEEE floating-point types.
*/
@ -122,16 +116,14 @@ typedef struct {
* Software IEC/IEEE floating-point underflow tininess-detection mode.
*/
enum {
float_tininess_after_rounding = 0,
float_tininess_before_rounding = 1
};
#define float_tininess_after_rounding false
#define float_tininess_before_rounding true
/*
*Software IEC/IEEE floating-point rounding mode.
*/
enum {
typedef enum __attribute__((__packed__)) {
float_round_nearest_even = 0,
float_round_down = 1,
float_round_up = 2,
@ -139,7 +131,7 @@ enum {
float_round_ties_away = 4,
/* Not an IEEE rounding mode: round to the closest odd mantissa value */
float_round_to_odd = 5,
};
} FloatRoundMode;
/*
* Software IEC/IEEE floating-point exception flags.
@ -164,17 +156,17 @@ enum {
*/
typedef struct float_status {
signed char float_detect_tininess;
signed char float_rounding_mode;
FloatRoundMode float_rounding_mode;
uint8_t float_exception_flags;
signed char floatx80_rounding_precision;
bool tininess_before_rounding;
/* should denormalised results go to zero and set the inexact flag? */
flag flush_to_zero;
bool flush_to_zero;
/* should denormalised inputs go to zero and set the input_denormal flag? */
flag flush_inputs_to_zero;
flag default_nan_mode;
bool flush_inputs_to_zero;
bool default_nan_mode;
/* not always used -- see snan_bit_is_one() in softfloat-specialize.h */
flag snan_bit_is_one;
bool snan_bit_is_one;
} float_status;
#endif /* SOFTFLOAT_TYPES_H */

View File

@ -85,12 +85,13 @@ this code that are retained.
/*----------------------------------------------------------------------------
| Software IEC/IEEE floating-point ordering relations
*----------------------------------------------------------------------------*/
enum {
typedef enum {
float_relation_less = -1,
float_relation_equal = 0,
float_relation_greater = 1,
float_relation_unordered = 2
};
} FloatRelation;
#include "fpu/softfloat-types.h"
#include "fpu/softfloat-helpers.h"
@ -186,9 +187,9 @@ float32 float16_to_float32(float16, bool ieee, float_status *status);
float16 float64_to_float16(float64 a, bool ieee, float_status *status);
float64 float16_to_float64(float16 a, bool ieee, float_status *status);
int16_t float16_to_int16_scalbn(float16, int, int, float_status *status);
int32_t float16_to_int32_scalbn(float16, int, int, float_status *status);
int64_t float16_to_int64_scalbn(float16, int, int, float_status *status);
int16_t float16_to_int16_scalbn(float16, FloatRoundMode, int, float_status *);
int32_t float16_to_int32_scalbn(float16, FloatRoundMode, int, float_status *);
int64_t float16_to_int64_scalbn(float16, FloatRoundMode, int, float_status *);
int16_t float16_to_int16(float16, float_status *status);
int32_t float16_to_int32(float16, float_status *status);
@ -198,9 +199,12 @@ int16_t float16_to_int16_round_to_zero(float16, float_status *status);
int32_t float16_to_int32_round_to_zero(float16, float_status *status);
int64_t float16_to_int64_round_to_zero(float16, float_status *status);
uint16_t float16_to_uint16_scalbn(float16 a, int, int, float_status *status);
uint32_t float16_to_uint32_scalbn(float16 a, int, int, float_status *status);
uint64_t float16_to_uint64_scalbn(float16 a, int, int, float_status *status);
uint16_t float16_to_uint16_scalbn(float16 a, FloatRoundMode,
int, float_status *status);
uint32_t float16_to_uint32_scalbn(float16 a, FloatRoundMode,
int, float_status *status);
uint64_t float16_to_uint64_scalbn(float16 a, FloatRoundMode,
int, float_status *status);
uint16_t float16_to_uint16(float16 a, float_status *status);
uint32_t float16_to_uint32(float16 a, float_status *status);
@ -228,34 +232,34 @@ float16 float16_maxnum(float16, float16, float_status *status);
float16 float16_minnummag(float16, float16, float_status *status);
float16 float16_maxnummag(float16, float16, float_status *status);
float16 float16_sqrt(float16, float_status *status);
int float16_compare(float16, float16, float_status *status);
int float16_compare_quiet(float16, float16, float_status *status);
FloatRelation float16_compare(float16, float16, float_status *status);
FloatRelation float16_compare_quiet(float16, float16, float_status *status);
int float16_is_quiet_nan(float16, float_status *status);
int float16_is_signaling_nan(float16, float_status *status);
bool float16_is_quiet_nan(float16, float_status *status);
bool float16_is_signaling_nan(float16, float_status *status);
float16 float16_silence_nan(float16, float_status *status);
static inline int float16_is_any_nan(float16 a)
static inline bool float16_is_any_nan(float16 a)
{
return ((float16_val(a) & ~0x8000) > 0x7c00);
}
static inline int float16_is_neg(float16 a)
static inline bool float16_is_neg(float16 a)
{
return float16_val(a) >> 15;
}
static inline int float16_is_infinity(float16 a)
static inline bool float16_is_infinity(float16 a)
{
return (float16_val(a) & 0x7fff) == 0x7c00;
}
static inline int float16_is_zero(float16 a)
static inline bool float16_is_zero(float16 a)
{
return (float16_val(a) & 0x7fff) == 0;
}
static inline int float16_is_zero_or_denormal(float16 a)
static inline bool float16_is_zero_or_denormal(float16 a)
{
return (float16_val(a) & 0x7c00) == 0;
}
@ -298,9 +302,9 @@ float16 float16_default_nan(float_status *status);
| Software IEC/IEEE single-precision conversion routines.
*----------------------------------------------------------------------------*/
int16_t float32_to_int16_scalbn(float32, int, int, float_status *status);
int32_t float32_to_int32_scalbn(float32, int, int, float_status *status);
int64_t float32_to_int64_scalbn(float32, int, int, float_status *status);
int16_t float32_to_int16_scalbn(float32, FloatRoundMode, int, float_status *);
int32_t float32_to_int32_scalbn(float32, FloatRoundMode, int, float_status *);
int64_t float32_to_int64_scalbn(float32, FloatRoundMode, int, float_status *);
int16_t float32_to_int16(float32, float_status *status);
int32_t float32_to_int32(float32, float_status *status);
@ -310,9 +314,9 @@ int16_t float32_to_int16_round_to_zero(float32, float_status *status);
int32_t float32_to_int32_round_to_zero(float32, float_status *status);
int64_t float32_to_int64_round_to_zero(float32, float_status *status);
uint16_t float32_to_uint16_scalbn(float32, int, int, float_status *status);
uint32_t float32_to_uint32_scalbn(float32, int, int, float_status *status);
uint64_t float32_to_uint64_scalbn(float32, int, int, float_status *status);
uint16_t float32_to_uint16_scalbn(float32, FloatRoundMode, int, float_status *);
uint32_t float32_to_uint32_scalbn(float32, FloatRoundMode, int, float_status *);
uint64_t float32_to_uint64_scalbn(float32, FloatRoundMode, int, float_status *);
uint16_t float32_to_uint16(float32, float_status *status);
uint32_t float32_to_uint32(float32, float_status *status);
@ -339,24 +343,16 @@ float32 float32_muladd(float32, float32, float32, int, float_status *status);
float32 float32_sqrt(float32, float_status *status);
float32 float32_exp2(float32, float_status *status);
float32 float32_log2(float32, float_status *status);
int float32_eq(float32, float32, float_status *status);
int float32_le(float32, float32, float_status *status);
int float32_lt(float32, float32, float_status *status);
int float32_unordered(float32, float32, float_status *status);
int float32_eq_quiet(float32, float32, float_status *status);
int float32_le_quiet(float32, float32, float_status *status);
int float32_lt_quiet(float32, float32, float_status *status);
int float32_unordered_quiet(float32, float32, float_status *status);
int float32_compare(float32, float32, float_status *status);
int float32_compare_quiet(float32, float32, float_status *status);
FloatRelation float32_compare(float32, float32, float_status *status);
FloatRelation float32_compare_quiet(float32, float32, float_status *status);
float32 float32_min(float32, float32, float_status *status);
float32 float32_max(float32, float32, float_status *status);
float32 float32_minnum(float32, float32, float_status *status);
float32 float32_maxnum(float32, float32, float_status *status);
float32 float32_minnummag(float32, float32, float_status *status);
float32 float32_maxnummag(float32, float32, float_status *status);
int float32_is_quiet_nan(float32, float_status *status);
int float32_is_signaling_nan(float32, float_status *status);
bool float32_is_quiet_nan(float32, float_status *status);
bool float32_is_signaling_nan(float32, float_status *status);
float32 float32_silence_nan(float32, float_status *status);
float32 float32_scalbn(float32, int, float_status *status);
@ -376,27 +372,27 @@ static inline float32 float32_chs(float32 a)
return make_float32(float32_val(a) ^ 0x80000000);
}
static inline int float32_is_infinity(float32 a)
static inline bool float32_is_infinity(float32 a)
{
return (float32_val(a) & 0x7fffffff) == 0x7f800000;
}
static inline int float32_is_neg(float32 a)
static inline bool float32_is_neg(float32 a)
{
return float32_val(a) >> 31;
}
static inline int float32_is_zero(float32 a)
static inline bool float32_is_zero(float32 a)
{
return (float32_val(a) & 0x7fffffff) == 0;
}
static inline int float32_is_any_nan(float32 a)
static inline bool float32_is_any_nan(float32 a)
{
return ((float32_val(a) & ~(1 << 31)) > 0x7f800000UL);
}
static inline int float32_is_zero_or_denormal(float32 a)
static inline bool float32_is_zero_or_denormal(float32 a)
{
return (float32_val(a) & 0x7f800000) == 0;
}
@ -421,6 +417,47 @@ static inline float32 float32_set_sign(float32 a, int sign)
return make_float32((float32_val(a) & 0x7fffffff) | (sign << 31));
}
static inline bool float32_eq(float32 a, float32 b, float_status *s)
{
return float32_compare(a, b, s) == float_relation_equal;
}
static inline bool float32_le(float32 a, float32 b, float_status *s)
{
return float32_compare(a, b, s) <= float_relation_equal;
}
static inline bool float32_lt(float32 a, float32 b, float_status *s)
{
return float32_compare(a, b, s) < float_relation_equal;
}
static inline bool float32_unordered(float32 a, float32 b, float_status *s)
{
return float32_compare(a, b, s) == float_relation_unordered;
}
static inline bool float32_eq_quiet(float32 a, float32 b, float_status *s)
{
return float32_compare_quiet(a, b, s) == float_relation_equal;
}
static inline bool float32_le_quiet(float32 a, float32 b, float_status *s)
{
return float32_compare_quiet(a, b, s) <= float_relation_equal;
}
static inline bool float32_lt_quiet(float32 a, float32 b, float_status *s)
{
return float32_compare_quiet(a, b, s) < float_relation_equal;
}
static inline bool float32_unordered_quiet(float32 a, float32 b,
float_status *s)
{
return float32_compare_quiet(a, b, s) == float_relation_unordered;
}
#define float32_zero make_float32(0)
#define float32_half make_float32(0x3f000000)
#define float32_one make_float32(0x3f800000)
@ -440,7 +477,7 @@ static inline float32 float32_set_sign(float32 a, int sign)
| significand.
*----------------------------------------------------------------------------*/
static inline float32 packFloat32(flag zSign, int zExp, uint32_t zSig)
static inline float32 packFloat32(bool zSign, int zExp, uint32_t zSig)
{
return make_float32(
(((uint32_t)zSign) << 31) + (((uint32_t)zExp) << 23) + zSig);
@ -455,9 +492,9 @@ float32 float32_default_nan(float_status *status);
| Software IEC/IEEE double-precision conversion routines.
*----------------------------------------------------------------------------*/
int16_t float64_to_int16_scalbn(float64, int, int, float_status *status);
int32_t float64_to_int32_scalbn(float64, int, int, float_status *status);
int64_t float64_to_int64_scalbn(float64, int, int, float_status *status);
int16_t float64_to_int16_scalbn(float64, FloatRoundMode, int, float_status *);
int32_t float64_to_int32_scalbn(float64, FloatRoundMode, int, float_status *);
int64_t float64_to_int64_scalbn(float64, FloatRoundMode, int, float_status *);
int16_t float64_to_int16(float64, float_status *status);
int32_t float64_to_int32(float64, float_status *status);
@ -467,9 +504,9 @@ int16_t float64_to_int16_round_to_zero(float64, float_status *status);
int32_t float64_to_int32_round_to_zero(float64, float_status *status);
int64_t float64_to_int64_round_to_zero(float64, float_status *status);
uint16_t float64_to_uint16_scalbn(float64, int, int, float_status *status);
uint32_t float64_to_uint32_scalbn(float64, int, int, float_status *status);
uint64_t float64_to_uint64_scalbn(float64, int, int, float_status *status);
uint16_t float64_to_uint16_scalbn(float64, FloatRoundMode, int, float_status *);
uint32_t float64_to_uint32_scalbn(float64, FloatRoundMode, int, float_status *);
uint64_t float64_to_uint64_scalbn(float64, FloatRoundMode, int, float_status *);
uint16_t float64_to_uint16(float64, float_status *status);
uint32_t float64_to_uint32(float64, float_status *status);
@ -495,24 +532,16 @@ float64 float64_rem(float64, float64, float_status *status);
float64 float64_muladd(float64, float64, float64, int, float_status *status);
float64 float64_sqrt(float64, float_status *status);
float64 float64_log2(float64, float_status *status);
int float64_eq(float64, float64, float_status *status);
int float64_le(float64, float64, float_status *status);
int float64_lt(float64, float64, float_status *status);
int float64_unordered(float64, float64, float_status *status);
int float64_eq_quiet(float64, float64, float_status *status);
int float64_le_quiet(float64, float64, float_status *status);
int float64_lt_quiet(float64, float64, float_status *status);
int float64_unordered_quiet(float64, float64, float_status *status);
int float64_compare(float64, float64, float_status *status);
int float64_compare_quiet(float64, float64, float_status *status);
FloatRelation float64_compare(float64, float64, float_status *status);
FloatRelation float64_compare_quiet(float64, float64, float_status *status);
float64 float64_min(float64, float64, float_status *status);
float64 float64_max(float64, float64, float_status *status);
float64 float64_minnum(float64, float64, float_status *status);
float64 float64_maxnum(float64, float64, float_status *status);
float64 float64_minnummag(float64, float64, float_status *status);
float64 float64_maxnummag(float64, float64, float_status *status);
int float64_is_quiet_nan(float64 a, float_status *status);
int float64_is_signaling_nan(float64, float_status *status);
bool float64_is_quiet_nan(float64 a, float_status *status);
bool float64_is_signaling_nan(float64, float_status *status);
float64 float64_silence_nan(float64, float_status *status);
float64 float64_scalbn(float64, int, float_status *status);
@ -532,27 +561,27 @@ static inline float64 float64_chs(float64 a)
return make_float64(float64_val(a) ^ 0x8000000000000000LL);
}
static inline int float64_is_infinity(float64 a)
static inline bool float64_is_infinity(float64 a)
{
return (float64_val(a) & 0x7fffffffffffffffLL ) == 0x7ff0000000000000LL;
}
static inline int float64_is_neg(float64 a)
static inline bool float64_is_neg(float64 a)
{
return float64_val(a) >> 63;
}
static inline int float64_is_zero(float64 a)
static inline bool float64_is_zero(float64 a)
{
return (float64_val(a) & 0x7fffffffffffffffLL) == 0;
}
static inline int float64_is_any_nan(float64 a)
static inline bool float64_is_any_nan(float64 a)
{
return ((float64_val(a) & ~(1ULL << 63)) > 0x7ff0000000000000ULL);
}
static inline int float64_is_zero_or_denormal(float64 a)
static inline bool float64_is_zero_or_denormal(float64 a)
{
return (float64_val(a) & 0x7ff0000000000000LL) == 0;
}
@ -578,6 +607,47 @@ static inline float64 float64_set_sign(float64 a, int sign)
| ((int64_t)sign << 63));
}
static inline bool float64_eq(float64 a, float64 b, float_status *s)
{
return float64_compare(a, b, s) == float_relation_equal;
}
static inline bool float64_le(float64 a, float64 b, float_status *s)
{
return float64_compare(a, b, s) <= float_relation_equal;
}
static inline bool float64_lt(float64 a, float64 b, float_status *s)
{
return float64_compare(a, b, s) < float_relation_equal;
}
static inline bool float64_unordered(float64 a, float64 b, float_status *s)
{
return float64_compare(a, b, s) == float_relation_unordered;
}
static inline bool float64_eq_quiet(float64 a, float64 b, float_status *s)
{
return float64_compare_quiet(a, b, s) == float_relation_equal;
}
static inline bool float64_le_quiet(float64 a, float64 b, float_status *s)
{
return float64_compare_quiet(a, b, s) <= float_relation_equal;
}
static inline bool float64_lt_quiet(float64 a, float64 b, float_status *s)
{
return float64_compare_quiet(a, b, s) < float_relation_equal;
}
static inline bool float64_unordered_quiet(float64 a, float64 b,
float_status *s)
{
return float64_compare_quiet(a, b, s) == float_relation_unordered;
}
#define float64_zero make_float64(0)
#define float64_half make_float64(0x3fe0000000000000LL)
#define float64_one make_float64(0x3ff0000000000000LL)
@ -619,16 +689,8 @@ floatx80 floatx80_mul(floatx80, floatx80, float_status *status);
floatx80 floatx80_div(floatx80, floatx80, float_status *status);
floatx80 floatx80_rem(floatx80, floatx80, float_status *status);
floatx80 floatx80_sqrt(floatx80, float_status *status);
int floatx80_eq(floatx80, floatx80, float_status *status);
int floatx80_le(floatx80, floatx80, float_status *status);
int floatx80_lt(floatx80, floatx80, float_status *status);
int floatx80_unordered(floatx80, floatx80, float_status *status);
int floatx80_eq_quiet(floatx80, floatx80, float_status *status);
int floatx80_le_quiet(floatx80, floatx80, float_status *status);
int floatx80_lt_quiet(floatx80, floatx80, float_status *status);
int floatx80_unordered_quiet(floatx80, floatx80, float_status *status);
int floatx80_compare(floatx80, floatx80, float_status *status);
int floatx80_compare_quiet(floatx80, floatx80, float_status *status);
FloatRelation floatx80_compare(floatx80, floatx80, float_status *status);
FloatRelation floatx80_compare_quiet(floatx80, floatx80, float_status *status);
int floatx80_is_quiet_nan(floatx80, float_status *status);
int floatx80_is_signaling_nan(floatx80, float_status *status);
floatx80 floatx80_silence_nan(floatx80, float_status *status);
@ -646,7 +708,7 @@ static inline floatx80 floatx80_chs(floatx80 a)
return a;
}
static inline int floatx80_is_infinity(floatx80 a)
static inline bool floatx80_is_infinity(floatx80 a)
{
#if defined(TARGET_M68K)
return (a.high & 0x7fff) == floatx80_infinity.high && !(a.low << 1);
@ -656,26 +718,67 @@ static inline int floatx80_is_infinity(floatx80 a)
#endif
}
static inline int floatx80_is_neg(floatx80 a)
static inline bool floatx80_is_neg(floatx80 a)
{
return a.high >> 15;
}
static inline int floatx80_is_zero(floatx80 a)
static inline bool floatx80_is_zero(floatx80 a)
{
return (a.high & 0x7fff) == 0 && a.low == 0;
}
static inline int floatx80_is_zero_or_denormal(floatx80 a)
static inline bool floatx80_is_zero_or_denormal(floatx80 a)
{
return (a.high & 0x7fff) == 0;
}
static inline int floatx80_is_any_nan(floatx80 a)
static inline bool floatx80_is_any_nan(floatx80 a)
{
return ((a.high & 0x7fff) == 0x7fff) && (a.low<<1);
}
static inline bool floatx80_eq(floatx80 a, floatx80 b, float_status *s)
{
return floatx80_compare(a, b, s) == float_relation_equal;
}
static inline bool floatx80_le(floatx80 a, floatx80 b, float_status *s)
{
return floatx80_compare(a, b, s) <= float_relation_equal;
}
static inline bool floatx80_lt(floatx80 a, floatx80 b, float_status *s)
{
return floatx80_compare(a, b, s) < float_relation_equal;
}
static inline bool floatx80_unordered(floatx80 a, floatx80 b, float_status *s)
{
return floatx80_compare(a, b, s) == float_relation_unordered;
}
static inline bool floatx80_eq_quiet(floatx80 a, floatx80 b, float_status *s)
{
return floatx80_compare_quiet(a, b, s) == float_relation_equal;
}
static inline bool floatx80_le_quiet(floatx80 a, floatx80 b, float_status *s)
{
return floatx80_compare_quiet(a, b, s) <= float_relation_equal;
}
static inline bool floatx80_lt_quiet(floatx80 a, floatx80 b, float_status *s)
{
return floatx80_compare_quiet(a, b, s) < float_relation_equal;
}
static inline bool floatx80_unordered_quiet(floatx80 a, floatx80 b,
float_status *s)
{
return floatx80_compare_quiet(a, b, s) == float_relation_unordered;
}
/*----------------------------------------------------------------------------
| Return whether the given value is an invalid floatx80 encoding.
| Invalid floatx80 encodings arise when the integer bit is not set, but
@ -722,7 +825,7 @@ static inline int32_t extractFloatx80Exp(floatx80 a)
| `a'.
*----------------------------------------------------------------------------*/
static inline flag extractFloatx80Sign(floatx80 a)
static inline bool extractFloatx80Sign(floatx80 a)
{
return a.high >> 15;
}
@ -732,7 +835,7 @@ static inline flag extractFloatx80Sign(floatx80 a)
| extended double-precision floating-point value, returning the result.
*----------------------------------------------------------------------------*/
static inline floatx80 packFloatx80(flag zSign, int32_t zExp, uint64_t zSig)
static inline floatx80 packFloatx80(bool zSign, int32_t zExp, uint64_t zSig)
{
floatx80 z;
@ -783,7 +886,7 @@ floatx80 propagateFloatx80NaN(floatx80 a, floatx80 b, float_status *status);
| Floating-Point Arithmetic.
*----------------------------------------------------------------------------*/
floatx80 roundAndPackFloatx80(int8_t roundingPrecision, flag zSign,
floatx80 roundAndPackFloatx80(int8_t roundingPrecision, bool zSign,
int32_t zExp, uint64_t zSig0, uint64_t zSig1,
float_status *status);
@ -797,7 +900,7 @@ floatx80 roundAndPackFloatx80(int8_t roundingPrecision, flag zSign,
*----------------------------------------------------------------------------*/
floatx80 normalizeRoundAndPackFloatx80(int8_t roundingPrecision,
flag zSign, int32_t zExp,
bool zSign, int32_t zExp,
uint64_t zSig0, uint64_t zSig1,
float_status *status);
@ -831,18 +934,10 @@ float128 float128_mul(float128, float128, float_status *status);
float128 float128_div(float128, float128, float_status *status);
float128 float128_rem(float128, float128, float_status *status);
float128 float128_sqrt(float128, float_status *status);
int float128_eq(float128, float128, float_status *status);
int float128_le(float128, float128, float_status *status);
int float128_lt(float128, float128, float_status *status);
int float128_unordered(float128, float128, float_status *status);
int float128_eq_quiet(float128, float128, float_status *status);
int float128_le_quiet(float128, float128, float_status *status);
int float128_lt_quiet(float128, float128, float_status *status);
int float128_unordered_quiet(float128, float128, float_status *status);
int float128_compare(float128, float128, float_status *status);
int float128_compare_quiet(float128, float128, float_status *status);
int float128_is_quiet_nan(float128, float_status *status);
int float128_is_signaling_nan(float128, float_status *status);
FloatRelation float128_compare(float128, float128, float_status *status);
FloatRelation float128_compare_quiet(float128, float128, float_status *status);
bool float128_is_quiet_nan(float128, float_status *status);
bool float128_is_signaling_nan(float128, float_status *status);
float128 float128_silence_nan(float128, float_status *status);
float128 float128_scalbn(float128, int, float_status *status);
@ -858,22 +953,22 @@ static inline float128 float128_chs(float128 a)
return a;
}
static inline int float128_is_infinity(float128 a)
static inline bool float128_is_infinity(float128 a)
{
return (a.high & 0x7fffffffffffffffLL) == 0x7fff000000000000LL && a.low == 0;
}
static inline int float128_is_neg(float128 a)
static inline bool float128_is_neg(float128 a)
{
return a.high >> 63;
}
static inline int float128_is_zero(float128 a)
static inline bool float128_is_zero(float128 a)
{
return (a.high & 0x7fffffffffffffffLL) == 0 && a.low == 0;
}
static inline int float128_is_zero_or_denormal(float128 a)
static inline bool float128_is_zero_or_denormal(float128 a)
{
return (a.high & 0x7fff000000000000LL) == 0;
}
@ -888,12 +983,53 @@ static inline bool float128_is_denormal(float128 a)
return float128_is_zero_or_denormal(a) && !float128_is_zero(a);
}
static inline int float128_is_any_nan(float128 a)
static inline bool float128_is_any_nan(float128 a)
{
return ((a.high >> 48) & 0x7fff) == 0x7fff &&
((a.low != 0) || ((a.high & 0xffffffffffffLL) != 0));
}
static inline bool float128_eq(float128 a, float128 b, float_status *s)
{
return float128_compare(a, b, s) == float_relation_equal;
}
static inline bool float128_le(float128 a, float128 b, float_status *s)
{
return float128_compare(a, b, s) <= float_relation_equal;
}
static inline bool float128_lt(float128 a, float128 b, float_status *s)
{
return float128_compare(a, b, s) < float_relation_equal;
}
static inline bool float128_unordered(float128 a, float128 b, float_status *s)
{
return float128_compare(a, b, s) == float_relation_unordered;
}
static inline bool float128_eq_quiet(float128 a, float128 b, float_status *s)
{
return float128_compare_quiet(a, b, s) == float_relation_equal;
}
static inline bool float128_le_quiet(float128 a, float128 b, float_status *s)
{
return float128_compare_quiet(a, b, s) <= float_relation_equal;
}
static inline bool float128_lt_quiet(float128 a, float128 b, float_status *s)
{
return float128_compare_quiet(a, b, s) < float_relation_equal;
}
static inline bool float128_unordered_quiet(float128 a, float128 b,
float_status *s)
{
return float128_compare_quiet(a, b, s) == float_relation_unordered;
}
#define float128_zero make_float128(0, 0)
/*----------------------------------------------------------------------------

View File

@ -3201,7 +3201,7 @@ void HELPER(NAME)(void *vd, void *vn, void *vg, void *status, uint32_t desc) \
*/
static inline float32 sve_f16_to_f32(float16 f, float_status *fpst)
{
flag save = get_flush_inputs_to_zero(fpst);
bool save = get_flush_inputs_to_zero(fpst);
float32 ret;
set_flush_inputs_to_zero(false, fpst);
@ -3212,7 +3212,7 @@ static inline float32 sve_f16_to_f32(float16 f, float_status *fpst)
static inline float64 sve_f16_to_f64(float16 f, float_status *fpst)
{
flag save = get_flush_inputs_to_zero(fpst);
bool save = get_flush_inputs_to_zero(fpst);
float64 ret;
set_flush_inputs_to_zero(false, fpst);
@ -3223,7 +3223,7 @@ static inline float64 sve_f16_to_f64(float16 f, float_status *fpst)
static inline float16 sve_f32_to_f16(float32 f, float_status *fpst)
{
flag save = get_flush_to_zero(fpst);
bool save = get_flush_to_zero(fpst);
float16 ret;
set_flush_to_zero(false, fpst);
@ -3234,7 +3234,7 @@ static inline float16 sve_f32_to_f16(float32 f, float_status *fpst)
static inline float16 sve_f64_to_f16(float64 f, float_status *fpst)
{
flag save = get_flush_to_zero(fpst);
bool save = get_flush_to_zero(fpst);
float16 ret;
set_flush_to_zero(false, fpst);

View File

@ -281,7 +281,7 @@ float64 VFP_HELPER(sqrt, d)(float64 a, CPUARMState *env)
return float64_sqrt(a, &env->vfp.fp_status);
}
static void softfloat_to_vfp_compare(CPUARMState *env, int cmp)
static void softfloat_to_vfp_compare(CPUARMState *env, FloatRelation cmp)
{
uint32_t flags;
switch (cmp) {
@ -531,7 +531,7 @@ float32 HELPER(vfp_fcvt_f16_to_f32)(uint32_t a, void *fpstp, uint32_t ahp_mode)
* it would affect flushing input denormals.
*/
float_status *fpst = fpstp;
flag save = get_flush_inputs_to_zero(fpst);
bool save = get_flush_inputs_to_zero(fpst);
set_flush_inputs_to_zero(false, fpst);
float32 r = float16_to_float32(a, !ahp_mode, fpst);
set_flush_inputs_to_zero(save, fpst);
@ -544,7 +544,7 @@ uint32_t HELPER(vfp_fcvt_f32_to_f16)(float32 a, void *fpstp, uint32_t ahp_mode)
* it would affect flushing output denormals.
*/
float_status *fpst = fpstp;
flag save = get_flush_to_zero(fpst);
bool save = get_flush_to_zero(fpst);
set_flush_to_zero(false, fpst);
float16 r = float32_to_float16(a, !ahp_mode, fpst);
set_flush_to_zero(save, fpst);
@ -557,7 +557,7 @@ float64 HELPER(vfp_fcvt_f16_to_f64)(uint32_t a, void *fpstp, uint32_t ahp_mode)
* it would affect flushing input denormals.
*/
float_status *fpst = fpstp;
flag save = get_flush_inputs_to_zero(fpst);
bool save = get_flush_inputs_to_zero(fpst);
set_flush_inputs_to_zero(false, fpst);
float64 r = float16_to_float64(a, !ahp_mode, fpst);
set_flush_inputs_to_zero(save, fpst);
@ -570,7 +570,7 @@ uint32_t HELPER(vfp_fcvt_f64_to_f16)(float64 a, void *fpstp, uint32_t ahp_mode)
* it would affect flushing output denormals.
*/
float_status *fpst = fpstp;
flag save = get_flush_to_zero(fpst);
bool save = get_flush_to_zero(fpst);
set_flush_to_zero(false, fpst);
float16 r = float64_to_float16(a, !ahp_mode, fpst);
set_flush_to_zero(save, fpst);
@ -697,9 +697,9 @@ static bool round_to_inf(float_status *fpst, bool sign_bit)
return sign_bit;
case float_round_to_zero: /* Round to Zero */
return false;
default:
g_assert_not_reached();
}
g_assert_not_reached();
}
uint32_t HELPER(recpe_f16)(uint32_t input, void *fpstp)

View File

@ -523,7 +523,8 @@ uint64_t HELPER(fcnv_t_d_udw)(CPUHPPAState *env, float64 arg)
return ret;
}
static void update_fr0_cmp(CPUHPPAState *env, uint32_t y, uint32_t c, int r)
static void update_fr0_cmp(CPUHPPAState *env, uint32_t y,
uint32_t c, FloatRelation r)
{
uint32_t shadow = env->fr0_shadow;
@ -565,7 +566,7 @@ static void update_fr0_cmp(CPUHPPAState *env, uint32_t y, uint32_t c, int r)
void HELPER(fcmp_s)(CPUHPPAState *env, float32 a, float32 b,
uint32_t y, uint32_t c)
{
int r;
FloatRelation r;
if (c & 1) {
r = float32_compare(a, b, &env->fp_status);
} else {
@ -578,7 +579,7 @@ void HELPER(fcmp_s)(CPUHPPAState *env, float32 a, float32 b,
void HELPER(fcmp_d)(CPUHPPAState *env, float64 a, float64 b,
uint32_t y, uint32_t c)
{
int r;
FloatRelation r;
if (c & 1) {
r = float64_compare(a, b, &env->fp_status);
} else {

View File

@ -420,7 +420,7 @@ static const int fcom_ccval[4] = {0x0100, 0x4000, 0x0000, 0x4500};
void helper_fcom_ST0_FT0(CPUX86State *env)
{
int ret;
FloatRelation ret;
ret = floatx80_compare(ST0, FT0, &env->fp_status);
env->fpus = (env->fpus & ~0x4500) | fcom_ccval[ret + 1];
@ -428,7 +428,7 @@ void helper_fcom_ST0_FT0(CPUX86State *env)
void helper_fucom_ST0_FT0(CPUX86State *env)
{
int ret;
FloatRelation ret;
ret = floatx80_compare_quiet(ST0, FT0, &env->fp_status);
env->fpus = (env->fpus & ~0x4500) | fcom_ccval[ret + 1];
@ -439,7 +439,7 @@ static const int fcomi_ccval[4] = {CC_C, CC_Z, 0, CC_Z | CC_P | CC_C};
void helper_fcomi_ST0_FT0(CPUX86State *env)
{
int eflags;
int ret;
FloatRelation ret;
ret = floatx80_compare(ST0, FT0, &env->fp_status);
eflags = cpu_cc_compute_all(env, CC_OP);
@ -450,7 +450,7 @@ void helper_fcomi_ST0_FT0(CPUX86State *env)
void helper_fucomi_ST0_FT0(CPUX86State *env)
{
int eflags;
int ret;
FloatRelation ret;
ret = floatx80_compare_quiet(ST0, FT0, &env->fp_status);
eflags = cpu_cc_compute_all(env, CC_OP);

View File

@ -1031,7 +1031,7 @@ static const int comis_eflags[4] = {CC_C, CC_Z, 0, CC_Z | CC_P | CC_C};
void helper_ucomiss(CPUX86State *env, Reg *d, Reg *s)
{
int ret;
FloatRelation ret;
float32 s0, s1;
s0 = d->ZMM_S(0);
@ -1042,7 +1042,7 @@ void helper_ucomiss(CPUX86State *env, Reg *d, Reg *s)
void helper_comiss(CPUX86State *env, Reg *d, Reg *s)
{
int ret;
FloatRelation ret;
float32 s0, s1;
s0 = d->ZMM_S(0);
@ -1053,7 +1053,7 @@ void helper_comiss(CPUX86State *env, Reg *d, Reg *s)
void helper_ucomisd(CPUX86State *env, Reg *d, Reg *s)
{
int ret;
FloatRelation ret;
float64 d0, d1;
d0 = d->ZMM_D(0);
@ -1064,7 +1064,7 @@ void helper_ucomisd(CPUX86State *env, Reg *d, Reg *s)
void helper_comisd(CPUX86State *env, Reg *d, Reg *s)
{
int ret;
FloatRelation ret;
float64 d0, d1;
d0 = d->ZMM_D(0);

View File

@ -149,7 +149,7 @@ void cpu_m68k_set_fpcr(CPUM68KState *env, uint32_t val)
void HELPER(fitrunc)(CPUM68KState *env, FPReg *res, FPReg *val)
{
int rounding_mode = get_float_rounding_mode(&env->fp_status);
FloatRoundMode rounding_mode = get_float_rounding_mode(&env->fp_status);
set_float_rounding_mode(float_round_to_zero, &env->fp_status);
res->d = floatx80_round_to_int(val->d, &env->fp_status);
set_float_rounding_mode(rounding_mode, &env->fp_status);
@ -300,7 +300,7 @@ void HELPER(fdmul)(CPUM68KState *env, FPReg *res, FPReg *val0, FPReg *val1)
void HELPER(fsglmul)(CPUM68KState *env, FPReg *res, FPReg *val0, FPReg *val1)
{
int rounding_mode = get_float_rounding_mode(&env->fp_status);
FloatRoundMode rounding_mode = get_float_rounding_mode(&env->fp_status);
floatx80 a, b;
PREC_BEGIN(32);
@ -333,7 +333,7 @@ void HELPER(fddiv)(CPUM68KState *env, FPReg *res, FPReg *val0, FPReg *val1)
void HELPER(fsgldiv)(CPUM68KState *env, FPReg *res, FPReg *val0, FPReg *val1)
{
int rounding_mode = get_float_rounding_mode(&env->fp_status);
FloatRoundMode rounding_mode = get_float_rounding_mode(&env->fp_status);
floatx80 a, b;
PREC_BEGIN(32);

View File

@ -49,7 +49,7 @@ static floatx80 propagateFloatx80NaNOneArg(floatx80 a, float_status *status)
floatx80 floatx80_mod(floatx80 a, floatx80 b, float_status *status)
{
flag aSign, zSign;
bool aSign, zSign;
int32_t aExp, bExp, expDiff;
uint64_t aSig0, aSig1, bSig;
uint64_t qTemp, term0, term1;
@ -132,7 +132,7 @@ floatx80 floatx80_mod(floatx80 a, floatx80 b, float_status *status)
floatx80 floatx80_getman(floatx80 a, float_status *status)
{
flag aSign;
bool aSign;
int32_t aExp;
uint64_t aSig;
@ -166,7 +166,7 @@ floatx80 floatx80_getman(floatx80 a, float_status *status)
floatx80 floatx80_getexp(floatx80 a, float_status *status)
{
flag aSign;
bool aSign;
int32_t aExp;
uint64_t aSig;
@ -202,7 +202,7 @@ floatx80 floatx80_getexp(floatx80 a, float_status *status)
floatx80 floatx80_scale(floatx80 a, floatx80 b, float_status *status)
{
flag aSign, bSign;
bool aSign, bSign;
int32_t aExp, bExp, shiftCount;
uint64_t aSig, bSig;
@ -258,7 +258,7 @@ floatx80 floatx80_scale(floatx80 a, floatx80 b, float_status *status)
floatx80 floatx80_move(floatx80 a, float_status *status)
{
flag aSign;
bool aSign;
int32_t aExp;
uint64_t aSig;
@ -306,7 +306,7 @@ static int32_t floatx80_make_compact(int32_t aExp, uint64_t aSig)
floatx80 floatx80_lognp1(floatx80 a, float_status *status)
{
flag aSign;
bool aSign;
int32_t aExp;
uint64_t aSig, fSig;
@ -505,7 +505,7 @@ floatx80 floatx80_lognp1(floatx80 a, float_status *status)
floatx80 floatx80_logn(floatx80 a, float_status *status)
{
flag aSign;
bool aSign;
int32_t aExp;
uint64_t aSig, fSig;
@ -673,7 +673,7 @@ floatx80 floatx80_logn(floatx80 a, float_status *status)
floatx80 floatx80_log10(floatx80 a, float_status *status)
{
flag aSign;
bool aSign;
int32_t aExp;
uint64_t aSig;
@ -730,7 +730,7 @@ floatx80 floatx80_log10(floatx80 a, float_status *status)
floatx80 floatx80_log2(floatx80 a, float_status *status)
{
flag aSign;
bool aSign;
int32_t aExp;
uint64_t aSig;
@ -797,7 +797,7 @@ floatx80 floatx80_log2(floatx80 a, float_status *status)
floatx80 floatx80_etox(floatx80 a, float_status *status)
{
flag aSign;
bool aSign;
int32_t aExp;
uint64_t aSig;
@ -805,7 +805,7 @@ floatx80 floatx80_etox(floatx80 a, float_status *status)
int32_t compact, n, j, k, m, m1;
floatx80 fp0, fp1, fp2, fp3, l2, scale, adjscale;
flag adjflag;
bool adjflag;
aSig = extractFloatx80Frac(a);
aExp = extractFloatx80Exp(a);
@ -981,7 +981,7 @@ floatx80 floatx80_etox(floatx80 a, float_status *status)
floatx80 floatx80_twotox(floatx80 a, float_status *status)
{
flag aSign;
bool aSign;
int32_t aExp;
uint64_t aSig;
@ -1131,7 +1131,7 @@ floatx80 floatx80_twotox(floatx80 a, float_status *status)
floatx80 floatx80_tentox(floatx80 a, float_status *status)
{
flag aSign;
bool aSign;
int32_t aExp;
uint64_t aSig;
@ -1286,7 +1286,7 @@ floatx80 floatx80_tentox(floatx80 a, float_status *status)
floatx80 floatx80_tan(floatx80 a, float_status *status)
{
flag aSign, xSign;
bool aSign, xSign;
int32_t aExp, xExp;
uint64_t aSig, xSig;
@ -1295,7 +1295,7 @@ floatx80 floatx80_tan(floatx80 a, float_status *status)
int32_t compact, l, n, j;
floatx80 fp0, fp1, fp2, fp3, fp4, fp5, invtwopi, twopi1, twopi2;
float32 twoto63;
flag endflag;
bool endflag;
aSig = extractFloatx80Frac(a);
aExp = extractFloatx80Exp(a);
@ -1344,10 +1344,10 @@ floatx80 floatx80_tan(floatx80 a, float_status *status)
xExp -= 0x3FFF;
if (xExp <= 28) {
l = 0;
endflag = 1;
endflag = true;
} else {
l = xExp - 27;
endflag = 0;
endflag = false;
}
invtwopi = packFloatx80(0, 0x3FFE - l,
UINT64_C(0xA2F9836E4E44152A)); /* INVTWOPI */
@ -1372,7 +1372,7 @@ floatx80 floatx80_tan(floatx80 a, float_status *status)
fp1 = floatx80_sub(fp1, fp4, status); /* FP1 is a := r - p */
fp0 = floatx80_add(fp0, fp1, status); /* FP0 is R := A+a */
if (endflag > 0) {
if (endflag) {
n = floatx80_to_int32(fp2, status);
goto tancont;
}
@ -1496,7 +1496,7 @@ floatx80 floatx80_tan(floatx80 a, float_status *status)
floatx80 floatx80_sin(floatx80 a, float_status *status)
{
flag aSign, xSign;
bool aSign, xSign;
int32_t aExp, xExp;
uint64_t aSig, xSig;
@ -1505,7 +1505,7 @@ floatx80 floatx80_sin(floatx80 a, float_status *status)
int32_t compact, l, n, j;
floatx80 fp0, fp1, fp2, fp3, fp4, fp5, x, invtwopi, twopi1, twopi2;
float32 posneg1, twoto63;
flag endflag;
bool endflag;
aSig = extractFloatx80Frac(a);
aExp = extractFloatx80Exp(a);
@ -1554,10 +1554,10 @@ floatx80 floatx80_sin(floatx80 a, float_status *status)
xExp -= 0x3FFF;
if (xExp <= 28) {
l = 0;
endflag = 1;
endflag = true;
} else {
l = xExp - 27;
endflag = 0;
endflag = false;
}
invtwopi = packFloatx80(0, 0x3FFE - l,
UINT64_C(0xA2F9836E4E44152A)); /* INVTWOPI */
@ -1582,7 +1582,7 @@ floatx80 floatx80_sin(floatx80 a, float_status *status)
fp1 = floatx80_sub(fp1, fp4, status); /* FP1 is a := r - p */
fp0 = floatx80_add(fp0, fp1, status); /* FP0 is R := A+a */
if (endflag > 0) {
if (endflag) {
n = floatx80_to_int32(fp2, status);
goto sincont;
}
@ -1735,7 +1735,7 @@ floatx80 floatx80_sin(floatx80 a, float_status *status)
floatx80 floatx80_cos(floatx80 a, float_status *status)
{
flag aSign, xSign;
bool aSign, xSign;
int32_t aExp, xExp;
uint64_t aSig, xSig;
@ -1744,7 +1744,7 @@ floatx80 floatx80_cos(floatx80 a, float_status *status)
int32_t compact, l, n, j;
floatx80 fp0, fp1, fp2, fp3, fp4, fp5, x, invtwopi, twopi1, twopi2;
float32 posneg1, twoto63;
flag endflag;
bool endflag;
aSig = extractFloatx80Frac(a);
aExp = extractFloatx80Exp(a);
@ -1793,10 +1793,10 @@ floatx80 floatx80_cos(floatx80 a, float_status *status)
xExp -= 0x3FFF;
if (xExp <= 28) {
l = 0;
endflag = 1;
endflag = true;
} else {
l = xExp - 27;
endflag = 0;
endflag = false;
}
invtwopi = packFloatx80(0, 0x3FFE - l,
UINT64_C(0xA2F9836E4E44152A)); /* INVTWOPI */
@ -1821,7 +1821,7 @@ floatx80 floatx80_cos(floatx80 a, float_status *status)
fp1 = floatx80_sub(fp1, fp4, status); /* FP1 is a := r - p */
fp0 = floatx80_add(fp0, fp1, status); /* FP0 is R := A+a */
if (endflag > 0) {
if (endflag) {
n = floatx80_to_int32(fp2, status);
goto sincont;
}
@ -1972,7 +1972,7 @@ floatx80 floatx80_cos(floatx80 a, float_status *status)
floatx80 floatx80_atan(floatx80 a, float_status *status)
{
flag aSign;
bool aSign;
int32_t aExp;
uint64_t aSig;
@ -2169,7 +2169,7 @@ floatx80 floatx80_atan(floatx80 a, float_status *status)
floatx80 floatx80_asin(floatx80 a, float_status *status)
{
flag aSign;
bool aSign;
int32_t aExp;
uint64_t aSig;
@ -2234,7 +2234,7 @@ floatx80 floatx80_asin(floatx80 a, float_status *status)
floatx80 floatx80_acos(floatx80 a, float_status *status)
{
flag aSign;
bool aSign;
int32_t aExp;
uint64_t aSig;
@ -2303,7 +2303,7 @@ floatx80 floatx80_acos(floatx80 a, float_status *status)
floatx80 floatx80_atanh(floatx80 a, float_status *status)
{
flag aSign;
bool aSign;
int32_t aExp;
uint64_t aSig;
@ -2368,7 +2368,7 @@ floatx80 floatx80_atanh(floatx80 a, float_status *status)
floatx80 floatx80_etoxm1(floatx80 a, float_status *status)
{
flag aSign;
bool aSign;
int32_t aExp;
uint64_t aSig;
@ -2620,7 +2620,7 @@ floatx80 floatx80_etoxm1(floatx80 a, float_status *status)
floatx80 floatx80_tanh(floatx80 a, float_status *status)
{
flag aSign, vSign;
bool aSign, vSign;
int32_t aExp, vExp;
uint64_t aSig, vSig;
@ -2735,7 +2735,7 @@ floatx80 floatx80_tanh(floatx80 a, float_status *status)
floatx80 floatx80_sinh(floatx80 a, float_status *status)
{
flag aSign;
bool aSign;
int32_t aExp;
uint64_t aSig;

View File

@ -5508,7 +5508,7 @@ static inline int get_enabled_exceptions(const CPUMIPSState *env, int c)
return c & enable;
}
static inline float16 float16_from_float32(int32_t a, flag ieee,
static inline float16 float16_from_float32(int32_t a, bool ieee,
float_status *status)
{
float16 f_val;
@ -5527,7 +5527,7 @@ static inline float32 float32_from_float64(int64_t a, float_status *status)
return a < 0 ? (f_val | (1 << 31)) : f_val;
}
static inline float32 float32_from_float16(int16_t a, flag ieee,
static inline float32 float32_from_float16(int16_t a, bool ieee,
float_status *status)
{
float32 f_val;
@ -6564,7 +6564,7 @@ void helper_msa_fexdo_df(CPUMIPSState *env, uint32_t df, uint32_t wd,
* IEEE and "ARM" format. The latter gains extra exponent
* range by omitting the NaN/Inf encodings.
*/
flag ieee = 1;
bool ieee = true;
MSA_FLOAT_BINOP(Lh(pwx, i), from_float32, pws->w[i], ieee, 16);
MSA_FLOAT_BINOP(Rh(pwx, i), from_float32, pwt->w[i], ieee, 16);
@ -7178,7 +7178,7 @@ void helper_msa_fexupl_df(CPUMIPSState *env, uint32_t df, uint32_t wd,
* IEEE and "ARM" format. The latter gains extra exponent
* range by omitting the NaN/Inf encodings.
*/
flag ieee = 1;
bool ieee = true;
MSA_FLOAT_BINOP(pwx->w[i], from_float16, Lh(pws, i), ieee, 32);
}
@ -7214,7 +7214,7 @@ void helper_msa_fexupr_df(CPUMIPSState *env, uint32_t df, uint32_t wd,
* IEEE and "ARM" format. The latter gains extra exponent
* range by omitting the NaN/Inf encodings.
*/
flag ieee = 1;
bool ieee = true;
MSA_FLOAT_BINOP(pwx->w[i], from_float16, Rh(pws, i), ieee, 32);
}

View File

@ -155,13 +155,13 @@ FLOAT_CMP(un, unordered_quiet)
target_ulong helper_float_ ## name ## _d(CPUOpenRISCState *env, \
uint64_t fdt0, uint64_t fdt1) \
{ \
int r = float64_compare_quiet(fdt0, fdt1, &env->fp_status); \
FloatRelation r = float64_compare_quiet(fdt0, fdt1, &env->fp_status); \
return expr; \
} \
target_ulong helper_float_ ## name ## _s(CPUOpenRISCState *env, \
uint32_t fdt0, uint32_t fdt1) \
{ \
int r = float32_compare_quiet(fdt0, fdt1, &env->fp_status); \
FloatRelation r = float32_compare_quiet(fdt0, fdt1, &env->fp_status); \
return expr; \
}

View File

@ -770,8 +770,9 @@ VCMPNE(w, u32, uint32_t, 0)
\
for (i = 0; i < ARRAY_SIZE(r->f32); i++) { \
uint32_t result; \
int rel = float32_compare_quiet(a->f32[i], b->f32[i], \
&env->vec_status); \
FloatRelation rel = \
float32_compare_quiet(a->f32[i], b->f32[i], \
&env->vec_status); \
if (rel == float_relation_unordered) { \
result = 0; \
} else if (rel compare order) { \
@ -803,15 +804,15 @@ static inline void vcmpbfp_internal(CPUPPCState *env, ppc_avr_t *r,
int all_in = 0;
for (i = 0; i < ARRAY_SIZE(r->f32); i++) {
int le_rel = float32_compare_quiet(a->f32[i], b->f32[i],
&env->vec_status);
FloatRelation le_rel = float32_compare_quiet(a->f32[i], b->f32[i],
&env->vec_status);
if (le_rel == float_relation_unordered) {
r->u32[i] = 0xc0000000;
all_in = 1;
} else {
float32 bneg = float32_chs(b->f32[i]);
int ge_rel = float32_compare_quiet(a->f32[i], bneg,
&env->vec_status);
FloatRelation ge_rel = float32_compare_quiet(a->f32[i], bneg,
&env->vec_status);
int le = le_rel != float_relation_greater;
int ge = ge_rel != float_relation_less;

View File

@ -112,7 +112,7 @@ static void handle_exceptions(CPUS390XState *env, bool XxC, uintptr_t retaddr)
}
}
int float_comp_to_cc(CPUS390XState *env, int float_compare)
int float_comp_to_cc(CPUS390XState *env, FloatRelation float_compare)
{
switch (float_compare) {
case float_relation_equal:
@ -368,7 +368,7 @@ uint64_t HELPER(lexb)(CPUS390XState *env, uint64_t ah, uint64_t al,
/* 32-bit FP compare */
uint32_t HELPER(ceb)(CPUS390XState *env, uint64_t f1, uint64_t f2)
{
int cmp = float32_compare_quiet(f1, f2, &env->fpu_status);
FloatRelation cmp = float32_compare_quiet(f1, f2, &env->fpu_status);
handle_exceptions(env, false, GETPC());
return float_comp_to_cc(env, cmp);
}
@ -376,7 +376,7 @@ uint32_t HELPER(ceb)(CPUS390XState *env, uint64_t f1, uint64_t f2)
/* 64-bit FP compare */
uint32_t HELPER(cdb)(CPUS390XState *env, uint64_t f1, uint64_t f2)
{
int cmp = float64_compare_quiet(f1, f2, &env->fpu_status);
FloatRelation cmp = float64_compare_quiet(f1, f2, &env->fpu_status);
handle_exceptions(env, false, GETPC());
return float_comp_to_cc(env, cmp);
}
@ -385,9 +385,9 @@ uint32_t HELPER(cdb)(CPUS390XState *env, uint64_t f1, uint64_t f2)
uint32_t HELPER(cxb)(CPUS390XState *env, uint64_t ah, uint64_t al,
uint64_t bh, uint64_t bl)
{
int cmp = float128_compare_quiet(make_float128(ah, al),
make_float128(bh, bl),
&env->fpu_status);
FloatRelation cmp = float128_compare_quiet(make_float128(ah, al),
make_float128(bh, bl),
&env->fpu_status);
handle_exceptions(env, false, GETPC());
return float_comp_to_cc(env, cmp);
}
@ -675,7 +675,7 @@ uint64_t HELPER(fixb)(CPUS390XState *env, uint64_t ah, uint64_t al,
/* 32-bit FP compare and signal */
uint32_t HELPER(keb)(CPUS390XState *env, uint64_t f1, uint64_t f2)
{
int cmp = float32_compare(f1, f2, &env->fpu_status);
FloatRelation cmp = float32_compare(f1, f2, &env->fpu_status);
handle_exceptions(env, false, GETPC());
return float_comp_to_cc(env, cmp);
}
@ -683,7 +683,7 @@ uint32_t HELPER(keb)(CPUS390XState *env, uint64_t f1, uint64_t f2)
/* 64-bit FP compare and signal */
uint32_t HELPER(kdb)(CPUS390XState *env, uint64_t f1, uint64_t f2)
{
int cmp = float64_compare(f1, f2, &env->fpu_status);
FloatRelation cmp = float64_compare(f1, f2, &env->fpu_status);
handle_exceptions(env, false, GETPC());
return float_comp_to_cc(env, cmp);
}
@ -692,9 +692,9 @@ uint32_t HELPER(kdb)(CPUS390XState *env, uint64_t f1, uint64_t f2)
uint32_t HELPER(kxb)(CPUS390XState *env, uint64_t ah, uint64_t al,
uint64_t bh, uint64_t bl)
{
int cmp = float128_compare(make_float128(ah, al),
make_float128(bh, bl),
&env->fpu_status);
FloatRelation cmp = float128_compare(make_float128(ah, al),
make_float128(bh, bl),
&env->fpu_status);
handle_exceptions(env, false, GETPC());
return float_comp_to_cc(env, cmp);
}

View File

@ -174,7 +174,7 @@ void HELPER(gvec_wfk64)(const void *v1, const void *v2, CPUS390XState *env,
env->cc_op = wfc64(v1, v2, env, true, GETPC());
}
typedef int (*vfc64_fn)(float64 a, float64 b, float_status *status);
typedef bool (*vfc64_fn)(float64 a, float64 b, float_status *status);
static int vfc64(S390Vector *v1, const S390Vector *v2, const S390Vector *v3,
CPUS390XState *env, bool s, vfc64_fn fn, uintptr_t retaddr)
{

View File

@ -264,7 +264,7 @@ void helper_fsqrtq(CPUSPARCState *env)
#define GEN_FCMP(name, size, reg1, reg2, FS, E) \
target_ulong glue(helper_, name) (CPUSPARCState *env) \
{ \
int ret; \
FloatRelation ret; \
target_ulong fsr; \
if (E) { \
ret = glue(size, _compare)(reg1, reg2, &env->fp_status); \
@ -295,7 +295,7 @@ void helper_fsqrtq(CPUSPARCState *env)
#define GEN_FCMP_T(name, size, FS, E) \
target_ulong glue(helper_, name)(CPUSPARCState *env, size src1, size src2)\
{ \
int ret; \
FloatRelation ret; \
target_ulong fsr; \
if (E) { \
ret = glue(size, _compare)(src1, src2, &env->fp_status); \

View File

@ -174,8 +174,7 @@ float64 HELPER(ucf64_absd)(float64 a)
void HELPER(ucf64_cmps)(float32 a, float32 b, uint32_t c,
CPUUniCore32State *env)
{
int flag;
flag = float32_compare_quiet(a, b, &env->ucf64.fp_status);
FloatRelation flag = float32_compare_quiet(a, b, &env->ucf64.fp_status);
env->CF = 0;
switch (c & 0x7) {
case 0: /* F */
@ -223,8 +222,7 @@ void HELPER(ucf64_cmps)(float32 a, float32 b, uint32_t c,
void HELPER(ucf64_cmpd)(float64 a, float64 b, uint32_t c,
CPUUniCore32State *env)
{
int flag;
flag = float64_compare_quiet(a, b, &env->ucf64.fp_status);
FloatRelation flag = float64_compare_quiet(a, b, &env->ucf64.fp_status);
env->CF = 0;
switch (c & 0x7) {
case 0: /* F */

View File

@ -139,7 +139,7 @@ void HELPER(oeq_s)(CPUXtensaState *env, uint32_t br, float32 a, float32 b)
void HELPER(ueq_s)(CPUXtensaState *env, uint32_t br, float32 a, float32 b)
{
int v = float32_compare_quiet(a, b, &env->fp_status);
FloatRelation v = float32_compare_quiet(a, b, &env->fp_status);
set_br(env, v == float_relation_equal || v == float_relation_unordered, br);
}
@ -150,7 +150,7 @@ void HELPER(olt_s)(CPUXtensaState *env, uint32_t br, float32 a, float32 b)
void HELPER(ult_s)(CPUXtensaState *env, uint32_t br, float32 a, float32 b)
{
int v = float32_compare_quiet(a, b, &env->fp_status);
FloatRelation v = float32_compare_quiet(a, b, &env->fp_status);
set_br(env, v == float_relation_less || v == float_relation_unordered, br);
}
@ -161,6 +161,6 @@ void HELPER(ole_s)(CPUXtensaState *env, uint32_t br, float32 a, float32 b)
void HELPER(ule_s)(CPUXtensaState *env, uint32_t br, float32 a, float32 b)
{
int v = float32_compare_quiet(a, b, &env->fp_status);
FloatRelation v = float32_compare_quiet(a, b, &env->fp_status);
set_br(env, v != float_relation_greater, br);
}

View File

@ -989,7 +989,7 @@ static void QEMU_NORETURN run_test(void)
verCases_tininessCode = 0;
slowfloat_detectTininess = tmode;
qsf.float_detect_tininess = sf_tininess_to_qemu(tmode);
qsf.tininess_before_rounding = sf_tininess_to_qemu(tmode);
if (attrs & FUNC_EFF_TININESSMODE ||
((attrs & FUNC_EFF_TININESSMODE_REDUCEDPREC) &&