diff mbox series

[37/52] alpha: New hook implementation alpha_c_mode_for_floating_type

Message ID e4e7c7e99e63b077ac4a076c3f749d36970a278b.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 alpha port, and add new port specific hook
implementation alpha_c_mode_for_floating_type.

gcc/ChangeLog:

	* config/alpha/alpha.cc (alpha_c_mode_for_floating_type): New
	function.
	(TARGET_C_MODE_FOR_FLOATING_TYPE): New macro.
	* config/alpha/alpha.h (FLOAT_TYPE_SIZE): Remove.
	(DOUBLE_TYPE_SIZE): Likewise.
	(LONG_DOUBLE_TYPE_SIZE): Likewise.
---
 gcc/config/alpha/alpha.cc | 17 ++++++++++++++++-
 gcc/config/alpha/alpha.h  |  8 --------
 2 files changed, 16 insertions(+), 9 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/653370.html

BR,
Kewen

on 2024/6/3 11:01, Kewen Lin wrote:
> This is to remove macros {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE
> defines in alpha port, and add new port specific hook
> implementation alpha_c_mode_for_floating_type.
> 
> gcc/ChangeLog:
> 
> 	* config/alpha/alpha.cc (alpha_c_mode_for_floating_type): New
> 	function.
> 	(TARGET_C_MODE_FOR_FLOATING_TYPE): New macro.
> 	* config/alpha/alpha.h (FLOAT_TYPE_SIZE): Remove.
> 	(DOUBLE_TYPE_SIZE): Likewise.
> 	(LONG_DOUBLE_TYPE_SIZE): Likewise.
> ---
>  gcc/config/alpha/alpha.cc | 17 ++++++++++++++++-
>  gcc/config/alpha/alpha.h  |  8 --------
>  2 files changed, 16 insertions(+), 9 deletions(-)
> 
> diff --git a/gcc/config/alpha/alpha.cc b/gcc/config/alpha/alpha.cc
> index 1126cea1f7b..a6fe95e7177 100644
> --- a/gcc/config/alpha/alpha.cc
> +++ b/gcc/config/alpha/alpha.cc
> @@ -9916,7 +9916,19 @@ alpha_can_change_mode_class (machine_mode from, machine_mode to,
>    return (GET_MODE_SIZE (from) == GET_MODE_SIZE (to)
>  	  || !reg_classes_intersect_p (FLOAT_REGS, rclass));
>  }
> -
> +
> +/* Implement TARGET_C_MODE_FOR_FLOATING_TYPE.  Return TFmode or DFmode
> +   for TI_LONG_DOUBLE_TYPE which is for long double type, go with the
> +   default one for the others.  */
> +
> +static machine_mode
> +alpha_c_mode_for_floating_type (enum tree_index ti)
> +{
> +  if (ti == TI_LONG_DOUBLE_TYPE)
> +    return TARGET_LONG_DOUBLE_128 ? TFmode : DFmode;
> +  return default_mode_for_floating_type (ti);
> +}
> +
>  /* Initialize the GCC target structure.  */
>  #if TARGET_ABI_OPEN_VMS
>  # undef TARGET_ATTRIBUTE_TABLE
> @@ -10123,6 +10135,9 @@ alpha_can_change_mode_class (machine_mode from, machine_mode to,
>  #undef TARGET_CAN_CHANGE_MODE_CLASS
>  #define TARGET_CAN_CHANGE_MODE_CLASS alpha_can_change_mode_class
>  
> +#undef TARGET_C_MODE_FOR_FLOATING_TYPE
> +#define TARGET_C_MODE_FOR_FLOATING_TYPE alpha_c_mode_for_floating_type
> +
>  struct gcc_target targetm = TARGET_INITIALIZER;
>  
>  
> diff --git a/gcc/config/alpha/alpha.h b/gcc/config/alpha/alpha.h
> index 25ccfce96b8..ee9e0918038 100644
> --- a/gcc/config/alpha/alpha.h
> +++ b/gcc/config/alpha/alpha.h
> @@ -195,14 +195,6 @@ extern enum alpha_fp_trap_mode alpha_fptm;
>  /* Define the size of `long long'.  The default is the twice the word size.  */
>  #define LONG_LONG_TYPE_SIZE 64
>  
> -/* The two floating-point formats we support are S-floating, which is
> -   4 bytes, and T-floating, which is 8 bytes.  `float' is S and `double'
> -   and `long double' are T.  */
> -
> -#define FLOAT_TYPE_SIZE 32
> -#define DOUBLE_TYPE_SIZE 64
> -#define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64)
> -
>  /* Work around target_flags dependency in ada/targtyps.cc.  */
>  #define WIDEST_HARDWARE_FP_SIZE 64
>
diff mbox series

Patch

diff --git a/gcc/config/alpha/alpha.cc b/gcc/config/alpha/alpha.cc
index 1126cea1f7b..a6fe95e7177 100644
--- a/gcc/config/alpha/alpha.cc
+++ b/gcc/config/alpha/alpha.cc
@@ -9916,7 +9916,19 @@  alpha_can_change_mode_class (machine_mode from, machine_mode to,
   return (GET_MODE_SIZE (from) == GET_MODE_SIZE (to)
 	  || !reg_classes_intersect_p (FLOAT_REGS, rclass));
 }
-
+
+/* Implement TARGET_C_MODE_FOR_FLOATING_TYPE.  Return TFmode or DFmode
+   for TI_LONG_DOUBLE_TYPE which is for long double type, go with the
+   default one for the others.  */
+
+static machine_mode
+alpha_c_mode_for_floating_type (enum tree_index ti)
+{
+  if (ti == TI_LONG_DOUBLE_TYPE)
+    return TARGET_LONG_DOUBLE_128 ? TFmode : DFmode;
+  return default_mode_for_floating_type (ti);
+}
+
 /* Initialize the GCC target structure.  */
 #if TARGET_ABI_OPEN_VMS
 # undef TARGET_ATTRIBUTE_TABLE
@@ -10123,6 +10135,9 @@  alpha_can_change_mode_class (machine_mode from, machine_mode to,
 #undef TARGET_CAN_CHANGE_MODE_CLASS
 #define TARGET_CAN_CHANGE_MODE_CLASS alpha_can_change_mode_class
 
+#undef TARGET_C_MODE_FOR_FLOATING_TYPE
+#define TARGET_C_MODE_FOR_FLOATING_TYPE alpha_c_mode_for_floating_type
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 
diff --git a/gcc/config/alpha/alpha.h b/gcc/config/alpha/alpha.h
index 25ccfce96b8..ee9e0918038 100644
--- a/gcc/config/alpha/alpha.h
+++ b/gcc/config/alpha/alpha.h
@@ -195,14 +195,6 @@  extern enum alpha_fp_trap_mode alpha_fptm;
 /* Define the size of `long long'.  The default is the twice the word size.  */
 #define LONG_LONG_TYPE_SIZE 64
 
-/* The two floating-point formats we support are S-floating, which is
-   4 bytes, and T-floating, which is 8 bytes.  `float' is S and `double'
-   and `long double' are T.  */
-
-#define FLOAT_TYPE_SIZE 32
-#define DOUBLE_TYPE_SIZE 64
-#define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64)
-
 /* Work around target_flags dependency in ada/targtyps.cc.  */
 #define WIDEST_HARDWARE_FP_SIZE 64