This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Eliminate MODE_HAS_... macros


On Sun, Aug 10, 2008 at 5:36 PM, Ulrich Weigand <uweigand@de.ibm.com> wrote:
> Hello,
>
> we currently have a certain amount of redundancy between information in the
> real_format data structure and the MODE_HAS_... target macros.  For example,
> the information provided by MODE_HAS_NANS is already available by looking at
> the has_nans member of the appropriate real_format structure.
>
> This patch eliminates that redundancy by removing the MODE_HAS_... macros,
> and introducing REAL_MODE_FORMAT_HAS_... macros that look at the real_format
> members.  (One piece of information, whether the format supports any sign
> dependent rounding mode, was missing from real_format.  This patch adds that
> as another member.)
>
> Note that there is only one target (SPU) that changes the default definition
> of the MODE_HAS_... macros, and the the default definition only looks at
> TARGET_FLOAT_FORMAT (which is only special on VAX), and macros that are
> nowhere defined (LARGEST_EXPONENT_IS_NORMAL, ROUND_TOWARDS_ZERO).  This has
> the effect all four MODE_HAS_... macros were always true on all non-VAX,
> non-SPU targets, and always false on all VAX targets.
>
> This agrees with the current settings of the real_format has_nans, has_inf
> and has_signed_zeros members, and the new has_sign_dependent_rounding
> member introduced by the patch.  Overall, this patch should therefore have
> no effect on the behaviour of GCC on any target except SPU.
>
> On the SPU, this patch actually fixes three problems:
>
> - MODE_HAS_SIGN_DEPENDENT_ROUNDING was always false; it should be false
>  only for SFmode and true for DFmode (which does have round to pos/neg
>  infinity rounding modes).
>
> - The MODE_HAS_ macros defined in the SPU back end did not expect to be
>  called for vector / complex float values, but they were.  The new
>  mechanism in the patch below inherits properties of the base floating
>  point format for the corresponding vector / complex types.
>
> - The ROUND_TOWARDS_ZERO macro influences the behaviour of the FPBIT
>  routines.  On the SPU, single-precision routines should round towards
>  zero, while double-precision routines should round to nearest; this
>  cannot be specified with the current single-valued ROUND_TOWARDS_ZERO.
>  However, on inspection it seems that no single-precision FPBIT routine
>  is ever actually *used* by the SPU back-end, only two double-precision
>  routines are (__fixdfsi and __unorddf2).  Therefore, removing the
>  definition of ROUND_TOWARDS_ZERO actually fixes a problem.
>
> Tested on spu-elf, s390-ibm-linux and s390x-ibm-linux with no regressions.
> OK for mainline?

As you can see from

-#define MODE_HAS_NANS(MODE)                                     \
-  (FLOAT_MODE_P (MODE)                                                 \
-   && MODE != SFmode                                           \
-   && !LARGEST_EXPONENT_IS_NORMAL (GET_MODE_BITSIZE (MODE)))
-#endif

the MODE_HAS_* macros are supposed to work for _any_ mode, not only
real modes.  Your new macros do not.  So I think this is a bad change.

Please refactor the patch to keep the old names.

Thanks,
Richard.

> Bye,
> Ulrich
>
>
> ChangeLog:
>
>        * real.h (struct real_format): New member has_sign_dependent_rounding.
>        * real.c (ieee_single_format, mips_single_format, motorola_single_format,
>        spu_single_format, ieee_double_format, mips_double_format,
>        motorola_double_format, ieee_extended_motorola_format,
>        ieee_extended_intel_96_format, ieee_extended_intel_128_format,
>        ieee_extended_intel_96_round_53_format, ibm_extended_format,
>        mips_extended_format, ieee_quad_format, mips_quad_format,
>        vax_f_format, vax_d_format, vax_g_format): Initialize it.
>        * config/pdp11/pdp11.c (pdp11_f_format, pdp11_d_format): Likewise.
>
>        * defaults.h (MODE_HAS_NANS, MODE_HAS_INFINITIES,
>        MODE_HAS_SIGNED_ZEROS, MODE_HAS_SIGN_DEPENDENT_ROUNDING): Remove.
>        * config/spu/spu.h (MODE_HAS_NANS, MODE_HAS_INFINITIES,
>        MODE_HAS_SIGN_DEPENDENT_ROUNDING): Remove.
>        (ROUND_TOWARDS_ZERO): Likewise.
>
>        * real.h (REAL_MODE_FORMAT_HAS_NANS): New macro.
>        (REAL_MODE_FORMAT_HAS_INFINITIES, REAL_MODE_FORMAT_HAS_SIGNED_ZEROS,
>        REAL_MODE_FORMAT_HAS_SIGN_DEPENDENT_ROUNDING): Likewise.
>        * flags.h: Include "real.h".
>        (HONOR_NANS): Use REAL_MODE_FORMAT_HAS_xxx instead of MODE_HAS_xxx.
>        (HONOR_INFINITIES, HONOR_SIGNED_ZEROS, HONOR_SIGN_DEPENDENT_ROUNDING):
>        Likewise.
>        * builtins.c (fold_builtin_inf): Likewise.
>        * c-cppbuiltins.c (builtin_define_float_constants): Likewise.
>        * c-lex.c (interpret_float): Likewise.
>        * fold-const.c (const_binop, fold_binary): Likewise.
>        * simplify-rtx.c (simplify_const_binary_operation): Likewise.
>
>        * machmode.h (GET_MODE_INNER): Cast result to enum machine_mode.
>        * real.h (REAL_MODE_FORMAT): Protect MODE against macro expansion.
>
>        * doc/tm.texi (Storage Layout): Remove documentation of
>        MODE_HAS_NANS, MODE_HAS_INFINITIES, MODE_HAS_SIGNED_ZEROS,
>        MODE_HAS_SIGN_DEPENDENT_ROUNDING.  Update documentation of
>        ROUND_TOWARDS_ZERO and LARGEST_EXPONENT_IS_NORMAL to clarify
>        they only apply to libgcc2.a.
>
>
> diff -urNp -x .svn gcc-head-orig/gcc/builtins.c gcc-head/gcc/builtins.c
> --- gcc-head-orig/gcc/builtins.c        2008-08-09 14:43:47.000000000 +0200
> +++ gcc-head/gcc/builtins.c     2008-08-09 18:34:26.000000000 +0200
> @@ -7276,7 +7276,7 @@ fold_builtin_inf (tree type, int warn)
>      constraint in 6.4.4 and thus require a diagnostic." (C99 7.12#4).
>      Thus we pedwarn to ensure this constraint violation is
>      diagnosed.  */
> -  if (!MODE_HAS_INFINITIES (TYPE_MODE (type)) && warn)
> +  if (!REAL_MODE_FORMAT_HAS_INFINITIES (TYPE_MODE (type)) && warn)
>     pedwarn (0, "target format does not support infinity");
>
>   real_inf (&real);
> diff -urNp -x .svn gcc-head-orig/gcc/c-cppbuiltin.c gcc-head/gcc/c-cppbuiltin.c
> --- gcc-head-orig/gcc/c-cppbuiltin.c    2008-08-09 14:43:47.000000000 +0200
> +++ gcc-head/gcc/c-cppbuiltin.c 2008-08-09 18:34:26.000000000 +0200
> @@ -86,6 +86,8 @@ builtin_define_float_constants (const ch
>                                const char *fp_cast,
>                                tree type)
>  {
> +  enum machine_mode mode = TYPE_MODE (type);
> +
>   /* Used to convert radix-based values to base 10 values in several cases.
>
>      In the max_exp -> max_10_exp conversion for 128-bit IEEE, we need at
> @@ -241,14 +243,14 @@ builtin_define_float_constants (const ch
>   /* For C++ std::numeric_limits<T>::has_infinity.  */
>   sprintf (name, "__%s_HAS_INFINITY__", name_prefix);
>   builtin_define_with_int_value (name,
> -                                MODE_HAS_INFINITIES (TYPE_MODE (type)));
> +                                REAL_MODE_FORMAT_HAS_INFINITIES (mode));
>   /* For C++ std::numeric_limits<T>::has_quiet_NaN.  We do not have a
>      predicate to distinguish a target that has both quiet and
>      signalling NaNs from a target that has only quiet NaNs or only
>      signalling NaNs, so we assume that a target that has any kind of
>      NaN has quiet NaNs.  */
>   sprintf (name, "__%s_HAS_QUIET_NAN__", name_prefix);
> -  builtin_define_with_int_value (name, MODE_HAS_NANS (TYPE_MODE (type)));
> +  builtin_define_with_int_value (name, REAL_MODE_FORMAT_HAS_NANS (mode));
>  }
>
>  /* Define __DECx__ constants for TYPE using NAME_PREFIX and SUFFIX. */
> diff -urNp -x .svn gcc-head-orig/gcc/c-lex.c gcc-head/gcc/c-lex.c
> --- gcc-head-orig/gcc/c-lex.c   2008-08-09 14:42:37.000000000 +0200
> +++ gcc-head/gcc/c-lex.c        2008-08-09 18:34:26.000000000 +0200
> @@ -683,7 +683,7 @@ interpret_float (const cpp_token *token,
>      mandatory pedwarn if the target does not support infinities.  */
>   if (REAL_VALUE_ISINF (real))
>     {
> -      if (!MODE_HAS_INFINITIES (TYPE_MODE (type)))
> +      if (!REAL_MODE_FORMAT_HAS_INFINITIES (TYPE_MODE (type)))
>        pedwarn (0, "floating constant exceeds range of %qT", type);
>       else
>        warning (OPT_Woverflow, "floating constant exceeds range of %qT", type);
> diff -urNp -x .svn gcc-head-orig/gcc/config/pdp11/pdp11.c gcc-head/gcc/config/pdp11/pdp11.c
> --- gcc-head-orig/gcc/config/pdp11/pdp11.c      2008-08-09 14:43:47.000000000 +0200
> +++ gcc-head/gcc/config/pdp11/pdp11.c   2008-08-09 18:34:26.000000000 +0200
> @@ -79,6 +79,7 @@ const struct real_format pdp11_f_format
>     false,
>     false,
>     false,
> +    false,
>     false
>   };
>
> @@ -99,6 +100,7 @@ const struct real_format pdp11_d_format
>     false,
>     false,
>     false,
> +    false,
>     false
>   };
>
> diff -urNp -x .svn gcc-head-orig/gcc/config/spu/spu.h gcc-head/gcc/config/spu/spu.h
> --- gcc-head-orig/gcc/config/spu/spu.h  2008-08-09 14:44:12.000000000 +0200
> +++ gcc-head/gcc/config/spu/spu.h       2008-08-09 18:34:26.000000000 +0200
> @@ -124,34 +124,6 @@ extern GTY(()) int spu_tune;
>
>  #define STACK_SIZE_MODE SImode
>
> -/* #define TARGET_FLOAT_FORMAT         SPU_FLOAT_FORMAT */
> -
> -#ifndef MODE_HAS_NANS
> -#define MODE_HAS_NANS(MODE)                                     \
> -  (FLOAT_MODE_P (MODE)                                                 \
> -   && MODE != SFmode                                           \
> -   && !LARGEST_EXPONENT_IS_NORMAL (GET_MODE_BITSIZE (MODE)))
> -#endif
> -
> -#ifndef MODE_HAS_INFINITIES
> -#define MODE_HAS_INFINITIES(MODE)                               \
> -  (FLOAT_MODE_P (MODE)                                                 \
> -   && MODE != SFmode                                            \
> -   && !LARGEST_EXPONENT_IS_NORMAL (GET_MODE_BITSIZE (MODE)))
> -#endif
> -
> -#ifndef MODE_HAS_SIGN_DEPENDENT_ROUNDING
> -#define MODE_HAS_SIGN_DEPENDENT_ROUNDING(MODE)                  \
> -  (FLOAT_MODE_P (MODE)                                          \
> -    && MODE != SFmode                                           \
> -   && !ROUND_TOWARDS_ZERO)
> -#endif
> -
> -#define ROUND_TOWARDS_ZERO 1
> -
> -/* This is certainly true.  Should it be defined?  (It wasn't before.) */
> -/* #define LARGEST_EXPONENT_IS_NORMAL(size) (size != 32) */
> -
>
>  /* Type Layout */
>
> diff -urNp -x .svn gcc-head-orig/gcc/defaults.h gcc-head/gcc/defaults.h
> --- gcc-head-orig/gcc/defaults.h        2008-08-09 14:42:37.000000000 +0200
> +++ gcc-head/gcc/defaults.h     2008-08-09 18:34:26.000000000 +0200
> @@ -681,32 +681,6 @@ along with GCC; see the file COPYING3.
>  #define ROUND_TOWARDS_ZERO 0
>  #endif
>
> -#ifndef MODE_HAS_NANS
> -#define MODE_HAS_NANS(MODE)                                    \
> -  (FLOAT_MODE_P (MODE)                                         \
> -   && TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT                 \
> -   && !LARGEST_EXPONENT_IS_NORMAL (GET_MODE_BITSIZE (MODE)))
> -#endif
> -
> -#ifndef MODE_HAS_INFINITIES
> -#define MODE_HAS_INFINITIES(MODE)                              \
> -  (FLOAT_MODE_P (MODE)                                         \
> -   && TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT                 \
> -   && !LARGEST_EXPONENT_IS_NORMAL (GET_MODE_BITSIZE (MODE)))
> -#endif
> -
> -#ifndef MODE_HAS_SIGNED_ZEROS
> -#define MODE_HAS_SIGNED_ZEROS(MODE) \
> -  (FLOAT_MODE_P (MODE) && TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT)
> -#endif
> -
> -#ifndef MODE_HAS_SIGN_DEPENDENT_ROUNDING
> -#define MODE_HAS_SIGN_DEPENDENT_ROUNDING(MODE)                 \
> -  (FLOAT_MODE_P (MODE)                                         \
> -   && TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT                 \
> -   && !ROUND_TOWARDS_ZERO)
> -#endif
> -
>  #ifndef FLOAT_LIB_COMPARE_RETURNS_BOOL
>  #define FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE, COMPARISON) false
>  #endif
> diff -urNp -x .svn gcc-head-orig/gcc/doc/tm.texi gcc-head/gcc/doc/tm.texi
> --- gcc-head-orig/gcc/doc/tm.texi       2008-08-09 14:42:37.000000000 +0200
> +++ gcc-head/gcc/doc/tm.texi    2008-08-09 18:34:26.000000000 +0200
> @@ -1407,78 +1407,12 @@ The ordering of the component words of f
>  memory is controlled by @code{FLOAT_WORDS_BIG_ENDIAN}.
>  @end defmac
>
> -@defmac MODE_HAS_NANS (@var{mode})
> -When defined, this macro should be true if @var{mode} has a NaN
> -representation.  The compiler assumes that NaNs are not equal to
> -anything (including themselves) and that addition, subtraction,
> -multiplication and division all return NaNs when one operand is
> -NaN@.
> -
> -By default, this macro is true if @var{mode} is a floating-point
> -mode and the target floating-point format is IEEE@.
> -@end defmac
> -
> -@defmac MODE_HAS_INFINITIES (@var{mode})
> -This macro should be true if @var{mode} can represent infinity.  At
> -present, the compiler uses this macro to decide whether @samp{x - x}
> -is always defined.  By default, the macro is true when @var{mode}
> -is a floating-point mode and the target format is IEEE@.
> -@end defmac
> -
> -@defmac MODE_HAS_SIGNED_ZEROS (@var{mode})
> -True if @var{mode} distinguishes between positive and negative zero.
> -The rules are expected to follow the IEEE standard:
> -
> -@itemize @bullet
> -@item
> -@samp{x + x} has the same sign as @samp{x}.
> -
> -@item
> -If the sum of two values with opposite sign is zero, the result is
> -positive for all rounding modes expect towards @minus{}infinity, for
> -which it is negative.
> -
> -@item
> -The sign of a product or quotient is negative when exactly one
> -of the operands is negative.
> -@end itemize
> -
> -The default definition is true if @var{mode} is a floating-point
> -mode and the target format is IEEE@.
> -@end defmac
> -
> -@defmac MODE_HAS_SIGN_DEPENDENT_ROUNDING (@var{mode})
> -If defined, this macro should be true for @var{mode} if it has at
> -least one rounding mode in which @samp{x} and @samp{-x} can be
> -rounded to numbers of different magnitude.  Two such modes are
> -towards @minus{}infinity and towards +infinity.
> -
> -The default definition of this macro is true if @var{mode} is
> -a floating-point mode and the target format is IEEE@.
> -@end defmac
> -
>  @defmac ROUND_TOWARDS_ZERO
>  If defined, this macro should be true if the prevailing rounding
> -mode is towards zero.  A true value has the following effects:
> -
> -@itemize @bullet
> -@item
> -@code{MODE_HAS_SIGN_DEPENDENT_ROUNDING} will be false for all modes.
> +mode is towards zero.
>
> -@item
> -@file{libgcc.a}'s floating-point emulator will round towards zero
> -rather than towards nearest.
> -
> -@item
> -The compiler's floating-point emulator will round towards zero after
> -doing arithmetic, and when converting from the internal float format to
> -the target format.
> -@end itemize
> -
> -The macro does not affect the parsing of string literals.  When the
> -primary rounding mode is towards zero, library functions like
> -@code{strtod} might still round towards nearest, and the compiler's
> -parser should behave like the target's @code{strtod} where possible.
> +Defining this macro only affects the way @file{libgcc.a} emulates
> +floating-point arithmetic.
>
>  Not defining this macro is equivalent to returning zero.
>  @end defmac
> @@ -1488,9 +1422,7 @@ This macro should return true if floats
>  bits do not have a NaN or infinity representation, but use the largest
>  exponent for normal numbers instead.
>
> -Defining this macro to true for @var{size} causes @code{MODE_HAS_NANS}
> -and @code{MODE_HAS_INFINITIES} to be false for @var{size}-bit modes.
> -It also affects the way @file{libgcc.a} and @file{real.c} emulate
> +Defining this macro only affects the way @file{libgcc.a} emulates
>  floating-point arithmetic.
>
>  The default definition of this macro returns false for all sizes.
> @@ -9077,7 +9009,7 @@ following codes are supported: @code{PLU
>  If @code{REAL_ARITHMETIC} is asked to evaluate division by zero and the
>  target's floating point format cannot represent infinity, it will call
>  @code{abort}.  Callers should check for this situation first, using
> -@code{MODE_HAS_INFINITIES}.  @xref{Storage Layout}.
> +@code{REAL_MODE_FORMAT_HAS_INFINITIES}.  @xref{Storage Layout}.
>  @end deftypefn
>
>  @deftypefn Macro REAL_VALUE_TYPE REAL_VALUE_NEGATE (REAL_VALUE_TYPE @var{x})
> diff -urNp -x .svn gcc-head-orig/gcc/flags.h gcc-head/gcc/flags.h
> --- gcc-head-orig/gcc/flags.h   2008-08-09 14:42:37.000000000 +0200
> +++ gcc-head/gcc/flags.h        2008-08-09 19:06:20.000000000 +0200
> @@ -24,6 +24,7 @@ along with GCC; see the file COPYING3.
>
>  #include "coretypes.h"
>  #include "options.h"
> +#include "real.h"
>
>  enum debug_info_type
>  {
> @@ -282,7 +283,9 @@ extern bool warn_disallowed_functions;
>    disabled for modes with NaNs.  The user can ask for them to be
>    done anyway using the -funsafe-math-optimizations switch.  */
>  #define HONOR_NANS(MODE) \
> -  (MODE_HAS_NANS (MODE) && !flag_finite_math_only)
> +  (!flag_finite_math_only && FLOAT_MODE_P (MODE) \
> +   && REAL_MODE_FORMAT_HAS_NANS \
> +       (SCALAR_FLOAT_MODE_P (MODE)? (MODE) : GET_MODE_INNER (MODE)))
>
>  /* Like HONOR_NANs, but true if we honor signaling NaNs (or sNaNs).  */
>  #define HONOR_SNANS(MODE) (flag_signaling_nans && HONOR_NANS (MODE))
> @@ -290,17 +293,23 @@ extern bool warn_disallowed_functions;
>  /* As for HONOR_NANS, but true if the mode can represent infinity and
>    the treatment of infinite values is important.  */
>  #define HONOR_INFINITIES(MODE) \
> -  (MODE_HAS_INFINITIES (MODE) && !flag_finite_math_only)
> +  (!flag_finite_math_only && FLOAT_MODE_P (MODE) \
> +   && REAL_MODE_FORMAT_HAS_INFINITIES \
> +       (SCALAR_FLOAT_MODE_P (MODE)? (MODE) : GET_MODE_INNER (MODE)))
>
>  /* Like HONOR_NANS, but true if the given mode distinguishes between
>    positive and negative zero, and the sign of zero is important.  */
>  #define HONOR_SIGNED_ZEROS(MODE) \
> -  (MODE_HAS_SIGNED_ZEROS (MODE) && flag_signed_zeros)
> +  (flag_signed_zeros && FLOAT_MODE_P (MODE) \
> +   && REAL_MODE_FORMAT_HAS_SIGNED_ZEROS \
> +       (SCALAR_FLOAT_MODE_P (MODE)? (MODE) : GET_MODE_INNER (MODE)))
>
>  /* Like HONOR_NANS, but true if given mode supports sign-dependent rounding,
>    and the rounding mode is important.  */
>  #define HONOR_SIGN_DEPENDENT_ROUNDING(MODE) \
> -  (MODE_HAS_SIGN_DEPENDENT_ROUNDING (MODE) && flag_rounding_math)
> +  (flag_rounding_math && FLOAT_MODE_P (MODE) \
> +   && REAL_MODE_FORMAT_HAS_SIGN_DEPENDENT_ROUNDING \
> +       (SCALAR_FLOAT_MODE_P (MODE)? (MODE) : GET_MODE_INNER (MODE)))
>
>  /* True if overflow wraps around for the given integral type.  That
>    is, TYPE_MAX + 1 == TYPE_MIN.  */
> diff -urNp -x .svn gcc-head-orig/gcc/fold-const.c gcc-head/gcc/fold-const.c
> --- gcc-head-orig/gcc/fold-const.c      2008-08-09 14:42:37.000000000 +0200
> +++ gcc-head/gcc/fold-const.c   2008-08-09 20:26:53.000000000 +0200
> @@ -1858,7 +1858,8 @@ const_binop (enum tree_code code, tree a
>         by zero exception.  */
>       if (code == RDIV_EXPR
>          && REAL_VALUES_EQUAL (d2, dconst0)
> -         && (flag_trapping_math || ! MODE_HAS_INFINITIES (mode)))
> +         && (flag_trapping_math
> +             || ! REAL_MODE_FORMAT_HAS_INFINITIES (mode)))
>        return NULL_TREE;
>
>       /* If either operand is a NaN, just return it.  Otherwise, set up
> @@ -1874,7 +1875,7 @@ const_binop (enum tree_code code, tree a
>       /* Don't constant fold this floating point operation if
>         the result has overflowed and flag_trapping_math.  */
>       if (flag_trapping_math
> -         && MODE_HAS_INFINITIES (mode)
> +         && REAL_MODE_FORMAT_HAS_INFINITIES (mode)
>          && REAL_VALUE_ISINF (result)
>          && !REAL_VALUE_ISINF (d1)
>          && !REAL_VALUE_ISINF (d2))
> @@ -10959,7 +10960,7 @@ fold_binary (enum tree_code code, tree t
>       /* Don't touch a floating-point divide by zero unless the mode
>         of the constant can represent infinity.  */
>       if (TREE_CODE (arg1) == REAL_CST
> -         && !MODE_HAS_INFINITIES (TYPE_MODE (TREE_TYPE (arg1)))
> +         && !REAL_MODE_FORMAT_HAS_INFINITIES (TYPE_MODE (TREE_TYPE (arg1)))
>          && real_zerop (arg1))
>        return NULL_TREE;
>
> diff -urNp -x .svn gcc-head-orig/gcc/machmode.h gcc-head/gcc/machmode.h
> --- gcc-head-orig/gcc/machmode.h        2008-06-10 23:24:06.000000000 +0200
> +++ gcc-head/gcc/machmode.h     2008-08-09 19:21:06.000000000 +0200
> @@ -202,7 +202,7 @@ extern const unsigned HOST_WIDE_INT mode
>  /* Return the mode of the inner elements in a vector.  */
>
>  extern const unsigned char mode_inner[NUM_MACHINE_MODES];
> -#define GET_MODE_INNER(MODE) mode_inner[MODE]
> +#define GET_MODE_INNER(MODE) ((enum machine_mode) mode_inner[MODE])
>
>  /* Get the size in bytes of the basic parts of an object of mode MODE.  */
>
> diff -urNp -x .svn gcc-head-orig/gcc/real.c gcc-head/gcc/real.c
> --- gcc-head-orig/gcc/real.c    2008-08-09 14:43:47.000000000 +0200
> +++ gcc-head/gcc/real.c 2008-08-09 18:34:27.000000000 +0200
> @@ -2871,6 +2871,7 @@ const struct real_format ieee_single_for
>     true,
>     true,
>     true,
> +    true,
>     false
>   };
>
> @@ -2890,6 +2891,7 @@ const struct real_format mips_single_for
>     true,
>     true,
>     true,
> +    true,
>     false,
>     true
>   };
> @@ -2911,6 +2913,7 @@ const struct real_format motorola_single
>     true,
>     true,
>     true,
> +    true,
>     true
>   };
>
> @@ -2939,6 +2942,7 @@ const struct real_format spu_single_form
>     true,
>     false,
>     false,
> +    false,
>     true,
>     true,
>     false,
> @@ -3150,6 +3154,7 @@ const struct real_format ieee_double_for
>     true,
>     true,
>     true,
> +    true,
>     false
>   };
>
> @@ -3169,6 +3174,7 @@ const struct real_format mips_double_for
>     true,
>     true,
>     true,
> +    true,
>     false,
>     true
>   };
> @@ -3190,6 +3196,7 @@ const struct real_format motorola_double
>     true,
>     true,
>     true,
> +    true,
>     true
>   };
>
> @@ -3528,6 +3535,7 @@ const struct real_format ieee_extended_m
>     true,
>     true,
>     true,
> +    true,
>     true
>   };
>
> @@ -3548,6 +3556,7 @@ const struct real_format ieee_extended_i
>     true,
>     true,
>     true,
> +    true,
>     false
>   };
>
> @@ -3568,6 +3577,7 @@ const struct real_format ieee_extended_i
>     true,
>     true,
>     true,
> +    true,
>     false
>   };
>
> @@ -3590,6 +3600,7 @@ const struct real_format ieee_extended_i
>     true,
>     true,
>     true,
> +    true,
>     false
>   };
>
> @@ -3677,6 +3688,7 @@ const struct real_format ibm_extended_fo
>     true,
>     true,
>     true,
> +    true,
>     false
>   };
>
> @@ -3696,6 +3708,7 @@ const struct real_format mips_extended_f
>     true,
>     true,
>     true,
> +    true,
>     false,
>     true
>   };
> @@ -3959,6 +3972,7 @@ const struct real_format ieee_quad_forma
>     true,
>     true,
>     true,
> +    true,
>     false
>   };
>
> @@ -3978,6 +3992,7 @@ const struct real_format mips_quad_forma
>     true,
>     true,
>     true,
> +    true,
>     false,
>     true
>   };
> @@ -4278,6 +4293,7 @@ const struct real_format vax_f_format =
>     false,
>     false,
>     false,
> +    false,
>     false
>   };
>
> @@ -4298,6 +4314,7 @@ const struct real_format vax_d_format =
>     false,
>     false,
>     false,
> +    false,
>     false
>   };
>
> @@ -4318,6 +4335,7 @@ const struct real_format vax_g_format =
>     false,
>     false,
>     false,
> +    false,
>     false
>   };
>
> @@ -4391,6 +4409,7 @@ const struct real_format decimal_single_
>     true,
>     true,
>     true,
> +    true,
>     true,
>     true,
>     false
> @@ -4414,6 +4433,7 @@ const struct real_format decimal_double_
>     true,
>     true,
>     true,
> +    true,
>     false
>   };
>
> @@ -4432,6 +4452,7 @@ const struct real_format decimal_quad_fo
>     false,
>     true,
>     true,
> +    true,
>     true,
>     true,
>     true,
> @@ -4474,6 +4495,7 @@ const struct real_format real_internal_f
>     -1,
>     -1,
>     false,
> +    false,
>     true,
>     true,
>     false,
> diff -urNp -x .svn gcc-head-orig/gcc/real.h gcc-head/gcc/real.h
> --- gcc-head-orig/gcc/real.h    2008-08-09 14:43:47.000000000 +0200
> +++ gcc-head/gcc/real.h 2008-08-09 20:16:37.000000000 +0200
> @@ -149,6 +149,7 @@ struct real_format
>
>   /* Default rounding mode for operations on this format.  */
>   bool round_towards_zero;
> +  bool has_sign_dependent_rounding;
>
>   /* Properties of the format.  */
>   bool has_nans;
> @@ -171,9 +172,9 @@ extern const struct real_format *
>
>  #define REAL_MODE_FORMAT(MODE)                                         \
>   (real_format_for_mode[DECIMAL_FLOAT_MODE_P (MODE)                    \
> -                       ? ((MODE - MIN_MODE_DECIMAL_FLOAT)              \
> +                       ? (((MODE) - MIN_MODE_DECIMAL_FLOAT)            \
>                           + (MAX_MODE_FLOAT - MIN_MODE_FLOAT + 1))     \
> -                       : (MODE - MIN_MODE_FLOAT)])
> +                       : ((MODE) - MIN_MODE_FLOAT)])
>
>  /* The following macro determines whether the floating point format is
>    composite, i.e. may contain non-consecutive mantissa bits, in which
> @@ -181,6 +182,16 @@ extern const struct real_format *
>  #define REAL_MODE_FORMAT_COMPOSITE_P(MODE) \
>        ((REAL_MODE_FORMAT(MODE))->pnan < (REAL_MODE_FORMAT (MODE))->p)
>
> +/* Accessor macros for format properties.  */
> +#define REAL_MODE_FORMAT_HAS_NANS(MODE) \
> +       (REAL_MODE_FORMAT (MODE)->has_nans)
> +#define REAL_MODE_FORMAT_HAS_INFINITIES(MODE) \
> +       (REAL_MODE_FORMAT (MODE)->has_inf)
> +#define REAL_MODE_FORMAT_HAS_SIGNED_ZEROS(MODE) \
> +       (REAL_MODE_FORMAT (MODE)->has_signed_zero)
> +#define REAL_MODE_FORMAT_HAS_SIGN_DEPENDENT_ROUNDING(MODE) \
> +       (REAL_MODE_FORMAT (MODE)->has_sign_dependent_rounding)
> +
>  /* Declare functions in real.c.  */
>
>  /* Binary or unary arithmetic on tree_code.  */
> diff -urNp -x .svn gcc-head-orig/gcc/simplify-rtx.c gcc-head/gcc/simplify-rtx.c
> --- gcc-head-orig/gcc/simplify-rtx.c    2008-08-09 14:42:37.000000000 +0200
> +++ gcc-head/gcc/simplify-rtx.c 2008-08-09 18:34:27.000000000 +0200
> @@ -3021,10 +3021,11 @@ simplify_const_binary_operation (enum rt
>
>          if (code == DIV
>              && REAL_VALUES_EQUAL (f1, dconst0)
> -             && (flag_trapping_math || ! MODE_HAS_INFINITIES (mode)))
> +             && (flag_trapping_math
> +                 || ! REAL_MODE_FORMAT_HAS_INFINITIES (mode)))
>            return 0;
>
> -         if (MODE_HAS_INFINITIES (mode) && HONOR_NANS (mode)
> +         if (REAL_MODE_FORMAT_HAS_INFINITIES (mode) && HONOR_NANS (mode)
>              && flag_trapping_math
>              && REAL_VALUE_ISINF (f0) && REAL_VALUE_ISINF (f1))
>            {
> @@ -3051,7 +3052,8 @@ simplify_const_binary_operation (enum rt
>                }
>            }
>
> -         if (code == MULT && MODE_HAS_INFINITIES (mode) && HONOR_NANS (mode)
> +         if (code == MULT && REAL_MODE_FORMAT_HAS_INFINITIES (mode)
> +             && HONOR_NANS (mode)
>              && flag_trapping_math
>              && ((REAL_VALUE_ISINF (f0) && REAL_VALUES_EQUAL (f1, dconst0))
>                  || (REAL_VALUE_ISINF (f1)
> @@ -3067,7 +3069,7 @@ simplify_const_binary_operation (enum rt
>             the result has overflowed and flag_trapping_math.  */
>
>          if (flag_trapping_math
> -             && MODE_HAS_INFINITIES (mode)
> +             && REAL_MODE_FORMAT_HAS_INFINITIES (mode)
>              && REAL_VALUE_ISINF (result)
>              && !REAL_VALUE_ISINF (f0)
>              && !REAL_VALUE_ISINF (f1))
> --
>  Dr. Ulrich Weigand
>  GNU Toolchain for Linux on System z and Cell BE
>  Ulrich.Weigand@de.ibm.com
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]