@@ -519,7 +519,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
esize = UI_To_Int (Esize (gnat_entity));
if (IN (kind, Float_Kind))
- max_esize = fp_prec_to_size (LONG_DOUBLE_TYPE_SIZE);
+ max_esize
+ = fp_prec_to_size (TYPE_PRECISION (long_double_type_node));
else if (IN (kind, Access_Kind))
max_esize = POINTER_SIZE * 2;
else
@@ -28413,6 +28413,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. */
@@ -30540,6 +30552,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
@@ -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
@@ -9916,7 +9916,19 @@ alpha_can_change_mode_class (machine_mode from, machine_mode to,
return (GET_MODE_SIZE (from) == GET_MODE_SIZE (to)
|| !reg_classes_intersect_p (FLOAT_REGS, rclass));
}
-
+
+/* Implement TARGET_C_MODE_FOR_FLOATING_TYPE. Return TFmode or DFmode
+ for TI_LONG_DOUBLE_TYPE which is for long double type, go with the
+ default one for the others. */
+
+static machine_mode
+alpha_c_mode_for_floating_type (enum tree_index ti)
+{
+ if (ti == TI_LONG_DOUBLE_TYPE)
+ return TARGET_LONG_DOUBLE_128 ? TFmode : DFmode;
+ return default_mode_for_floating_type (ti);
+}
+
/* Initialize the GCC target structure. */
#if TARGET_ABI_OPEN_VMS
# undef TARGET_ATTRIBUTE_TABLE
@@ -10123,6 +10135,9 @@ alpha_can_change_mode_class (machine_mode from, machine_mode to,
#undef TARGET_CAN_CHANGE_MODE_CLASS
#define TARGET_CAN_CHANGE_MODE_CLASS alpha_can_change_mode_class
+#undef TARGET_C_MODE_FOR_FLOATING_TYPE
+#define TARGET_C_MODE_FOR_FLOATING_TYPE alpha_c_mode_for_floating_type
+
struct gcc_target targetm = TARGET_INITIALIZER;
@@ -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
@@ -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
@@ -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;
@@ -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
@@ -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"
@@ -3620,7 +3620,7 @@ darwin_patch_builtin (enum built_in_function fncode)
void
darwin_patch_builtins (void)
{
- if (LONG_DOUBLE_TYPE_SIZE != 128)
+ if (TYPE_PRECISION (long_double_type_node) != 128)
return;
#define PATCH_BUILTIN(fncode) darwin_patch_builtin (fncode);
@@ -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
@@ -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
@@ -366,9 +366,6 @@
#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
@@ -53,10 +53,6 @@
#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
@@ -111,9 +111,6 @@
#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
@@ -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_SIZE == 32 ? SFmode : DFmode;
+ 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;
@@ -25800,6 +25800,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)
@@ -26425,6 +26438,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
@@ -677,10 +677,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
@@ -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
@@ -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
@@ -112,9 +112,6 @@
#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
@@ -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"
@@ -10946,6 +10946,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)
{
@@ -11256,6 +11268,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"
@@ -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
@@ -279,9 +279,6 @@
#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
@@ -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);
/* 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_SIZE == 64 ? DFmode : XFmode;
+ return default_mode_for_floating_type (ti);
+}
+
#include "gt-m68k.h"
@@ -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
@@ -22982,6 +22982,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 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)
@@ -23352,6 +23364,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;
@@ -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
@@ -55,10 +55,6 @@
#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
@@ -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
@@ -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"
@@ -100,9 +100,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 DOUBLE_TYPE_SIZE
#undef SIZE_TYPE
#define SIZE_TYPE "unsigned int"
@@ -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
@@ -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
@@ -34,6 +34,7 @@ along with GCC; see the file COPYING3. If not see
#define SIZE_TYPE "unsigned int"
#define PTRDIFF_TYPE "int"
+#undef LONG_DOUBLE_TYPE_SIZE
#define LONG_DOUBLE_TYPE_SIZE 128
#define FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE, COMPARISON) ((MODE) == TFmode)
@@ -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
@@ -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 LONG_DOUBLE_TYPE_SIZE == 64 ? DFmode : TFmode;
+ return default_mode_for_floating_type (ti);
+}
+
/* Target hook for function_section. */
static section *
@@ -1306,3 +1306,8 @@ 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 defaults.h doesn't define them any more. */
+#define FLOAT_TYPE_SIZE BITS_PER_WORD
+#define DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
+#define LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
@@ -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???? */
@@ -107,9 +107,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 DOUBLE_TYPE_SIZE
#undef SIZE_TYPE
#define SIZE_TYPE "unsigned int"
@@ -11281,6 +11281,18 @@ riscv_get_raw_result_mode (int regno)
return default_get_reg_raw_mode (regno);
}
+/* 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"
@@ -11636,6 +11648,9 @@ riscv_get_raw_result_mode (int regno)
#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"
@@ -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
@@ -4971,6 +4971,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);
+}
+
/* The strub runtime uses asms, and physical register allocation won't
deal with them, so disable it. */
@@ -113,10 +113,6 @@
#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
@@ -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
@@ -24364,6 +24367,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)
@@ -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
@@ -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"
@@ -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. */
@@ -18037,6 +18037,18 @@ s390_vectorize_vec_perm_const (machine_mode vmode, machine_mode op_mode,
return vectorize_vec_perm_const_1 (d);
}
+/* 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
@@ -18350,6 +18362,9 @@ s390_vectorize_vec_perm_const (machine_mode vmode, machine_mode op_mode,
#undef TARGET_VECTORIZE_VEC_PERM_CONST
#define TARGET_VECTORIZE_VEC_PERM_CONST s390_vectorize_vec_perm_const
+#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"
@@ -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
@@ -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);
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;
@@ -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
@@ -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
@@ -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);
#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,14 +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
@@ -13984,4 +13980,16 @@ 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 which is for long double type, go with the
+ default one for the others. */
+
+static machine_mode
+sparc_c_mode_for_floating_type (enum tree_index ti)
+{
+ if (ti == TI_LONG_DOUBLE_TYPE)
+ return LONG_DOUBLE_TYPE_SIZE == 128 ? TFmode : DFmode;
+ return default_mode_for_floating_type (ti);
+}
+
#include "gt-sparc.h"
@@ -101,12 +101,6 @@
#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"
@@ -330,33 +330,16 @@
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'
@@ -141,6 +141,7 @@ vms_patch_builtins (void)
if (builtin_decl_implicit_p (BUILT_IN_FWRITE_UNLOCKED))
set_builtin_decl_implicit_p (BUILT_IN_FWRITE_UNLOCKED, false);
+ unsigned long_double_type_size = TYPE_PRECISION (long_double_type_node);
/* Define aliases for names. */
for (i = 0; i < NBR_CRTL_NAMES; i++)
{
@@ -179,7 +180,7 @@ vms_patch_builtins (void)
vms_add_crtl_xlat (alt, nlen + 1, res, rlen);
/* Long double version. */
- res[rlen - 1] = (LONG_DOUBLE_TYPE_SIZE == 128 ? 'X' : 'T');
+ res[rlen - 1] = (long_double_type_size == 128 ? 'X' : 'T');
alt[nlen] = 'l';
vms_add_crtl_xlat (alt, nlen + 1, res, rlen);
@@ -223,7 +224,7 @@ vms_patch_builtins (void)
if (n->flags & VMS_CRTL_FLOAT64)
res[rlen++] = 't';
- if ((n->flags & VMS_CRTL_FLOAT128) && LONG_DOUBLE_TYPE_SIZE == 128)
+ if ((n->flags & VMS_CRTL_FLOAT128) && long_double_type_size == 128)
res[rlen++] = 'x';
memcpy (res + rlen, n->name, nlen);
@@ -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
@@ -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. */
@@ -163,7 +163,8 @@ Target::_init (const Param &)
this->c.intsize = (INT_TYPE_SIZE / BITS_PER_UNIT);
this->c.longsize = (LONG_TYPE_SIZE / BITS_PER_UNIT);
this->c.long_longsize = (LONG_LONG_TYPE_SIZE / BITS_PER_UNIT);
- this->c.long_doublesize = (LONG_DOUBLE_TYPE_SIZE / BITS_PER_UNIT);
+ this->c.long_doublesize
+ = (TYPE_PRECISION (long_double_type_node) / BITS_PER_UNIT);
this->c.wchar_tsize = (WCHAR_TYPE_SIZE / BITS_PER_UNIT);
this->c.bitFieldStyle = targetm.ms_bitfield_layout_p (unknown_type_node)
@@ -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
@@ -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 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
@@ -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 tree_index 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
@@ -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 tree_index 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
@@ -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);
@@ -395,7 +395,8 @@ build_round_expr (tree arg, tree restype)
don't have an appropriate function that converts directly to the integer
type (such as kind == 16), just use ROUND, and then convert the result to
an integer. We might also need to convert the result afterwards. */
- if (resprec <= INT_TYPE_SIZE && argprec <= LONG_DOUBLE_TYPE_SIZE)
+ if (resprec <= INT_TYPE_SIZE
+ && argprec <= TYPE_PRECISION (long_double_type_node))
fn = builtin_decl_for_precision (BUILT_IN_IROUND, argprec);
else if (resprec <= LONG_TYPE_SIZE)
fn = builtin_decl_for_precision (BUILT_IN_LROUND, argprec);
@@ -873,13 +873,15 @@ gfc_build_real_type (gfc_real_info *info)
int mode_precision = info->mode_precision;
tree new_type;
- if (mode_precision == FLOAT_TYPE_SIZE)
+ if (mode_precision == TYPE_PRECISION (float_type_node))
info->c_float = 1;
- if (mode_precision == DOUBLE_TYPE_SIZE)
+ if (mode_precision == TYPE_PRECISION (double_type_node))
info->c_double = 1;
- if (mode_precision == LONG_DOUBLE_TYPE_SIZE && !info->c_float128)
+ if (mode_precision == TYPE_PRECISION (long_double_type_node)
+ && !info->c_float128)
info->c_long_double = 1;
- if (mode_precision != LONG_DOUBLE_TYPE_SIZE && mode_precision == 128)
+ if (mode_precision != TYPE_PRECISION (long_double_type_node)
+ && mode_precision == 128)
{
/* TODO: see PR101835. */
info->c_float128 = 1;
@@ -993,11 +993,11 @@ Btype*
Gcc_backend::float_type(int bits)
{
tree type;
- if (bits == FLOAT_TYPE_SIZE)
+ if (bits == TYPE_PRECISION (float_type_node))
type = float_type_node;
- else if (bits == DOUBLE_TYPE_SIZE)
+ else if (bits == TYPE_PRECISION (double_type_node))
type = double_type_node;
- else if (bits == LONG_DOUBLE_TYPE_SIZE)
+ else if (bits == TYPE_PRECISION (long_double_type_node))
type = long_double_type_node;
else
{
@@ -1014,11 +1014,11 @@ Btype*
Gcc_backend::complex_type(int bits)
{
tree type;
- if (bits == FLOAT_TYPE_SIZE * 2)
+ if (bits == TYPE_PRECISION (float_type_node) * 2)
type = complex_float_type_node;
- else if (bits == DOUBLE_TYPE_SIZE * 2)
+ else if (bits == TYPE_PRECISION (double_type_node) * 2)
type = complex_double_type_node;
- else if (bits == LONG_DOUBLE_TYPE_SIZE * 2)
+ else if (bits == TYPE_PRECISION (long_double_type_node) * 2)
type = complex_long_double_type_node;
else
{
@@ -21,7 +21,7 @@ along with GCC; see the file COPYING3. If not see
#include "config.h"
#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;
@@ -1420,7 +1420,7 @@ build_m2_short_real_node (void)
/* Define `REAL'. */
c = make_node (REAL_TYPE);
- TYPE_PRECISION (c) = FLOAT_TYPE_SIZE;
+ TYPE_PRECISION (c) = TYPE_PRECISION (float_type_node);
layout_type (c);
return c;
}
@@ -1433,7 +1433,7 @@ build_m2_real_node (void)
/* Define `REAL'. */
c = make_node (REAL_TYPE);
- TYPE_PRECISION (c) = DOUBLE_TYPE_SIZE;
+ TYPE_PRECISION (c) = TYPE_PRECISION (double_type_node);
layout_type (c);
return c;
}
@@ -1447,7 +1447,7 @@ build_m2_long_real_node (void)
if (M2Options_GetIBMLongDouble ())
{
longreal = make_node (REAL_TYPE);
- TYPE_PRECISION (longreal) = LONG_DOUBLE_TYPE_SIZE;
+ TYPE_PRECISION (longreal) = TYPE_PRECISION (long_double_type_node);
}
else if (M2Options_GetIEEELongDouble ())
longreal = float128_type_node;
@@ -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 ())
@@ -411,11 +411,11 @@ tree
float_type (int bits)
{
tree type;
- if (bits == FLOAT_TYPE_SIZE)
+ if (bits == TYPE_PRECISION (float_type_node))
type = float_type_node;
- else if (bits == DOUBLE_TYPE_SIZE)
+ else if (bits == TYPE_PRECISION (double_type_node))
type = double_type_node;
- else if (bits == LONG_DOUBLE_TYPE_SIZE)
+ else if (bits == TYPE_PRECISION (long_double_type_node))
type = long_double_type_node;
else
{
@@ -6370,6 +6370,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. */
@@ -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;
@@ -289,6 +289,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 *);
@@ -624,7 +624,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,
@@ -691,17 +691,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. */
@@ -9596,15 +9596,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++)