From b216cd4ae3bd06a171b0b2db41d79d4b6f818008 Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Sat, 23 Mar 2002 01:10:56 +0000 Subject: real.h: Don't define REAL_INFINITY or REAL_IS_NOT_DOUBLE. * real.h: Don't define REAL_INFINITY or REAL_IS_NOT_DOUBLE. Always make REAL_VALUE_TYPE a struct containing an array of HOST_WIDE_INT, not a double. Tidy up the code deciding how big it is. Don't declare or use union real_extract. * emit-rtl.c (init_emit_once), varasm.c (immed_real_const_1, decode_rtx_const, output_constant_pool), config/a29k/a29k.c (print_operand), config/arm/arm.c (output_move_double), config/arm/arm.md (consttable_4, consttable_8), config/romp/romp.c (output_fpops), config/s390/s390.h (ASM_OUTPUT_SPECIAL_POOL_ENTRY), config/xtensa/xtensa.c (xtensa_output_literal): Don't use union real_extract. * config/dsp16xx/dsp16xx.c (print_operand), config/i860/i860.c (sfmode_constant_to_ulong), config/ns32k/merlin.h (PRINT_OPERAND), config/ns32k/ns32k.c (print_operand), config/pdp11/pdp11.h (PRINT_OPERAND), config/we32k/we32k.h (PRINT_OPERAND): Don't use local version of union real_extract. * config/convex/convex.c (check_float_value), config/vax/vax.c (vax_float_literal), config/m88k/m88k.md (divdf3), config/dsp16xx/dsp16xx.md (fixuns_trunchfhi2), config/pdp11/pdp11.c (output_move_quad): Don't do host arithmetic on target floating point quantities. * config/a29k/a29k.md, config/dsp16xx/dsp16xx.c (output_dsp16xx_float_const): Don't test HOST_FLOAT_FORMAT. * fold-const.c (fold), simplify-rtx.c (simplify_binary_real): Use MODE_HAS_INFINITIES rather than #ifdef REAL_INFINITY. * real.c (earith): Test INFINITY rather than REAL_INFINITY; NANS implies INFINITY, so can drop #ifdef NANS inside #ifndef INFINITY. * print-rtl.c (print_rtx): Disable code which needs floating-point emulator. * libgcc2.c: Include float.h and use DBL_MANT_DIG, FLT_MANT_DIG, to define DF_SIZE and SF_SIZE, rather than depending on HOST_FLOAT_FORMAT to be defined properly. * ch/grant.c, cp/error.c: Always use REAL_VALUE_TO_DECIMAL; don't test REAL_IS_NOT_DOUBLE. * config/1750a/1750a.c (get_double, float_label): Delete. (print_operand): Delete huge commented-out chunk. Use REAL_VALUE_TO_DECIMAL. * config/1750a/1750a-protos.h: Delete prototypes of deleted functions. * config/convex/convex.h: Always set TARGET_FLOAT_FORMAT to IEEE_FLOAT_FORMAT. * config/i370/i370.h (PRINT_OPERAND [TARGET_HLASM version]): Use REAL_VALUE_TO_DECIMAL as ELF version does. * config/m88k/m88k.c (real_power_of_2_operand, legitimize_operand): Take the REAL_VALUE_TYPE and/or union real_extract out of the union; run the input through REAL_VALUE_TO_TARGET_DOUBLE, then plug the pair of longwords from that into the union. * config/pdp11/pdp11.c (output_move_double): Rearrange parentheses to make automatic indenter happy. * doc/tm.texi (Cross-compilation): Rename node to "Floating Point" and rewrite to describe current situation. Also adjust documentation of REAL_VALUE_TO_TARGET_SINGLE and friends to match code. * doc/rtl.texi: Adjust cross reference. From-SVN: r51210 --- gcc/config/convex/convex.c | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) (limited to 'gcc/config/convex/convex.c') diff --git a/gcc/config/convex/convex.c b/gcc/config/convex/convex.c index bee0f17..74af45e 100644 --- a/gcc/config/convex/convex.c +++ b/gcc/config/convex/convex.c @@ -515,12 +515,12 @@ expand_movstr_call (operands) TYPE_MODE (sizetype)); } -#if _IEEE_FLOAT_ -#define MAX_FLOAT 3.4028234663852886e+38 -#define MIN_FLOAT 1.1754943508222875e-38 +#if TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT +#define MAX_FLOAT "3.4028234663852886e+38" +#define MIN_FLOAT "1.1754943508222875e-38" #else -#define MAX_FLOAT 1.7014117331926443e+38 -#define MIN_FLOAT 2.9387358770557188e-39 +#define MAX_FLOAT "1.7014117331926443e+38" +#define MIN_FLOAT "2.9387358770557188e-39" #endif int @@ -530,28 +530,35 @@ check_float_value (mode, dp, overflow) int overflow; { REAL_VALUE_TYPE d = *dp; + REAL_VALUE_TYPE maxfloat = REAL_VALUE_ATOF (MAX_FLOAT, mode); + REAL_VALUE_TYPE minfloat = REAL_VALUE_ATOF (MIN_FLOAT, mode); + REAL_VALUE_TYPE neg_maxfloat = REAL_VALUE_NEGATE (maxfloat); + REAL_VALUE_TYPE neg_minfloat = REAL_VALUE_NEGATE (minfloat); if (overflow) { - *dp = MAX_FLOAT; + *dp = maxfloat; return 1; } if (mode == SFmode) { - if (d > MAX_FLOAT) + if (REAL_VALUES_LESS (maxfloat, d)) { - *dp = MAX_FLOAT; + *dp = maxfloat; return 1; } - else if (d < -MAX_FLOAT) + else if (REAL_VALUES_LESS (d, neg_maxfloat)) { - *dp = -MAX_FLOAT; + *dp = neg_maxfloat; return 1; } - else if ((d > 0 && d < MIN_FLOAT) || (d < 0 && d > -MIN_FLOAT)) + else if ((REAL_VALUES_LESS (dconst0, d) + && REAL_VALUES_LESS (d, minfloat)) + || (REAL_VALUES_LESS (d, dconst0) + && REAL_VALUES_LESS (neg_minfloat, d))) { - *dp = 0.0; + *dp = dconst0; return 1; } } @@ -628,16 +635,7 @@ print_operand (file, x, code) REAL_VALUE_FROM_CONST_DOUBLE (d, x); switch (GET_MODE (x)) { case DFmode: -#if 0 /* doesn't work, produces dfloats */ REAL_VALUE_TO_TARGET_DOUBLE (d, u); -#else - { - union { double d; int i[2]; } t; - t.d = d; - u[0] = t.i[0]; - u[1] = t.i[1]; - } -#endif if (code == 'u') fprintf (file, "#%#lx", u[0]); else if (code == 'v') -- cgit v1.1