diff mbox series

[44/52] s390: New hook implementation s390_c_mode_for_floating_type

Message ID 9f2632b1ee6415c2dbb909dfac7df66225130a7c.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 s390 port, and add new port specific hook
implementation s390_c_mode_for_floating_type.

gcc/ChangeLog:

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

Comments

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

Gentle ping:

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

BR,
Kewen

on 2024/6/3 11:01, Kewen Lin wrote:
> This is to remove macros {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE
> defines in s390 port, and add new port specific hook
> implementation s390_c_mode_for_floating_type.
> 
> gcc/ChangeLog:
> 
> 	* config/s390/s390.cc (s390_c_mode_for_floating_type): New function.
> 	(TARGET_C_MODE_FOR_FLOATING_TYPE): New macro.
> 	* config/s390/s390.h (FLOAT_TYPE_SIZE): Remove.
> 	(DOUBLE_TYPE_SIZE): Likewise.
> 	(LONG_DOUBLE_TYPE_SIZE): Likewise.
> ---
>  gcc/config/s390/s390.cc | 15 +++++++++++++++
>  gcc/config/s390/s390.h  |  3 ---
>  2 files changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/gcc/config/s390/s390.cc b/gcc/config/s390/s390.cc
> index fa517bd3e77..117da36b3c0 100644
> --- a/gcc/config/s390/s390.cc
> +++ b/gcc/config/s390/s390.cc
> @@ -18066,6 +18066,18 @@ s390_noce_conversion_profitable_p (rtx_insn *seq, struct noce_if_info *if_info)
>    return default_noce_conversion_profitable_p (seq, if_info);
>  }
>  
> +/* 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
> +s390_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 GCC target structure.  */
>  
>  #undef  TARGET_ASM_ALIGNED_HI_OP
> @@ -18382,6 +18394,9 @@ s390_noce_conversion_profitable_p (rtx_insn *seq, struct noce_if_info *if_info)
>  #undef TARGET_NOCE_CONVERSION_PROFITABLE_P
>  #define TARGET_NOCE_CONVERSION_PROFITABLE_P s390_noce_conversion_profitable_p
>  
> +#undef TARGET_C_MODE_FOR_FLOATING_TYPE
> +#define TARGET_C_MODE_FOR_FLOATING_TYPE s390_c_mode_for_floating_type
> +
>  struct gcc_target targetm = TARGET_INITIALIZER;
>  
>  #include "gt-s390.h"
> diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h
> index 0e6666a8802..4a4dde1a9ba 100644
> --- a/gcc/config/s390/s390.h
> +++ b/gcc/config/s390/s390.h
> @@ -396,9 +396,6 @@ extern const char *s390_host_detect_local_cpu (int argc, const char **argv);
>  #define INT_TYPE_SIZE 32
>  #define LONG_TYPE_SIZE (TARGET_64BIT ? 64 : 32)
>  #define LONG_LONG_TYPE_SIZE 64
> -#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
Andreas Krebbel June 14, 2024, 5:40 a.m. UTC | #2
On 6/13/24 09:43, Kewen.Lin wrote:
> Hi,
>
> Gentle ping:
>
> https://gcc.gnu.org/pipermail/gcc-patches/2024-June/653382.html
>
> BR,
> Kewen
>
> on 2024/6/3 11:01, Kewen Lin wrote:
>> This is to remove macros {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE
>> defines in s390 port, and add new port specific hook
>> implementation s390_c_mode_for_floating_type.
>>
>> gcc/ChangeLog:
>>
>> 	* config/s390/s390.cc (s390_c_mode_for_floating_type): New function.
>> 	(TARGET_C_MODE_FOR_FLOATING_TYPE): New macro.
>> 	* config/s390/s390.h (FLOAT_TYPE_SIZE): Remove.
>> 	(DOUBLE_TYPE_SIZE): Likewise.
>> 	(LONG_DOUBLE_TYPE_SIZE): Likewise.

Ok. Thanks!


Andreas



>> ---
>>   gcc/config/s390/s390.cc | 15 +++++++++++++++
>>   gcc/config/s390/s390.h  |  3 ---
>>   2 files changed, 15 insertions(+), 3 deletions(-)
>>
>> diff --git a/gcc/config/s390/s390.cc b/gcc/config/s390/s390.cc
>> index fa517bd3e77..117da36b3c0 100644
>> --- a/gcc/config/s390/s390.cc
>> +++ b/gcc/config/s390/s390.cc
>> @@ -18066,6 +18066,18 @@ s390_noce_conversion_profitable_p (rtx_insn *seq, struct noce_if_info *if_info)
>>     return default_noce_conversion_profitable_p (seq, if_info);
>>   }
>>   
>> +/* 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
>> +s390_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 GCC target structure.  */
>>   
>>   #undef  TARGET_ASM_ALIGNED_HI_OP
>> @@ -18382,6 +18394,9 @@ s390_noce_conversion_profitable_p (rtx_insn *seq, struct noce_if_info *if_info)
>>   #undef TARGET_NOCE_CONVERSION_PROFITABLE_P
>>   #define TARGET_NOCE_CONVERSION_PROFITABLE_P s390_noce_conversion_profitable_p
>>   
>> +#undef TARGET_C_MODE_FOR_FLOATING_TYPE
>> +#define TARGET_C_MODE_FOR_FLOATING_TYPE s390_c_mode_for_floating_type
>> +
>>   struct gcc_target targetm = TARGET_INITIALIZER;
>>   
>>   #include "gt-s390.h"
>> diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h
>> index 0e6666a8802..4a4dde1a9ba 100644
>> --- a/gcc/config/s390/s390.h
>> +++ b/gcc/config/s390/s390.h
>> @@ -396,9 +396,6 @@ extern const char *s390_host_detect_local_cpu (int argc, const char **argv);
>>   #define INT_TYPE_SIZE 32
>>   #define LONG_TYPE_SIZE (TARGET_64BIT ? 64 : 32)
>>   #define LONG_LONG_TYPE_SIZE 64
>> -#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/s390/s390.cc b/gcc/config/s390/s390.cc
index fa517bd3e77..117da36b3c0 100644
--- a/gcc/config/s390/s390.cc
+++ b/gcc/config/s390/s390.cc
@@ -18066,6 +18066,18 @@  s390_noce_conversion_profitable_p (rtx_insn *seq, struct noce_if_info *if_info)
   return default_noce_conversion_profitable_p (seq, if_info);
 }
 
+/* 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
+s390_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 GCC target structure.  */
 
 #undef  TARGET_ASM_ALIGNED_HI_OP
@@ -18382,6 +18394,9 @@  s390_noce_conversion_profitable_p (rtx_insn *seq, struct noce_if_info *if_info)
 #undef TARGET_NOCE_CONVERSION_PROFITABLE_P
 #define TARGET_NOCE_CONVERSION_PROFITABLE_P s390_noce_conversion_profitable_p
 
+#undef TARGET_C_MODE_FOR_FLOATING_TYPE
+#define TARGET_C_MODE_FOR_FLOATING_TYPE s390_c_mode_for_floating_type
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 #include "gt-s390.h"
diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h
index 0e6666a8802..4a4dde1a9ba 100644
--- a/gcc/config/s390/s390.h
+++ b/gcc/config/s390/s390.h
@@ -396,9 +396,6 @@  extern const char *s390_host_detect_local_cpu (int argc, const char **argv);
 #define INT_TYPE_SIZE 32
 #define LONG_TYPE_SIZE (TARGET_64BIT ? 64 : 32)
 #define LONG_LONG_TYPE_SIZE 64
-#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