Don't define USE_LONG_DOUBLE when sizeof(long double) == 16. This still

is not very clean but it should build now. Probably live with USE_LONG_DOUBLE
for any case where native long double exists and sizeof > 8 ?
This commit is contained in:
gbeauche 2002-09-19 16:02:13 +00:00
parent b765112cf9
commit a5ba7ea5ac
3 changed files with 51 additions and 52 deletions

View File

@ -1591,7 +1591,7 @@ void FFPU fpuop_arithmetic(uae_u32 opcode, uae_u32 extra)
FPU registers[reg] = 1.0e256;
fpu_debug(("FP const: 1.0e256\n"));
break;
#if USE_LONG_DOUBLE
#if USE_LONG_DOUBLE || USE_QUAD_DOUBLE
case 0x3c:
FPU registers[reg] = 1.0e512;
fpu_debug(("FP const: 1.0e512\n"));
@ -1967,7 +1967,10 @@ void FFPU fpuop_arithmetic(uae_u32 opcode, uae_u32 extra)
// an overflow or underflow always results.
// Here (int) cast is okay.
int scale_factor = (int)fp_round_to_zero(src);
#ifndef USE_LONG_DOUBLE
#if USE_LONG_DOUBLE || USE_QUAD_DOUBLE
fp_declare_init_shape(sxp, FPU registers[reg], extended);
sxp->ieee.exponent += scale_factor;
#else
fp_declare_init_shape(sxp, FPU registers[reg], double);
uae_u32 exp = sxp->ieee.exponent + scale_factor;
if (exp < FP_EXTENDED_EXP_BIAS - FP_DOUBLE_EXP_BIAS)
@ -1977,9 +1980,6 @@ void FFPU fpuop_arithmetic(uae_u32 opcode, uae_u32 extra)
else
exp += FP_DOUBLE_EXP_BIAS - FP_EXTENDED_EXP_BIAS;
sxp->ieee.exponent = exp;
#else
fp_declare_init_shape(sxp, FPU registers[reg], extended);
sxp->ieee.exponent += scale_factor;
#endif
}
else if (fl_source.infinity) {

View File

@ -395,12 +395,12 @@ PRIVATE inline bool FFPU fp_do_isnan(fpu_register const & r)
return (int)(((uae_u32)(se)) >> 16);
#endif
#else
#ifndef USE_LONG_DOUBLE
fp_declare_init_shape(sxp, r, double);
return (sxp->ieee_nan.exponent == FP_DOUBLE_EXP_MAX)
#else
#if USE_LONG_DOUBLE || USE_QUAD_DOUBLE
fp_declare_init_shape(sxp, r, extended);
return (sxp->ieee_nan.exponent == FP_EXTENDED_EXP_MAX)
#else
fp_declare_init_shape(sxp, r, double);
return (sxp->ieee_nan.exponent == FP_DOUBLE_EXP_MAX)
#endif
&& (sxp->ieee_nan.mantissa0 != 0)
&& (sxp->ieee_nan.mantissa1 != 0)
@ -454,12 +454,12 @@ PRIVATE inline bool FFPU fp_do_isinf(fpu_register const & r)
return ~(lx >> 31) & (1 - (se >> 14));
#endif
#else
#ifndef USE_LONG_DOUBLE
fp_declare_init_shape(sxp, r, double);
return (sxp->ieee_nan.exponent == FP_DOUBLE_EXP_MAX)
#else
#if USE_LONG_DOUBLE || USE_QUAD_DOUBLE
fp_declare_init_shape(sxp, r, extended);
return (sxp->ieee_nan.exponent == FP_EXTENDED_EXP_MAX)
#else
fp_declare_init_shape(sxp, r, double);
return (sxp->ieee_nan.exponent == FP_DOUBLE_EXP_MAX)
#endif
&& (sxp->ieee_nan.mantissa0 == 0)
&& (sxp->ieee_nan.mantissa1 == 0)
@ -476,10 +476,10 @@ PRIVATE inline bool FFPU fp_do_isinf(fpu_register const & r)
PRIVATE inline bool FFPU fp_do_isneg(fpu_register const & r)
{
#ifndef USE_LONG_DOUBLE
fp_declare_init_shape(sxp, r, double);
#else
#if USE_LONG_DOUBLE || USE_QUAD_DOUBLE
fp_declare_init_shape(sxp, r, extended);
#else
fp_declare_init_shape(sxp, r, double);
#endif
return sxp->ieee.negative;
}
@ -490,10 +490,10 @@ PRIVATE inline bool FFPU fp_do_isneg(fpu_register const & r)
PRIVATE inline bool FFPU fp_do_iszero(fpu_register const & r)
{
// TODO: BRANCHES_ARE_EXPENSIVE
#ifndef USE_LONG_DOUBLE
fp_declare_init_shape(sxp, r, double);
#else
#if USE_LONG_DOUBLE || USE_QUAD_DOUBLE
fp_declare_init_shape(sxp, r, extended);
#else
fp_declare_init_shape(sxp, r, double);
#endif
return (sxp->ieee.exponent == 0)
&& (sxp->ieee.mantissa0 == 0)
@ -526,14 +526,14 @@ PRIVATE inline void FFPU get_source_flags(fpu_register const & r)
PRIVATE inline void FFPU make_nan(fpu_register & r)
{
// FIXME: is that correct ?
#ifndef USE_LONG_DOUBLE
fp_declare_init_shape(sxp, r, double);
sxp->ieee.exponent = FP_DOUBLE_EXP_MAX;
sxp->ieee.mantissa0 = 0xfffff;
#else
#if USE_LONG_DOUBLE || USE_QUAD_DOUBLE
fp_declare_init_shape(sxp, r, extended);
sxp->ieee.exponent = FP_EXTENDED_EXP_MAX;
sxp->ieee.mantissa0 = 0xffffffff;
#else
fp_declare_init_shape(sxp, r, double);
sxp->ieee.exponent = FP_DOUBLE_EXP_MAX;
sxp->ieee.mantissa0 = 0xfffff;
#endif
sxp->ieee.mantissa1 = 0xffffffff;
#ifdef USE_QUAD_DOUBLE
@ -547,10 +547,10 @@ PRIVATE inline void FFPU make_zero_positive(fpu_register & r)
#if 1
r = +0.0;
#else
#ifndef USE_LONG_DOUBLE
fp_declare_init_shape(sxp, r, double);
#else
#if USE_LONG_DOUBLE || USE_QUAD_DOUBLE
fp_declare_init_shape(sxp, r, extended);
#else
fp_declare_init_shape(sxp, r, double);
#endif
sxp->ieee.negative = 0;
sxp->ieee.exponent = 0;
@ -568,10 +568,10 @@ PRIVATE inline void FFPU make_zero_negative(fpu_register & r)
#if 1
r = -0.0;
#else
#ifndef USE_LONG_DOUBLE
fp_declare_init_shape(sxp, r, double);
#else
#if USE_LONG_DOUBLE || USE_QUAD_DOUBLE
fp_declare_init_shape(sxp, r, extended);
#else
fp_declare_init_shape(sxp, r, double);
#endif
sxp->ieee.negative = 1;
sxp->ieee.exponent = 0;
@ -586,12 +586,12 @@ PRIVATE inline void FFPU make_zero_negative(fpu_register & r)
PRIVATE inline void FFPU make_inf_positive(fpu_register & r)
{
#ifndef USE_LONG_DOUBLE
fp_declare_init_shape(sxp, r, double);
sxp->ieee_nan.exponent = FP_DOUBLE_EXP_MAX;
#else
#if USE_LONG_DOUBLE || USE_QUAD_DOUBLE
fp_declare_init_shape(sxp, r, extended);
sxp->ieee_nan.exponent = FP_EXTENDED_EXP_MAX;
#else
fp_declare_init_shape(sxp, r, double);
sxp->ieee_nan.exponent = FP_DOUBLE_EXP_MAX;
#endif
sxp->ieee_nan.negative = 0;
sxp->ieee_nan.mantissa0 = 0;
@ -604,12 +604,12 @@ PRIVATE inline void FFPU make_inf_positive(fpu_register & r)
PRIVATE inline void FFPU make_inf_negative(fpu_register & r)
{
#ifndef USE_LONG_DOUBLE
fp_declare_init_shape(sxp, r, double);
sxp->ieee_nan.exponent = FP_DOUBLE_EXP_MAX;
#else
#if USE_LONG_DOUBLE || USE_QUAD_DOUBLE
fp_declare_init_shape(sxp, r, extended);
sxp->ieee_nan.exponent = FP_EXTENDED_EXP_MAX;
#else
fp_declare_init_shape(sxp, r, double);
sxp->ieee_nan.exponent = FP_DOUBLE_EXP_MAX;
#endif
sxp->ieee_nan.negative = 1;
sxp->ieee_nan.mantissa0 = 0;
@ -622,24 +622,24 @@ PRIVATE inline void FFPU make_inf_negative(fpu_register & r)
PRIVATE inline fpu_register FFPU fast_fgetexp(fpu_register const & r)
{
#ifndef USE_LONG_DOUBLE
fp_declare_init_shape(sxp, r, double);
return (sxp->ieee.exponent - FP_DOUBLE_EXP_BIAS);
#else
#if USE_LONG_DOUBLE || USE_QUAD_DOUBLE
fp_declare_init_shape(sxp, r, extended);
return (sxp->ieee.exponent - FP_EXTENDED_EXP_BIAS);
#else
fp_declare_init_shape(sxp, r, double);
return (sxp->ieee.exponent - FP_DOUBLE_EXP_BIAS);
#endif
}
// Normalize to range 1..2
PRIVATE inline void FFPU fast_remove_exponent(fpu_register & r)
{
#ifndef USE_LONG_DOUBLE
fp_declare_init_shape(sxp, r, double);
sxp->ieee.exponent = FP_DOUBLE_EXP_BIAS;
#else
#if USE_LONG_DOUBLE || USE_QUAD_DOUBLE
fp_declare_init_shape(sxp, r, extended);
sxp->ieee.exponent = FP_EXTENDED_EXP_BIAS;
#else
fp_declare_init_shape(sxp, r, double);
sxp->ieee.exponent = FP_DOUBLE_EXP_BIAS;
#endif
}
@ -647,12 +647,12 @@ PRIVATE inline void FFPU fast_remove_exponent(fpu_register & r)
// of the source and destination operands.
PRIVATE inline uae_u32 FFPU get_quotient_sign(fpu_register const & ra, fpu_register const & rb)
{
#ifndef USE_LONG_DOUBLE
fp_declare_init_shape(sap, ra, double);
fp_declare_init_shape(sbp, rb, double);
#else
#if USE_LONG_DOUBLE || USE_QUAD_DOUBLE
fp_declare_init_shape(sap, ra, extended);
fp_declare_init_shape(sbp, rb, extended);
#else
fp_declare_init_shape(sap, ra, double);
fp_declare_init_shape(sbp, rb, double);
#endif
return ((sap->ieee.negative ^ sbp->ieee.negative) ? FPSR_QUOTIENT_SIGN : 0);
}
@ -661,7 +661,7 @@ PRIVATE inline uae_u32 FFPU get_quotient_sign(fpu_register const & ra, fpu_regis
/* --- Math functions --- */
/* -------------------------------------------------------------------------- */
#if FPU_USE_ISO_C99 && USE_LONG_DOUBLE
#if FPU_USE_ISO_C99 && (USE_LONG_DOUBLE || USE_QUAD_DOUBLE)
# ifdef HAVE_LOGL
# define fp_log logl
# endif

View File

@ -136,7 +136,6 @@ typedef uae_f96 fpu_register;
#elif SIZEOF_LONG_DOUBLE == 16
typedef long double uae_f128;
typedef uae_f128 fpu_register;
#define USE_LONG_DOUBLE 1
#define USE_QUAD_DOUBLE 1
#else
typedef uae_f64 fpu_register;