diff mbox series

[36/52] aarch64: New hook implementation aarch64_c_mode_for_floating_type

Message ID 04ffc80353d58e7af4af30592bfaccdb44498276.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 aarch64 port, and add new port specific hook
implementation aarch64_c_mode_for_floating_type.

gcc/ChangeLog:

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

Comments

Richard Sandiford June 3, 2024, 10:32 a.m. UTC | #1
Kewen Lin <linkw@linux.ibm.com> writes:
> This is to remove macros {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE
> defines in aarch64 port, and add new port specific hook
> implementation aarch64_c_mode_for_floating_type.
>
> gcc/ChangeLog:
>
> 	* config/aarch64/aarch64.cc (aarch64_c_mode_for_floating_type):
> 	New function.
> 	(TARGET_C_MODE_FOR_FLOATING_TYPE): New macro.
> 	* config/aarch64/aarch64.h (FLOAT_TYPE_SIZE): Remove.
> 	(DOUBLE_TYPE_SIZE): Likewise.
> 	(LONG_DOUBLE_TYPE_SIZE): Likewise.

OK, thanks.

Richard

> ---
>  gcc/config/aarch64/aarch64.cc | 15 +++++++++++++++
>  gcc/config/aarch64/aarch64.h  |  6 ------
>  2 files changed, 15 insertions(+), 6 deletions(-)
>
> diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
> index ee12d8897a8..1c1c278fd69 100644
> --- a/gcc/config/aarch64/aarch64.cc
> +++ b/gcc/config/aarch64/aarch64.cc
> @@ -28427,6 +28427,18 @@ aarch64_bitint_type_info (int n, struct bitint_info *info)
>    return true;
>  }
>  
> +/* Implement TARGET_C_MODE_FOR_FLOATING_TYPE.  Return TFmode for
> +   TI_LONG_DOUBLE_TYPE which is for long double type, go with the default
> +   one for the others.  */
> +
> +static machine_mode
> +aarch64_c_mode_for_floating_type (enum tree_index ti)
> +{
> +  if (ti == TI_LONG_DOUBLE_TYPE)
> +    return TFmode;
> +  return default_mode_for_floating_type (ti);
> +}
> +
>  /* Implement TARGET_SCHED_CAN_SPECULATE_INSN.  Return true if INSN can be
>     scheduled for speculative execution.  Reject the long-running division
>     and square-root instructions.  */
> @@ -30554,6 +30566,9 @@ aarch64_run_selftests (void)
>  #undef TARGET_C_BITINT_TYPE_INFO
>  #define TARGET_C_BITINT_TYPE_INFO aarch64_bitint_type_info
>  
> +#undef TARGET_C_MODE_FOR_FLOATING_TYPE
> +#define TARGET_C_MODE_FOR_FLOATING_TYPE aarch64_c_mode_for_floating_type
> +
>  #undef  TARGET_EXPAND_BUILTIN
>  #define TARGET_EXPAND_BUILTIN aarch64_expand_builtin
>  
> diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
> index bbf11faaf4b..2064c23f961 100644
> --- a/gcc/config/aarch64/aarch64.h
> +++ b/gcc/config/aarch64/aarch64.h
> @@ -96,12 +96,6 @@
>  
>  #define LONG_LONG_TYPE_SIZE	64
>  
> -#define FLOAT_TYPE_SIZE		32
> -
> -#define DOUBLE_TYPE_SIZE	64
> -
> -#define LONG_DOUBLE_TYPE_SIZE	128
> -
>  /* This value is the amount of bytes a caller is allowed to drop the stack
>     before probing has to be done for stack clash protection.  */
>  #define STACK_CLASH_CALLER_GUARD 1024
diff mbox series

Patch

diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
index ee12d8897a8..1c1c278fd69 100644
--- a/gcc/config/aarch64/aarch64.cc
+++ b/gcc/config/aarch64/aarch64.cc
@@ -28427,6 +28427,18 @@  aarch64_bitint_type_info (int n, struct bitint_info *info)
   return true;
 }
 
+/* Implement TARGET_C_MODE_FOR_FLOATING_TYPE.  Return TFmode for
+   TI_LONG_DOUBLE_TYPE which is for long double type, go with the default
+   one for the others.  */
+
+static machine_mode
+aarch64_c_mode_for_floating_type (enum tree_index ti)
+{
+  if (ti == TI_LONG_DOUBLE_TYPE)
+    return TFmode;
+  return default_mode_for_floating_type (ti);
+}
+
 /* Implement TARGET_SCHED_CAN_SPECULATE_INSN.  Return true if INSN can be
    scheduled for speculative execution.  Reject the long-running division
    and square-root instructions.  */
@@ -30554,6 +30566,9 @@  aarch64_run_selftests (void)
 #undef TARGET_C_BITINT_TYPE_INFO
 #define TARGET_C_BITINT_TYPE_INFO aarch64_bitint_type_info
 
+#undef TARGET_C_MODE_FOR_FLOATING_TYPE
+#define TARGET_C_MODE_FOR_FLOATING_TYPE aarch64_c_mode_for_floating_type
+
 #undef  TARGET_EXPAND_BUILTIN
 #define TARGET_EXPAND_BUILTIN aarch64_expand_builtin
 
diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
index bbf11faaf4b..2064c23f961 100644
--- a/gcc/config/aarch64/aarch64.h
+++ b/gcc/config/aarch64/aarch64.h
@@ -96,12 +96,6 @@ 
 
 #define LONG_LONG_TYPE_SIZE	64
 
-#define FLOAT_TYPE_SIZE		32
-
-#define DOUBLE_TYPE_SIZE	64
-
-#define LONG_DOUBLE_TYPE_SIZE	128
-
 /* This value is the amount of bytes a caller is allowed to drop the stack
    before probing has to be done for stack clash protection.  */
 #define STACK_CLASH_CALLER_GUARD 1024