diff options
author | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-03-03 21:10:09 +0000 |
---|---|---|
committer | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-03-03 21:10:09 +0000 |
commit | 4268f174a342afb4108ba0718c302c349d53128f (patch) | |
tree | 95ce10820dcdc63db9f1448b54fe058ae5559247 /gcc/real.h | |
parent | ba403b8ee3c4394c51bfdf6539169e5c79957bed (diff) | |
download | gcc-4268f174a342afb4108ba0718c302c349d53128f.tar.gz |
* emit-rtl.c, final.c, fold-const.c, gengenrtl.c, optabs.c,
print-tree.c, real.c, real.h, recog.c, rtl.c, simplify-rtx.c,
tree.c, config/m68k/m68k.c, f/com.c, f/target.h, java/expr.c,
java/jcf-parse.c, java/lex.c:
Remove all #ifndef REAL_ARITHMETIC blocks, make all #ifdef
REAL_ARITHMETIC blocks unconditional. Delete some further
#ifdef blocks predicated on REAL_ARITHMETIC.
* flags.h, toplev.c: Delete remaining references to
flag_pretend_float.
* doc/invoke.texi: Remove documentation of -fpretend-float.
* doc/tm.texi: Describe the various REAL_* macros as provided by
real.h, not by the target configuration files.
* config/alpha/alpha.h, config/alpha/unicosmk.h, config/arm/arm.h,
config/avr/avr.h, config/c4x/c4x.h, config/convex/convex.h,
config/cris/cris.h, config/d30v/d30v.h, config/dsp16xx/dsp16xx.h,
config/h8300/h8300.h, config/i370/i370.h, config/i386/i386.h,
config/i386/osf1elf.h, config/i960/i960.h, config/ia64/ia64.h,
config/m32r/m32r.h, config/m68hc11/m68hc11.h, config/m68k/dpx2.h,
config/m68k/linux-aout.h, config/m68k/linux.h, config/m68k/m68k.h,
config/m68k/sun3.h, config/m68k/vxm68k.h, config/mcore/mcore.h,
config/mips/mips.h, config/mmix/mmix.h, config/mn10200/mn10200.h,
config/mn10300/mn10300.h, config/pa/pa.h, config/pj/pj.h,
config/rs6000/rs6000.h, config/s390/s390.h, config/sh/sh.h,
config/sparc/freebsd.h, config/sparc/linux.h, config/sparc/linux64.h,
config/sparc/sol2.h, config/sparc/sparc.h, config/sparc/vxsim.h,
config/stormy16/stormy16.h, config/v850/v850.h, config/vax/vax.h,
config/xtensa/xtensa.h:
Do not define, undefine, or mention in comments any of
REAL_ARITHMETIC, REAL_VALUE_ATOF, REAL_VALUE_HTOF,
REAL_VALUE_ISNAN, REAL_VALUE_ISINF,
REAL_VALUE_TO_TARGET_SINGLE, REAL_VALUE_TO_TARGET_DOUBLE,
REAL_VALUE_TO_TARGET_LONG_DOUBLE, REAL_VALUE_TO_DECIMAL,
REAL_VALUE_TYPE, REAL_VALUES_EQUAL, REAL_VALUES_LESS,
REAL_VALUE_LDEXP, REAL_VALUE_FIX, REAL_VALUE_UNSIGNED_FIX,
REAL_VALUE_RNDZINT, REAL_VALUE_UNSIGNED_RNDZINT,
REAL_INFINITY, REAL_VALUE_NEGATE, REAL_VALUE_TRUNCATE,
REAL_VALUE_TO_INT, or REAL_VALUE_FROM_INT.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@50263 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/real.h')
-rw-r--r-- | gcc/real.h | 245 |
1 files changed, 22 insertions, 223 deletions
diff --git a/gcc/real.h b/gcc/real.h index 2d3a9090e04..e734b26548e 100644 --- a/gcc/real.h +++ b/gcc/real.h @@ -65,10 +65,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #endif #endif -/* Defining REAL_ARITHMETIC invokes a floating point emulator - that can produce a target machine format differing by more - than just endian-ness from the host's format. The emulator - is also used to support extended real XFmode. */ #ifndef LONG_DOUBLE_TYPE_SIZE #define LONG_DOUBLE_TYPE_SIZE 64 #endif @@ -80,19 +76,13 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #ifndef MAX_LONG_DOUBLE_TYPE_SIZE #define MAX_LONG_DOUBLE_TYPE_SIZE LONG_DOUBLE_TYPE_SIZE #endif -#if (MAX_LONG_DOUBLE_TYPE_SIZE == 96) || (MAX_LONG_DOUBLE_TYPE_SIZE == 128) -#ifndef REAL_ARITHMETIC -#define REAL_ARITHMETIC -#endif -#endif -#ifdef REAL_ARITHMETIC + /* **** Start of software floating point emulator interface macros **** */ /* Support 80-bit extended real XFmode if LONG_DOUBLE_TYPE_SIZE has been defined to be 96 in the tm.h machine file. */ #if (MAX_LONG_DOUBLE_TYPE_SIZE == 96) #define REAL_IS_NOT_DOUBLE -#define REAL_ARITHMETIC typedef struct { HOST_WIDE_INT r[(11 + sizeof (HOST_WIDE_INT))/(sizeof (HOST_WIDE_INT))]; } realvaluetype; @@ -103,7 +93,6 @@ typedef struct { #if (MAX_LONG_DOUBLE_TYPE_SIZE == 128) #define REAL_IS_NOT_DOUBLE -#define REAL_ARITHMETIC typedef struct { HOST_WIDE_INT r[(19 + sizeof (HOST_WIDE_INT))/(sizeof (HOST_WIDE_INT))]; } realvaluetype; @@ -130,13 +119,6 @@ typedef struct { extern unsigned int significand_size PARAMS ((enum machine_mode)); -/* If emulation has been enabled by defining REAL_ARITHMETIC or by - setting LONG_DOUBLE_TYPE_SIZE to 96 or 128, then define macros so that - they invoke emulator functions. This will succeed only if the machine - files have been updated to use these macros in place of any - references to host machine `double' or `float' types. */ -#ifdef REAL_ARITHMETIC -#undef REAL_ARITHMETIC #define REAL_ARITHMETIC(value, code, d1, d2) \ earith (&(value), (code), &(d1), &(d2)) @@ -176,10 +158,21 @@ extern REAL_VALUE_TYPE ereal_from_double PARAMS ((HOST_WIDE_INT *)); #define REAL_VALUES_LESS(x, y) (ereal_cmp ((x), (y)) == -1) #define REAL_VALUE_LDEXP(x, n) ereal_ldexp (x, n) +/* Compare two floating-point objects for bitwise identity. + This is not the same as comparing for equality on IEEE hosts: + -0.0 equals 0.0 but they are not identical, and conversely + two NaNs might be identical but they cannot be equal. */ +#define REAL_VALUES_IDENTICAL(x, y) \ + (!memcmp ((char *) &(x), (char *) &(y), sizeof (REAL_VALUE_TYPE))) + /* These return REAL_VALUE_TYPE: */ #define REAL_VALUE_RNDZINT(x) (etrunci (x)) #define REAL_VALUE_UNSIGNED_RNDZINT(x) (etruncui (x)) + +/* Truncate the floating-point value X to mode MODE. */ #define REAL_VALUE_TRUNCATE(mode, x) real_value_truncate (mode, x) +extern REAL_VALUE_TYPE real_value_truncate PARAMS ((enum machine_mode, + REAL_VALUE_TYPE)); /* These return HOST_WIDE_INT: */ /* Convert a floating-point value to integer, rounding toward zero. */ @@ -195,6 +188,16 @@ extern REAL_VALUE_TYPE ereal_from_double PARAMS ((HOST_WIDE_INT *)); #define REAL_VALUE_NEGATE ereal_negate +/* Determine whether a floating-point value X is infinite. */ +#define REAL_VALUE_ISINF(x) (target_isinf (x)) + +/* Determine whether a floating-point value X is a NaN. */ +#define REAL_VALUE_ISNAN(x) (target_isnan (x)) + +/* Determine whether a floating-point value X is negative. */ +#define REAL_VALUE_NEGATIVE(x) (target_negative (x)) + +/* Determine whether a floating-point value X is minus zero. */ #define REAL_VALUE_MINUS_ZERO(x) \ ((ereal_cmp (x, dconst0) == 0) && (ereal_isneg (x) != 0 )) @@ -234,203 +237,7 @@ extern REAL_VALUE_TYPE ereal_from_double PARAMS ((HOST_WIDE_INT *)); /* Conversions to decimal ASCII string. */ #define REAL_VALUE_TO_DECIMAL(r, fmt, s) (ereal_to_decimal (r, s)) -#endif /* REAL_ARITHMETIC defined */ - /* **** End of software floating point emulator interface macros **** */ -#else /* No XFmode or TFmode and REAL_ARITHMETIC not defined */ - -/* old interface */ -#ifdef REAL_ARITHMETIC -/* Defining REAL_IS_NOT_DOUBLE breaks certain initializations - when REAL_ARITHMETIC etc. are not defined. */ - -/* Now see if the host and target machines use the same format. - If not, define REAL_IS_NOT_DOUBLE (even if we end up representing - reals as doubles because we have no better way in this cross compiler.) - This turns off various optimizations that can happen when we know the - compiler's float format matches the target's float format. - */ -#if HOST_FLOAT_FORMAT != TARGET_FLOAT_FORMAT -#define REAL_IS_NOT_DOUBLE -#ifndef REAL_VALUE_TYPE -typedef struct { - HOST_WIDE_INT r[sizeof (double)/sizeof (HOST_WIDE_INT)]; - } realvaluetype; -#define REAL_VALUE_TYPE realvaluetype -#endif /* no REAL_VALUE_TYPE */ -#endif /* formats differ */ -#endif /* 0 */ - -#endif /* emulator not used */ - -/* If we are not cross-compiling, use a `double' to represent the - floating-point value. Otherwise, use some other type - (probably a struct containing an array of longs). */ -#ifndef REAL_VALUE_TYPE -#define REAL_VALUE_TYPE double -#else -#define REAL_IS_NOT_DOUBLE -#endif - -#if HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT - -/* Convert a type `double' value in host format first to a type `float' - value in host format and then to a single type `long' value which - is the bitwise equivalent of the `float' value. */ -#ifndef REAL_VALUE_TO_TARGET_SINGLE -#define REAL_VALUE_TO_TARGET_SINGLE(IN, OUT) \ -do { \ - union { \ - float f; \ - HOST_WIDE_INT l; \ - } u; \ - if (sizeof(HOST_WIDE_INT) < sizeof(float)) \ - abort (); \ - u.l = 0; \ - u.f = (IN); \ - (OUT) = u.l; \ -} while (0) -#endif - -/* Convert a type `double' value in host format to a pair of type `long' - values which is its bitwise equivalent, but put the two words into - proper word order for the target. */ -#ifndef REAL_VALUE_TO_TARGET_DOUBLE -#define REAL_VALUE_TO_TARGET_DOUBLE(IN, OUT) \ -do { \ - union { \ - REAL_VALUE_TYPE f; \ - HOST_WIDE_INT l[2]; \ - } u; \ - if (sizeof(HOST_WIDE_INT) * 2 < sizeof(REAL_VALUE_TYPE)) \ - abort (); \ - u.l[0] = u.l[1] = 0; \ - u.f = (IN); \ - if (HOST_FLOAT_WORDS_BIG_ENDIAN == FLOAT_WORDS_BIG_ENDIAN) \ - (OUT)[0] = u.l[0], (OUT)[1] = u.l[1]; \ - else \ - (OUT)[1] = u.l[0], (OUT)[0] = u.l[1]; \ -} while (0) -#endif -#endif /* HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT */ - -/* In this configuration, double and long double are the same. */ -#ifndef REAL_VALUE_TO_TARGET_LONG_DOUBLE -#define REAL_VALUE_TO_TARGET_LONG_DOUBLE(a, b) REAL_VALUE_TO_TARGET_DOUBLE (a, b) -#endif - -/* Compare two floating-point objects for bitwise identity. - This is not the same as comparing for equality on IEEE hosts: - -0.0 equals 0.0 but they are not identical, and conversely - two NaNs might be identical but they cannot be equal. */ -#define REAL_VALUES_IDENTICAL(x, y) \ - (!memcmp ((char *) &(x), (char *) &(y), sizeof (REAL_VALUE_TYPE))) - -/* Compare two floating-point values for equality. */ -#ifndef REAL_VALUES_EQUAL -#define REAL_VALUES_EQUAL(x, y) ((x) == (y)) -#endif - -/* Compare two floating-point values for less than. */ -#ifndef REAL_VALUES_LESS -#define REAL_VALUES_LESS(x, y) ((x) < (y)) -#endif - -/* Truncate toward zero to an integer floating-point value. */ -#ifndef REAL_VALUE_RNDZINT -#define REAL_VALUE_RNDZINT(x) ((double) ((int) (x))) -#endif - -/* Truncate toward zero to an unsigned integer floating-point value. */ -#ifndef REAL_VALUE_UNSIGNED_RNDZINT -#define REAL_VALUE_UNSIGNED_RNDZINT(x) ((double) ((unsigned int) (x))) -#endif - -/* Convert a floating-point value to integer, rounding toward zero. */ -#ifndef REAL_VALUE_FIX -#define REAL_VALUE_FIX(x) ((int) (x)) -#endif - -/* Convert a floating-point value to unsigned integer, rounding - toward zero. */ -#ifndef REAL_VALUE_UNSIGNED_FIX -#define REAL_VALUE_UNSIGNED_FIX(x) ((unsigned int) (x)) -#endif - -/* Scale X by Y powers of 2. */ -#ifndef REAL_VALUE_LDEXP -#define REAL_VALUE_LDEXP(x, y) ldexp (x, y) -extern double ldexp PARAMS ((double, int)); -#endif - -/* Convert the string X to a floating-point value. */ -#ifndef REAL_VALUE_ATOF -#if 1 -/* Use real.c to convert decimal numbers to binary, ... */ -#define REAL_VALUE_ATOF(x, s) ereal_atof (x, s) -/* Could use ereal_atof here for hexadecimal floats too, but real_hex_to_f - is OK and it uses faster native fp arithmetic. */ -/* #define REAL_VALUE_HTOF(x, s) ereal_atof (x, s) */ -#else -/* ... or, if you like the host computer's atof, go ahead and use it: */ -#define REAL_VALUE_ATOF(x, s) atof (x) -#if defined (MIPSEL) || defined (MIPSEB) -/* MIPS compiler can't handle parens around the function name. - This problem *does not* appear to be connected with any - macro definition for atof. It does not seem there is one. */ -extern double atof (); -#else -extern double (atof) (); -#endif -#endif -#endif - -/* Hexadecimal floating constant input for use with host computer's - fp arithmetic. */ -#ifndef REAL_VALUE_HTOF -extern REAL_VALUE_TYPE real_hex_to_f PARAMS ((const char *, - enum machine_mode)); -#define REAL_VALUE_HTOF(s,m) real_hex_to_f(s,m) -#endif - -/* Negate the floating-point value X. */ -#ifndef REAL_VALUE_NEGATE -#define REAL_VALUE_NEGATE(x) (- (x)) -#endif - -/* Truncate the floating-point value X to mode MODE. This is correct only - for the most common case where the host and target have objects of the same - size and where `float' is SFmode. */ - -/* Don't use REAL_VALUE_TRUNCATE directly--always call real_value_truncate. */ -extern REAL_VALUE_TYPE real_value_truncate PARAMS ((enum machine_mode, - REAL_VALUE_TYPE)); - -#ifndef REAL_VALUE_TRUNCATE -#define REAL_VALUE_TRUNCATE(mode, x) \ - (GET_MODE_BITSIZE (mode) == sizeof (float) * HOST_BITS_PER_CHAR \ - ? (float) (x) : (x)) -#endif - -/* Determine whether a floating-point value X is infinite. */ -#ifndef REAL_VALUE_ISINF -#define REAL_VALUE_ISINF(x) (target_isinf (x)) -#endif - -/* Determine whether a floating-point value X is a NaN. */ -#ifndef REAL_VALUE_ISNAN -#define REAL_VALUE_ISNAN(x) (target_isnan (x)) -#endif - -/* Determine whether a floating-point value X is negative. */ -#ifndef REAL_VALUE_NEGATIVE -#define REAL_VALUE_NEGATIVE(x) (target_negative (x)) -#endif - -/* Determine whether a floating-point value X is minus 0. */ -#ifndef REAL_VALUE_MINUS_ZERO -#define REAL_VALUE_MINUS_ZERO(x) ((x) == 0 && REAL_VALUE_NEGATIVE (x)) -#endif /* Constant real values 0, 1, 2, and -1. */ @@ -466,14 +273,6 @@ do { union real_extract u; \ extern struct rtx_def *immed_real_const_1 PARAMS ((REAL_VALUE_TYPE, enum machine_mode)); - -/* Convert a floating point value `r', that can be interpreted - as a host machine float or double, to a decimal ASCII string `s' - using printf format string `fmt'. */ -#ifndef REAL_VALUE_TO_DECIMAL -#define REAL_VALUE_TO_DECIMAL(r, fmt, s) (sprintf (s, fmt, r)) -#endif - /* Replace R by 1/R in the given machine mode, if the result is exact. */ extern int exact_real_inverse PARAMS ((enum machine_mode, REAL_VALUE_TYPE *)); extern int target_isnan PARAMS ((REAL_VALUE_TYPE)); |