Remove SF_SIZE etc. target macros

Richard Biener richard.guenther@gmail.com
Mon Sep 8 09:12:00 GMT 2014


On Sat, Sep 6, 2014 at 12:07 AM, Joseph S. Myers
<joseph@codesourcery.com> wrote:
> This patch replaces the target macros SF_SIZE, DF_SIZE, XF_SIZE and
> TF_SIZE, used to tell libgcc the number of bits in the mantissas of
> floating-point modes, with __LIBGCC_SF_MANT_DIG__ etc. macros defined
> if -fbuilding-libgcc for all floating-point modes.  Various libgcc
> logic to determine default values of the macros based on other target
> macros such as LIBGCC2_LONG_DOUBLE_TYPE_SIZE can thus be removed.
>
> Bootstrapped with no regressions on x86_64-unknown-linux-gnu.  OK to
> commit?

Ok.

Thanks,
Richard.

> gcc:
> 2014-09-05  Joseph Myers  <joseph@codesourcery.com>
>
>         * config/i386/cygming.h (TF_SIZE): Remove.
>         * config/i386/darwin.h (TF_SIZE): Remove.
>         * config/i386/dragonfly.h (TF_SIZE): Remove.
>         * config/i386/freebsd.h (TF_SIZE): Remove.
>         * config/i386/gnu-user-common.h (TF_SIZE): Remove.
>         * config/i386/openbsdelf.h (TF_SIZE): Remove.
>         * config/i386/sol2.h (TF_SIZE): Remove.
>         * config/ia64/hpux.h (XF_SIZE, TF_SIZE): Remove.
>         * config/ia64/linux.h (TF_SIZE): Remove.
>         * doc/tm.texi.in (SF_SIZE, DF_SIZE, XF_SIZE, TF_SIZE): Remove.
>         * doc/tm.texi: Regenerate.
>         * system.h (SF_SIZE, DF_SIZE, XF_SIZE, TF_SIZE): Poison.
>
> gcc/c-family:
> 2014-09-05  Joseph Myers  <joseph@codesourcery.com>
>
>         * c-cppbuiltin.c (c_cpp_builtins): Define macros for mantissa
>         digits of floating-point modes if -fbuilding-libgcc.
>
> libgcc:
> 2014-09-05  Joseph Myers  <joseph@codesourcery.com>
>
>         * libgcc2.c (SF_SIZE): Change all uses to __LIBGCC_SF_MANT_DIG__.
>         (DF_SIZE): Change all uses to __LIBGCC_DF_MANT_DIG__.
>         (XF_SIZE): Change all uses to __LIBGCC_XF_MANT_DIG__.
>         (TF_SIZE): Change all uses to __LIBGCC_TF_MANT_DIG__.
>         * libgcc2.h (SF_SIZE): Change to __LIBGCC_SF_MANT_DIG__.  Give
>         error if not defined and LIBGCC2_HAS_SF_MODE is defined.
>         (DF_SIZE): Change to __LIBGCC_DF_MANT_DIG__.  Give error if not
>         defined and LIBGCC2_HAS_DF_MODE is defined.
>         (XF_SIZE): Change to __LIBGCC_XF_MANT_DIG__.  Give error if not
>         defined and LIBGCC2_HAS_XF_MODE is defined.
>         (TF_SIZE): Change to __LIBGCC_TF_MANT_DIG__.  Give error if not
>         defined and LIBGCC2_HAS_TF_MODE is defined.
>
> Index: gcc/c-family/c-cppbuiltin.c
> ===================================================================
> --- gcc/c-family/c-cppbuiltin.c (revision 214954)
> +++ gcc/c-family/c-cppbuiltin.c (working copy)
> @@ -944,6 +944,20 @@ c_cpp_builtins (cpp_reader *pfile)
>    /* For libgcc-internal use only.  */
>    if (flag_building_libgcc)
>      {
> +      /* Properties of floating-point modes for libgcc2.c.  */
> +      for (enum machine_mode mode = GET_CLASS_NARROWEST_MODE (MODE_FLOAT);
> +          mode != VOIDmode;
> +          mode = GET_MODE_WIDER_MODE (mode))
> +       {
> +         const char *name = GET_MODE_NAME (mode);
> +         char *macro_name
> +           = (char *) alloca (strlen (name)
> +                              + sizeof ("__LIBGCC__MANT_DIG__"));
> +         sprintf (macro_name, "__LIBGCC_%s_MANT_DIG__", name);
> +         builtin_define_with_int_value (macro_name,
> +                                        REAL_MODE_FORMAT (mode)->p);
> +       }
> +
>        /* For libgcc crtstuff.c and libgcc2.c.  */
>        builtin_define_with_int_value ("__LIBGCC_EH_TABLES_CAN_BE_READ_ONLY__",
>                                      EH_TABLES_CAN_BE_READ_ONLY);
> Index: gcc/config/i386/cygming.h
> ===================================================================
> --- gcc/config/i386/cygming.h   (revision 214954)
> +++ gcc/config/i386/cygming.h   (working copy)
> @@ -343,7 +343,6 @@ do {                                                \
>  #undef LIBGCC2_HAS_TF_MODE
>  #define LIBGCC2_HAS_TF_MODE 1
>  #define LIBGCC2_TF_CEXT q
> -#define TF_SIZE 113
>
>  /* Output function declarations at the end of the file.  */
>  #undef TARGET_ASM_FILE_END
> Index: gcc/config/i386/darwin.h
> ===================================================================
> --- gcc/config/i386/darwin.h    (revision 214954)
> +++ gcc/config/i386/darwin.h    (working copy)
> @@ -157,7 +157,6 @@ extern int darwin_emit_branch_islands;
>  #undef LIBGCC2_HAS_TF_MODE
>  #define LIBGCC2_HAS_TF_MODE 1
>  #define LIBGCC2_TF_CEXT q
> -#define TF_SIZE 113
>
>  #undef TARGET_ASM_FILE_END
>  #define TARGET_ASM_FILE_END darwin_file_end
> Index: gcc/config/i386/dragonfly.h
> ===================================================================
> --- gcc/config/i386/dragonfly.h (revision 214954)
> +++ gcc/config/i386/dragonfly.h (working copy)
> @@ -93,7 +93,6 @@ see the files COPYING3 and COPYING.RUNTIME respect
>  #undef LIBGCC2_HAS_TF_MODE
>  #define LIBGCC2_HAS_TF_MODE 1
>  #define LIBGCC2_TF_CEXT q
> -#define TF_SIZE 113
>
>  /* Static stack checking is supported by means of probes.  */
>  #define STACK_CHECK_STATIC_BUILTIN 1
> Index: gcc/config/i386/freebsd.h
> ===================================================================
> --- gcc/config/i386/freebsd.h   (revision 214954)
> +++ gcc/config/i386/freebsd.h   (working copy)
> @@ -135,7 +135,6 @@ along with GCC; see the file COPYING3.  If not see
>  #undef LIBGCC2_HAS_TF_MODE
>  #define LIBGCC2_HAS_TF_MODE 1
>  #define LIBGCC2_TF_CEXT q
> -#define TF_SIZE 113
>
>  /* Static stack checking is supported by means of probes.  */
>  #define STACK_CHECK_STATIC_BUILTIN 1
> Index: gcc/config/i386/gnu-user-common.h
> ===================================================================
> --- gcc/config/i386/gnu-user-common.h   (revision 214954)
> +++ gcc/config/i386/gnu-user-common.h   (working copy)
> @@ -61,7 +61,6 @@ along with GCC; see the file COPYING3.  If not see
>  #undef LIBGCC2_HAS_TF_MODE
>  #define LIBGCC2_HAS_TF_MODE 1
>  #define LIBGCC2_TF_CEXT q
> -#define TF_SIZE 113
>
>  #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
>
> Index: gcc/config/i386/openbsdelf.h
> ===================================================================
> --- gcc/config/i386/openbsdelf.h        (revision 214954)
> +++ gcc/config/i386/openbsdelf.h        (working copy)
> @@ -116,4 +116,3 @@ along with GCC; see the file COPYING3.  If not see
>  #undef LIBGCC2_HAS_TF_MODE
>  #define LIBGCC2_HAS_TF_MODE 1
>  #define LIBGCC2_TF_CEXT q
> -#define TF_SIZE 113
> Index: gcc/config/i386/sol2.h
> ===================================================================
> --- gcc/config/i386/sol2.h      (revision 214954)
> +++ gcc/config/i386/sol2.h      (working copy)
> @@ -241,4 +241,3 @@ along with GCC; see the file COPYING3.  If not see
>  #undef LIBGCC2_HAS_TF_MODE
>  #define LIBGCC2_HAS_TF_MODE 1
>  #define LIBGCC2_TF_CEXT q
> -#define TF_SIZE 113
> Index: gcc/config/ia64/hpux.h
> ===================================================================
> --- gcc/config/ia64/hpux.h      (revision 214954)
> +++ gcc/config/ia64/hpux.h      (working copy)
> @@ -192,12 +192,10 @@ do {                                                              \
>  /* Put all *xf routines in libgcc, regardless of long double size.  */
>  #undef LIBGCC2_HAS_XF_MODE
>  #define LIBGCC2_HAS_XF_MODE 1
> -#define XF_SIZE 64
>
>  /* Put all *tf routines in libgcc, regardless of long double size.  */
>  #undef LIBGCC2_HAS_TF_MODE
>  #define LIBGCC2_HAS_TF_MODE 1
> -#define TF_SIZE 113
>
>  /* HP-UX headers are C++-compatible.  */
>  #define NO_IMPLICIT_EXTERN_C
> Index: gcc/config/ia64/linux.h
> ===================================================================
> --- gcc/config/ia64/linux.h     (revision 214954)
> +++ gcc/config/ia64/linux.h     (working copy)
> @@ -81,7 +81,6 @@ do {                                          \
>  #define LIBGCC2_HAS_TF_MODE 1
>  #undef LIBGCC2_TF_CEXT
>  #define LIBGCC2_TF_CEXT q
> -#define TF_SIZE 113
>
>  #undef TARGET_INIT_LIBFUNCS
>  #define TARGET_INIT_LIBFUNCS ia64_soft_fp_init_libfuncs
> Index: gcc/doc/tm.texi
> ===================================================================
> --- gcc/doc/tm.texi     (revision 214954)
> +++ gcc/doc/tm.texi     (working copy)
> @@ -1602,20 +1602,6 @@ uses this macro should also arrange to use @file{t
>  the libgcc @file{config.host}.
>  @end defmac
>
> -@defmac SF_SIZE
> -@defmacx DF_SIZE
> -@defmacx XF_SIZE
> -@defmacx TF_SIZE
> -Define these macros to be the size in bits of the mantissa of
> -@code{SFmode}, @code{DFmode}, @code{XFmode} and @code{TFmode} values,
> -if the defaults in @file{libgcc2.h} are inappropriate.  By default,
> -@code{FLT_MANT_DIG} is used for @code{SF_SIZE}, @code{LDBL_MANT_DIG}
> -for @code{XF_SIZE} and @code{TF_SIZE}, and @code{DBL_MANT_DIG} or
> -@code{LDBL_MANT_DIG} for @code{DF_SIZE} according to whether
> -@code{DOUBLE_TYPE_SIZE} or
> -@code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE} is 64.
> -@end defmac
> -
>  @defmac TARGET_FLT_EVAL_METHOD
>  A C expression for the value for @code{FLT_EVAL_METHOD} in @file{float.h},
>  assuming, if applicable, that the floating-point control word is in its
> Index: gcc/doc/tm.texi.in
> ===================================================================
> --- gcc/doc/tm.texi.in  (revision 214954)
> +++ gcc/doc/tm.texi.in  (working copy)
> @@ -1444,20 +1444,6 @@ uses this macro should also arrange to use @file{t
>  the libgcc @file{config.host}.
>  @end defmac
>
> -@defmac SF_SIZE
> -@defmacx DF_SIZE
> -@defmacx XF_SIZE
> -@defmacx TF_SIZE
> -Define these macros to be the size in bits of the mantissa of
> -@code{SFmode}, @code{DFmode}, @code{XFmode} and @code{TFmode} values,
> -if the defaults in @file{libgcc2.h} are inappropriate.  By default,
> -@code{FLT_MANT_DIG} is used for @code{SF_SIZE}, @code{LDBL_MANT_DIG}
> -for @code{XF_SIZE} and @code{TF_SIZE}, and @code{DBL_MANT_DIG} or
> -@code{LDBL_MANT_DIG} for @code{DF_SIZE} according to whether
> -@code{DOUBLE_TYPE_SIZE} or
> -@code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE} is 64.
> -@end defmac
> -
>  @defmac TARGET_FLT_EVAL_METHOD
>  A C expression for the value for @code{FLT_EVAL_METHOD} in @file{float.h},
>  assuming, if applicable, that the floating-point control word is in its
> Index: gcc/system.h
> ===================================================================
> --- gcc/system.h        (revision 214954)
> +++ gcc/system.h        (working copy)
> @@ -934,7 +934,7 @@ extern void fancy_abort (const char *, int, const
>         REG_CLASS_FROM_CONSTRAINT REG_CLASS_FOR_CONSTRAINT                 \
>         EXTRA_CONSTRAINT_STR EXTRA_MEMORY_CONSTRAINT                       \
>         EXTRA_ADDRESS_CONSTRAINT CONST_DOUBLE_OK_FOR_CONSTRAINT_P          \
> -       CALLER_SAVE_PROFITABLE
> +       CALLER_SAVE_PROFITABLE SF_SIZE DF_SIZE XF_SIZE TF_SIZE
>
>  /* Hooks that are no longer used.  */
>   #pragma GCC poison LANG_HOOKS_FUNCTION_MARK LANG_HOOKS_FUNCTION_FREE  \
> Index: libgcc/libgcc2.c
> ===================================================================
> --- libgcc/libgcc2.c    (revision 214954)
> +++ libgcc/libgcc2.c    (working copy)
> @@ -1506,7 +1506,7 @@ __fixsfdi (SFtype a)
>  XFtype
>  __floatdixf (DWtype u)
>  {
> -#if W_TYPE_SIZE > XF_SIZE
> +#if W_TYPE_SIZE > __LIBGCC_XF_MANT_DIG__
>  # error
>  #endif
>    XFtype d = (Wtype) (u >> W_TYPE_SIZE);
> @@ -1520,7 +1520,7 @@ __floatdixf (DWtype u)
>  XFtype
>  __floatundixf (UDWtype u)
>  {
> -#if W_TYPE_SIZE > XF_SIZE
> +#if W_TYPE_SIZE > __LIBGCC_XF_MANT_DIG__
>  # error
>  #endif
>    XFtype d = (UWtype) (u >> W_TYPE_SIZE);
> @@ -1534,7 +1534,7 @@ __floatundixf (UDWtype u)
>  TFtype
>  __floatditf (DWtype u)
>  {
> -#if W_TYPE_SIZE > TF_SIZE
> +#if W_TYPE_SIZE > __LIBGCC_TF_MANT_DIG__
>  # error
>  #endif
>    TFtype d = (Wtype) (u >> W_TYPE_SIZE);
> @@ -1548,7 +1548,7 @@ __floatditf (DWtype u)
>  TFtype
>  __floatunditf (UDWtype u)
>  {
> -#if W_TYPE_SIZE > TF_SIZE
> +#if W_TYPE_SIZE > __LIBGCC_TF_MANT_DIG__
>  # error
>  #endif
>    TFtype d = (UWtype) (u >> W_TYPE_SIZE);
> @@ -1568,11 +1568,11 @@ __floatunditf (UDWtype u)
>  #if defined(L_floatdisf)
>  #define FUNC __floatdisf
>  #define FSTYPE SFtype
> -#define FSSIZE SF_SIZE
> +#define FSSIZE __LIBGCC_SF_MANT_DIG__
>  #else
>  #define FUNC __floatdidf
>  #define FSTYPE DFtype
> -#define FSSIZE DF_SIZE
> +#define FSSIZE __LIBGCC_DF_MANT_DIG__
>  #endif
>
>  FSTYPE
> @@ -1584,18 +1584,18 @@ FUNC (DWtype u)
>    f *= Wtype_MAXp1_F;
>    f += (UWtype)u;
>    return f;
> -#elif (LIBGCC2_HAS_DF_MODE && F_MODE_OK (DF_SIZE))     \
> -     || (LIBGCC2_HAS_XF_MODE && F_MODE_OK (XF_SIZE))   \
> -     || (LIBGCC2_HAS_TF_MODE && F_MODE_OK (TF_SIZE))
> +#elif (LIBGCC2_HAS_DF_MODE && F_MODE_OK (__LIBGCC_DF_MANT_DIG__))      \
> +     || (LIBGCC2_HAS_XF_MODE && F_MODE_OK (__LIBGCC_XF_MANT_DIG__))    \
> +     || (LIBGCC2_HAS_TF_MODE && F_MODE_OK (__LIBGCC_TF_MANT_DIG__))
>
> -#if (LIBGCC2_HAS_DF_MODE && F_MODE_OK (DF_SIZE))
> -# define FSIZE DF_SIZE
> +#if (LIBGCC2_HAS_DF_MODE && F_MODE_OK (__LIBGCC_DF_MANT_DIG__))
> +# define FSIZE __LIBGCC_DF_MANT_DIG__
>  # define FTYPE DFtype
> -#elif (LIBGCC2_HAS_XF_MODE && F_MODE_OK (XF_SIZE))
> -# define FSIZE XF_SIZE
> +#elif (LIBGCC2_HAS_XF_MODE && F_MODE_OK (__LIBGCC_XF_MANT_DIG__))
> +# define FSIZE __LIBGCC_XF_MANT_DIG__
>  # define FTYPE XFtype
> -#elif (LIBGCC2_HAS_TF_MODE && F_MODE_OK (TF_SIZE))
> -# define FSIZE TF_SIZE
> +#elif (LIBGCC2_HAS_TF_MODE && F_MODE_OK (__LIBGCC_TF_MANT_DIG__))
> +# define FSIZE __LIBGCC_TF_MANT_DIG__
>  # define FTYPE TFtype
>  #else
>  # error
> @@ -1684,11 +1684,11 @@ FUNC (DWtype u)
>  #if defined(L_floatundisf)
>  #define FUNC __floatundisf
>  #define FSTYPE SFtype
> -#define FSSIZE SF_SIZE
> +#define FSSIZE __LIBGCC_SF_MANT_DIG__
>  #else
>  #define FUNC __floatundidf
>  #define FSTYPE DFtype
> -#define FSSIZE DF_SIZE
> +#define FSSIZE __LIBGCC_DF_MANT_DIG__
>  #endif
>
>  FSTYPE
> @@ -1700,18 +1700,18 @@ FUNC (UDWtype u)
>    f *= Wtype_MAXp1_F;
>    f += (UWtype)u;
>    return f;
> -#elif (LIBGCC2_HAS_DF_MODE && F_MODE_OK (DF_SIZE))     \
> -     || (LIBGCC2_HAS_XF_MODE && F_MODE_OK (XF_SIZE))   \
> -     || (LIBGCC2_HAS_TF_MODE && F_MODE_OK (TF_SIZE))
> +#elif (LIBGCC2_HAS_DF_MODE && F_MODE_OK (__LIBGCC_DF_MANT_DIG__))      \
> +     || (LIBGCC2_HAS_XF_MODE && F_MODE_OK (__LIBGCC_XF_MANT_DIG__))    \
> +     || (LIBGCC2_HAS_TF_MODE && F_MODE_OK (__LIBGCC_TF_MANT_DIG__))
>
> -#if (LIBGCC2_HAS_DF_MODE && F_MODE_OK (DF_SIZE))
> -# define FSIZE DF_SIZE
> +#if (LIBGCC2_HAS_DF_MODE && F_MODE_OK (__LIBGCC_DF_MANT_DIG__))
> +# define FSIZE __LIBGCC_DF_MANT_DIG__
>  # define FTYPE DFtype
> -#elif (LIBGCC2_HAS_XF_MODE && F_MODE_OK (XF_SIZE))
> -# define FSIZE XF_SIZE
> +#elif (LIBGCC2_HAS_XF_MODE && F_MODE_OK (__LIBGCC_XF_MANT_DIG__))
> +# define FSIZE __LIBGCC_XF_MANT_DIG__
>  # define FTYPE XFtype
> -#elif (LIBGCC2_HAS_TF_MODE && F_MODE_OK (TF_SIZE))
> -# define FSIZE TF_SIZE
> +#elif (LIBGCC2_HAS_TF_MODE && F_MODE_OK (__LIBGCC_TF_MANT_DIG__))
> +# define FSIZE __LIBGCC_TF_MANT_DIG__
>  # define FTYPE TFtype
>  #else
>  # error
> Index: libgcc/libgcc2.h
> ===================================================================
> --- libgcc/libgcc2.h    (revision 214954)
> +++ libgcc/libgcc2.h    (working copy)
> @@ -59,41 +59,35 @@ extern void __eprintf (const char *, const char *,
>    (BITS_PER_UNIT == 8 && LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128)
>  #endif
>
> -#ifndef SF_SIZE
> +#ifndef __LIBGCC_SF_MANT_DIG__
>  #if LIBGCC2_HAS_SF_MODE
> -#define SF_SIZE FLT_MANT_DIG
> +#error __LIBGCC_SF_MANT_DIG__ not defined
>  #else
> -#define SF_SIZE 0
> +#define __LIBGCC_SF_MANT_DIG__ 0
>  #endif
>  #endif
>
> -#ifndef DF_SIZE
> +#ifndef __LIBGCC_DF_MANT_DIG__
>  #if LIBGCC2_HAS_DF_MODE
> -#if __SIZEOF_DOUBLE__ * __CHAR_BIT__ == 64
> -#define DF_SIZE DBL_MANT_DIG
> -#elif LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 64
> -#define DF_SIZE LDBL_MANT_DIG
> +#error __LIBGCC_DF_MANT_DIG__ not defined
>  #else
> -#define DF_SIZE 0
> +#define __LIBGCC_DF_MANT_DIG__ 0
>  #endif
> -#else
> -#define DF_SIZE 0
>  #endif
> -#endif
>
> -#ifndef XF_SIZE
> +#ifndef __LIBGCC_XF_MANT_DIG__
>  #if LIBGCC2_HAS_XF_MODE
> -#define XF_SIZE LDBL_MANT_DIG
> +#error __LIBGCC_XF_MANT_DIG__ not defined
>  #else
> -#define XF_SIZE 0
> +#define __LIBGCC_XF_MANT_DIG__ 0
>  #endif
>  #endif
>
> -#ifndef TF_SIZE
> +#ifndef __LIBGCC_TF_MANT_DIG__
>  #if LIBGCC2_HAS_TF_MODE
> -#define TF_SIZE LDBL_MANT_DIG
> +#error __LIBGCC_TF_MANT_DIG__ not defined
>  #else
> -#define TF_SIZE 0
> +#define __LIBGCC_TF_MANT_DIG__ 0
>  #endif
>  #endif
>
>
> --
> Joseph S. Myers
> joseph@codesourcery.com



More information about the Gcc-patches mailing list