diff options
Diffstat (limited to 'gcc/config/loongarch')
-rw-r--r-- | gcc/config/loongarch/loongarch.cc | 15 | ||||
-rw-r--r-- | gcc/config/loongarch/loongarch.h | 13 |
2 files changed, 21 insertions, 7 deletions
diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loongarch.cc index 6ec3ee6..e2ff2af 100644 --- a/gcc/config/loongarch/loongarch.cc +++ b/gcc/config/loongarch/loongarch.cc @@ -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" diff --git a/gcc/config/loongarch/loongarch.h b/gcc/config/loongarch/loongarch.h index f7fe950..b9323ab 100644 --- a/gcc/config/loongarch/loongarch.h +++ b/gcc/config/loongarch/loongarch.h @@ -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) |