]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Replace {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE with new hook mode_for_floating_type
authorKewen Lin <linkw@linux.ibm.com>
Tue, 25 Jun 2024 05:04:53 +0000 (00:04 -0500)
committerKewen Lin <linkw@linux.ibm.com>
Tue, 25 Jun 2024 05:04:53 +0000 (00:04 -0500)
Currently how we determine which mode will be used for a
floating point type is that for a given type precision
(size) call mode_for_size to get the first mode which has
this size in the specified class.  On Powerpc, we have
three modes (TF/KF/IF) having the same mode precision 128
(see[1]), so the processing forces us to have to place TF
at the first place, it would require us to make more
adjustment in some generic code to avoid some unexpected
mode conversions and it would be even worse if we get rid
of TF eventually one day.  And as Joseph pointed out in [2],
"floating  types should have their mode, not a poorly
defined precision value", as Joseph and Richi suggested,
this patch is to introduce one hook mode_for_floating_type
which returns the corresponding mode for type float, double
or long double.  The default implementation returns SFmode
for float and DFmode for double or long double.  For ports
which need special treatment, there are some other patches
for their own port specific implementation (referring to
how {,LONG_}DOUBLE_TYPE_SIZE get used there).  For all
generic uses of {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE, depending
on the context, some of them are replaced with TYPE_PRECISION
of the according type node, some other are replaced with
GET_MODE_PRECISION on the mode from mode_for_floating_type.
This patch also poisons {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE,
so most defines of {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE in port
specific are removed, but there are still some which are
good to be kept for readability then they get renamed with
port specific prefix.

[1] https://gcc.gnu.org/pipermail/gcc-patches/2024-May/651017.html
[2] https://gcc.gnu.org/pipermail/gcc-patches/2024-May/651209.html

gcc/jit/ChangeLog:

* jit-recording.cc (recording::memento_of_get_type::get_size): Update
macros {FLOAT,DOUBLE,LONG_DOUBLE}_TYPE_SIZE by calling
targetm.c.mode_for_floating_type with
TI_{FLOAT,DOUBLE,LONG_DOUBLE}_TYPE.

gcc/ChangeLog:

* coretypes.h (enum tree_index): Forward declaration.
* defaults.h (FLOAT_TYPE_SIZE): Remove.
(DOUBLE_TYPE_SIZE): Likewise.
(LONG_DOUBLE_TYPE_SIZE): Likewise.
* doc/rtl.texi: Update document by replacing {FLOAT,DOUBLE}_TYPE_SIZE
with C type {float,double}.
* doc/tm.texi.in: Document new hook mode_for_floating_type, remove
document entries for {FLOAT,DOUBLE,LONG_DOUBLE}_TYPE_SIZE and
update document for WIDEST_HARDWARE_FP_SIZE.
* doc/tm.texi: Regenerate.
* emit-rtl.cc (init_emit_once): Replace DOUBLE_TYPE_SIZE by
calling targetm.c.mode_for_floating_type with TI_DOUBLE_TYPE.
* real.h (REAL_VALUE_TO_TARGET_LONG_DOUBLE): Use TYPE_PRECISION of
long_double_type_node to replace LONG_DOUBLE_TYPE_SIZE.
* system.h (FLOAT_TYPE_SIZE): Poison.
(DOUBLE_TYPE_SIZE): Likewise.
(LONG_DOUBLE_TYPE_SIZE): Likewise.
* target.def (mode_for_floating_type): New hook.
* targhooks.cc (default_mode_for_floating_type): New function.
(default_scalar_mode_supported_p): Update macros
{FLOAT,DOUBLE,LONG_DOUBLE}_TYPE_SIZE by calling
targetm.c.mode_for_floating_type with
TI_{FLOAT,DOUBLE,LONG_DOUBLE}_TYPE.
* targhooks.h (default_mode_for_floating_type): New declaration.
* tree-core.h (enum tree_index): Specify underlying type unsigned
to sync with forward declaration in coretypes.h.
(NUM_FLOATN_TYPES): Explicitly convert to int.
(NUM_FLOATNX_TYPES): Likewise.
(NUM_FLOATN_NX_TYPES): Likewise.
* tree.cc (build_common_tree_nodes): Update macros
{FLOAT,DOUBLE,LONG_DOUBLE}_TYPE_SIZE by calling
targetm.c.mode_for_floating_type with
TI_{FLOAT,DOUBLE,LONG_DOUBLE}_TYPE and set type mode accordingly.
* config/arc/arc.h (FLOAT_TYPE_SIZE): Remove.
(DOUBLE_TYPE_SIZE): Likewise.
(LONG_DOUBLE_TYPE_SIZE): Likewise.
* config/bpf/bpf.h (FLOAT_TYPE_SIZE): Remove.
(DOUBLE_TYPE_SIZE): Likewise.
(LONG_DOUBLE_TYPE_SIZE): Likewise.
* config/epiphany/epiphany.h (FLOAT_TYPE_SIZE): Remove.
(DOUBLE_TYPE_SIZE): Likewise.
(LONG_DOUBLE_TYPE_SIZE): Likewise.
* config/fr30/fr30.h (FLOAT_TYPE_SIZE): Remove.
(DOUBLE_TYPE_SIZE): Likewise.
(LONG_DOUBLE_TYPE_SIZE): Likewise.
* config/frv/frv.h (FLOAT_TYPE_SIZE): Remove.
(DOUBLE_TYPE_SIZE): Likewise.
(LONG_DOUBLE_TYPE_SIZE): Likewise.
* config/ft32/ft32.h (FLOAT_TYPE_SIZE): Remove.
(DOUBLE_TYPE_SIZE): Likewise.
(LONG_DOUBLE_TYPE_SIZE): Likewise.
* config/gcn/gcn.h (FLOAT_TYPE_SIZE): Remove.
(DOUBLE_TYPE_SIZE): Likewise.
(LONG_DOUBLE_TYPE_SIZE): Likewise.
* config/iq2000/iq2000.h (FLOAT_TYPE_SIZE): Remove.
(DOUBLE_TYPE_SIZE): Likewise.
(LONG_DOUBLE_TYPE_SIZE): Likewise.
* config/lm32/lm32.h (FLOAT_TYPE_SIZE): Remove.
(DOUBLE_TYPE_SIZE): Likewise.
(LONG_DOUBLE_TYPE_SIZE): Likewise.
* config/m32c/m32c.h (FLOAT_TYPE_SIZE): Remove.
(DOUBLE_TYPE_SIZE): Likewise.
(LONG_DOUBLE_TYPE_SIZE): Likewise.
* config/m32r/m32r.h (FLOAT_TYPE_SIZE): Remove.
(DOUBLE_TYPE_SIZE): Likewise.
(LONG_DOUBLE_TYPE_SIZE): Likewise.
* config/microblaze/microblaze.h (FLOAT_TYPE_SIZE): Remove.
(DOUBLE_TYPE_SIZE): Likewise.
(LONG_DOUBLE_TYPE_SIZE): Likewise.
* config/mmix/mmix.h (FLOAT_TYPE_SIZE): Remove.
(DOUBLE_TYPE_SIZE): Likewise.
(LONG_DOUBLE_TYPE_SIZE): Likewise.
* config/moxie/moxie.h (FLOAT_TYPE_SIZE): Remove.
(DOUBLE_TYPE_SIZE): Likewise.
(LONG_DOUBLE_TYPE_SIZE): Likewise.
* config/msp430/msp430.h (FLOAT_TYPE_SIZE): Remove.
(DOUBLE_TYPE_SIZE): Likewise.
(LONG_DOUBLE_TYPE_SIZE): Likewise.
* config/nds32/nds32.h (FLOAT_TYPE_SIZE): Remove.
(DOUBLE_TYPE_SIZE): Likewise.
(LONG_DOUBLE_TYPE_SIZE): Likewise.
* config/nios2/nios2.h (FLOAT_TYPE_SIZE): Remove.
(DOUBLE_TYPE_SIZE): Likewise.
(LONG_DOUBLE_TYPE_SIZE): Likewise.
* config/nvptx/nvptx.h (FLOAT_TYPE_SIZE): Remove.
(DOUBLE_TYPE_SIZE): Likewise.
(LONG_DOUBLE_TYPE_SIZE): Likewise.
* config/or1k/or1k.h (FLOAT_TYPE_SIZE): Remove.
(DOUBLE_TYPE_SIZE): Likewise.
(LONG_DOUBLE_TYPE_SIZE): Likewise.
* config/pdp11/pdp11.h (FLOAT_TYPE_SIZE): Remove.
(DOUBLE_TYPE_SIZE): Likewise.
(LONG_DOUBLE_TYPE_SIZE): Likewise.
* config/pru/pru.h (FLOAT_TYPE_SIZE): Remove.
(DOUBLE_TYPE_SIZE): Likewise.
(LONG_DOUBLE_TYPE_SIZE): Likewise.
* config/stormy16/stormy16.h (FLOAT_TYPE_SIZE): Remove.
(DOUBLE_TYPE_SIZE): Likewise.
(LONG_DOUBLE_TYPE_SIZE): Likewise.
* config/visium/visium.h (FLOAT_TYPE_SIZE): Remove.
(DOUBLE_TYPE_SIZE): Likewise.
(LONG_DOUBLE_TYPE_SIZE): Likewise.
* config/xtensa/xtensa.h (FLOAT_TYPE_SIZE): Remove.
(DOUBLE_TYPE_SIZE): Likewise.
(LONG_DOUBLE_TYPE_SIZE): Likewise.
* config/rs6000/rs6000.cc (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro.
(rs6000_c_mode_for_floating_type): New function.
* config/rs6000/rs6000.h (FLOAT_TYPE_SIZE): Remove.
(DOUBLE_TYPE_SIZE): Likewise.
(LONG_DOUBLE_TYPE_SIZE): Likewise.
* 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.
* 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.
* config/avr/avr.cc (avr_c_mode_for_floating_type): New
function.
(TARGET_C_MODE_FOR_FLOATING_TYPE): New macro.
* config/avr/avr.h (FLOAT_TYPE_SIZE): Remove.
(DOUBLE_TYPE_SIZE): Likewise.
(LONG_DOUBLE_TYPE_SIZE): Likewise.
* config/i386/i386.cc (ix86_c_mode_for_floating_type): New
function.
(TARGET_C_MODE_FOR_FLOATING_TYPE): New macro.
* config/i386/i386.h (FLOAT_TYPE_SIZE): Remove.
(DOUBLE_TYPE_SIZE): Likewise.
(LONG_DOUBLE_TYPE_SIZE): Likewise.
* config/ia64/ia64.cc (ia64_c_mode_for_floating_type): New
function.
(TARGET_C_MODE_FOR_FLOATING_TYPE): New macro.
* config/ia64/ia64.h (FLOAT_TYPE_SIZE): Remove.
(DOUBLE_TYPE_SIZE): Likewise.
(LONG_DOUBLE_TYPE_SIZE): Likewise.
* config/riscv/riscv.cc (riscv_c_mode_for_floating_type): New function.
(TARGET_C_MODE_FOR_FLOATING_TYPE): New macro.
* config/riscv/riscv.h (FLOAT_TYPE_SIZE): Remove.
(DOUBLE_TYPE_SIZE): Likewise.
(LONG_DOUBLE_TYPE_SIZE): Likewise.
* 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.
* 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.
* 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.
* config/sh/sh.cc (sh_c_mode_for_floating_type): New function.
(TARGET_C_MODE_FOR_FLOATING_TYPE): New macro.
* config/sh/sh.h (LONG_DOUBLE_TYPE_SIZE): Remove.
* config/h8300/h8300.cc (h8300_c_mode_for_floating_type): New
function.
(TARGET_C_MODE_FOR_FLOATING_TYPE): New macro.
* config/h8300/h8300.h (FLOAT_TYPE_SIZE): Remove.
(DOUBLE_TYPE_SIZE): Remove.
(LONG_DOUBLE_TYPE_SIZE): Remove.
(DOUBLE_TYPE_MODE): New macro.
* config/h8300/linux.h (DOUBLE_TYPE_SIZE): Remove.
(DOUBLE_TYPE_MODE): New macro.
* config/loongarch/loongarch.cc (loongarch_c_mode_for_floating_type):
New function.
(TARGET_C_MODE_FOR_FLOATING_TYPE): New macro.
* config/loongarch/loongarch.h (FLOAT_TYPE_SIZE): Remove.
(DOUBLE_TYPE_SIZE): Remove.
(LONG_DOUBLE_TYPE_SIZE): Rename to ...
(LA_LONG_DOUBLE_TYPE_SIZE): ... this.
(UNITS_PER_FPVALUE): Replace LONG_DOUBLE_TYPE_SIZE with
LA_LONG_DOUBLE_TYPE_SIZE.
(MAX_FIXED_MODE_SIZE): Likewise.
(STRUCTURE_SIZE_BOUNDARY): Likewise.
(BIGGEST_ALIGNMENT): Likewise.
* config/m68k/m68k.cc (m68k_c_mode_for_floating_type): New function.
(TARGET_C_MODE_FOR_FLOATING_TYPE): New macro.
* config/m68k/m68k.h (LONG_DOUBLE_TYPE_SIZE): Remove.
(LONG_DOUBLE_TYPE_MODE): New macro.
* config/m68k/netbsd-elf.h (LONG_DOUBLE_TYPE_SIZE): Remove.
(LONG_DOUBLE_TYPE_MODE): New macro.
* config/mips/mips.cc (mips_c_mode_for_floating_type): New function.
(TARGET_C_MODE_FOR_FLOATING_TYPE): New macro.
* config/mips/mips.h (UNITS_PER_FPVALUE): Replace LONG_DOUBLE_TYPE_SIZE
with MIPS_LONG_DOUBLE_TYPE_SIZE.
(MAX_FIXED_MODE_SIZE): Likewise.
(STRUCTURE_SIZE_BOUNDARY): Likewise.
(BIGGEST_ALIGNMENT): Likewise.
(FLOAT_TYPE_SIZE): Remove.
(DOUBLE_TYPE_SIZE): Remove.
(LONG_DOUBLE_TYPE_SIZE): Rename to ...
(MIPS_LONG_DOUBLE_TYPE_SIZE): ... this.
* config/mips/n32-elf.h (LONG_DOUBLE_TYPE_SIZE): Rename to ...
(MIPS_LONG_DOUBLE_TYPE_SIZE): ... this.
* config/pa/pa.cc (pa_c_mode_for_floating_type): New function.
(TARGET_C_MODE_FOR_FLOATING_TYPE): New macro.
(pa_scalar_mode_supported_p): Rename FLOAT_TYPE_SIZE to
PA_FLOAT_TYPE_SIZE, rename DOUBLE_TYPE_SIZE to PA_DOUBLE_TYPE_SIZE
and rename LONG_DOUBLE_TYPE_SIZE to PA_LONG_DOUBLE_TYPE_SIZE.
* config/pa/pa.h (PA_FLOAT_TYPE_SIZE): New macro.
(PA_DOUBLE_TYPE_SIZE): Likewise.
(PA_LONG_DOUBLE_TYPE_SIZE): Likewise.
* config/pa/pa-64.h (FLOAT_TYPE_SIZE): Rename to ...
(PA_FLOAT_TYPE_SIZE): ... this.
(DOUBLE_TYPE_SIZE): Rename to ...
(PA_DOUBLE_TYPE_SIZE): ... this.
(LONG_DOUBLE_TYPE_SIZE): Rename to ...
(PA_LONG_DOUBLE_TYPE_SIZE): ... this.
* config/pa/pa-hpux.h (LONG_DOUBLE_TYPE_SIZE): Rename to ...
(PA_LONG_DOUBLE_TYPE_SIZE): ... this.
* config/sparc/sparc.cc (sparc_c_mode_for_floating_type): New function.
(TARGET_C_MODE_FOR_FLOATING_TYPE): New macro.
(FLOAT_TYPE_SIZE): Remove.
(DOUBLE_TYPE_SIZE): Likewise.
(LONG_DOUBLE_TYPE_SIZE): Likewise.
(sparc_type_code): Replace FLOAT_TYPE_SIZE with TYPE_PRECISION of
float_type_node.
* config/sparc/sparc.h (FLOAT_TYPE_SIZE): Remove.
(DOUBLE_TYPE_SIZE): Remove.
* config/sparc/freebsd.h (LONG_DOUBLE_TYPE_SIZE): Rename to ...
(SPARC_LONG_DOUBLE_TYPE_SIZE): ... this.
* config/sparc/linux.h (LONG_DOUBLE_TYPE_SIZE): Rename to ...
(SPARC_LONG_DOUBLE_TYPE_SIZE): ... this.
* config/sparc/linux64.h (LONG_DOUBLE_TYPE_SIZE): Rename to ...
(SPARC_LONG_DOUBLE_TYPE_SIZE): ... this.
* config/sparc/netbsd-elf.h (LONG_DOUBLE_TYPE_SIZE): Rename to ...
(SPARC_LONG_DOUBLE_TYPE_SIZE): ... this.
* config/sparc/openbsd64.h (LONG_DOUBLE_TYPE_SIZE): Rename to ...
(SPARC_LONG_DOUBLE_TYPE_SIZE): ... this.
* config/sparc/sol2.h (LONG_DOUBLE_TYPE_SIZE): Rename to ...
(SPARC_LONG_DOUBLE_TYPE_SIZE): ... this.
* config/sparc/sp-elf.h (LONG_DOUBLE_TYPE_SIZE): Rename to ...
(SPARC_LONG_DOUBLE_TYPE_SIZE): ... this.
* config/sparc/sp64-elf.h (LONG_DOUBLE_TYPE_SIZE): Rename to ...
(SPARC_LONG_DOUBLE_TYPE_SIZE): ... this.
* config/bfin/bfin.h (FLOAT_TYPE_SIZE): Rename to ...
(BFIN_FLOAT_TYPE_SIZE): ... this.
(DOUBLE_TYPE_SIZE): Rename to ...
(BFIN_DOUBLE_TYPE_SIZE): ... this.
(LONG_DOUBLE_TYPE_SIZE): Remove.
(UNITS_PER_FLOAT): Replace FLOAT_TYPE_SIZE with BFIN_FLOAT_TYPE_SIZE.
(UNITS_PER_DOUBLE): Replace DOUBLE_TYPE_SIZE with
BFIN_DOUBLE_TYPE_SIZE.

86 files changed:
gcc/config/aarch64/aarch64.cc
gcc/config/aarch64/aarch64.h
gcc/config/alpha/alpha.cc
gcc/config/alpha/alpha.h
gcc/config/arc/arc.h
gcc/config/avr/avr.cc
gcc/config/avr/avr.h
gcc/config/bfin/bfin.h
gcc/config/bpf/bpf.h
gcc/config/epiphany/epiphany.h
gcc/config/fr30/fr30.h
gcc/config/frv/frv.h
gcc/config/ft32/ft32.h
gcc/config/gcn/gcn.h
gcc/config/h8300/h8300.cc
gcc/config/h8300/h8300.h
gcc/config/h8300/linux.h
gcc/config/i386/i386.cc
gcc/config/i386/i386.h
gcc/config/ia64/ia64.cc
gcc/config/ia64/ia64.h
gcc/config/iq2000/iq2000.h
gcc/config/lm32/lm32.h
gcc/config/loongarch/loongarch.cc
gcc/config/loongarch/loongarch.h
gcc/config/m32c/m32c.h
gcc/config/m32r/m32r.h
gcc/config/m68k/m68k.cc
gcc/config/m68k/m68k.h
gcc/config/m68k/netbsd-elf.h
gcc/config/microblaze/microblaze.h
gcc/config/mips/mips.cc
gcc/config/mips/mips.h
gcc/config/mips/n32-elf.h
gcc/config/mmix/mmix.h
gcc/config/moxie/moxie.h
gcc/config/msp430/msp430.h
gcc/config/nds32/nds32.h
gcc/config/nios2/nios2.h
gcc/config/nvptx/nvptx.h
gcc/config/or1k/or1k.h
gcc/config/pa/pa-64.h
gcc/config/pa/pa-hpux.h
gcc/config/pa/pa.cc
gcc/config/pa/pa.h
gcc/config/pdp11/pdp11.h
gcc/config/pru/pru.h
gcc/config/riscv/riscv.cc
gcc/config/riscv/riscv.h
gcc/config/rl78/rl78.cc
gcc/config/rl78/rl78.h
gcc/config/rs6000/rs6000.cc
gcc/config/rs6000/rs6000.h
gcc/config/rx/rx.cc
gcc/config/rx/rx.h
gcc/config/s390/s390.cc
gcc/config/s390/s390.h
gcc/config/sh/sh.cc
gcc/config/sh/sh.h
gcc/config/sparc/freebsd.h
gcc/config/sparc/linux.h
gcc/config/sparc/linux64.h
gcc/config/sparc/netbsd-elf.h
gcc/config/sparc/openbsd64.h
gcc/config/sparc/sol2.h
gcc/config/sparc/sp-elf.h
gcc/config/sparc/sp64-elf.h
gcc/config/sparc/sparc.cc
gcc/config/sparc/sparc.h
gcc/config/stormy16/stormy16.h
gcc/config/visium/visium.h
gcc/config/xtensa/xtensa.h
gcc/coretypes.h
gcc/defaults.h
gcc/doc/rtl.texi
gcc/doc/tm.texi
gcc/doc/tm.texi.in
gcc/emit-rtl.cc
gcc/jit/jit-recording.cc
gcc/real.h
gcc/system.h
gcc/target.def
gcc/targhooks.cc
gcc/targhooks.h
gcc/tree-core.h
gcc/tree.cc

index 026f8627a89306c32629a3b191db126c08dc1084..ae7e21d90b2aeec51b7626471ccf7f036fa9b3db 100644 (file)
@@ -28406,6 +28406,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.  */
@@ -30533,6 +30545,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
 
index 2b89f6f88ef00b4691eb3e7b27593ace8d872fb5..fac1882bcb38eae3690c2dc366ebc6c3f64ee940 100644 (file)
 
 #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
index 1126cea1f7ba2c8a1c4e5785c4d156cdfe2ff5b1..a6fe95e71778bd28aaea356ea2b93da584f12190 100644 (file)
@@ -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));
 }
-\f
+
+/* 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;
 
 \f
index 25ccfce96b8a3e65ae5b63ac0f675ee7f90bf5d7..ee9e0918038e3f411a8a43a28ad8bd9589b801fc 100644 (file)
@@ -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
 
index f3b43882671e42d3caa9bc105130d999aabca483..0a1ecb71d893816fe46588498a307ecd5d92eb87 100644 (file)
@@ -296,9 +296,6 @@ if (GET_MODE_CLASS (MODE) == MODE_INT               \
 #define INT_TYPE_SIZE          32
 #define LONG_TYPE_SIZE         32
 #define LONG_LONG_TYPE_SIZE    64
-#define FLOAT_TYPE_SIZE                32
-#define DOUBLE_TYPE_SIZE       64
-#define LONG_DOUBLE_TYPE_SIZE  64
 
 /* Define this as 1 if `char' should by default be signed; else as 0.  */
 #define DEFAULT_SIGNED_CHAR 0
index 74924ab0565779c597d10ee880548640a9dd59ae..61c325f2497e61fad05b2a0ec5256e499fb08159 100644 (file)
@@ -6930,6 +6930,20 @@ avr_canonicalize_comparison (int *icode, rtx *op0, rtx *op1, bool op0_fixed)
     }
 }
 
+/* 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
+avr_c_mode_for_floating_type (enum tree_index ti)
+{
+  if (ti == TI_DOUBLE_TYPE)
+    return avr_double == 32 ? SFmode : DFmode;
+  if (ti == TI_LONG_DOUBLE_TYPE)
+    return avr_long_double == 32 ? SFmode : DFmode;
+  return default_mode_for_floating_type (ti);
+}
+
 
 /* Output compare instruction
 
@@ -16411,6 +16425,9 @@ avr_float_lib_compare_returns_bool (machine_mode mode, enum rtx_code)
 #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 avr_c_mode_for_floating_type
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 \f
index 56211fa9cd00ec856eb000aa25a3d2058c452778..4977e15eeedef284adbbf183c6812b40ad27b6d9 100644 (file)
@@ -143,9 +143,6 @@ FIXME: DRIVER_SELF_SPECS has changed.
 #define SHORT_TYPE_SIZE (INT_TYPE_SIZE == 8 ? INT_TYPE_SIZE : 16)
 #define LONG_TYPE_SIZE (INT_TYPE_SIZE == 8 ? 16 : 32)
 #define LONG_LONG_TYPE_SIZE (INT_TYPE_SIZE == 8 ? 32 : 64)
-#define FLOAT_TYPE_SIZE 32
-#define DOUBLE_TYPE_SIZE (avr_double)
-#define LONG_DOUBLE_TYPE_SIZE (avr_long_double)
 
 #define LONG_LONG_ACCUM_TYPE_SIZE 64
 
index e6ac8e3206cd586c205cbbd32d36117f82eaae26..e957c31a788e926ce3790d9cf96810b85fda19bb 100644 (file)
@@ -862,10 +862,10 @@ typedef struct {
  *  really cause some alignment problem
  */
 
-#define UNITS_PER_FLOAT  ((FLOAT_TYPE_SIZE  + BITS_PER_UNIT - 1) / \
+#define UNITS_PER_FLOAT  ((BFIN_FLOAT_TYPE_SIZE  + BITS_PER_UNIT - 1) / \
                           BITS_PER_UNIT)
 
-#define UNITS_PER_DOUBLE ((DOUBLE_TYPE_SIZE + BITS_PER_UNIT - 1) / \
+#define UNITS_PER_DOUBLE ((BFIN_DOUBLE_TYPE_SIZE + BITS_PER_UNIT - 1) / \
                           BITS_PER_UNIT)
 
 
@@ -874,7 +874,8 @@ typedef struct {
 
 /* Define this as 1 if `char' should by default be signed; else as 0.  */
 #define DEFAULT_SIGNED_CHAR 1
-#define FLOAT_TYPE_SIZE BITS_PER_WORD
+/* FLOAT_TYPE_SIZE get poisoned, so add BFIN_ prefix.  */
+#define BFIN_FLOAT_TYPE_SIZE BITS_PER_WORD
 #define SHORT_TYPE_SIZE 16 
 #define CHAR_TYPE_SIZE 8
 #define INT_TYPE_SIZE  32
@@ -890,8 +891,8 @@ typedef struct {
  * #define DOUBLES_ARE_FLOATS 1
  */
 
-#define DOUBLE_TYPE_SIZE       64
-#define LONG_DOUBLE_TYPE_SIZE  64
+/* DOUBLE_TYPE_SIZE get poisoned, so add BFIN_ prefix.  */
+#define BFIN_DOUBLE_TYPE_SIZE  64
 
 /* `PROMOTE_MODE (M, UNSIGNEDP, TYPE)'
      A macro to update M and UNSIGNEDP when an object whose type is
index e163fbf688d06a79913dabf3ad252e8b8f08b752..2298e5b05afd94e481d310b3463a020b0c161c62 100644 (file)
@@ -90,9 +90,6 @@
 #define LONG_TYPE_SIZE        64
 #define LONG_LONG_TYPE_SIZE   64
 #define CHAR_TYPE_SIZE         8
-#define FLOAT_TYPE_SIZE       32
-#define DOUBLE_TYPE_SIZE      64
-#define LONG_DOUBLE_TYPE_SIZE 64
 
 #define INTPTR_TYPE    "long int"
 #define UINTPTR_TYPE   "long unsigned int"
index 1df9eeecd0ea5a5a35ceed8c2dda51e3c5b3b762..aa4715bfe104eafeb32634055af5571db5b1e60e 100644 (file)
@@ -188,9 +188,6 @@ along with GCC; see the file COPYING3.  If not see
 #define INT_TYPE_SIZE          32
 #define LONG_TYPE_SIZE         32
 #define LONG_LONG_TYPE_SIZE    64
-#define FLOAT_TYPE_SIZE                32
-#define DOUBLE_TYPE_SIZE       64
-#define LONG_DOUBLE_TYPE_SIZE  64
 
 /* Define this as 1 if `char' should by default be signed; else as 0.  */
 #define DEFAULT_SIGNED_CHAR 0
index 2a2674ca29efea5611291046ff019cc919129630..19020fbbd366f52f59332def187baba660d2ccb2 100644 (file)
@@ -99,9 +99,6 @@ along with GCC; see the file COPYING3.  If not see
 #define INT_TYPE_SIZE          32
 #define LONG_TYPE_SIZE                 32
 #define LONG_LONG_TYPE_SIZE    64
-#define FLOAT_TYPE_SIZE        32
-#define DOUBLE_TYPE_SIZE       64
-#define LONG_DOUBLE_TYPE_SIZE  64
 
 #define DEFAULT_SIGNED_CHAR 1
 
index 60225ee8230bf9fd35491c77d3cf50d9940a0afc..b16103afff584d88c5c5b806e30e4035ac5d6c25 100644 (file)
 #define INT_TYPE_SIZE         32
 #define LONG_TYPE_SIZE        32
 #define LONG_LONG_TYPE_SIZE   64
-#define FLOAT_TYPE_SIZE       32
-#define DOUBLE_TYPE_SIZE      64
-#define LONG_DOUBLE_TYPE_SIZE 64
 
 /* An expression whose value is 1 or 0, according to whether the type `char'
    should be signed or unsigned by default.  The user can always override this
index 6d892a5ab8eebb319407d24ee566c123f155a993..1803d5b6be08ab5d7fb70044b977b9d8874ab9fa 100644 (file)
 #define LONG_TYPE_SIZE 32
 #define LONG_LONG_TYPE_SIZE 64
 
-#define FLOAT_TYPE_SIZE 32
-#define DOUBLE_TYPE_SIZE 64
-#define LONG_DOUBLE_TYPE_SIZE 64
-
 #define DEFAULT_SIGNED_CHAR 1
 
 #undef  SIZE_TYPE
index afa615320ca35eeb0b05dead92646911ab5e6f46..e3bfd29c17d2f490bbe4aef01db7ab428dd6f5e6 100644 (file)
 #define INT_TYPE_SIZE            32
 #define LONG_TYPE_SIZE           64
 #define LONG_LONG_TYPE_SIZE      64
-#define FLOAT_TYPE_SIZE                  32
-#define DOUBLE_TYPE_SIZE         64
-#define LONG_DOUBLE_TYPE_SIZE    64
 #define DEFAULT_SIGNED_CHAR      1
 #define PCC_BITFIELD_TYPE_MATTERS 1
 
index 9ac6d52f9d6d869f035fa7c73e675b2104a2b09a..7ab26f2b7f9de82b2789372f3e8bc7cf5632b0bb 100644 (file)
@@ -5601,6 +5601,18 @@ h8300_ok_for_sibcall_p (tree fndecl, tree)
   return 1;
 }
 
+/* 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
+h8300_c_mode_for_floating_type (enum tree_index ti)
+{
+  if (ti == TI_DOUBLE_TYPE || ti == TI_LONG_DOUBLE_TYPE)
+    return DOUBLE_TYPE_MODE;
+  return default_mode_for_floating_type (ti);
+}
+
 /* Return TRUE if OP is a PRE_INC or PRE_DEC
    instruction using REG, FALSE otherwise.  */
 
@@ -5721,4 +5733,7 @@ pre_incdec_with_reg (rtx op, unsigned int reg)
 #undef TARGET_FUNCTION_OK_FOR_SIBCALL
 #define TARGET_FUNCTION_OK_FOR_SIBCALL h8300_ok_for_sibcall_p
 
+#undef TARGET_C_MODE_FOR_FLOATING_TYPE
+#define TARGET_C_MODE_FOR_FLOATING_TYPE h8300_c_mode_for_floating_type
+
 struct gcc_target targetm = TARGET_INITIALIZER;
index bb0bf7404e0f6722194f9cb66abc9f131411da4d..d25689ccec8f6d2d0967e7f47fa99cd6965a7971 100644 (file)
@@ -149,9 +149,7 @@ extern const char * const *h8_reg_names;
 #define INT_TYPE_SIZE          (TARGET_INT32 ? 32 : 16)
 #define LONG_TYPE_SIZE         32
 #define LONG_LONG_TYPE_SIZE    64
-#define FLOAT_TYPE_SIZE        32
-#define DOUBLE_TYPE_SIZE       32
-#define LONG_DOUBLE_TYPE_SIZE  DOUBLE_TYPE_SIZE
+#define DOUBLE_TYPE_MODE       SFmode
 
 #define MAX_FIXED_MODE_SIZE    32
 
index 326c481b512dda82b5bd87a0d51b426b324fd4d0..6e21db376554e1b772dea495c89f5da00b7c0ac1 100644 (file)
@@ -36,8 +36,8 @@ along with GCC; see the file COPYING3.  If not see
 #define TARGET_DEFAULT (MASK_QUICKCALL | MASK_INT32 | MASK_H8300H)
 
 /* Width of a word, in units (bytes).  */
-#undef DOUBLE_TYPE_SIZE
-#define DOUBLE_TYPE_SIZE       64
+#undef DOUBLE_TYPE_MODE
+#define DOUBLE_TYPE_MODE       DFmode
 
 #undef DEFAULT_SIGNED_CHAR
 #define DEFAULT_SIGNED_CHAR 1
index d4ccc24be6ec2341459346f743f2cf078f39499f..41858570919b5353fde825521b7fe3c113d33831 100644 (file)
@@ -26109,6 +26109,19 @@ ix86_bitint_type_info (int n, struct bitint_info *info)
   return true;
 }
 
+/* Implement TARGET_C_MODE_FOR_FLOATING_TYPE.  Return DFmode, TFmode
+   or XFmode for TI_LONG_DOUBLE_TYPE which is for long double type,
+   based on long double bits, go with the default one for the others.  */
+
+static machine_mode
+ix86_c_mode_for_floating_type (enum tree_index ti)
+{
+  if (ti == TI_LONG_DOUBLE_TYPE)
+    return (TARGET_LONG_DOUBLE_64 ? DFmode
+                                 : (TARGET_LONG_DOUBLE_128 ? TFmode : XFmode));
+  return default_mode_for_floating_type (ti);
+}
+
 /* Returns modified FUNCTION_TYPE for cdtor callabi.  */
 tree
 ix86_cxx_adjust_cdtor_callabi_fntype (tree fntype)
@@ -26741,6 +26754,8 @@ static const scoped_attribute_specs *const ix86_attribute_table[] =
 #define TARGET_C_EXCESS_PRECISION ix86_get_excess_precision
 #undef TARGET_C_BITINT_TYPE_INFO
 #define TARGET_C_BITINT_TYPE_INFO ix86_bitint_type_info
+#undef TARGET_C_MODE_FOR_FLOATING_TYPE
+#define TARGET_C_MODE_FOR_FLOATING_TYPE ix86_c_mode_for_floating_type
 #undef TARGET_CXX_ADJUST_CDTOR_CALLABI_FNTYPE
 #define TARGET_CXX_ADJUST_CDTOR_CALLABI_FNTYPE ix86_cxx_adjust_cdtor_callabi_fntype
 #undef TARGET_PROMOTE_PROTOTYPES
index ff5ed32e21e3c4bff7f4156551d1c0cac3d97e7f..a204c9228f8ecf68fc9f1e9558ddae919ced004d 100644 (file)
@@ -678,10 +678,6 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
 #define LONG_TYPE_SIZE (TARGET_X32 ? 32 : BITS_PER_WORD)
 #define POINTER_SIZE (TARGET_X32 ? 32 : BITS_PER_WORD)
 #define LONG_LONG_TYPE_SIZE 64
-#define FLOAT_TYPE_SIZE 32
-#define DOUBLE_TYPE_SIZE 64
-#define LONG_DOUBLE_TYPE_SIZE \
-  (TARGET_LONG_DOUBLE_64 ? 64 : (TARGET_LONG_DOUBLE_128 ? 128 : 80))
 
 #define WIDEST_HARDWARE_FP_SIZE 80
 
index ac3d56073ac2137f84bd08688c22c66b1cd36c57..cd6ed8952114647a3188eaadd4340dcacfcc90e3 100644 (file)
@@ -321,6 +321,7 @@ static const char *ia64_invalid_conversion (const_tree, const_tree);
 static const char *ia64_invalid_unary_op (int, const_tree);
 static const char *ia64_invalid_binary_op (int, const_tree, const_tree);
 static machine_mode ia64_c_mode_for_suffix (char);
+static machine_mode ia64_c_mode_for_floating_type (enum tree_index);
 static void ia64_trampoline_init (rtx, tree, rtx);
 static void ia64_override_options_after_change (void);
 static bool ia64_member_type_forces_blk (const_tree, machine_mode);
@@ -637,6 +638,9 @@ static const scoped_attribute_specs *const ia64_attribute_table[] =
 #undef TARGET_C_MODE_FOR_SUFFIX
 #define TARGET_C_MODE_FOR_SUFFIX ia64_c_mode_for_suffix
 
+#undef TARGET_C_MODE_FOR_FLOATING_TYPE
+#define TARGET_C_MODE_FOR_FLOATING_TYPE ia64_c_mode_for_floating_type
+
 #undef TARGET_CAN_ELIMINATE
 #define TARGET_CAN_ELIMINATE ia64_can_eliminate
 
@@ -11329,6 +11333,20 @@ ia64_c_mode_for_suffix (char suffix)
   return VOIDmode;
 }
 
+/* Implement TARGET_C_MODE_FOR_FLOATING_TYPE.  Return DFmode, XFmode
+   or TFmode for TI_LONG_DOUBLE_TYPE which is for long double type,
+   go with the default one for the others.  */
+
+static machine_mode
+ia64_c_mode_for_floating_type (enum tree_index ti)
+{
+  /* long double is XFmode normally, and TFmode for HPUX.  It should be
+     TFmode for VMS as well but we only support up to DFmode now.  */
+  if (ti == TI_LONG_DOUBLE_TYPE)
+    return TARGET_HPUX ? TFmode : (TARGET_ABI_OPEN_VMS ? DFmode : XFmode);
+  return default_mode_for_floating_type (ti);
+}
+
 static GTY(()) rtx ia64_dconst_0_5_rtx;
 
 rtx
index b7f9d654f90bdc4d426b1a641ecd265a3292f4c8..763b1c3ed481ab7eff5707631782733012f0c29f 100644 (file)
@@ -236,18 +236,6 @@ while (0)
 
 #define LONG_LONG_TYPE_SIZE 64
 
-#define FLOAT_TYPE_SIZE 32
-
-#define DOUBLE_TYPE_SIZE 64
-
-/* long double is XFmode normally, and TFmode for HPUX.  It should be
-   TFmode for VMS as well but we only support up to DFmode now.  */
-#define LONG_DOUBLE_TYPE_SIZE \
-  (TARGET_HPUX ? 128 \
-   : TARGET_ABI_OPEN_VMS ? 64 \
-   : 80)
-
-
 #define DEFAULT_SIGNED_CHAR 1
 
 /* A C expression for a string describing the name of the data type to use for
index 88e87c6f603992df945edb6e51087637af0e0d6a..c3562be0fb964875be8b9e591f8386df3178c1c2 100644 (file)
 #define LONG_TYPE_SIZE                 32
 #define LONG_LONG_TYPE_SIZE    64
 #define CHAR_TYPE_SIZE         BITS_PER_UNIT
-#define FLOAT_TYPE_SIZE        32
-#define DOUBLE_TYPE_SIZE       64
-#define LONG_DOUBLE_TYPE_SIZE  64
 #define DEFAULT_SIGNED_CHAR    1
 
 #undef  SIZE_TYPE
index 1d2c8adadfec4290ff7f0585bfa411ce3e088330..e761e14dcc506604dbe93c147edc6f8e90a3aa60 100644 (file)
@@ -122,10 +122,6 @@ do {                                                    \
 #define LONG_TYPE_SIZE             32
 #define LONG_LONG_TYPE_SIZE        64
 
-#define FLOAT_TYPE_SIZE                    32
-#define DOUBLE_TYPE_SIZE           64
-#define LONG_DOUBLE_TYPE_SIZE       64
-
 #define DEFAULT_SIGNED_CHAR         0
 
 #define SIZE_TYPE "unsigned int"
index 6ec3ee6250262d7f44fd851ee919bb35eccd12f7..e2ff2af89e2453277bfd0c6d6c363cc4b8a3ca3f 100644 (file)
@@ -10953,6 +10953,18 @@ loongarch_builtin_support_vector_misalignment (machine_mode mode,
                                                      is_packed);
 }
 
+/* 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
+loongarch_c_mode_for_floating_type (enum tree_index ti)
+{
+  if (ti == TI_LONG_DOUBLE_TYPE)
+    return TARGET_64BIT ? TFmode : DFmode;
+  return default_mode_for_floating_type (ti);
+}
+
 static bool
 use_rsqrt_p (void)
 {
@@ -11263,6 +11275,9 @@ loongarch_asm_code_end (void)
 #define TARGET_VECTORIZE_SUPPORT_VECTOR_MISALIGNMENT \
   loongarch_builtin_support_vector_misalignment
 
+#undef TARGET_C_MODE_FOR_FLOATING_TYPE
+#define TARGET_C_MODE_FOR_FLOATING_TYPE loongarch_c_mode_for_floating_type
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 #include "gt-loongarch.h"
index f7fe950f33326d25e4925e7cb890b0325199714e..b9323aba394817e123c217b73c40fdaead41c56d 100644 (file)
@@ -151,7 +151,7 @@ along with GCC; see the file COPYING3.  If not see
 #define UNITS_PER_FPVALUE \
   (TARGET_SOFT_FLOAT ? 0 \
    : TARGET_SINGLE_FLOAT ? UNITS_PER_FP_REG \
-                        : LONG_DOUBLE_TYPE_SIZE / BITS_PER_UNIT)
+                        : LA_LONG_DOUBLE_TYPE_SIZE / BITS_PER_UNIT)
 
 /* The number of bytes in a double.  */
 #define UNITS_PER_DOUBLE (TYPE_PRECISION (double_type_node) / BITS_PER_UNIT)
@@ -162,9 +162,8 @@ along with GCC; see the file COPYING3.  If not see
 #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_64BIT ? 128 : 64)
+/* LONG_DOUBLE_TYPE_SIZE get poisoned, so add LA_ prefix.  */
+#define LA_LONG_DOUBLE_TYPE_SIZE (TARGET_64BIT ? 128 : 64)
 
 /* Define the sizes of fixed-point types.  */
 #define SHORT_FRACT_TYPE_SIZE 8
@@ -179,7 +178,7 @@ along with GCC; see the file COPYING3.  If not see
 
 /* long double is not a fixed mode, but the idea is that, if we
    support long double, we also want a 128-bit integer type.  */
-#define MAX_FIXED_MODE_SIZE LONG_DOUBLE_TYPE_SIZE
+#define MAX_FIXED_MODE_SIZE LA_LONG_DOUBLE_TYPE_SIZE
 
 /* Width in bits of a pointer.  */
 #ifndef POINTER_SIZE
@@ -200,11 +199,11 @@ along with GCC; see the file COPYING3.  If not see
 #define STRUCTURE_SIZE_BOUNDARY 8
 
 /* There is no point aligning anything to a rounder boundary than
-   LONG_DOUBLE_TYPE_SIZE, unless under LSX/LASX the bigggest alignment is
+   LA_LONG_DOUBLE_TYPE_SIZE, unless under LSX/LASX the bigggest alignment is
    BITS_PER_LSX_REG/BITS_PER_LASX_REG/..  */
 #define BIGGEST_ALIGNMENT \
   (ISA_HAS_LASX? BITS_PER_LASX_REG \
-   : (ISA_HAS_LSX ? BITS_PER_LSX_REG : LONG_DOUBLE_TYPE_SIZE))
+   : (ISA_HAS_LSX ? BITS_PER_LSX_REG : LA_LONG_DOUBLE_TYPE_SIZE))
 
 /* All accesses must be aligned.  */
 #define STRICT_ALIGNMENT (TARGET_STRICT_ALIGN)
index 247b4358cf9a79a750939c97210e3132cb683b94..a956c507d8d89c3507f9b8bb98d31b614f78c42f 100644 (file)
@@ -180,10 +180,6 @@ machine_function;
 #define LONG_TYPE_SIZE 32
 #define LONG_LONG_TYPE_SIZE 64
 
-#define FLOAT_TYPE_SIZE 32
-#define DOUBLE_TYPE_SIZE 64
-#define LONG_DOUBLE_TYPE_SIZE 64
-
 #define DEFAULT_SIGNED_CHAR 1
 
 #undef PTRDIFF_TYPE
index 4a400d1654f63fb1f3b0026d66dae234a5ee1974..7be8dfd79169f2a09fdeec1f5a0f76f334b5abac 100644 (file)
 #define INT_TYPE_SIZE          32
 #define LONG_TYPE_SIZE         32
 #define LONG_LONG_TYPE_SIZE    64
-#define FLOAT_TYPE_SIZE                32
-#define DOUBLE_TYPE_SIZE       64
-#define LONG_DOUBLE_TYPE_SIZE  64
 
 /* Define this as 1 if `char' should by default be signed; else as 0.  */
 #define DEFAULT_SIGNED_CHAR 1
index b1c9238949fb2de210a0bb4657142f2427bf3459..79ba4d5343cff5732835282ca0785d7a5ea55339 100644 (file)
@@ -198,6 +198,7 @@ static machine_mode m68k_promote_function_mode (const_tree, machine_mode,
                                                int *, const_tree, int);
 static void m68k_asm_final_postscan_insn (FILE *, rtx_insn *insn, rtx [], int);
 static HARD_REG_SET m68k_zero_call_used_regs (HARD_REG_SET);
+static machine_mode m68k_c_mode_for_floating_type (enum tree_index);
 \f
 /* Initialize the GCC target structure.  */
 
@@ -365,6 +366,9 @@ static HARD_REG_SET m68k_zero_call_used_regs (HARD_REG_SET);
 #undef TARGET_ZERO_CALL_USED_REGS
 #define TARGET_ZERO_CALL_USED_REGS m68k_zero_call_used_regs
 
+#undef TARGET_C_MODE_FOR_FLOATING_TYPE
+#define TARGET_C_MODE_FOR_FLOATING_TYPE m68k_c_mode_for_floating_type
+
 TARGET_GNU_ATTRIBUTES (m68k_attribute_table,
 {
   /* { name, min_len, max_len, decl_req, type_req, fn_type_req,
@@ -7212,4 +7216,16 @@ m68k_zero_call_used_regs (HARD_REG_SET need_zeroed_hardregs)
   return need_zeroed_hardregs;
 }
 
+/* Implement TARGET_C_MODE_FOR_FLOATING_TYPE.  Return XFmode or DFmode
+   for TI_LONG_DOUBLE_TYPE which is for long double type, go with the
+   default one for the others.  */
+
+static machine_mode
+m68k_c_mode_for_floating_type (enum tree_index ti)
+{
+  if (ti == TI_LONG_DOUBLE_TYPE)
+    return LONG_DOUBLE_TYPE_MODE;
+  return default_mode_for_floating_type (ti);
+}
+
 #include "gt-m68k.h"
index 1aa89f1789b52b8ce0f3394b6b30b2f54cdfa973..0d57199714361ff9ed7f92ef28e36f71aee326b3 100644 (file)
@@ -278,8 +278,8 @@ along with GCC; see the file COPYING3.  If not see
 /* "long double" is the same as "double" on ColdFire and fido
    targets.  */
 
-#define LONG_DOUBLE_TYPE_SIZE                  \
-  ((TARGET_COLDFIRE || TARGET_FIDOA) ? 64 : 80)
+#define LONG_DOUBLE_TYPE_MODE                  \
+  ((TARGET_COLDFIRE || TARGET_FIDOA) ? DFmode : XFmode)
 
 #define BITS_BIG_ENDIAN 1
 #define BYTES_BIG_ENDIAN 1
index 5239f09b4cc3d4bb87a2a4528e2d5402766e0bc3..6fc5ad1a0a651b280391939cafa7740ad6bb99b6 100644 (file)
@@ -36,8 +36,8 @@ along with GCC; see the file COPYING3.  If not see
   while (0)
 
 /* Don't try using XFmode on the 68010.  */ 
-#undef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE (TARGET_68020 ? 80 : 64)
+#undef LONG_DOUBLE_TYPE_MODE
+#define LONG_DOUBLE_TYPE_MODE (TARGET_68020 ? XFmode : DFmode)
 
 #undef SUBTARGET_EXTRA_SPECS
 #define SUBTARGET_EXTRA_SPECS \
index c88a87c12e29ac1be480688907640d7cd8a103ad..5d28abf9741a2a039360ccd9ea9e694836832994 100644 (file)
@@ -216,9 +216,6 @@ extern enum pipeline_type microblaze_pipe;
 #define SHORT_TYPE_SIZE         16
 #define LONG_TYPE_SIZE          32
 #define LONG_LONG_TYPE_SIZE     64
-#define FLOAT_TYPE_SIZE         32
-#define DOUBLE_TYPE_SIZE        64
-#define LONG_DOUBLE_TYPE_SIZE   64
 #define POINTER_SIZE            32
 #define PARM_BOUNDARY           32
 #define FUNCTION_BOUNDARY       32
index 48924116937be85897907e10959092cd4ce4bb75..24addfa89aa772af426e63a89b611d2508b4bdc5 100644 (file)
@@ -23045,6 +23045,18 @@ mips_asm_file_end (void)
     file_end_indicate_exec_stack ();
 }
 
+/* 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
+mips_c_mode_for_floating_type (enum tree_index ti)
+{
+  if (ti == TI_LONG_DOUBLE_TYPE)
+    return MIPS_LONG_DOUBLE_TYPE_SIZE == 64 ? DFmode : TFmode;
+  return default_mode_for_floating_type (ti);
+}
+
 void
 mips_bit_clear_info (enum machine_mode mode, unsigned HOST_WIDE_INT m,
                      int *start_pos, int *size)
@@ -23413,6 +23425,8 @@ mips_bit_clear_p (enum machine_mode mode, unsigned HOST_WIDE_INT m)
 #undef TARGET_ASM_FILE_END
 #define TARGET_ASM_FILE_END mips_asm_file_end
 
+#undef TARGET_C_MODE_FOR_FLOATING_TYPE
+#define TARGET_C_MODE_FOR_FLOATING_TYPE mips_c_mode_for_floating_type
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
index d18ca7dad8a9ad5a3f91a8680a63a48a7dc6f479..84dd64d98a0f609743f923fcb6b4374508afc04b 100644 (file)
@@ -1654,7 +1654,7 @@ FP_ASM_SPEC "\
 #define UNITS_PER_FPVALUE                      \
   (TARGET_SOFT_FLOAT_ABI ? 0                   \
    : TARGET_SINGLE_FLOAT ? UNITS_PER_FPREG     \
-   : LONG_DOUBLE_TYPE_SIZE / BITS_PER_UNIT)
+   : MIPS_LONG_DOUBLE_TYPE_SIZE / BITS_PER_UNIT)
 
 /* The number of bytes in a double.  */
 #define UNITS_PER_DOUBLE (TYPE_PRECISION (double_type_node) / BITS_PER_UNIT)
@@ -1665,9 +1665,8 @@ FP_ASM_SPEC "\
 #define LONG_TYPE_SIZE (TARGET_LONG64 ? 64 : 32)
 #define LONG_LONG_TYPE_SIZE 64
 
-#define FLOAT_TYPE_SIZE 32
-#define DOUBLE_TYPE_SIZE 64
-#define LONG_DOUBLE_TYPE_SIZE (TARGET_NEWABI ? 128 : 64)
+/* LONG_DOUBLE_TYPE_SIZE gets poisoned, so add MIPS_ prefix.  */
+#define MIPS_LONG_DOUBLE_TYPE_SIZE (TARGET_NEWABI ? 128 : 64)
 
 /* Define the sizes of fixed-point types.  */
 #define SHORT_FRACT_TYPE_SIZE 8
@@ -1684,7 +1683,7 @@ FP_ASM_SPEC "\
 
 /* long double is not a fixed mode, but the idea is that, if we
    support long double, we also want a 128-bit integer type.  */
-#define MAX_FIXED_MODE_SIZE LONG_DOUBLE_TYPE_SIZE
+#define MAX_FIXED_MODE_SIZE MIPS_LONG_DOUBLE_TYPE_SIZE
 
 /* Width in bits of a pointer.  */
 #ifndef POINTER_SIZE
@@ -1705,10 +1704,10 @@ FP_ASM_SPEC "\
 #define STRUCTURE_SIZE_BOUNDARY 8
 
 /* There is no point aligning anything to a rounder boundary than
-   LONG_DOUBLE_TYPE_SIZE, unless under MSA the bigggest alignment is
+   MIPS_LONG_DOUBLE_TYPE_SIZE, unless under MSA the bigggest alignment is
    BITS_PER_MSA_REG.  */
 #define BIGGEST_ALIGNMENT \
-  (ISA_HAS_MSA ? BITS_PER_MSA_REG : LONG_DOUBLE_TYPE_SIZE)
+  (ISA_HAS_MSA ? BITS_PER_MSA_REG : MIPS_LONG_DOUBLE_TYPE_SIZE)
 
 /* All accesses must be aligned.  */
 #define STRICT_ALIGNMENT (!ISA_HAS_UNALIGNED_ACCESS)
index 94a90d847f05a0bbf3d504ad3ece36deb1212103..01c8a852539d914d88084da40a2faac893df64dc 100644 (file)
@@ -26,5 +26,5 @@ along with GCC; see the file COPYING3.  If not see
 #define NO_DOLLAR_IN_LABEL
 
 /* Force n32 to use 64-bit long doubles.  */
-#undef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE 64
+#undef MIPS_LONG_DOUBLE_TYPE_SIZE
+#define MIPS_LONG_DOUBLE_TYPE_SIZE 64
index c3c5a2a69c9fe7220d11305c4eacb6e05bfe2dab..e20bca1d363ece0eef9a6e8012c5886314402032 100644 (file)
@@ -195,10 +195,6 @@ struct GTY(()) machine_function
 #define SHORT_TYPE_SIZE 16
 #define LONG_LONG_TYPE_SIZE 64
 
-#define FLOAT_TYPE_SIZE 32
-#define DOUBLE_TYPE_SIZE 64
-#define LONG_DOUBLE_TYPE_SIZE 64
-
 #define DEFAULT_SIGNED_CHAR 1
 
 
index 066c2566d84e12abd1db07ef6df8183359c7fe7a..4857c92890fca80d8ec3985282309085228427e8 100644 (file)
 #define LONG_TYPE_SIZE 32
 #define LONG_LONG_TYPE_SIZE 64
 
-#define FLOAT_TYPE_SIZE 32
-#define DOUBLE_TYPE_SIZE 64
-#define LONG_DOUBLE_TYPE_SIZE 64
-
 #define DEFAULT_SIGNED_CHAR 0
 
 #undef  SIZE_TYPE
index 5c856ee699710a644788a8f407ef6c8ecb7fdcee..f20309c65ac1c1bdf54afff392439d24a83924f0 100644 (file)
@@ -178,10 +178,6 @@ extern const char *msp430_get_linker_devices_include_path (int, const char **);
 #define LONG_TYPE_SIZE                 32
 #define LONG_LONG_TYPE_SIZE            64
 
-#define FLOAT_TYPE_SIZE                32
-#define DOUBLE_TYPE_SIZE               64
-#define LONG_DOUBLE_TYPE_SIZE          64 /*DOUBLE_TYPE_SIZE*/
-
 #define DEFAULT_SIGNED_CHAR            0
 
 #define STRICT_ALIGNMENT               1
index 03cf7a9aa5695cd0fdb3530498e8c7eebdf1596c..4c02302c785b4a513cc875efb8b372128652ba15 100644 (file)
@@ -1061,10 +1061,6 @@ enum nds32_builtins
 #define LONG_TYPE_SIZE          32
 #define LONG_LONG_TYPE_SIZE     64
 
-#define FLOAT_TYPE_SIZE         32
-#define DOUBLE_TYPE_SIZE        64
-#define LONG_DOUBLE_TYPE_SIZE   64
-
 #define DEFAULT_SIGNED_CHAR 1
 
 #define SIZE_TYPE "long unsigned int"
index 767f56e95b148115565621381dec826dc1ffe646..bad726713eb222f9f7074f22195f29f9684718d5 100644 (file)
 #define SHORT_TYPE_SIZE 16
 #define LONG_TYPE_SIZE 32
 #define LONG_LONG_TYPE_SIZE 64
-#define FLOAT_TYPE_SIZE 32
-#define DOUBLE_TYPE_SIZE 64
-#define LONG_DOUBLE_TYPE_SIZE DOUBLE_TYPE_SIZE
 
 #undef SIZE_TYPE
 #define SIZE_TYPE "unsigned int"
index 74f4a68924c0d9ad0ae395f2798e10b14296e6fa..68ab011c5a16a0ceec6a971dcc5a421968d51608 100644 (file)
@@ -75,9 +75,6 @@
 #define INT_TYPE_SIZE 32
 #define LONG_TYPE_SIZE (TARGET_ABI64 ? 64 : 32)
 #define LONG_LONG_TYPE_SIZE 64
-#define FLOAT_TYPE_SIZE 32
-#define DOUBLE_TYPE_SIZE 64
-#define LONG_DOUBLE_TYPE_SIZE 64
 #define TARGET_SUPPORTS_WIDE_INT 1
 
 #undef SIZE_TYPE
index 0ff73df33e7c5198e4e39ae35e8591acad026a37..a55509f9f3279c86aa9e12c5068ba8b5e1a67616 100644 (file)
@@ -67,9 +67,6 @@
 #define SHORT_TYPE_SIZE 16
 #define LONG_TYPE_SIZE 32
 #define LONG_LONG_TYPE_SIZE 64
-#define FLOAT_TYPE_SIZE 32
-#define DOUBLE_TYPE_SIZE 64
-#define LONG_DOUBLE_TYPE_SIZE 64
 #define WCHAR_TYPE_SIZE 32
 
 #undef SIZE_TYPE
index ea9d86ee7d406434023f181a6cf503e636bd1933..b676468d2cec25e90137620f279fe13fc255cf76 100644 (file)
@@ -58,12 +58,12 @@ along with GCC; see the file COPYING3.  If not see
 #define LONG_TYPE_SIZE 64
 #undef LONG_LONG_TYPE_SIZE
 #define LONG_LONG_TYPE_SIZE 64
-#undef FLOAT_TYPE_SIZE
-#define FLOAT_TYPE_SIZE 32
-#undef DOUBLE_TYPE_SIZE
-#define DOUBLE_TYPE_SIZE 64
-#undef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE 128
+#undef PA_FLOAT_TYPE_SIZE
+#define PA_FLOAT_TYPE_SIZE 32
+#undef PA_DOUBLE_TYPE_SIZE
+#define PA_DOUBLE_TYPE_SIZE 64
+#undef PA_LONG_DOUBLE_TYPE_SIZE
+#define PA_LONG_DOUBLE_TYPE_SIZE 128
 
 /* ?!? This needs to be made compile-time selectable.
 
index a7421d68ca0ad83194cba7d07d0681ed1ed497ed..accef4475232f9e7f2e9ffaa9946d7a5671333d6 100644 (file)
@@ -34,7 +34,8 @@ along with GCC; see the file COPYING3.  If not see
 #define SIZE_TYPE "unsigned int"
 #define PTRDIFF_TYPE "int"
 
-#define LONG_DOUBLE_TYPE_SIZE 128
+#undef PA_LONG_DOUBLE_TYPE_SIZE
+#define PA_LONG_DOUBLE_TYPE_SIZE 128
 #define FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE, COMPARISON) ((MODE) == TFmode)
 
 /* GCC always defines __STDC__.  HP C++ compilers don't define it.  This
index a7af6b8c121f7720ea73bf1297a4ee2c98719772..ab4bfc5d0c2646d3a644e09c4cead82e09cf1baf 100644 (file)
@@ -194,6 +194,7 @@ static rtx pa_internal_arg_pointer (void);
 static bool pa_can_eliminate (const int, const int);
 static void pa_conditional_register_usage (void);
 static machine_mode pa_c_mode_for_suffix (char);
+static machine_mode pa_c_mode_for_floating_type (enum tree_index);
 static section *pa_function_section (tree, enum node_frequency, bool, bool);
 static bool pa_cannot_force_const_mem (machine_mode, rtx);
 static bool pa_legitimate_constant_p (machine_mode, rtx);
@@ -398,6 +399,8 @@ static size_t n_deferred_plabels = 0;
 #define TARGET_CONDITIONAL_REGISTER_USAGE pa_conditional_register_usage
 #undef TARGET_C_MODE_FOR_SUFFIX
 #define TARGET_C_MODE_FOR_SUFFIX pa_c_mode_for_suffix
+#undef TARGET_C_MODE_FOR_FLOATING_TYPE
+#define TARGET_C_MODE_FOR_FLOATING_TYPE pa_c_mode_for_floating_type
 #undef TARGET_ASM_FUNCTION_SECTION
 #define TARGET_ASM_FUNCTION_SECTION pa_function_section
 
@@ -6728,11 +6731,11 @@ pa_scalar_mode_supported_p (scalar_mode mode)
       return false;
 
     case MODE_FLOAT:
-      if (precision == FLOAT_TYPE_SIZE)
+      if (precision == PA_FLOAT_TYPE_SIZE)
        return true;
-      if (precision == DOUBLE_TYPE_SIZE)
+      if (precision == PA_DOUBLE_TYPE_SIZE)
        return true;
-      if (precision == LONG_DOUBLE_TYPE_SIZE)
+      if (precision == PA_LONG_DOUBLE_TYPE_SIZE)
        return true;
       return false;
 
@@ -10808,6 +10811,18 @@ pa_c_mode_for_suffix (char suffix)
   return VOIDmode;
 }
 
+/* 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
+pa_c_mode_for_floating_type (enum tree_index ti)
+{
+  if (ti == TI_LONG_DOUBLE_TYPE)
+    return PA_LONG_DOUBLE_TYPE_SIZE == 64 ? DFmode : TFmode;
+  return default_mode_for_floating_type (ti);
+}
+
 /* Target hook for function_section.  */
 
 static section *
index 127a0d1966d28a3f03400f98a1f54b6d83e03780..7e45c358895b4be623c4c699409e66011974d2da 100644 (file)
@@ -1306,3 +1306,9 @@ do {                                                                           \
 /* An integer expression for the size in bits of the largest integer machine
    mode that should actually be used.  We allow pairs of registers.  */
 #define MAX_FIXED_MODE_SIZE GET_MODE_BITSIZE (TARGET_64BIT ? TImode : DImode)
+
+/* Define these macros as default for all subtargets, add PA_ prefix
+   as {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE get poisoned.  */
+#define PA_FLOAT_TYPE_SIZE BITS_PER_WORD
+#define PA_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
+#define PA_LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
index 2446fea0b58f06c3ddbe2b82cc3b50c21ba4afb3..6c8e045bc57d113fa8d139d7aed558419e6d438a 100644 (file)
@@ -71,17 +71,6 @@ along with GCC; see the file COPYING3.  If not see
 #define LONG_TYPE_SIZE         32
 #define LONG_LONG_TYPE_SIZE    64     
 
-/* In earlier versions, FLOAT_TYPE_SIZE was selectable as 32 or 64,
-   but that conflicts with Fortran language rules.  Since there is no
-   obvious reason why we should have that feature -- other targets
-   generally don't have float and double the same size -- I've removed
-   it.  Note that it continues to be true (for now) that arithmetic is
-   always done with 64-bit values, i.e., the FPU is always in "double"
-   mode.  */
-#define FLOAT_TYPE_SIZE                32
-#define DOUBLE_TYPE_SIZE       64
-#define LONG_DOUBLE_TYPE_SIZE  64
-
 /* machine types from ansi */
 #define SIZE_TYPE "short unsigned int"         /* definition of size_t */
 #define WCHAR_TYPE "short int"                 /* or long int???? */
index 28aeb603178d98be1d55c4245c70e6c4db7b8bdf..7aee2861871740f90feac40df0b6e4c374cc3500 100644 (file)
 #define SHORT_TYPE_SIZE 16
 #define LONG_TYPE_SIZE 32
 #define LONG_LONG_TYPE_SIZE 64
-#define FLOAT_TYPE_SIZE 32
-#define DOUBLE_TYPE_SIZE 64
-#define LONG_DOUBLE_TYPE_SIZE DOUBLE_TYPE_SIZE
 
 #undef SIZE_TYPE
 #define SIZE_TYPE "unsigned int"
index cca7ffde33aaafdff4a870044cdf1af4547c4dc5..9bba5da016e950e8acd0dc9d53a82b945e619163 100644 (file)
@@ -11649,6 +11649,18 @@ riscv_expand_ussub (rtx dest, rtx x, rtx y)
   emit_move_insn (dest, gen_lowpart (mode, pmode_dest));
 }
 
+/* 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
+riscv_c_mode_for_floating_type (enum tree_index ti)
+{
+  if (ti == TI_LONG_DOUBLE_TYPE)
+    return TFmode;
+  return default_mode_for_floating_type (ti);
+}
+
 /* Initialize the GCC target structure.  */
 #undef TARGET_ASM_ALIGNED_HI_OP
 #define TARGET_ASM_ALIGNED_HI_OP "\t.half\t"
@@ -12004,6 +12016,9 @@ riscv_expand_ussub (rtx dest, rtx x, rtx y)
 #undef TARGET_GET_RAW_RESULT_MODE
 #define TARGET_GET_RAW_RESULT_MODE riscv_get_raw_result_mode
 
+#undef TARGET_C_MODE_FOR_FLOATING_TYPE
+#define TARGET_C_MODE_FOR_FLOATING_TYPE riscv_c_mode_for_floating_type
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 #include "gt-riscv.h"
index 57910eecd3ea4e0699befaebf85b175fa8e22fad..6f040011864242563bcb350f10472d1bc29c4f9f 100644 (file)
@@ -188,10 +188,6 @@ ASM_MISA_SPEC
 #define POINTER_SIZE (riscv_abi >= ABI_LP64 ? 64 : 32)
 #define LONG_TYPE_SIZE POINTER_SIZE
 
-#define FLOAT_TYPE_SIZE 32
-#define DOUBLE_TYPE_SIZE 64
-#define LONG_DOUBLE_TYPE_SIZE 128
-
 /* Allocation boundary (in *bits*) for storing arguments in argument list.  */
 #define PARM_BOUNDARY BITS_PER_WORD
 
index b4bb145b5a690787c29186623ee5e504fd03f956..25f660686e4356b548d42019bc3a1f0564a7d075 100644 (file)
@@ -4972,6 +4972,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);
+}
+
 \f
 /* The strub runtime uses asms, and physical register allocation won't
    deal with them, so disable it.  */
index cfff98df6bc0a0b2b70680b5e97fc3df18e49fce..a960aee3931c7cdb692c507090b0d665ec9e1336 100644 (file)
 #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
index ec31674db498e2be1474410657add163fe0cb7f9..cd14e5a34ed52ae2627821b56fc546f2701859ce 100644 (file)
@@ -1707,6 +1707,9 @@ static const scoped_attribute_specs *const rs6000_attribute_table[] =
 #undef TARGET_C_MODE_FOR_SUFFIX
 #define TARGET_C_MODE_FOR_SUFFIX rs6000_c_mode_for_suffix
 
+#undef TARGET_C_MODE_FOR_FLOATING_TYPE
+#define TARGET_C_MODE_FOR_FLOATING_TYPE rs6000_c_mode_for_floating_type
+
 #undef TARGET_INVALID_BINARY_OP
 #define TARGET_INVALID_BINARY_OP rs6000_invalid_binary_op
 
@@ -24373,6 +24376,19 @@ rs6000_c_mode_for_suffix (char suffix)
   return VOIDmode;
 }
 
+/* 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
+rs6000_c_mode_for_floating_type (enum tree_index ti)
+{
+  if (ti == TI_LONG_DOUBLE_TYPE)
+    return rs6000_long_double_type_size == FLOAT_PRECISION_TFmode ? TFmode
+                                                                 : DFmode;
+  return default_mode_for_floating_type (ti);
+}
+
 /* Target hook for invalid_arg_for_unprototyped_fn. */
 static const char *
 invalid_arg_for_unprototyped_fn (const_tree typelist, const_tree funcdecl, const_tree val)
index 2cde2e329b0de6ceb4d32152a20084be6dc09406..9211f91740a2fbd2de09f2e4b114a09e91c0085c 100644 (file)
@@ -693,20 +693,6 @@ extern unsigned char rs6000_recip_bits[];
    words.  */
 #define LONG_LONG_TYPE_SIZE 64
 
-/* A C expression for the size in bits of the type `float' on the
-   target machine.  If you don't define this, the default is one
-   word.  */
-#define FLOAT_TYPE_SIZE 32
-
-/* A C expression for the size in bits of the type `double' on the
-   target machine.  If you don't define this, the default is two
-   words.  */
-#define DOUBLE_TYPE_SIZE 64
-
-/* A C expression for the size in bits of the type `long double' on the target
-   machine.  If you don't define this, the default is two words.  */
-#define LONG_DOUBLE_TYPE_SIZE rs6000_long_double_type_size
-
 /* Work around rs6000_long_double_type_size dependency in ada/targtyps.cc.  */
 #define WIDEST_HARDWARE_FP_SIZE 64
 
index 9bf9d87fed1738c99bf8d38a89784da25869e9a8..8048cc9870846d39bba25388627f0ca8407621b0 100644 (file)
@@ -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);
+}
 \f
 #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"
index ff445df49a32e77b69b34dcbd0acc02b6785a058..15d6d2503e72c8b003a2444e2ab6215dabb819c2 100644 (file)
 #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.  */
index ec836ec3cd4afa3d2d3f90971880f4a357732e2a..c65421de831e5af2e28efe6e2cca40040d5da3d2 100644 (file)
@@ -18079,6 +18079,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
@@ -18395,6 +18407,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"
index 0e6666a8802fa3fcc7e4cf6b45d54b317c1ba2c8..4a4dde1a9ba82641c6c777a7c4edd8f37941dd15 100644 (file)
@@ -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
index ef3c2e6791d7ec814c8e2feff876278736df39ba..bc0174203810f4917ee97f42ea10549f3163fce7 100644 (file)
@@ -328,6 +328,7 @@ static unsigned int sh_hard_regno_nregs (unsigned int, machine_mode);
 static bool sh_hard_regno_mode_ok (unsigned int, machine_mode);
 static bool sh_modes_tieable_p (machine_mode, machine_mode);
 static bool sh_can_change_mode_class (machine_mode, machine_mode, reg_class_t);
+static machine_mode sh_c_mode_for_floating_type (enum tree_index);
 \f
 TARGET_GNU_ATTRIBUTES (sh_attribute_table,
 {
@@ -664,6 +665,9 @@ TARGET_GNU_ATTRIBUTES (sh_attribute_table,
 #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 sh_c_mode_for_floating_type
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
 
@@ -10674,6 +10678,20 @@ sh_can_change_mode_class (machine_mode from, machine_mode to,
   return true;
 }
 
+/* Implement TARGET_C_MODE_FOR_FLOATING_TYPE.  Return SFmode or DFmode
+   for TI_DOUBLE_TYPE which is for double type, go with the default one
+   for the others.  */
+
+static machine_mode
+sh_c_mode_for_floating_type (enum tree_index ti)
+{
+  /* Since the SH2e has only `float' support, it is desirable to make all
+     floating point types equivalent to `float'.  */
+  if (ti == TI_DOUBLE_TYPE)
+    return TARGET_FPU_SINGLE_ONLY ? SFmode : DFmode;
+  return default_mode_for_floating_type (ti);
+}
+
 /* Return true if registers in machine mode MODE will likely be
    allocated to registers in small register classes.  */
 bool
index 7d3a3f0833887516cfde60b5673d8f251e7e682a..53cad85d1229c6e4b5f624022c719e2172d25482 100644 (file)
@@ -425,9 +425,6 @@ extern const sh_atomic_model& selected_atomic_model (void);
 /* Width in bits of a `long long'.  */
 #define LONG_LONG_TYPE_SIZE 64
 
-/* Width in bits of a `long double'.  */
-#define LONG_DOUBLE_TYPE_SIZE 64
-
 /* Width of a word, in units (bytes).  */
 #define UNITS_PER_WORD (4)
 #define MIN_UNITS_PER_WORD 4
@@ -1433,13 +1430,6 @@ extern bool current_function_interrupt;
    Do not define this if the table should contain absolute addresses.  */
 #define CASE_VECTOR_PC_RELATIVE 1
 
-/* Define it here, so that it doesn't get bumped to 64-bits on SHmedia.  */
-#define FLOAT_TYPE_SIZE 32
-
-/* Since the SH2e has only `float' support, it is desirable to make all
-   floating point types equivalent to `float'.  */
-#define DOUBLE_TYPE_SIZE (TARGET_FPU_SINGLE_ONLY ? 32 : 64)
-
 /* 'char' is signed by default.  */
 #define DEFAULT_SIGNED_CHAR  1
 
index 3f00a083c1d15432c7012a0c150766f831939f4d..5396b32c405fc86317efc349874d47934139f738 100644 (file)
@@ -68,8 +68,8 @@ along with GCC; see the file COPYING3.  If not see
 
 /* Define for support of TFmode long double.
    SPARC ABI says that long double is 4 words.  */
-#undef  LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64)
+#undef  SPARC_LONG_DOUBLE_TYPE_SIZE
+#define SPARC_LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64)
 
 /* Definitions for 64-bit SPARC running systems with ELF. */
 
index 9646fa9c41e5b741506e662bec0766a84177f5dd..8cc53899193b06284107c3208ff4843f03d7a592 100644 (file)
@@ -115,7 +115,7 @@ do {                                                                        \
 \f
 /* Define for support of TFmode long double.
    SPARC ABI says that long double is 4 words.  */
-#define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64)
+#define SPARC_LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64)
 
 #undef DITF_CONVERSION_LIBFUNCS
 #define DITF_CONVERSION_LIBFUNCS 1
index 1e2e4aef2ad3a0c340ae77fc27e3b8a59ac7d064..66426d8f5feac9bea435ae97b132d2ddcf1ad576 100644 (file)
@@ -61,8 +61,8 @@ along with GCC; see the file COPYING3.  If not see
 
 /* Define for support of TFmode long double.
    SPARC ABI says that long double is 4 words.  */
-#undef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64)
+#undef SPARC_LONG_DOUBLE_TYPE_SIZE
+#define SPARC_LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64)
 
 #undef CPP_SUBTARGET_SPEC
 #define CPP_SUBTARGET_SPEC "\
index 2cf85dd709694719edea536813fa93ac023eed0d..3bb05c55278033f7a94af39142a11a6ac740b5e3 100644 (file)
@@ -160,8 +160,8 @@ along with GCC; see the file COPYING3.  If not see
 
 #ifdef SPARC_BI_ARCH
 
-#undef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64)
+#undef SPARC_LONG_DOUBLE_TYPE_SIZE
+#define SPARC_LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64)
 
 #undef  CC1_SPEC
 #if DEFAULT_ARCH32_P
@@ -181,8 +181,8 @@ along with GCC; see the file COPYING3.  If not see
 #if TARGET_CPU_DEFAULT == TARGET_CPU_v9 \
  || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc
 
-#undef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE 128
+#undef SPARC_LONG_DOUBLE_TYPE_SIZE
+#define SPARC_LONG_DOUBLE_TYPE_SIZE 128
 
 #undef  CC1_SPEC
 #define CC1_SPEC CC1_SPEC64
@@ -193,8 +193,8 @@ along with GCC; see the file COPYING3.  If not see
 /* A 32-bit only compiler.  NetBSD don't support 128 bit `long double'
    for 32-bit code, unlike Solaris.  */
 
-#undef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE 64
+#undef SPARC_LONG_DOUBLE_TYPE_SIZE
+#define SPARC_LONG_DOUBLE_TYPE_SIZE 64
 
 #undef  CC1_SPEC
 #define CC1_SPEC CC1_SPEC32
index 9cd23f29b35ea3246d49f74ff44cbcea618b6c95..19cc20e69cd4e0acb95282fd5efd15da1c2f1dbc 100644 (file)
@@ -54,8 +54,8 @@ along with GCC; see the file COPYING3.  If not see
 #undef WCHAR_TYPE_SIZE
 #define WCHAR_TYPE_SIZE 32
 
-#undef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE 128
+#undef SPARC_LONG_DOUBLE_TYPE_SIZE
+#define SPARC_LONG_DOUBLE_TYPE_SIZE 128
 
 #undef LINK_SPEC
 #define LINK_SPEC \
index 530e681aaee127ba386e87749b0220698d061a7f..f0181d5914c8fc0dbddc1d85714a5c235d96d6b0 100644 (file)
@@ -440,7 +440,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
 
 /* Define for support of TFmode long double.
    SPARC ABI says that long double is 4 words.  */
-#define LONG_DOUBLE_TYPE_SIZE 128
+#define SPARC_LONG_DOUBLE_TYPE_SIZE 128
 
 /* Solaris's _Qp_* library routine implementation clobbers the output
    memory before the inputs are fully consumed.  */
index aa7982a9141606a4beca4ae9cb838a84067460b4..cc64d5dd58ef0d24fba8e8f1671e9ba1fd359416 100644 (file)
@@ -63,5 +63,5 @@ along with GCC; see the file COPYING3.  If not see
 #define WCHAR_TYPE_SIZE BITS_PER_WORD
 
 /* ??? until fixed.  */
-#undef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE 64
+#undef SPARC_LONG_DOUBLE_TYPE_SIZE
+#define SPARC_LONG_DOUBLE_TYPE_SIZE 64
index a9c53cb6d4f4aa30f4fba17d4b0382bdd0051c60..6eb5b86ddce2c438c1230370ab139f030b151810 100644 (file)
@@ -69,5 +69,5 @@ along with GCC; see the file COPYING3.  If not see
 #undef WCHAR_TYPE_SIZE
 #define WCHAR_TYPE_SIZE 16
 
-#undef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE 128
+#undef SPARC_LONG_DOUBLE_TYPE_SIZE
+#define SPARC_LONG_DOUBLE_TYPE_SIZE 128
index 8a5f76c8885fc8b16d18c95810fda4a6ee0745a8..9282fb43b44f90975e8bcec558c5514ec88c881b 100644 (file)
@@ -718,6 +718,7 @@ static bool sparc_vectorize_vec_perm_const (machine_mode, machine_mode,
                                            const vec_perm_indices &);
 static bool sparc_can_follow_jump (const rtx_insn *, const rtx_insn *);
 static HARD_REG_SET sparc_zero_call_used_regs (HARD_REG_SET);
+static machine_mode sparc_c_mode_for_floating_type (enum tree_index);
 \f
 #ifdef SUBTARGET_ATTRIBUTE_TABLE
 /* Table of valid machine attributes.  */
@@ -971,6 +972,9 @@ char sparc_hard_reg_printed[8];
 #undef TARGET_ZERO_CALL_USED_REGS
 #define TARGET_ZERO_CALL_USED_REGS sparc_zero_call_used_regs
 
+#undef TARGET_C_MODE_FOR_FLOATING_TYPE
+#define TARGET_C_MODE_FOR_FLOATING_TYPE sparc_c_mode_for_floating_type
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 /* Return the memory reference contained in X if any, zero otherwise.  */
@@ -9824,18 +9828,6 @@ sparc_assemble_integer (rtx x, unsigned int size, int aligned_p)
 #define LONG_LONG_TYPE_SIZE (BITS_PER_WORD * 2)
 #endif
 
-#ifndef FLOAT_TYPE_SIZE
-#define FLOAT_TYPE_SIZE BITS_PER_WORD
-#endif
-
-#ifndef DOUBLE_TYPE_SIZE
-#define DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
-#endif
-
-#ifndef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
-#endif
-
 unsigned long
 sparc_type_code (tree type)
 {
@@ -9920,7 +9912,7 @@ sparc_type_code (tree type)
          /* Carefully distinguish all the standard types of C,
             without messing up if the language is not C.  */
 
-         if (TYPE_PRECISION (type) == FLOAT_TYPE_SIZE)
+         if (TYPE_PRECISION (type) == TYPE_PRECISION (float_type_node))
            return (qualifiers | 6);
 
          else
@@ -13984,4 +13976,15 @@ sparc_zero_call_used_regs (HARD_REG_SET need_zeroed_hardregs)
   return need_zeroed_hardregs;
 }
 
+/* Implement TARGET_C_MODE_FOR_FLOATING_TYPE.  Return TFmode or DFmode
+   for TI_LONG_DOUBLE_TYPE and the default for others.  */
+
+static machine_mode
+sparc_c_mode_for_floating_type (enum tree_index ti)
+{
+  if (ti == TI_LONG_DOUBLE_TYPE)
+    return SPARC_LONG_DOUBLE_TYPE_SIZE == 128 ? TFmode : DFmode;
+  return default_mode_for_floating_type (ti);
+}
+
 #include "gt-sparc.h"
index 232ecb30ddc98ad9a303961bd31c30cc93130d52..8612832a03ecb7fef72848e365da7bebd9ea5ebf 100644 (file)
@@ -489,12 +489,11 @@ along with GCC; see the file COPYING3.  If not see
 #define INT_TYPE_SIZE          32
 #define LONG_TYPE_SIZE         (TARGET_ARCH64 ? 64 : 32)
 #define LONG_LONG_TYPE_SIZE    64
-#define FLOAT_TYPE_SIZE                32
-#define DOUBLE_TYPE_SIZE       64
 
-/* LONG_DOUBLE_TYPE_SIZE is defined per OS even though the
-   SPARC ABI says that it is 128-bit wide.  */
-/* #define LONG_DOUBLE_TYPE_SIZE       128 */
+/* SPARC_LONG_DOUBLE_TYPE_SIZE is defined per OS even though the
+   SPARC ABI says that it is 128-bit wide.  LONG_DOUBLE_TYPE_SIZE
+   get poisoned, so add SPARC_ prefix.  */
+/* #define SPARC_LONG_DOUBLE_TYPE_SIZE 128 */
 
 /* The widest floating-point format really supported by the hardware.  */
 #define WIDEST_HARDWARE_FP_SIZE 64
index 2503f234c6afec3543a6adb3bfd09975f6e988ff..3d5e21d644d97b2cbd6f641c9f644ff49fc61af3 100644 (file)
 
 #define LONG_LONG_TYPE_SIZE 64
 
-#define FLOAT_TYPE_SIZE 32
-
-#define DOUBLE_TYPE_SIZE 64
-
-#define LONG_DOUBLE_TYPE_SIZE 64
-
 #define DEFAULT_SIGNED_CHAR 0
 
 #define SIZE_TYPE "unsigned int"
index 69e25523e053e91481d9a0bba6bb1988bdd53f02..afeb68f84cc7ac23d2c05cea466e4ed3e730d8f0 100644 (file)
    it is rounded up to one unit.) */
 #define CHAR_TYPE_SIZE  8
 
-/* `FLOAT_TYPE_SIZE'
-
-   A C expression for the size in bits of the type `float' on the
-   target machine.  If you don't define this, the default is one word. */
-#define FLOAT_TYPE_SIZE  32
-
-/* `DOUBLE_TYPE_SIZE'
-
-   A C expression for the size in bits of the type `double' on the
-   target machine.  If you don't define this, the default is two
-   words. */
-#define DOUBLE_TYPE_SIZE  64
-
-/* `LONG_DOUBLE_TYPE_SIZE'
-
-   A C expression for the size in bits of the type `long double' on
-   the target machine.  If you don't define this, the default is two
-   words. */
-#define LONG_DOUBLE_TYPE_SIZE   DOUBLE_TYPE_SIZE
-
 /* `WIDEST_HARDWARE_FP_SIZE'
 
    A C expression for the size in bits of the widest floating-point
    format supported by the hardware.  If you define this macro, you
-   must specify a value less than or equal to the value of
-   `LONG_DOUBLE_TYPE_SIZE'.  If you do not define this macro, the
-   value of `LONG_DOUBLE_TYPE_SIZE' is the default. */
+   must specify a value less than or equal to mode precision of the
+   mode used for C type long double (from hook
+   targetm.c.mode_for_floating_type with tree_index
+   TI_LONG_DOUBLE_TYPE).  If you do not define this macro, mode
+   precision of the mode used for C type long double is the
+   default.  */
 
 /* `DEFAULT_SIGNED_CHAR'
 
index 094d922a6d499898ef5b941175b3de240361214d..8680234315224be5ef54e5c95eb8f6c2870149e1 100644 (file)
@@ -120,9 +120,6 @@ along with GCC; see the file COPYING3.  If not see
 #define SHORT_TYPE_SIZE 16
 #define LONG_TYPE_SIZE 32
 #define LONG_LONG_TYPE_SIZE 64
-#define FLOAT_TYPE_SIZE 32
-#define DOUBLE_TYPE_SIZE 64
-#define LONG_DOUBLE_TYPE_SIZE 64
 
 /* Allocation boundary (in *bits*) for storing pointers in memory.  */
 #define POINTER_BOUNDARY 32
index 1ac6f0abea3b70d620ad56c64a590a2f30f67f94..00c1c58bd8c1b1bec9d24d9a8a530ef63f66cea4 100644 (file)
@@ -100,6 +100,7 @@ struct gimple;
 typedef gimple *gimple_seq;
 struct gimple_stmt_iterator;
 class code_helper;
+enum tree_index : unsigned;
 
 /* Forward declare rtx_code, so that we can use it in target hooks without
    needing to pull in rtl.h.  */
index 92f3e07f742f641a4711ed9d0f16dba531450042..ac2d25852abb504f3483eb041dc4714fc41dcf49 100644 (file)
@@ -513,18 +513,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #define WCHAR_TYPE_SIZE INT_TYPE_SIZE
 #endif
 
-#ifndef FLOAT_TYPE_SIZE
-#define FLOAT_TYPE_SIZE BITS_PER_WORD
-#endif
-
-#ifndef DOUBLE_TYPE_SIZE
-#define DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
-#endif
-
-#ifndef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
-#endif
-
 #ifndef DECIMAL32_TYPE_SIZE
 #define DECIMAL32_TYPE_SIZE 32
 #endif
index 846a043bdc75b36d592be4c37c4a818b3c2c30a8..c1717ab5f6b95d72c36397131e8dcddeb58a0ab7 100644 (file)
@@ -1326,7 +1326,7 @@ whose size is @code{BITS_PER_WORD}, @code{SImode} on 32-bit machines.
 
 The only modes which a machine description @i{must} support are
 @code{QImode}, and the modes corresponding to @code{BITS_PER_WORD},
-@code{FLOAT_TYPE_SIZE} and @code{DOUBLE_TYPE_SIZE}.
+C type @code{float} and C type @code{double}.
 The compiler will attempt to use @code{DImode} for 8-byte structures and
 unions, but this can be prevented by overriding the definition of
 @code{MAX_FIXED_MODE_SIZE}.  Alternatively, you can have the compiler
index be5543b72f85f987f18ddc9fb73ff439ec18bf75..24c92e2e7336b54655f1d61a6b7d093a08847604 100644 (file)
@@ -1044,6 +1044,14 @@ are zero or sign extended depending on if it is
 @code{GET_MODE_ALIGNMENT (info->limb_mode)}.
 @end deftypefn
 
+@deftypefn {Target Hook} machine_mode TARGET_C_MODE_FOR_FLOATING_TYPE (enum tree_index @var{ti})
+Return machine mode for a C floating point type which is indicated by
+ a given @code{enum tree_index} @var{ti}, @var{ti} should be
+ @code{TI_FLOAT_TYPE}, @code{TI_DOUBLE_TYPE} or @code{TI_LONG_DOUBLE_TYPE}.
+ The default implementation returns @code{SFmode} for @code{TI_FLOAT_TYPE},
+ and @code{DFmode} for @code{TI_DOUBLE_TYPE} or @code{TI_LONG_DOUBLE_TYPE}.
+@end deftypefn
+
 @deftypefn {Target Hook} machine_mode TARGET_PROMOTE_FUNCTION_MODE (const_tree @var{type}, machine_mode @var{mode}, int *@var{punsignedp}, const_tree @var{funtype}, int @var{for_return})
 Like @code{PROMOTE_MODE}, but it is applied to outgoing function arguments or
 function return values.  The target hook should return the new mode
@@ -1610,23 +1618,6 @@ C99 type @code{_Bool} on the target machine.  If you don't define
 this, and you probably shouldn't, the default is @code{CHAR_TYPE_SIZE}.
 @end defmac
 
-@defmac FLOAT_TYPE_SIZE
-A C expression for the size in bits of the type @code{float} on the
-target machine.  If you don't define this, the default is one word.
-@end defmac
-
-@defmac DOUBLE_TYPE_SIZE
-A C expression for the size in bits of the type @code{double} on the
-target machine.  If you don't define this, the default is two
-words.
-@end defmac
-
-@defmac LONG_DOUBLE_TYPE_SIZE
-A C expression for the size in bits of the type @code{long double} on
-the target machine.  If you don't define this, the default is two
-words.
-@end defmac
-
 @defmac SHORT_FRACT_TYPE_SIZE
 A C expression for the size in bits of the type @code{short _Fract} on
 the target machine.  If you don't define this, the default is
@@ -1687,9 +1678,11 @@ the libgcc @file{config.host}.
 @defmac WIDEST_HARDWARE_FP_SIZE
 A C expression for the size in bits of the widest floating-point format
 supported by the hardware.  If you define this macro, you must specify a
-value less than or equal to the value of @code{LONG_DOUBLE_TYPE_SIZE}.
-If you do not define this macro, the value of @code{LONG_DOUBLE_TYPE_SIZE}
-is the default.
+value less than or equal to mode precision of the mode used for C type
+@code{long double} (from hook @code{targetm.c.mode_for_floating_type}
+with argument @code{TI_LONG_DOUBLE_TYPE}).  If you do not define this
+macro, mode precision of the mode used for C type @code{long double} is
+the default.
 @end defmac
 
 @defmac DEFAULT_SIGNED_CHAR
index 87a7f8951741ac016f665e31eaef081fb5808d90..24596eb2f6b4e9ea3ea3464fda171d99155f4c0f 100644 (file)
@@ -947,6 +947,8 @@ applied.
 
 @hook TARGET_C_BITINT_TYPE_INFO
 
+@hook TARGET_C_MODE_FOR_FLOATING_TYPE
+
 @hook TARGET_PROMOTE_FUNCTION_MODE
 
 @defmac PARM_BOUNDARY
@@ -1351,23 +1353,6 @@ C99 type @code{_Bool} on the target machine.  If you don't define
 this, and you probably shouldn't, the default is @code{CHAR_TYPE_SIZE}.
 @end defmac
 
-@defmac FLOAT_TYPE_SIZE
-A C expression for the size in bits of the type @code{float} on the
-target machine.  If you don't define this, the default is one word.
-@end defmac
-
-@defmac DOUBLE_TYPE_SIZE
-A C expression for the size in bits of the type @code{double} on the
-target machine.  If you don't define this, the default is two
-words.
-@end defmac
-
-@defmac LONG_DOUBLE_TYPE_SIZE
-A C expression for the size in bits of the type @code{long double} on
-the target machine.  If you don't define this, the default is two
-words.
-@end defmac
-
 @defmac SHORT_FRACT_TYPE_SIZE
 A C expression for the size in bits of the type @code{short _Fract} on
 the target machine.  If you don't define this, the default is
@@ -1428,9 +1413,11 @@ the libgcc @file{config.host}.
 @defmac WIDEST_HARDWARE_FP_SIZE
 A C expression for the size in bits of the widest floating-point format
 supported by the hardware.  If you define this macro, you must specify a
-value less than or equal to the value of @code{LONG_DOUBLE_TYPE_SIZE}.
-If you do not define this macro, the value of @code{LONG_DOUBLE_TYPE_SIZE}
-is the default.
+value less than or equal to mode precision of the mode used for C type
+@code{long double} (from hook @code{targetm.c.mode_for_floating_type}
+with argument @code{TI_LONG_DOUBLE_TYPE}).  If you do not define this
+macro, mode precision of the mode used for C type @code{long double} is
+the default.
 @end defmac
 
 @defmac DEFAULT_SIGNED_CHAR
index 1856fa4884fe6478f47fd7e29b5ecdbd5899103a..cb04aa1a8c6ba76917b465685450ad98af11dc96 100644 (file)
@@ -6366,7 +6366,8 @@ init_emit_once (void)
   else
     const_true_rtx = gen_rtx_CONST_INT (VOIDmode, STORE_FLAG_VALUE);
 
-  double_mode = float_mode_for_size (DOUBLE_TYPE_SIZE).require ();
+  mode = targetm.c.mode_for_floating_type (TI_DOUBLE_TYPE);
+  double_mode = as_a<scalar_float_mode> (mode);
 
   real_from_integer (&dconst0, double_mode, 0, SIGNED);
   real_from_integer (&dconst1, double_mode, 1, SIGNED);
index 8a1ec2d980631b1d1790edb7835e40128720dee7..5e9ef40f3b7ddbbf3263d079e0be8148ddea731a 100644 (file)
@@ -22,7 +22,7 @@ along with GCC; see the file COPYING3.  If not see
 #define INCLUDE_SSTREAM
 #include "system.h"
 #include "coretypes.h"
-#include "tm.h"
+#include "target.h"
 #include "pretty-print.h"
 #include "toplev.h"
 
@@ -2353,6 +2353,7 @@ size_t
 recording::memento_of_get_type::get_size ()
 {
   int size;
+  machine_mode m;
   switch (m_kind)
     {
     case GCC_JIT_TYPE_VOID:
@@ -2399,13 +2400,16 @@ recording::memento_of_get_type::get_size ()
       size = 128;
       break;
     case GCC_JIT_TYPE_FLOAT:
-      size = FLOAT_TYPE_SIZE;
+      m = targetm.c.mode_for_floating_type (TI_FLOAT_TYPE);
+      size = GET_MODE_PRECISION (m).to_constant ();
       break;
     case GCC_JIT_TYPE_DOUBLE:
-      size = DOUBLE_TYPE_SIZE;
+      m = targetm.c.mode_for_floating_type (TI_DOUBLE_TYPE);
+      size = GET_MODE_PRECISION (m).to_constant ();
       break;
     case GCC_JIT_TYPE_LONG_DOUBLE:
-      size = LONG_DOUBLE_TYPE_SIZE;
+      m = targetm.c.mode_for_floating_type (TI_LONG_DOUBLE_TYPE);
+      size = GET_MODE_PRECISION (m).to_constant ();
       break;
     case GCC_JIT_TYPE_SIZE_T:
       size = MAX_BITS_PER_WORD;
index 2e40817a2d706b754a16c89d616202f7a963543f..f28022769b3cb06b3542844fc17697e7a8cd7040 100644 (file)
@@ -406,9 +406,10 @@ extern const struct real_format arm_bfloat_half_format;
 #define REAL_VALUE_MINUS_ZERO(x)       real_isnegzero (&(x))
 
 /* IN is a REAL_VALUE_TYPE.  OUT is an array of longs.  */
-#define REAL_VALUE_TO_TARGET_LONG_DOUBLE(IN, OUT)                      \
-  real_to_target (OUT, &(IN),                                          \
-                 float_mode_for_size (LONG_DOUBLE_TYPE_SIZE).require ())
+#define REAL_VALUE_TO_TARGET_LONG_DOUBLE(IN, OUT)                         \
+  real_to_target (OUT, &(IN),                                             \
+                 float_mode_for_size (TYPE_PRECISION                      \
+                                      (long_double_type_node)).require ())
 
 #define REAL_VALUE_TO_TARGET_DOUBLE(IN, OUT) \
   real_to_target (OUT, &(IN), float_mode_for_size (64).require ())
index 1028dcb1eb3c741d517d6f4ef3a65d7c48a8f49b..cbb14fb167d36d1352fe5d957d8629fd25856fd2 100644 (file)
@@ -1000,7 +1000,8 @@ extern void fancy_abort (const char *, int, const char *)
        HARD_REGNO_NREGS SECONDARY_MEMORY_NEEDED_MODE                   \
        SECONDARY_MEMORY_NEEDED CANNOT_CHANGE_MODE_CLASS                \
        TRULY_NOOP_TRUNCATION FUNCTION_ARG_OFFSET CONSTANT_ALIGNMENT    \
-       STARTING_FRAME_OFFSET
+       STARTING_FRAME_OFFSET FLOAT_TYPE_SIZE DOUBLE_TYPE_SIZE          \
+       LONG_DOUBLE_TYPE_SIZE
 
 /* Target macros only used for code built for the target, that have
    moved to libgcc-tm.h or have never been present elsewhere.  */
index e5a9b52676e4b568bb38960708f6003c0d1592d3..e6f4df963f0e2ddb09b46c6cf38ca6a828e9cbe6 100644 (file)
@@ -6389,6 +6389,15 @@ are zero or sign extended depending on if it is\n\
  bool, (int n, struct bitint_info *info),
  default_bitint_type_info)
 
+DEFHOOK
+(mode_for_floating_type,
+"Return machine mode for a C floating point type which is indicated by\n\
+ a given @code{enum tree_index} @var{ti}, @var{ti} should be\n\
+ @code{TI_FLOAT_TYPE}, @code{TI_DOUBLE_TYPE} or @code{TI_LONG_DOUBLE_TYPE}.\n\
+ The default implementation returns @code{SFmode} for @code{TI_FLOAT_TYPE},\n\
+ and @code{DFmode} for @code{TI_DOUBLE_TYPE} or @code{TI_LONG_DOUBLE_TYPE}.",
+ machine_mode, (enum tree_index ti), default_mode_for_floating_type)
+
 HOOK_VECTOR_END (c)
 
 /* Functions specific to the C++ frontend.  */
index 4f53257e55c0382665dcfcc85862e364377438d6..b10104c363bf8432082d51c0ecb7e2a6811c2cc2 100644 (file)
@@ -298,6 +298,18 @@ default_mode_for_suffix (char suffix ATTRIBUTE_UNUSED)
   return VOIDmode;
 }
 
+/* Return machine mode for a floating type which is indicated
+   by the given enum tree_index.  */
+
+machine_mode
+default_mode_for_floating_type (enum tree_index ti)
+{
+  if (ti == TI_FLOAT_TYPE)
+    return SFmode;
+  gcc_assert (ti == TI_DOUBLE_TYPE || ti == TI_LONG_DOUBLE_TYPE);
+  return DFmode;
+}
+
 /* The generic C++ ABI specifies this is a 64-bit value.  */
 tree
 default_cxx_guard_type (void)
@@ -449,11 +461,11 @@ default_scalar_mode_supported_p (scalar_mode mode)
       return false;
 
     case MODE_FLOAT:
-      if (precision == FLOAT_TYPE_SIZE)
+      if (mode == targetm.c.mode_for_floating_type (TI_FLOAT_TYPE))
        return true;
-      if (precision == DOUBLE_TYPE_SIZE)
+      if (mode == targetm.c.mode_for_floating_type (TI_DOUBLE_TYPE))
        return true;
-      if (precision == LONG_DOUBLE_TYPE_SIZE)
+      if (mode == targetm.c.mode_for_floating_type (TI_LONG_DOUBLE_TYPE))
        return true;
       return false;
 
index f53913ebdfaddedebbb65d7f2750f1597df0d469..3cbca0f13a5e5de893630c45a6bbe0616b725e86 100644 (file)
@@ -290,6 +290,7 @@ extern unsigned int default_min_arithmetic_precision (void);
 extern enum flt_eval_method
 default_excess_precision (enum excess_precision_type ATTRIBUTE_UNUSED);
 extern bool default_bitint_type_info (int, struct bitint_info *);
+extern machine_mode default_mode_for_floating_type (enum tree_index);
 extern HOST_WIDE_INT default_stack_clash_protection_alloca_probe_range (void);
 extern void default_select_early_remat_modes (sbitmap);
 extern tree default_preferred_else_value (unsigned, tree, unsigned, tree *);
index bb5a1303253de837f72ba782265adb1adebfa859..27c569c77022227643151fa4a909a95f3d45bf55 100644 (file)
@@ -633,7 +633,7 @@ enum cv_qualifier {
 };
 
 /* Standard named or nameless data types of the C compiler.  */
-enum tree_index {
+enum tree_index : unsigned {
   TI_ERROR_MARK,
   TI_INTQI_TYPE,
   TI_INTHI_TYPE,
@@ -700,17 +700,18 @@ enum tree_index {
   TI_FLOAT64_TYPE,
   TI_FLOAT128_TYPE,
   TI_FLOATN_TYPE_LAST = TI_FLOAT128_TYPE,
-#define NUM_FLOATN_TYPES (TI_FLOATN_TYPE_LAST - TI_FLOATN_TYPE_FIRST + 1)
+#define NUM_FLOATN_TYPES ((int) (TI_FLOATN_TYPE_LAST           \
+                                - TI_FLOATN_TYPE_FIRST + 1))
   TI_FLOAT32X_TYPE,
   TI_FLOATNX_TYPE_FIRST = TI_FLOAT32X_TYPE,
   TI_FLOAT64X_TYPE,
   TI_FLOAT128X_TYPE,
   TI_FLOATNX_TYPE_LAST = TI_FLOAT128X_TYPE,
   TI_FLOATN_NX_TYPE_LAST = TI_FLOAT128X_TYPE,
-#define NUM_FLOATNX_TYPES (TI_FLOATNX_TYPE_LAST - TI_FLOATNX_TYPE_FIRST + 1)
-#define NUM_FLOATN_NX_TYPES (TI_FLOATN_NX_TYPE_LAST            \
-                            - TI_FLOATN_NX_TYPE_FIRST          \
-                            + 1)
+#define NUM_FLOATNX_TYPES ((int) (TI_FLOATNX_TYPE_LAST         \
+                                 - TI_FLOATNX_TYPE_FIRST + 1))
+#define NUM_FLOATN_NX_TYPES ((int) (TI_FLOATN_NX_TYPE_LAST     \
+                                 - TI_FLOATN_NX_TYPE_FIRST + 1))
 
   /* Type used by certain backends for __float128, which in C++ should be
      distinct type from _Float128 for backwards compatibility reasons.  */
index 5a31fae3125ccc180c856324db67c21b79db7a30..2d2d5b6db6ed8e312859af136bbc5c74a8da8f7e 100644 (file)
@@ -9602,15 +9602,27 @@ build_common_tree_nodes (bool signed_char)
   pointer_sized_int_node = build_nonstandard_integer_type (POINTER_SIZE, 1);
 
   float_type_node = make_node (REAL_TYPE);
-  TYPE_PRECISION (float_type_node) = FLOAT_TYPE_SIZE;
+  machine_mode float_type_mode
+    = targetm.c.mode_for_floating_type (TI_FLOAT_TYPE);
+  SET_TYPE_MODE (float_type_node, float_type_mode);
+  TYPE_PRECISION (float_type_node)
+    = GET_MODE_PRECISION (float_type_mode).to_constant ();
   layout_type (float_type_node);
 
   double_type_node = make_node (REAL_TYPE);
-  TYPE_PRECISION (double_type_node) = DOUBLE_TYPE_SIZE;
+  machine_mode double_type_mode
+    = targetm.c.mode_for_floating_type (TI_DOUBLE_TYPE);
+  SET_TYPE_MODE (double_type_node, double_type_mode);
+  TYPE_PRECISION (double_type_node)
+    = GET_MODE_PRECISION (double_type_mode).to_constant ();
   layout_type (double_type_node);
 
   long_double_type_node = make_node (REAL_TYPE);
-  TYPE_PRECISION (long_double_type_node) = LONG_DOUBLE_TYPE_SIZE;
+  machine_mode long_double_type_mode
+    = targetm.c.mode_for_floating_type (TI_LONG_DOUBLE_TYPE);
+  SET_TYPE_MODE (long_double_type_node, long_double_type_mode);
+  TYPE_PRECISION (long_double_type_node)
+    = GET_MODE_PRECISION (long_double_type_mode).to_constant ();
   layout_type (long_double_type_node);
 
   for (i = 0; i < NUM_FLOATN_NX_TYPES; i++)