diff options
author | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-04-19 00:14:49 +0000 |
---|---|---|
committer | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-04-19 00:14:49 +0000 |
commit | 71a524bea0b1c2fd5df4a20f6935210b6d11d306 (patch) | |
tree | b1368d46e39903775acd3d13ff8c740e88165781 /gcc/real.c | |
parent | 86988432fce0c7ea15f9e0328296c71a25128825 (diff) | |
download | gcc-71a524bea0b1c2fd5df4a20f6935210b6d11d306.tar.gz |
* real.h: Define REAL_VALUE_TYPE_SIZE as 96 or 160, as
appropriate. Document need for extended precision even when
MAX_LONG_DOUBLE_TYPE_SIZE is smaller. Define REAL_WIDTH here,
based on REAL_VALUE_TYPE_SIZE. Use REAL_WIDTH to size
REAL_VALUE_TYPE. Define CONST_DOUBLE_FORMAT here. Use #error
instead of relying on later syntax error when REAL_WIDTH > 5.
* real.c: Define NE based only on whether or not we have a
full 128-bit extended type (not INTEL_EXTENDED_IEEE_FORMAT).
Require sizeof(REAL_VALUE_TYPE) == 2*NE. Unconditionally
define GET_REAL and PUT_REAL as simple memcpy operations; no
need to byteswap or round.
Use #error instead of #ifdef-ing out the entire file, for
prompt error detection.
* rtl.c, gengenrtl.c: No need to calculate CONST_DOUBLE_FORMAT here.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@52502 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/real.c')
-rw-r--r-- | gcc/real.c | 103 |
1 files changed, 27 insertions, 76 deletions
diff --git a/gcc/real.c b/gcc/real.c index 8674ee897d9..5d080393867 100644 --- a/gcc/real.c +++ b/gcc/real.c @@ -165,8 +165,7 @@ unknown arithmetic type #define EMUSHORT_SIZE HOST_BITS_PER_LONG #define EMULONG_SIZE (2 * HOST_BITS_PER_LONG) #else -/* You will have to modify this program to have a smaller unit size. */ -#define EMU_NON_COMPILE + #error "You will have to modify this program to have a smaller unit size." #endif #endif #endif @@ -199,92 +198,45 @@ typedef unsigned int UHItype __attribute__ ((mode (HI))); #if HOST_BITS_PER_LONGLONG >= EMULONG_SIZE #define EMULONG long long int #else -/* You will have to modify this program to have a smaller unit size. */ -#define EMU_NON_COMPILE + #error "You will have to modify this program to have a smaller unit size." #endif #endif #endif #endif - -/* The host interface doesn't work if no 16-bit size exists. */ #if EMUSHORT_SIZE != 16 -#define EMU_NON_COMPILE + #error "The host interface doesn't work if no 16-bit size exists." #endif -/* OK to continue compilation. */ -#ifndef EMU_NON_COMPILE +/* Calculate the size of the generic "e" type. This always has + identical in-memory size and representation to REAL_VALUE_TYPE. + There are only two supported sizes: ten and six 16-bit words (160 + or 96 bits). */ -/* Construct macros to translate between REAL_VALUE_TYPE and e type. - In GET_REAL and PUT_REAL, r and e are pointers. - A REAL_VALUE_TYPE is guaranteed to occupy contiguous locations - in memory, with no holes. */ - -#if MAX_LONG_DOUBLE_TYPE_SIZE == 96 || \ - ((INTEL_EXTENDED_IEEE_FORMAT != 0) && MAX_LONG_DOUBLE_TYPE_SIZE == 128) -/* Number of 16 bit words in external e type format */ +#if MAX_LONG_DOUBLE_TYPE_SIZE == 128 && !INTEL_EXTENDED_IEEE_FORMAT +/* TFmode */ +# define NE 10 +# define MAXDECEXP 4932 +# define MINDECEXP -4977 +#else # define NE 6 # define MAXDECEXP 4932 # define MINDECEXP -4956 -# define GET_REAL(r,e) memcpy ((e), (r), 2*NE) -# define PUT_REAL(e,r) \ - do { \ - memcpy ((r), (e), 2*NE); \ - if (2*NE < sizeof (*r)) \ - memset ((char *) (r) + 2*NE, 0, sizeof (*r) - 2*NE); \ - } while (0) -# else /* no XFmode */ -# if MAX_LONG_DOUBLE_TYPE_SIZE == 128 -# define NE 10 -# define MAXDECEXP 4932 -# define MINDECEXP -4977 -# define GET_REAL(r,e) memcpy ((e), (r), 2*NE) -# define PUT_REAL(e,r) \ - do { \ - memcpy ((r), (e), 2*NE); \ - if (2*NE < sizeof (*r)) \ - memset ((char *) (r) + 2*NE, 0, sizeof (*r) - 2*NE); \ - } while (0) -#else -#define NE 6 -#define MAXDECEXP 4932 -#define MINDECEXP -4956 -/* Emulator uses target format internally - but host stores it in host endian-ness. */ - -#define GET_REAL(r,e) \ -do { \ - if (HOST_FLOAT_WORDS_BIG_ENDIAN == REAL_WORDS_BIG_ENDIAN) \ - e53toe ((const UEMUSHORT *) (r), (e)); \ - else \ - { \ - UEMUSHORT w[4]; \ - memcpy (&w[3], ((const EMUSHORT *) r), sizeof (EMUSHORT)); \ - memcpy (&w[2], ((const EMUSHORT *) r) + 1, sizeof (EMUSHORT)); \ - memcpy (&w[1], ((const EMUSHORT *) r) + 2, sizeof (EMUSHORT)); \ - memcpy (&w[0], ((const EMUSHORT *) r) + 3, sizeof (EMUSHORT)); \ - e53toe (w, (e)); \ - } \ - } while (0) - -#define PUT_REAL(e,r) \ -do { \ - if (HOST_FLOAT_WORDS_BIG_ENDIAN == REAL_WORDS_BIG_ENDIAN) \ - etoe53 ((e), (UEMUSHORT *) (r)); \ - else \ - { \ - UEMUSHORT w[4]; \ - etoe53 ((e), w); \ - memcpy (((EMUSHORT *) r), &w[3], sizeof (EMUSHORT)); \ - memcpy (((EMUSHORT *) r) + 1, &w[2], sizeof (EMUSHORT)); \ - memcpy (((EMUSHORT *) r) + 2, &w[1], sizeof (EMUSHORT)); \ - memcpy (((EMUSHORT *) r) + 3, &w[0], sizeof (EMUSHORT)); \ - } \ - } while (0) - -#endif /* not TFmode */ -#endif /* not XFmode */ +#endif + +/* Fail compilation if 2*NE is not the appropriate size. */ + +struct compile_test_dummy { + char twice_NE_must_equal_sizeof_REAL_VALUE_TYPE + [(sizeof (REAL_VALUE_TYPE) == 2*NE) ? 1 : -1]; +}; +/* Construct macros to translate between REAL_VALUE_TYPE and e type. + In GET_REAL and PUT_REAL, r and e are pointers. + A REAL_VALUE_TYPE is guaranteed to occupy contiguous locations + in memory, with no holes. */ +#define GET_REAL(r, e) memcpy ((e), (r), 2*NE) +#define PUT_REAL(e, r) memcpy ((r), (e), 2*NE) /* Number of 16 bit words in internal format */ #define NI (NE+3) @@ -6918,7 +6870,6 @@ esqrt (x, y) emovo (sq, y); } #endif -#endif /* EMU_NON_COMPILE not defined */ /* Return the binary precision of the significand for a given floating point mode. The mode can hold an integer value |