gcc/ChangeLog:
* config/loongarch/loongarch-opts.cc (loongarch_target_option_override):
Delete opts->x_flag_pcc_struct_return.
* config/loongarch/loongarch.h (MAX_FIXED_MODE_SIZE): Set to 64 on LA32.
(DEFAULT_PCC_STRUCT_RETURN): New. If the size of struct <= 2 * GRLEN,
pass by registers if available.
(STACK_BOUNDARY): Set to 128 on LA64 and LA32.
(LARCH_STACK_ALIGN): Set to 16 on LA64 and LA32.
(TRAMPOLINE_SIZE): Set to same value on LA64 and LA32.
---
gcc/config/loongarch/loongarch-opts.cc | 4 ----
gcc/config/loongarch/loongarch.h | 16 ++++++++--------
2 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/gcc/config/loongarch/loongarch-opts.cc
b/gcc/config/loongarch/loongarch-opts.cc
index 4fdb5992467..6ee74445f82 100644
--- a/gcc/config/loongarch/loongarch-opts.cc
+++ b/gcc/config/loongarch/loongarch-opts.cc
@@ -1057,10 +1057,6 @@ loongarch_target_option_override (struct
loongarch_target *target,
if (!opts_set->x_la_addr_reg_reg_cost)
opts->x_la_addr_reg_reg_cost = loongarch_cost->addr_reg_reg_cost;
- /* other stuff */
- if (ABI_LP64_P (target->abi.base))
- opts->x_flag_pcc_struct_return = 0;
-
switch (target->cmodel)
{
case CMODEL_EXTREME:
diff --git a/gcc/config/loongarch/loongarch.h b/gcc/config/loongarch/loongarch.h
index b3fb4828057..be902bb4f6a 100644
--- a/gcc/config/loongarch/loongarch.h
+++ b/gcc/config/loongarch/loongarch.h
@@ -171,9 +171,9 @@ along with GCC; see the file COPYING3. If not see
#define LONG_ACCUM_TYPE_SIZE 64
#define LONG_LONG_ACCUM_TYPE_SIZE (TARGET_64BIT ? 128 : 64)
-/* 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 LA_LONG_DOUBLE_TYPE_SIZE
+/* An integer expression for the size in bits of the largest integer machine
+ mode that should actually be used. */
+#define MAX_FIXED_MODE_SIZE GET_MODE_BITSIZE (TARGET_64BIT ? TImode : DImode)
/* Width in bits of a pointer. */
#ifndef POINTER_SIZE
@@ -656,6 +656,8 @@ enum reg_class
#define REG_PARM_STACK_SPACE(FNDECL) 0
+#define DEFAULT_PCC_STRUCT_RETURN 0
+
/* Define this if it is the responsibility of the caller to
allocate the area reserved for arguments passed in registers.
If `ACCUMULATE_OUTGOING_ARGS' is also defined, the only effect
@@ -663,7 +665,7 @@ enum reg_class
`crtl->outgoing_args_size'. */
#define OUTGOING_REG_PARM_STACK_SPACE(FNTYPE) 1
-#define STACK_BOUNDARY (TARGET_ABI_LP64 ? 128 : 64)
+#define STACK_BOUNDARY 128
/* This value controls how many pages we manually unroll the loop for when
generating stack clash probes. */
@@ -750,8 +752,7 @@ typedef struct {
/* Treat LOC as a byte offset from the stack pointer and round it up
to the next fully-aligned offset. */
-#define LARCH_STACK_ALIGN(LOC) \
- (TARGET_ABI_LP64 ? ROUND_UP ((LOC), 16) : ROUND_UP ((LOC), 8))
+#define LARCH_STACK_ALIGN(LOC) ROUND_UP ((LOC), 16)
#define MCOUNT_NAME "_mcount"
@@ -781,8 +782,7 @@ typedef struct {
#define TRAMPOLINE_CODE_SIZE 16
#define TRAMPOLINE_SIZE \
- ((Pmode == SImode) ? TRAMPOLINE_CODE_SIZE \
- : (TRAMPOLINE_CODE_SIZE + POINTER_SIZE * 2))
+ (TRAMPOLINE_CODE_SIZE + GET_MODE_SIZE (ptr_mode) * 2)
#define TRAMPOLINE_ALIGNMENT POINTER_SIZE
/* loongarch_trampoline_init calls this library function to flush
--
2.34.1