On Mon, Jun 3, 2024 at 5:02 AM Kewen Lin <li...@linux.ibm.com> wrote:
>
> This is to remove macros {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE
> defines in i386 port, and add new port specific hook
> implementation ix86_c_mode_for_floating_type.
>
> gcc/ChangeLog:
>
>         * config/i386/i386.cc (ix86_c_mode_for_floating_type): New
>         function.
>         (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro.
>         * config/i386/i386.h (FLOAT_TYPE_SIZE): Remove.
>         (DOUBLE_TYPE_SIZE): Likewise.
>         (LONG_DOUBLE_TYPE_SIZE): Likewise.

OK.

Thanks,
Uros.

> ---
>  gcc/config/i386/i386.cc | 15 +++++++++++++++
>  gcc/config/i386/i386.h  |  4 ----
>  2 files changed, 15 insertions(+), 4 deletions(-)
>
> diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
> index 3e2a3a194f1..6abb6d7a1ca 100644
> --- a/gcc/config/i386/i386.cc
> +++ b/gcc/config/i386/i386.cc
> @@ -25794,6 +25794,19 @@ ix86_bitint_type_info (int n, struct bitint_info 
> *info)
>    return true;
>  }
>
> +/* Implement TARGET_C_MODE_FOR_FLOATING_TYPE.  Return DFmode, TFmode
> +   or XFmode for TI_LONG_DOUBLE_TYPE which is for long double type,
> +   based on long double bits, go with the default one for the others.  */
> +
> +static machine_mode
> +ix86_c_mode_for_floating_type (enum tree_index ti)
> +{
> +  if (ti == TI_LONG_DOUBLE_TYPE)
> +    return (TARGET_LONG_DOUBLE_64 ? DFmode
> +                                 : (TARGET_LONG_DOUBLE_128 ? TFmode : 
> XFmode));
> +  return default_mode_for_floating_type (ti);
> +}
> +
>  /* Returns modified FUNCTION_TYPE for cdtor callabi.  */
>  tree
>  ix86_cxx_adjust_cdtor_callabi_fntype (tree fntype)
> @@ -26419,6 +26432,8 @@ static const scoped_attribute_specs *const 
> ix86_attribute_table[] =
>  #define TARGET_C_EXCESS_PRECISION ix86_get_excess_precision
>  #undef TARGET_C_BITINT_TYPE_INFO
>  #define TARGET_C_BITINT_TYPE_INFO ix86_bitint_type_info
> +#undef TARGET_C_MODE_FOR_FLOATING_TYPE
> +#define TARGET_C_MODE_FOR_FLOATING_TYPE ix86_c_mode_for_floating_type
>  #undef TARGET_CXX_ADJUST_CDTOR_CALLABI_FNTYPE
>  #define TARGET_CXX_ADJUST_CDTOR_CALLABI_FNTYPE 
> ix86_cxx_adjust_cdtor_callabi_fntype
>  #undef TARGET_PROMOTE_PROTOTYPES
> diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
> index 359a8408263..fad434c10d6 100644
> --- a/gcc/config/i386/i386.h
> +++ b/gcc/config/i386/i386.h
> @@ -675,10 +675,6 @@ extern const char *host_detect_local_cpu (int argc, 
> const char **argv);
>  #define LONG_TYPE_SIZE (TARGET_X32 ? 32 : BITS_PER_WORD)
>  #define POINTER_SIZE (TARGET_X32 ? 32 : BITS_PER_WORD)
>  #define LONG_LONG_TYPE_SIZE 64
> -#define FLOAT_TYPE_SIZE 32
> -#define DOUBLE_TYPE_SIZE 64
> -#define LONG_DOUBLE_TYPE_SIZE \
> -  (TARGET_LONG_DOUBLE_64 ? 64 : (TARGET_LONG_DOUBLE_128 ? 128 : 80))
>
>  #define WIDEST_HARDWARE_FP_SIZE 80
>
> --
> 2.43.0
>

Reply via email to