summaryrefslogtreecommitdiffstats
path: root/gcc/real.h
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2002-09-20 07:33:25 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2002-09-20 07:33:25 +0000
commit479838eca39e7be88bd203bc7a2e8d26d1f92594 (patch)
treec54a7a01350d6852bd914b86bd519ff2f024d491 /gcc/real.h
parent65bfe40f7759004a2aca59e9a78ee2e18d9872ef (diff)
downloadppe42-gcc-479838eca39e7be88bd203bc7a2e8d26d1f92594.tar.gz
ppe42-gcc-479838eca39e7be88bd203bc7a2e8d26d1f92594.zip
* real.h (enum real_value_class, SIGNIFICAND_BITS, EXP_BITS,
MAX_EXP, SIGSZ, SIG_MSB, struct real_value): Move from real.c. (struct realvaluetype): Remove. (REAL_VALUE_TYPE): Use struct real_value. (REAL_VALUE_TYPE_SIZE): Use SIGNIFICAND_BITS. (test_real_width): New. * real.c: Global replace struct real_value with REAL_VALUE_TYPE. (real_arithmetic): Avoid hoops for REAL_VALUE_TYPE parameters. (real_compare, real_exponent, real_ldexp, real_isinf, real_isnan, real_isneg, real_isnegzero, real_identical, exact_real_inverse, real_to_integer, real_to_integer2, real_to_decimal, real_to_hexadecimal, real_from_string, real_from_integer, real_inf, real_nan, real_2expN, real_convert, real_to_target, real_from_target): Likewise. * tree.h (struct tree_real_cst): Use real_value not realvaluetype. * gengtype-yacc.y (bitfieldopt): Accept an ID as well. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@57343 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/real.h')
-rw-r--r--gcc/real.h49
1 files changed, 35 insertions, 14 deletions
diff --git a/gcc/real.h b/gcc/real.h
index 7ac10ffdd9a..6b9cc35a321 100644
--- a/gcc/real.h
+++ b/gcc/real.h
@@ -24,26 +24,47 @@
#include "machmode.h"
-/* REAL_VALUE_TYPE is an array of the minimum number of HOST_WIDE_INTs
- required to hold a 128-bit floating point type. This is true even
- if the maximum precision floating point type on the target is smaller.
+/* An expanded form of the represented number. */
+
+/* Enumerate the special cases of numbers that we encounter. */
+enum real_value_class {
+ rvc_zero,
+ rvc_normal,
+ rvc_inf,
+ rvc_nan
+};
+
+#define SIGNIFICAND_BITS 128
+#define EXP_BITS (32 - 3)
+#define MAX_EXP ((1 << (EXP_BITS - 1)) - 1)
+#define SIGSZ (SIGNIFICAND_BITS / HOST_BITS_PER_LONG)
+#define SIG_MSB ((unsigned long)1 << (HOST_BITS_PER_LONG - 1))
+
+struct real_value GTY(())
+{
+ enum real_value_class class : 2;
+ unsigned int sign : 1;
+ int exp : EXP_BITS;
+ unsigned long sig[SIGSZ];
+};
- The extra 32 bits are for storing the mode of the float. Ideally
- we'd keep this elsewhere, but that's too drastic a change all at once. */
+/* Various headers condition prototypes on #ifdef REAL_VALUE_TYPE, so it
+ needs to be a macro. We do need to continue to have a structure tag
+ so that other headers can forward declare it. */
+#define REAL_VALUE_TYPE struct real_value
-#define REAL_VALUE_TYPE_SIZE (128 + 32)
+/* We store a REAL_VALUE_TYPE into an rtx, and we do this by putting it in
+ consecutive "w" slots. Moreover, we've got to compute the number of "w"
+ slots at preprocessor time, which means we can't use sizeof. Guess. */
+
+#define REAL_VALUE_TYPE_SIZE (SIGNIFICAND_BITS + 32)
#define REAL_WIDTH \
(REAL_VALUE_TYPE_SIZE/HOST_BITS_PER_WIDE_INT \
+ (REAL_VALUE_TYPE_SIZE%HOST_BITS_PER_WIDE_INT ? 1 : 0)) /* round up */
-struct realvaluetype GTY(()) {
- HOST_WIDE_INT r[REAL_WIDTH];
-};
-
-/* Various headers condition prototypes on #ifdef REAL_VALUE_TYPE, so it needs
- to be a macro. realvaluetype cannot be a typedef as this interferes with
- other headers declaring opaque pointers to it. */
-#define REAL_VALUE_TYPE struct realvaluetype
+/* Verify the guess. */
+extern char test_real_width
+ [sizeof(REAL_VALUE_TYPE) <= REAL_WIDTH*sizeof(HOST_WIDE_INT) ? 1 : -1];
/* Calculate the format for CONST_DOUBLE. We need as many slots as
are necessary to overlay a REAL_VALUE_TYPE on them. This could be
OpenPOWER on IntegriCloud