public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] RISC-V: Optimal RVV epilogue logic.
@ 2022-11-14 16:29 jiawei
  2022-11-15  1:48 ` Kito Cheng
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: jiawei @ 2022-11-14 16:29 UTC (permalink / raw)
  To: gcc-patches
  Cc: kito.cheng, palmer, juzhe.zhong, christoph.muellner,
	philipp.tomsich, wuwei2016, jiawei

Skip add insn generate if the adjust size equal to zero.

gcc/ChangeLog:

        * config/riscv/riscv.cc (riscv_expand_epilogue): 
				New if control segement.

---
 gcc/config/riscv/riscv.cc | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index 02a01ca0b7c..af138db7545 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -5186,24 +5186,26 @@ riscv_expand_epilogue (int style)
 	}
 
       /* Get an rtx for STEP1 that we can add to BASE.  */
-      rtx adjust = GEN_INT (step1.to_constant ());
-      if (!SMALL_OPERAND (step1.to_constant ()))
+      if (step1.to_constant () != 0){
+        rtx adjust = GEN_INT (step1.to_constant ());
+        if (!SMALL_OPERAND (step1.to_constant ()))
 	{
 	  riscv_emit_move (RISCV_PROLOGUE_TEMP (Pmode), adjust);
 	  adjust = RISCV_PROLOGUE_TEMP (Pmode);
 	}
 
-      insn = emit_insn (
+        insn = emit_insn (
 	       gen_add3_insn (stack_pointer_rtx, stack_pointer_rtx, adjust));
 
-      rtx dwarf = NULL_RTX;
-      rtx cfa_adjust_rtx = gen_rtx_PLUS (Pmode, stack_pointer_rtx,
+        rtx dwarf = NULL_RTX;
+        rtx cfa_adjust_rtx = gen_rtx_PLUS (Pmode, stack_pointer_rtx,
 					 GEN_INT (step2));
 
-      dwarf = alloc_reg_note (REG_CFA_DEF_CFA, cfa_adjust_rtx, dwarf);
-      RTX_FRAME_RELATED_P (insn) = 1;
+        dwarf = alloc_reg_note (REG_CFA_DEF_CFA, cfa_adjust_rtx, dwarf);
+        RTX_FRAME_RELATED_P (insn) = 1;
 
-      REG_NOTES (insn) = dwarf;
+        REG_NOTES (insn) = dwarf;
+      }
     }
   else if (frame_pointer_needed)
     {
-- 
2.25.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-11-15 10:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-14 16:29 [PATCH] RISC-V: Optimal RVV epilogue logic jiawei
2022-11-15  1:48 ` Kito Cheng
2022-11-15  2:37   ` jiawei
2022-11-15  2:46     ` juzhe.zhong
2022-11-15  3:13       ` Kito Cheng
2022-11-15  3:42         ` Jeff Law
2022-11-15  3:30 ` Jeff Law
2022-11-15 10:35 ` Philipp Tomsich

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).