OSDN Git Service

* real.h (ieee_extended_intel_96_round_53_format): New.
[pf3gnuchains/gcc-fork.git] / gcc / real.h
index 6f8f7d8..71e3cc4 100644 (file)
@@ -1,6 +1,6 @@
 /* Definitions of floating-point access for GNU compiler.
-   Copyright (C) 1989, 1991, 1994, 1996, 1997, 1998,
-   1999, 2000, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1989, 1991, 1994, 1996, 1997, 1998, 1999,
+   2000, 2002, 2003 Free Software Foundation, Inc.
 
    This file is part of GCC.
 
@@ -34,17 +34,19 @@ enum real_value_class {
   rvc_nan
 };
 
-#define SIGNIFICAND_BITS       128
-#define EXP_BITS               (32 - 3)
+#define SIGNIFICAND_BITS       (128 + HOST_BITS_PER_LONG)
+#define EXP_BITS               (32 - 5)
 #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;
+  ENUM_BITFIELD (real_value_class) class : 2;
   unsigned int sign : 1;
-  int exp : EXP_BITS;
+  unsigned int signalling : 1;
+  unsigned int canonical : 1;
+  signed int exp : EXP_BITS;
   unsigned long sig[SIGSZ];
 };
 
@@ -88,7 +90,11 @@ extern char test_real_width
 #    if REAL_WIDTH == 5
 #     define CONST_DOUBLE_FORMAT "wwwww"
 #    else
-      #error "REAL_WIDTH > 5 not supported"
+#     if REAL_WIDTH == 6
+#      define CONST_DOUBLE_FORMAT "wwwwww"
+#     else
+       #error "REAL_WIDTH > 6 not supported"
+#     endif
 #    endif
 #   endif
 #  endif
@@ -100,8 +106,10 @@ extern char test_real_width
 struct real_format
 {
   /* Move to and from the target bytes.  */
-  void (*encode) (const struct real_format *, long *, const REAL_VALUE_TYPE *);
-  void (*decode) (const struct real_format *, REAL_VALUE_TYPE *, const long *);
+  void (*encode) PARAMS ((const struct real_format *, long *,
+                         const REAL_VALUE_TYPE *));
+  void (*decode) PARAMS ((const struct real_format *, REAL_VALUE_TYPE *,
+                         const long *));
 
   /* The radix of the exponent and digits of the significand.  */
   int b;
@@ -112,12 +120,18 @@ struct real_format
   /* Size of the significand in digits of radix B.  */
   int p;
 
+  /* Size of the significant of a NaN, in digits of radix B.  */
+  int pnan;
+
   /* The minimum negative integer, x, such that b**(x-1) is normalized.  */
   int emin;
 
   /* The maximum integer, x, such that b**(x-1) is representable.  */
   int emax;
 
+  /* The bit position of the sign bit, or -1 for a complex encoding.  */
+  int signbit;
+
   /* Properties of the format.  */
   bool has_nans;
   bool has_inf;
@@ -170,11 +184,11 @@ extern bool exact_real_truncate PARAMS ((enum machine_mode,
 
 /* Render R as a decimal floating point constant.  */
 extern void real_to_decimal    PARAMS ((char *, const REAL_VALUE_TYPE *,
-                                        int));
+                                        size_t, size_t, int));
 
 /* Render R as a hexadecimal floating point constant.  */
 extern void real_to_hexadecimal        PARAMS ((char *, const REAL_VALUE_TYPE *,
-                                        int));
+                                        size_t, size_t, int));
 
 /* Render R as an integer.  */
 extern HOST_WIDE_INT real_to_integer PARAMS ((const REAL_VALUE_TYPE *));
@@ -205,6 +219,9 @@ extern void real_inf                PARAMS ((REAL_VALUE_TYPE *));
 extern bool real_nan           PARAMS ((REAL_VALUE_TYPE *, const char *,
                                         int, enum machine_mode));
 
+extern void real_maxval                PARAMS ((REAL_VALUE_TYPE *, int,
+                                        enum machine_mode));
+
 extern void real_2expN         PARAMS ((REAL_VALUE_TYPE *, int));
 
 extern unsigned int real_hash  PARAMS ((const REAL_VALUE_TYPE *));
@@ -212,11 +229,17 @@ extern unsigned int real_hash     PARAMS ((const REAL_VALUE_TYPE *));
 
 /* Target formats defined in real.c.  */
 extern const struct real_format ieee_single_format;
+extern const struct real_format mips_single_format;
 extern const struct real_format ieee_double_format;
+extern const struct real_format mips_double_format;
 extern const struct real_format ieee_extended_motorola_format;
 extern const struct real_format ieee_extended_intel_96_format;
+extern const struct real_format ieee_extended_intel_96_round_53_format;
 extern const struct real_format ieee_extended_intel_128_format;
+extern const struct real_format ibm_extended_format;
+extern const struct real_format mips_extended_format;
 extern const struct real_format ieee_quad_format;
+extern const struct real_format mips_quad_format;
 extern const struct real_format vax_f_format;
 extern const struct real_format vax_d_format;
 extern const struct real_format vax_g_format;
@@ -224,6 +247,7 @@ extern const struct real_format i370_single_format;
 extern const struct real_format i370_double_format;
 extern const struct real_format c4x_single_format;
 extern const struct real_format c4x_extended_format;
+extern const struct real_format real_internal_format;
 
 
 /* ====================================================================== */
@@ -260,9 +284,6 @@ extern const struct real_format c4x_extended_format;
 #define REAL_VALUE_TO_TARGET_SINGLE(IN, OUT) \
   ((OUT) = real_to_target (NULL, &(IN), mode_for_size (32, MODE_FLOAT, 0)))
 
-#define REAL_VALUE_TO_DECIMAL(r, s, dig) \
-  real_to_decimal (s, &(r), dig)
-
 #define REAL_VALUE_FROM_INT(r, lo, hi, mode) \
   real_from_integer (&(r), mode, lo, hi, 0)
 
@@ -313,12 +334,14 @@ extern void real_ldexp            PARAMS ((REAL_VALUE_TYPE *,
 
 /* **** End of software floating point emulator interface macros **** */
 \f
-/* Constant real values 0, 1, 2, and -1.  */
+/* Constant real values 0, 1, 2, -1, -2 and 0.5.  */
 
 extern REAL_VALUE_TYPE dconst0;
 extern REAL_VALUE_TYPE dconst1;
 extern REAL_VALUE_TYPE dconst2;
 extern REAL_VALUE_TYPE dconstm1;
+extern REAL_VALUE_TYPE dconstm2;
+extern REAL_VALUE_TYPE dconsthalf;
 
 /* Function to return a real value (not a tree node)
    from a given integer constant.  */
@@ -341,5 +364,15 @@ extern bool exact_real_inverse     PARAMS ((enum machine_mode, REAL_VALUE_TYPE *));
 /* In tree.c: wrap up a REAL_VALUE_TYPE in a tree node.  */
 extern tree build_real                 PARAMS ((tree, REAL_VALUE_TYPE));
 
+/* Calculate R as the square root of X in the given machine mode.  */
+extern bool real_sqrt                  PARAMS ((REAL_VALUE_TYPE *,
+                                                enum machine_mode,
+                                                const REAL_VALUE_TYPE *));
+
+/* Calculate R as X raised to the integer exponent N in mode MODE.  */
+extern bool real_powi                  PARAMS ((REAL_VALUE_TYPE *,
+                                                enum machine_mode,
+                                                const REAL_VALUE_TYPE *,
+                                                HOST_WIDE_INT));
 
 #endif /* ! GCC_REAL_H */