Hi, according to Jeff's requirement 
(https://gcc.gnu.org/pipermail/gcc-patches/2025-April/681864.html), I divide 
the change of riscv_register_move_cost into separate patch. Please help to 
review. Thanks.


Zhijin


From b4c581393e864619192034bd8000c7e89443c19a Mon Sep 17 00:00:00 2001
From: Zhijin Zeng <zengzhi...@linux.spacemit.com&gt;
Date: Mon, 28 Apr 2025 09:24:16 +0800
Subject: [PATCH] RISC-V: Fix register move cost for SIBCALL_REGS/JALR_REGS


SIBCALL_REGS/JALR_REGS are also subset of GR_REGS and need to
be taken into acount in riscv_register_move_cost, otherwise it
will get a incorrect cost.


gcc/ChangeLog:


&nbsp; &nbsp; &nbsp; &nbsp; * config/riscv/riscv.cc (riscv_register_move_cost):
---
&nbsp;gcc/config/riscv/riscv.cc | 8 ++++----
&nbsp;1 file changed, 4 insertions(+), 4 deletions(-)


diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index bad59e248d0..c53e0dd7a7d 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -9650,10 +9650,10 @@ int
&nbsp;riscv_register_move_cost (machine_mode mode,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; reg_class_t from, reg_class_t to)
&nbsp;{
-&nbsp; bool from_is_fpr = from == FP_REGS || from == RVC_FP_REGS;
-&nbsp; bool from_is_gpr = from == GR_REGS || from == RVC_GR_REGS;
-&nbsp; bool to_is_fpr = to == FP_REGS || to == RVC_FP_REGS;
-&nbsp; bool to_is_gpr = to == GR_REGS || to == RVC_GR_REGS;
+&nbsp; bool from_is_fpr = reg_class_subset_p (from, FP_REGS);
+&nbsp; bool from_is_gpr = reg_class_subset_p (from, GR_REGS);
+&nbsp; bool to_is_fpr = reg_class_subset_p (to, FP_REGS);
+&nbsp; bool to_is_gpr = reg_class_subset_p (to, GR_REGS);
&nbsp; &nbsp;if ((from_is_fpr &amp;&amp; to_is_gpr) || (from_is_gpr &amp;&amp; 
to_is_fpr))
&nbsp; &nbsp; &nbsp;return tune_param-&gt;fmv_cost;


--
2.25.1

Reply via email to