public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] RISC-V: Handle no_insn in TARGET_SCHED_VARIABLE_ISSUE.
@ 2023-05-29 11:01 Jin Ma
  2023-05-29 12:46 ` Jeff Law
  0 siblings, 1 reply; 11+ messages in thread
From: Jin Ma @ 2023-05-29 11:01 UTC (permalink / raw)
  To: gcc-patches
  Cc: jeffreyalaw, richard.sandiford, kito.cheng, christoph.muellner,
	jinma.contrib, Jin Ma

Reference: https://github.com/gcc-mirror/gcc/commit/d0bc0cb66bcb0e6a5a5a31a9e900e8ccc98e34e5

RISC-V should also be implemented to handle no_insn patterns for pipelining.

gcc/ChangeLog:

	* config/riscv/riscv.cc (riscv_sched_variable_issue): New function.
	(TARGET_SCHED_VARIABLE_ISSUE): New macro.
---
 gcc/config/riscv/riscv.cc | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index 3954fc07a8b..559fa9cd7e0 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -6225,6 +6225,24 @@ riscv_issue_rate (void)
   return tune_param->issue_rate;
 }
 
+/* Implement TARGET_SCHED_VARIABLE_ISSUE.  */
+
+static int
+riscv_sched_variable_issue (FILE *, int, rtx_insn *insn, int more)
+{
+  if (DEBUG_INSN_P (insn))
+    return more;
+
+  rtx_code code = GET_CODE (PATTERN (insn));
+  if (code == USE || code == CLOBBER)
+    return more;
+
+  if (get_attr_type (insn) == TYPE_UNKNOWN)
+    return more;
+
+  return more - 1;
+}
+
 /* Auxiliary function to emit RISC-V ELF attribute. */
 static void
 riscv_emit_attribute ()
@@ -7671,6 +7689,9 @@ riscv_vectorize_related_mode (machine_mode vector_mode, scalar_mode element_mode
 #undef TARGET_SCHED_ISSUE_RATE
 #define TARGET_SCHED_ISSUE_RATE riscv_issue_rate
 
+#undef  TARGET_SCHED_VARIABLE_ISSUE
+#define TARGET_SCHED_VARIABLE_ISSUE riscv_sched_variable_issue
+
 #undef TARGET_FUNCTION_OK_FOR_SIBCALL
 #define TARGET_FUNCTION_OK_FOR_SIBCALL riscv_function_ok_for_sibcall
 
-- 
2.17.1


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

end of thread, other threads:[~2023-08-14 22:06 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-29 11:01 [PATCH] RISC-V: Handle no_insn in TARGET_SCHED_VARIABLE_ISSUE Jin Ma
2023-05-29 12:46 ` Jeff Law
2023-08-09 19:56   ` Jeff Law
2023-08-11  2:12     ` Jin Ma
2023-08-11  2:30       ` Palmer Dabbelt
2023-08-11  3:19         ` Jeff Law
2023-08-11  3:45           ` Palmer Dabbelt
2023-08-11 13:29             ` Jeff Law
2023-08-14 20:33               ` Edwin Lu
2023-08-14 22:06                 ` Jeff Law
2023-08-11 13:22       ` Jeff Law

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