* [PATCH v2 0/3] LoongArch: Cleanup unused/redundant codes.
@ 2024-03-15 1:30 Chenghui Pan
2024-03-15 1:30 ` [PATCH v2 1/3] LoongArch: Remove unused/useless definitions Chenghui Pan
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Chenghui Pan @ 2024-03-15 1:30 UTC (permalink / raw)
To: gcc-patches; +Cc: xry111, i, chenglulu, xuchenghua, Chenghui Pan
Changes from v1: Some correction about ChangeLog format.
There's some unused/redundant definitions inside LoongArch target support
codes, these patches make a simple cleanup. Regression test passed.
Chenghui Pan (3):
LoongArch: Remove unused/useless definitions.
LoongArch: Change loongarch_expand_vec_cmp()'s return type from bool
to void.
LoongArch: Combine UNITS_PER_FP_REG and UNITS_PER_FPREG macros.
gcc/config/loongarch/lasx.md | 6 ++--
gcc/config/loongarch/loongarch-protos.h | 7 +----
gcc/config/loongarch/loongarch.cc | 39 ++++---------------------
gcc/config/loongarch/loongarch.h | 7 ++---
gcc/config/loongarch/lsx.md | 6 ++--
5 files changed, 13 insertions(+), 52 deletions(-)
--
2.39.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/3] LoongArch: Remove unused/useless definitions.
2024-03-15 1:30 [PATCH v2 0/3] LoongArch: Cleanup unused/redundant codes Chenghui Pan
@ 2024-03-15 1:30 ` Chenghui Pan
2024-03-15 1:30 ` [PATCH v2 2/3] LoongArch: Change loongarch_expand_vec_cmp()'s return type from bool to void Chenghui Pan
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Chenghui Pan @ 2024-03-15 1:30 UTC (permalink / raw)
To: gcc-patches; +Cc: xry111, i, chenglulu, xuchenghua, Chenghui Pan
This patch removes some unnecessary definitions of target hook functions
according to the documentation of GCC.
gcc/ChangeLog:
* config/loongarch/loongarch-protos.h
(loongarch_cfun_has_cprestore_slot_p): Delete.
(loongarch_adjust_insn_length): Delete.
(current_section_name): Delete.
(loongarch_split_symbol_type): Delete.
* config/loongarch/loongarch.cc
(loongarch_case_values_threshold): Delete.
(loongarch_spill_class): Delete.
(TARGET_OPTAB_SUPPORTED_P): Delete.
(TARGET_CASE_VALUES_THRESHOLD): Delete.
(TARGET_SPILL_CLASS): Delete.
---
gcc/config/loongarch/loongarch-protos.h | 5 -----
gcc/config/loongarch/loongarch.cc | 26 -------------------------
2 files changed, 31 deletions(-)
diff --git a/gcc/config/loongarch/loongarch-protos.h b/gcc/config/loongarch/loongarch-protos.h
index 1fdfda9af01..871544f760c 100644
--- a/gcc/config/loongarch/loongarch-protos.h
+++ b/gcc/config/loongarch/loongarch-protos.h
@@ -93,7 +93,6 @@ extern void loongarch_split_lsx_copy_d (rtx, rtx, rtx, rtx (*)(rtx, rtx, rtx));
extern void loongarch_split_lsx_insert_d (rtx, rtx, rtx, rtx);
extern void loongarch_split_lsx_fill_d (rtx, rtx);
extern const char *loongarch_output_move (rtx, rtx);
-extern bool loongarch_cfun_has_cprestore_slot_p (void);
#ifdef RTX_CODE
extern void loongarch_expand_scc (rtx *);
extern bool loongarch_expand_vec_cmp (rtx *);
@@ -135,7 +134,6 @@ extern int loongarch_class_max_nregs (enum reg_class, machine_mode);
extern machine_mode loongarch_hard_regno_caller_save_mode (unsigned int,
unsigned int,
machine_mode);
-extern int loongarch_adjust_insn_length (rtx_insn *, int);
extern const char *loongarch_output_conditional_branch (rtx_insn *, rtx *,
const char *,
const char *);
@@ -157,7 +155,6 @@ extern bool loongarch_global_symbol_noweak_p (const_rtx);
extern bool loongarch_weak_symbol_p (const_rtx);
extern bool loongarch_symbol_binds_local_p (const_rtx);
-extern const char *current_section_name (void);
extern unsigned int current_section_flags (void);
extern bool loongarch_use_ins_ext_p (rtx, HOST_WIDE_INT, HOST_WIDE_INT);
extern bool loongarch_check_zero_div_p (void);
@@ -198,8 +195,6 @@ extern bool loongarch_epilogue_uses (unsigned int);
extern bool loongarch_load_store_bonding_p (rtx *, machine_mode, bool);
extern bool loongarch_split_symbol_type (enum loongarch_symbol_type);
-typedef rtx (*mulsidi3_gen_fn) (rtx, rtx, rtx);
-
extern void loongarch_register_frame_header_opt (void);
extern void loongarch_expand_vec_cond_expr (machine_mode, machine_mode, rtx *);
extern void loongarch_expand_vec_cond_mask_expr (machine_mode, machine_mode,
diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loongarch.cc
index 70e31bb831c..b25624c9406 100644
--- a/gcc/config/loongarch/loongarch.cc
+++ b/gcc/config/loongarch/loongarch.cc
@@ -10810,23 +10810,6 @@ loongarch_expand_vec_cmp (rtx operands[])
return true;
}
-/* Implement TARGET_CASE_VALUES_THRESHOLD. */
-
-unsigned int
-loongarch_case_values_threshold (void)
-{
- return default_case_values_threshold ();
-}
-
-/* Implement TARGET_SPILL_CLASS. */
-
-static reg_class_t
-loongarch_spill_class (reg_class_t rclass ATTRIBUTE_UNUSED,
- machine_mode mode ATTRIBUTE_UNUSED)
-{
- return NO_REGS;
-}
-
/* Implement TARGET_PROMOTE_FUNCTION_MODE. */
/* This function is equivalent to default_promote_function_mode_always_promote
@@ -11281,9 +11264,6 @@ loongarch_asm_code_end (void)
#undef TARGET_FUNCTION_ARG_BOUNDARY
#define TARGET_FUNCTION_ARG_BOUNDARY loongarch_function_arg_boundary
-#undef TARGET_OPTAB_SUPPORTED_P
-#define TARGET_OPTAB_SUPPORTED_P loongarch_optab_supported_p
-
#undef TARGET_VECTOR_MODE_SUPPORTED_P
#define TARGET_VECTOR_MODE_SUPPORTED_P loongarch_vector_mode_supported_p
@@ -11353,18 +11333,12 @@ loongarch_asm_code_end (void)
#undef TARGET_SCHED_REASSOCIATION_WIDTH
#define TARGET_SCHED_REASSOCIATION_WIDTH loongarch_sched_reassociation_width
-#undef TARGET_CASE_VALUES_THRESHOLD
-#define TARGET_CASE_VALUES_THRESHOLD loongarch_case_values_threshold
-
#undef TARGET_ATOMIC_ASSIGN_EXPAND_FENV
#define TARGET_ATOMIC_ASSIGN_EXPAND_FENV loongarch_atomic_assign_expand_fenv
#undef TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS
#define TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS true
-#undef TARGET_SPILL_CLASS
-#define TARGET_SPILL_CLASS loongarch_spill_class
-
#undef TARGET_HARD_REGNO_NREGS
#define TARGET_HARD_REGNO_NREGS loongarch_hard_regno_nregs
#undef TARGET_HARD_REGNO_MODE_OK
--
2.39.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 2/3] LoongArch: Change loongarch_expand_vec_cmp()'s return type from bool to void.
2024-03-15 1:30 [PATCH v2 0/3] LoongArch: Cleanup unused/redundant codes Chenghui Pan
2024-03-15 1:30 ` [PATCH v2 1/3] LoongArch: Remove unused/useless definitions Chenghui Pan
@ 2024-03-15 1:30 ` Chenghui Pan
2024-03-15 1:30 ` [PATCH v2 3/3] LoongArch: Combine UNITS_PER_FP_REG and UNITS_PER_FPREG macros Chenghui Pan
2024-03-20 2:29 ` [pushed][PATCH v2 0/3] LoongArch: Cleanup unused/redundant codes chenglulu
3 siblings, 0 replies; 5+ messages in thread
From: Chenghui Pan @ 2024-03-15 1:30 UTC (permalink / raw)
To: gcc-patches; +Cc: xry111, i, chenglulu, xuchenghua, Chenghui Pan
This function is always return true at the end of function implementation,
so the return value is useless.
gcc/ChangeLog:
* config/loongarch/lasx.md (vec_cmp<mode><mode256_i>): Remove checking
of loongarch_expand_vec_cmp()'s return value.
(vec_cmpu<ILASX:mode><mode256_i>): Ditto.
* config/loongarch/lsx.md (vec_cmp<mode><mode_i>): Ditto.
(vec_cmpu<ILSX:mode><mode_i>): Ditto.
* config/loongarch/loongarch-protos.h
(loongarch_expand_vec_cmp): Change loongarch_expand_vec_cmp()'s return
type from bool to void.
* config/loongarch/loongarch.cc (loongarch_expand_vec_cmp): Ditto.
---
gcc/config/loongarch/lasx.md | 6 ++----
gcc/config/loongarch/loongarch-protos.h | 2 +-
gcc/config/loongarch/loongarch.cc | 3 +--
gcc/config/loongarch/lsx.md | 6 ++----
4 files changed, 6 insertions(+), 11 deletions(-)
diff --git a/gcc/config/loongarch/lasx.md b/gcc/config/loongarch/lasx.md
index ac84db7f0ce..8d4c6b4ec35 100644
--- a/gcc/config/loongarch/lasx.md
+++ b/gcc/config/loongarch/lasx.md
@@ -1383,8 +1383,7 @@ (define_expand "vec_cmp<mode><mode256_i>"
(match_operand:LASX 3 "register_operand")]))]
"ISA_HAS_LASX"
{
- bool ok = loongarch_expand_vec_cmp (operands);
- gcc_assert (ok);
+ loongarch_expand_vec_cmp (operands);
DONE;
})
@@ -1395,8 +1394,7 @@ (define_expand "vec_cmpu<ILASX:mode><mode256_i>"
(match_operand:ILASX 3 "register_operand")]))]
"ISA_HAS_LASX"
{
- bool ok = loongarch_expand_vec_cmp (operands);
- gcc_assert (ok);
+ loongarch_expand_vec_cmp (operands);
DONE;
})
diff --git a/gcc/config/loongarch/loongarch-protos.h b/gcc/config/loongarch/loongarch-protos.h
index 871544f760c..e3ed2b912a5 100644
--- a/gcc/config/loongarch/loongarch-protos.h
+++ b/gcc/config/loongarch/loongarch-protos.h
@@ -95,7 +95,7 @@ extern void loongarch_split_lsx_fill_d (rtx, rtx);
extern const char *loongarch_output_move (rtx, rtx);
#ifdef RTX_CODE
extern void loongarch_expand_scc (rtx *);
-extern bool loongarch_expand_vec_cmp (rtx *);
+extern void loongarch_expand_vec_cmp (rtx *);
extern void loongarch_expand_conditional_branch (rtx *);
extern void loongarch_expand_conditional_move (rtx *);
extern void loongarch_expand_conditional_trap (rtx);
diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loongarch.cc
index b25624c9406..7ef04329668 100644
--- a/gcc/config/loongarch/loongarch.cc
+++ b/gcc/config/loongarch/loongarch.cc
@@ -10801,13 +10801,12 @@ loongarch_expand_vec_cond_mask_expr (machine_mode mode, machine_mode vimode,
}
/* Expand integer vector comparison */
-bool
+void
loongarch_expand_vec_cmp (rtx operands[])
{
rtx_code code = GET_CODE (operands[1]);
loongarch_expand_lsx_cmp (operands[0], code, operands[2], operands[3]);
- return true;
}
/* Implement TARGET_PROMOTE_FUNCTION_MODE. */
diff --git a/gcc/config/loongarch/lsx.md b/gcc/config/loongarch/lsx.md
index b9b94b9079c..87d3e7c5d9f 100644
--- a/gcc/config/loongarch/lsx.md
+++ b/gcc/config/loongarch/lsx.md
@@ -518,8 +518,7 @@ (define_expand "vec_cmp<mode><mode_i>"
(match_operand:LSX 3 "register_operand")]))]
"ISA_HAS_LSX"
{
- bool ok = loongarch_expand_vec_cmp (operands);
- gcc_assert (ok);
+ loongarch_expand_vec_cmp (operands);
DONE;
})
@@ -530,8 +529,7 @@ (define_expand "vec_cmpu<ILSX:mode><mode_i>"
(match_operand:ILSX 3 "register_operand")]))]
"ISA_HAS_LSX"
{
- bool ok = loongarch_expand_vec_cmp (operands);
- gcc_assert (ok);
+ loongarch_expand_vec_cmp (operands);
DONE;
})
--
2.39.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 3/3] LoongArch: Combine UNITS_PER_FP_REG and UNITS_PER_FPREG macros.
2024-03-15 1:30 [PATCH v2 0/3] LoongArch: Cleanup unused/redundant codes Chenghui Pan
2024-03-15 1:30 ` [PATCH v2 1/3] LoongArch: Remove unused/useless definitions Chenghui Pan
2024-03-15 1:30 ` [PATCH v2 2/3] LoongArch: Change loongarch_expand_vec_cmp()'s return type from bool to void Chenghui Pan
@ 2024-03-15 1:30 ` Chenghui Pan
2024-03-20 2:29 ` [pushed][PATCH v2 0/3] LoongArch: Cleanup unused/redundant codes chenglulu
3 siblings, 0 replies; 5+ messages in thread
From: Chenghui Pan @ 2024-03-15 1:30 UTC (permalink / raw)
To: gcc-patches; +Cc: xry111, i, chenglulu, xuchenghua, Chenghui Pan
These macros are completely same in definition, so we can keep the previous one
and eliminate later one.
gcc/ChangeLog:
* config/loongarch/loongarch.cc
(loongarch_hard_regno_mode_ok_uncached): Combine UNITS_PER_FP_REG and
UNITS_PER_FPREG macros.
(loongarch_hard_regno_nregs): Ditto.
(loongarch_class_max_nregs): Ditto.
(loongarch_get_separate_components): Ditto.
(loongarch_process_components): Ditto.
* config/loongarch/loongarch.h (UNITS_PER_FPREG): Ditto.
(UNITS_PER_HWFPVALUE): Ditto.
(UNITS_PER_FPVALUE): Ditto.
---
gcc/config/loongarch/loongarch.cc | 10 +++++-----
gcc/config/loongarch/loongarch.h | 7 ++-----
2 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loongarch.cc
index 7ef04329668..8f657ee1f9c 100644
--- a/gcc/config/loongarch/loongarch.cc
+++ b/gcc/config/loongarch/loongarch.cc
@@ -6770,7 +6770,7 @@ loongarch_hard_regno_mode_ok_uncached (unsigned int regno, machine_mode mode)
and TRUNC. There's no point allowing sizes smaller than a word,
because the FPU has no appropriate load/store instructions. */
if (mclass == MODE_INT)
- return size >= MIN_UNITS_PER_WORD && size <= UNITS_PER_FPREG;
+ return size >= MIN_UNITS_PER_WORD && size <= UNITS_PER_FP_REG;
}
return false;
@@ -6813,7 +6813,7 @@ loongarch_hard_regno_nregs (unsigned int regno, machine_mode mode)
if (LASX_SUPPORTED_MODE_P (mode))
return 1;
- return (GET_MODE_SIZE (mode) + UNITS_PER_FPREG - 1) / UNITS_PER_FPREG;
+ return (GET_MODE_SIZE (mode) + UNITS_PER_FP_REG - 1) / UNITS_PER_FP_REG;
}
/* All other registers are word-sized. */
@@ -6848,7 +6848,7 @@ loongarch_class_max_nregs (enum reg_class rclass, machine_mode mode)
else if (LSX_SUPPORTED_MODE_P (mode))
size = MIN (size, UNITS_PER_LSX_REG);
else
- size = MIN (size, UNITS_PER_FPREG);
+ size = MIN (size, UNITS_PER_FP_REG);
}
left &= ~reg_class_contents[FP_REGS];
}
@@ -8222,7 +8222,7 @@ loongarch_get_separate_components (void)
if (IMM12_OPERAND (offset))
bitmap_set_bit (components, regno);
- offset -= UNITS_PER_FPREG;
+ offset -= UNITS_PER_FP_REG;
}
/* Don't mess with the hard frame pointer. */
@@ -8301,7 +8301,7 @@ loongarch_process_components (sbitmap components, loongarch_save_restore_fn fn)
if (bitmap_bit_p (components, regno))
loongarch_save_restore_reg (mode, regno, offset, fn);
- offset -= UNITS_PER_FPREG;
+ offset -= UNITS_PER_FP_REG;
}
}
diff --git a/gcc/config/loongarch/loongarch.h b/gcc/config/loongarch/loongarch.h
index bf2351f0968..888a633961d 100644
--- a/gcc/config/loongarch/loongarch.h
+++ b/gcc/config/loongarch/loongarch.h
@@ -138,19 +138,16 @@ along with GCC; see the file COPYING3. If not see
/* Width of a LASX vector register in bits. */
#define BITS_PER_LASX_REG (UNITS_PER_LASX_REG * BITS_PER_UNIT)
-/* For LARCH, width of a floating point register. */
-#define UNITS_PER_FPREG (TARGET_DOUBLE_FLOAT ? 8 : 4)
-
/* The largest size of value that can be held in floating-point
registers and moved with a single instruction. */
#define UNITS_PER_HWFPVALUE \
- (TARGET_SOFT_FLOAT ? 0 : UNITS_PER_FPREG)
+ (TARGET_SOFT_FLOAT ? 0 : UNITS_PER_FP_REG)
/* The largest size of value that can be held in floating-point
registers. */
#define UNITS_PER_FPVALUE \
(TARGET_SOFT_FLOAT ? 0 \
- : TARGET_SINGLE_FLOAT ? UNITS_PER_FPREG \
+ : TARGET_SINGLE_FLOAT ? UNITS_PER_FP_REG \
: LONG_DOUBLE_TYPE_SIZE / BITS_PER_UNIT)
/* The number of bytes in a double. */
--
2.39.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [pushed][PATCH v2 0/3] LoongArch: Cleanup unused/redundant codes.
2024-03-15 1:30 [PATCH v2 0/3] LoongArch: Cleanup unused/redundant codes Chenghui Pan
` (2 preceding siblings ...)
2024-03-15 1:30 ` [PATCH v2 3/3] LoongArch: Combine UNITS_PER_FP_REG and UNITS_PER_FPREG macros Chenghui Pan
@ 2024-03-20 2:29 ` chenglulu
3 siblings, 0 replies; 5+ messages in thread
From: chenglulu @ 2024-03-20 2:29 UTC (permalink / raw)
To: Chenghui Pan, gcc-patches; +Cc: xry111, i, xuchenghua
Pushed to r14-9562...r14-9564.
在 2024/3/15 上午9:30, Chenghui Pan 写道:
> Changes from v1: Some correction about ChangeLog format.
>
> There's some unused/redundant definitions inside LoongArch target support
> codes, these patches make a simple cleanup. Regression test passed.
>
> Chenghui Pan (3):
> LoongArch: Remove unused/useless definitions.
> LoongArch: Change loongarch_expand_vec_cmp()'s return type from bool
> to void.
> LoongArch: Combine UNITS_PER_FP_REG and UNITS_PER_FPREG macros.
>
> gcc/config/loongarch/lasx.md | 6 ++--
> gcc/config/loongarch/loongarch-protos.h | 7 +----
> gcc/config/loongarch/loongarch.cc | 39 ++++---------------------
> gcc/config/loongarch/loongarch.h | 7 ++---
> gcc/config/loongarch/lsx.md | 6 ++--
> 5 files changed, 13 insertions(+), 52 deletions(-)
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-03-20 2:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-15 1:30 [PATCH v2 0/3] LoongArch: Cleanup unused/redundant codes Chenghui Pan
2024-03-15 1:30 ` [PATCH v2 1/3] LoongArch: Remove unused/useless definitions Chenghui Pan
2024-03-15 1:30 ` [PATCH v2 2/3] LoongArch: Change loongarch_expand_vec_cmp()'s return type from bool to void Chenghui Pan
2024-03-15 1:30 ` [PATCH v2 3/3] LoongArch: Combine UNITS_PER_FP_REG and UNITS_PER_FPREG macros Chenghui Pan
2024-03-20 2:29 ` [pushed][PATCH v2 0/3] LoongArch: Cleanup unused/redundant codes chenglulu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).