--- BasiliskII/src/uae_cpu/fpu/mathlib.h 2002/09/16 12:01:38 1.3 +++ BasiliskII/src/uae_cpu/fpu/mathlib.h 2002/11/16 15:28:25 1.6 @@ -395,12 +395,12 @@ PRIVATE inline bool FFPU fp_do_isnan(fpu 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 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 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 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_flag 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_posit #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_negat #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_negat 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_positi 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_negati 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_exp // 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,51 +661,131 @@ PRIVATE inline uae_u32 FFPU get_quotient /* --- Math functions --- */ /* -------------------------------------------------------------------------- */ -#if FPU_USE_ISO_C99 && USE_LONG_DOUBLE -# define fp_log logl -# define fp_log10 log10l -# define fp_exp expl -# define fp_pow powl -# define fp_fabs fabsl -# define fp_sqrt sqrtl -# define fp_sin sinl -# define fp_cos cosl -# define fp_tan tanl -# define fp_sinh sinhl -# define fp_cosh coshl -# define fp_tanh tanhl -# define fp_asin asinl -# define fp_acos acosl -# define fp_atan atanl -# define fp_asinh asinhl -# define fp_acosh acoshl -# define fp_atanh atanhl -# define fp_floor floorl -# define fp_ceil ceill -#else +#if FPU_USE_ISO_C99 && (USE_LONG_DOUBLE || USE_QUAD_DOUBLE) +# ifdef HAVE_LOGL +# define fp_log logl +# endif +# ifdef HAVE_LOG10L +# define fp_log10 log10l +# endif +# ifdef HAVE_EXPL +# define fp_exp expl +# endif +# ifdef HAVE_POWL +# define fp_pow powl +# endif +# ifdef HAVE_FABSL +# define fp_fabs fabsl +# endif +# ifdef HAVE_SQRTL +# define fp_sqrt sqrtl +# endif +# ifdef HAVE_SINL +# define fp_sin sinl +# endif +# ifdef HAVE_COSL +# define fp_cos cosl +# endif +# ifdef HAVE_TANL +# define fp_tan tanl +# endif +# ifdef HAVE_SINHL +# define fp_sinh sinhl +# endif +# ifdef HAVE_COSHL +# define fp_cosh coshl +# endif +# ifdef HAVE_TANHL +# define fp_tanh tanhl +# endif +# ifdef HAVE_ASINL +# define fp_asin asinl +# endif +# ifdef HAVE_ACOSL +# define fp_acos acosl +# endif +# ifdef HAVE_ATANL +# define fp_atan atanl +# endif +# ifdef HAVE_ASINHL +# define fp_asinh asinhl +# endif +# ifdef HAVE_ACOSHL +# define fp_acosh acoshl +# endif +# ifdef HAVE_ATANHL +# define fp_atanh atanhl +# endif +# ifdef HAVE_FLOORL +# define fp_floor floorl +# endif +# ifdef HAVE_CEILL +# define fp_ceil ceill +# endif +#endif + +#ifndef fp_log # define fp_log log +#endif +#ifndef fp_log10 # define fp_log10 log10 +#endif +#ifndef fp_exp # define fp_exp exp +#endif +#ifndef fp_pow # define fp_pow pow +#endif +#ifndef fp_fabs # define fp_fabs fabs +#endif +#ifndef fp_sqrt # define fp_sqrt sqrt +#endif +#ifndef fp_sin # define fp_sin sin +#endif +#ifndef fp_cos # define fp_cos cos +#endif +#ifndef fp_tan # define fp_tan tan +#endif +#ifndef fp_sinh # define fp_sinh sinh +#endif +#ifndef fp_cosh # define fp_cosh cosh +#endif +#ifndef fp_tanh # define fp_tanh tanh +#endif +#ifndef fp_asin # define fp_asin asin +#endif +#ifndef fp_acos # define fp_acos acos +#endif +#ifndef fp_atan # define fp_atan atan +#endif +#ifndef fp_asinh # define fp_asinh asinh +#endif +#ifndef fp_acosh # define fp_acosh acosh +#endif +#ifndef fp_atanh # define fp_atanh atanh +#endif +#ifndef fp_floor # define fp_floor floor +#endif +#ifndef fp_ceil # define fp_ceil ceil #endif -#if defined(FPU_IEEE) && defined(X86_ASSEMBLY) +#if defined(FPU_IEEE) && defined(USE_X87_ASSEMBLY) // Assembly optimized support functions. Taken from glibc 2.2.2 #undef fp_log @@ -1025,7 +1105,7 @@ DEFINE_ROUND_FUNC(zero, 0xc00) DEFINE_ROUND_FUNC(nearest, 0x000) -#endif /* X86_ASSEMBLY */ +#endif /* USE_X87_ASSEMBLY */ #ifndef fp_round_to_minus_infinity #define fp_round_to_minus_infinity(x) fp_floor(x)