diff mbox series

[42/52] rl78: New hook implementation rl78_c_mode_for_floating_type

Message ID 2d7d04dcf13809728719b5f7ec41af161cc1c8cc.1717134752.git.linkw@linux.ibm.com
State New
Headers show
Series Replace {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE with new hook | expand

Commit Message

Kewen.Lin June 3, 2024, 3:01 a.m. UTC
This is to remove macros {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE
defines in rl78 port, and add new port specific hook
implementation rl78_c_mode_for_floating_type.

gcc/ChangeLog:

	* config/rl78/rl78.cc (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro.
	(rl78_c_mode_for_floating_type): New function.
	* config/rl78/rl78.h (FLOAT_TYPE_SIZE): Remove.
	(DOUBLE_TYPE_SIZE): Likewise.
	(LONG_DOUBLE_TYPE_SIZE): Likewise.
---
 gcc/config/rl78/rl78.cc | 15 +++++++++++++++
 gcc/config/rl78/rl78.h  |  4 ----
 2 files changed, 15 insertions(+), 4 deletions(-)

Comments

Kewen.Lin June 13, 2024, 7:42 a.m. UTC | #1
Hi,

Gentle ping:

https://gcc.gnu.org/pipermail/gcc-patches/2024-June/653376.html

BR,
Kewen

on 2024/6/3 11:01, Kewen Lin wrote:
> This is to remove macros {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE
> defines in rl78 port, and add new port specific hook
> implementation rl78_c_mode_for_floating_type.
> 
> gcc/ChangeLog:
> 
> 	* config/rl78/rl78.cc (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro.
> 	(rl78_c_mode_for_floating_type): New function.
> 	* config/rl78/rl78.h (FLOAT_TYPE_SIZE): Remove.
> 	(DOUBLE_TYPE_SIZE): Likewise.
> 	(LONG_DOUBLE_TYPE_SIZE): Likewise.
> ---
>  gcc/config/rl78/rl78.cc | 15 +++++++++++++++
>  gcc/config/rl78/rl78.h  |  4 ----
>  2 files changed, 15 insertions(+), 4 deletions(-)
> 
> diff --git a/gcc/config/rl78/rl78.cc b/gcc/config/rl78/rl78.cc
> index e5345bfa9dd..ccb1c4f3867 100644
> --- a/gcc/config/rl78/rl78.cc
> +++ b/gcc/config/rl78/rl78.cc
> @@ -4971,6 +4971,21 @@ rl78_preferred_reload_class (rtx x ATTRIBUTE_UNUSED, reg_class_t rclass)
>    return rclass;
>  }
>  
> +#undef TARGET_C_MODE_FOR_FLOATING_TYPE
> +#define TARGET_C_MODE_FOR_FLOATING_TYPE rl78_c_mode_for_floating_type
> +
> +/* Implement TARGET_C_MODE_FOR_FLOATING_TYPE.  Return SFmode for
> +   TI_DOUBLE_TYPE which is for double type, go with the default
> +   one for the others.  */
> +
> +static machine_mode
> +rl78_c_mode_for_floating_type (enum tree_index ti)
> +{
> +  if (ti == TI_DOUBLE_TYPE)
> +    return SFmode;
> +  return default_mode_for_floating_type (ti);
> +}
> +
>  
>  /* The strub runtime uses asms, and physical register allocation won't
>     deal with them, so disable it.  */
> diff --git a/gcc/config/rl78/rl78.h b/gcc/config/rl78/rl78.h
> index cfff98df6bc..a960aee3931 100644
> --- a/gcc/config/rl78/rl78.h
> +++ b/gcc/config/rl78/rl78.h
> @@ -113,10 +113,6 @@
>  #define LONG_TYPE_SIZE			32
>  #define LONG_LONG_TYPE_SIZE		64
>  
> -#define FLOAT_TYPE_SIZE 		32
> -#define DOUBLE_TYPE_SIZE 		32 /*64*/
> -#define LONG_DOUBLE_TYPE_SIZE		64 /*DOUBLE_TYPE_SIZE*/
> -
>  #define DEFAULT_SIGNED_CHAR		0
>  
>  #define STRICT_ALIGNMENT 		1
Richard Biener June 13, 2024, 7:46 a.m. UTC | #2
On Thu, Jun 13, 2024 at 9:43 AM Kewen.Lin <linkw@linux.ibm.com> wrote:
>
> Hi,
>
> Gentle ping:
>
> https://gcc.gnu.org/pipermail/gcc-patches/2024-June/653376.html

The remaining target changes are all OK if the rest of the series is
approved.

Richard.

> BR,
> Kewen
>
> on 2024/6/3 11:01, Kewen Lin wrote:
> > This is to remove macros {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE
> > defines in rl78 port, and add new port specific hook
> > implementation rl78_c_mode_for_floating_type.
> >
> > gcc/ChangeLog:
> >
> >       * config/rl78/rl78.cc (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro.
> >       (rl78_c_mode_for_floating_type): New function.
> >       * config/rl78/rl78.h (FLOAT_TYPE_SIZE): Remove.
> >       (DOUBLE_TYPE_SIZE): Likewise.
> >       (LONG_DOUBLE_TYPE_SIZE): Likewise.
> > ---
> >  gcc/config/rl78/rl78.cc | 15 +++++++++++++++
> >  gcc/config/rl78/rl78.h  |  4 ----
> >  2 files changed, 15 insertions(+), 4 deletions(-)
> >
> > diff --git a/gcc/config/rl78/rl78.cc b/gcc/config/rl78/rl78.cc
> > index e5345bfa9dd..ccb1c4f3867 100644
> > --- a/gcc/config/rl78/rl78.cc
> > +++ b/gcc/config/rl78/rl78.cc
> > @@ -4971,6 +4971,21 @@ rl78_preferred_reload_class (rtx x ATTRIBUTE_UNUSED, reg_class_t rclass)
> >    return rclass;
> >  }
> >
> > +#undef TARGET_C_MODE_FOR_FLOATING_TYPE
> > +#define TARGET_C_MODE_FOR_FLOATING_TYPE rl78_c_mode_for_floating_type
> > +
> > +/* Implement TARGET_C_MODE_FOR_FLOATING_TYPE.  Return SFmode for
> > +   TI_DOUBLE_TYPE which is for double type, go with the default
> > +   one for the others.  */
> > +
> > +static machine_mode
> > +rl78_c_mode_for_floating_type (enum tree_index ti)
> > +{
> > +  if (ti == TI_DOUBLE_TYPE)
> > +    return SFmode;
> > +  return default_mode_for_floating_type (ti);
> > +}
> > +
> >
> >  /* The strub runtime uses asms, and physical register allocation won't
> >     deal with them, so disable it.  */
> > diff --git a/gcc/config/rl78/rl78.h b/gcc/config/rl78/rl78.h
> > index cfff98df6bc..a960aee3931 100644
> > --- a/gcc/config/rl78/rl78.h
> > +++ b/gcc/config/rl78/rl78.h
> > @@ -113,10 +113,6 @@
> >  #define LONG_TYPE_SIZE                       32
> >  #define LONG_LONG_TYPE_SIZE          64
> >
> > -#define FLOAT_TYPE_SIZE              32
> > -#define DOUBLE_TYPE_SIZE             32 /*64*/
> > -#define LONG_DOUBLE_TYPE_SIZE                64 /*DOUBLE_TYPE_SIZE*/
> > -
> >  #define DEFAULT_SIGNED_CHAR          0
> >
> >  #define STRICT_ALIGNMENT             1
>
>
>
diff mbox series

Patch

diff --git a/gcc/config/rl78/rl78.cc b/gcc/config/rl78/rl78.cc
index e5345bfa9dd..ccb1c4f3867 100644
--- a/gcc/config/rl78/rl78.cc
+++ b/gcc/config/rl78/rl78.cc
@@ -4971,6 +4971,21 @@  rl78_preferred_reload_class (rtx x ATTRIBUTE_UNUSED, reg_class_t rclass)
   return rclass;
 }
 
+#undef TARGET_C_MODE_FOR_FLOATING_TYPE
+#define TARGET_C_MODE_FOR_FLOATING_TYPE rl78_c_mode_for_floating_type
+
+/* Implement TARGET_C_MODE_FOR_FLOATING_TYPE.  Return SFmode for
+   TI_DOUBLE_TYPE which is for double type, go with the default
+   one for the others.  */
+
+static machine_mode
+rl78_c_mode_for_floating_type (enum tree_index ti)
+{
+  if (ti == TI_DOUBLE_TYPE)
+    return SFmode;
+  return default_mode_for_floating_type (ti);
+}
+
 
 /* The strub runtime uses asms, and physical register allocation won't
    deal with them, so disable it.  */
diff --git a/gcc/config/rl78/rl78.h b/gcc/config/rl78/rl78.h
index cfff98df6bc..a960aee3931 100644
--- a/gcc/config/rl78/rl78.h
+++ b/gcc/config/rl78/rl78.h
@@ -113,10 +113,6 @@ 
 #define LONG_TYPE_SIZE			32
 #define LONG_LONG_TYPE_SIZE		64
 
-#define FLOAT_TYPE_SIZE 		32
-#define DOUBLE_TYPE_SIZE 		32 /*64*/
-#define LONG_DOUBLE_TYPE_SIZE		64 /*DOUBLE_TYPE_SIZE*/
-
 #define DEFAULT_SIGNED_CHAR		0
 
 #define STRICT_ALIGNMENT 		1