diff mbox series

[43/52] rx: New hook implementation rx_c_mode_for_floating_type

Message ID 7707dba662e911f2a1c87215f490291b093f297a.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 rx port, and add new port specific hook
implementation rx_c_mode_for_floating_type.

gcc/ChangeLog:

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

Comments

Nick Clifton June 3, 2024, 1:36 p.m. UTC | #1
Hi Kewen,

> This is to remove macros {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE
> defines in rx port, and add new port specific hook
> implementation rx_c_mode_for_floating_type.
> 
> gcc/ChangeLog:
> 
> 	* config/rx/rx.cc (rx_c_mode_for_floating_type): New function.
> 	(TARGET_C_MODE_FOR_FLOATING_TYPE): New macro.
> 	* config/rx/rx.h (FLOAT_TYPE_SIZE): Remove.
> 	(DOUBLE_TYPE_SIZE): Likewise.
> 	(LONG_DOUBLE_TYPE_SIZE): Likewise.

Approved - please apply.

Cheers
   Nick
diff mbox series

Patch

diff --git a/gcc/config/rx/rx.cc b/gcc/config/rx/rx.cc
index 9bf9d87fed1..8048cc98708 100644
--- a/gcc/config/rx/rx.cc
+++ b/gcc/config/rx/rx.cc
@@ -3648,6 +3648,18 @@  rx_modes_tieable_p (machine_mode mode1, machine_mode mode2)
 	  == (GET_MODE_CLASS (mode2) == MODE_FLOAT
 	      || GET_MODE_CLASS (mode2) == MODE_COMPLEX_FLOAT));
 }
+
+/* Implement TARGET_C_MODE_FOR_FLOATING_TYPE.  Return SFmode or DFmode
+   for TI_{LONG_,}DOUBLE_TYPE which is for {long,} double type, go with
+   the default one for the others.  */
+
+static machine_mode
+rx_c_mode_for_floating_type (enum tree_index ti)
+{
+  if (ti == TI_DOUBLE_TYPE || ti == TI_LONG_DOUBLE_TYPE)
+    return TARGET_64BIT_DOUBLES ? DFmode : SFmode;
+  return default_mode_for_floating_type (ti);
+}
 
 #undef  TARGET_NARROW_VOLATILE_BITFIELD
 #define TARGET_NARROW_VOLATILE_BITFIELD		rx_narrow_volatile_bitfield
@@ -3807,6 +3819,9 @@  rx_modes_tieable_p (machine_mode mode1, machine_mode mode2)
 #undef  TARGET_HAVE_SPECULATION_SAFE_VALUE
 #define TARGET_HAVE_SPECULATION_SAFE_VALUE speculation_safe_value_not_needed
 
+#undef TARGET_C_MODE_FOR_FLOATING_TYPE
+#define TARGET_C_MODE_FOR_FLOATING_TYPE rx_c_mode_for_floating_type
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 #include "gt-rx.h"
diff --git a/gcc/config/rx/rx.h b/gcc/config/rx/rx.h
index ff445df49a3..15d6d2503e7 100644
--- a/gcc/config/rx/rx.h
+++ b/gcc/config/rx/rx.h
@@ -132,10 +132,6 @@ 
 #define LONG_TYPE_SIZE			32
 #define LONG_LONG_TYPE_SIZE		64
 
-#define FLOAT_TYPE_SIZE 		32
-#define DOUBLE_TYPE_SIZE 		(TARGET_64BIT_DOUBLES ? 64 : 32)
-#define LONG_DOUBLE_TYPE_SIZE		DOUBLE_TYPE_SIZE
-
 #define DEFAULT_SIGNED_CHAR		0
 
 /* RX load/store instructions can handle unaligned addresses.  */