Message ID | 1303160412-8107-4-git-send-email-aurelien@aurel32.net |
---|---|
State | New |
Headers | show |
On 18 April 2011 21:59, Aurelien Jarno <aurelien@aurel32.net> wrote: > Add floatx80 constants similarly to float32 or float64. > > Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> NB: I didn't actually check you got the ln2 value right :-) Also for x86 these constants are stored internally with a 66 bit mantissa and then rounded according to the current rounding mode, so strictly speaking using these values isn't always the right thing, but I think that's being overly picky for now. -- PMM
On Tue, Apr 19, 2011 at 12:07:26PM +0100, Peter Maydell wrote: > On 18 April 2011 21:59, Aurelien Jarno <aurelien@aurel32.net> wrote: > > Add floatx80 constants similarly to float32 or float64. > > > > Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> > > Reviewed-by: Peter Maydell <peter.maydell@linaro.org> > > NB: I didn't actually check you got the ln2 value right :-) > Also for x86 these constants are stored internally with a 66 bit > mantissa and then rounded according to the current rounding mode, > so strictly speaking using these values isn't always the right > thing, but I think that's being overly picky for now. > Agreed, however it's probably something x86 specific, so that should be handled in target-i386. That said except on old ARM Netwinder chips, only Intel is using floatx80.
diff --git a/fpu/softfloat.h b/fpu/softfloat.h index 3363128..90e0c41 100644 --- a/fpu/softfloat.h +++ b/fpu/softfloat.h @@ -154,6 +154,7 @@ typedef struct { uint64_t low; uint16_t high; } floatx80; +#define make_floatx80(exp, mant) ((floatx80) { mant, exp }) #endif #ifdef FLOAT128 typedef struct { @@ -584,6 +585,12 @@ INLINE int floatx80_is_any_nan(floatx80 a) return ((a.high & 0x7fff) == 0x7fff) && (a.low<<1); } +#define floatx80_zero make_floatx80(0x0000, 0x0000000000000000LL) +#define floatx80_one make_floatx80(0x3fff, 0x8000000000000000LL) +#define floatx80_ln2 make_floatx80(0x3ffe, 0xb17217f7d1cf79acLL) +#define floatx80_half make_floatx80(0x3ffe, 0x8000000000000000LL) +#define floatx80_infinity make_floatx80(0x7fff, 0x8000000000000000LL) + /*---------------------------------------------------------------------------- | The pattern for a default generated extended double-precision NaN. The | `high' and `low' values hold the most- and least-significant bits,
Add floatx80 constants similarly to float32 or float64. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> --- fpu/softfloat.h | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)