public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Add bypass_p cost check in flag_sched_last_insn_heuristic
       [not found] <jiejie_rong@c-sky.com@Add_bypass_p_cost_check_in_flag_sched_last_insn_heuristic>
@ 2020-11-05  8:24 ` Jojo R
  2020-11-06  2:10 ` [PATCH v2] " Jojo R
  1 sibling, 0 replies; 5+ messages in thread
From: Jojo R @ 2020-11-05  8:24 UTC (permalink / raw)
  To: jiejie_rong, gcc-patches, wilson, gnu, law, vmakarov, yunhai.syh

	gcc/
	* haifa-sched.c (rank_for_schedule): Add bypass_p
	cost check in flag_sched_last_insn_heuristic.

---
 gcc/haifa-sched.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index 62d1816a55d..7d826483f55 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -2780,10 +2780,14 @@ rank_for_schedule (const void *x, const void *y)
          1) Data dependent on last schedule insn.
          2) Anti/Output dependent on last scheduled insn.
          3) Independent of last scheduled insn, or has latency of one.
+         4) bypass of last scheduled insn, and has latency of zero.
          Choose the insn from the highest numbered class if different.  */
       dep1 = sd_find_dep_between (last, tmp, true);
 
-      if (dep1 == NULL || dep_cost (dep1) == 1)
+      if (dep1 == NULL || dep_cost (dep1) == 1
+	  || (INSN_CODE (DEP_PRO (dep1)) >= 0 && bypass_p (DEP_PRO (dep1))
+	      && recog_memoized (DEP_CON (dep1)) >= 0
+	      && !insn_latency (DEP_PRO (dep1), DEP_CON (dep1))))
 	tmp_class = 3;
       else if (/* Data dependence.  */
 	       DEP_TYPE (dep1) == REG_DEP_TRUE)
@@ -2793,7 +2797,10 @@ rank_for_schedule (const void *x, const void *y)
 
       dep2 = sd_find_dep_between (last, tmp2, true);
 
-      if (dep2 == NULL || dep_cost (dep2)  == 1)
+      if (dep2 == NULL || dep_cost (dep2)  == 1
+	  || (INSN_CODE (DEP_PRO (dep2)) >= 0 && bypass_p (DEP_PRO (dep2))
+	      && recog_memoized (DEP_CON (dep2)) >= 0
+	      && !insn_latency (DEP_PRO (dep2), DEP_CON (dep2))))
 	tmp2_class = 3;
       else if (/* Data dependence.  */
 	       DEP_TYPE (dep2) == REG_DEP_TRUE)
-- 
2.24.3 (Apple Git-128)


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

* [PATCH v2] Add bypass_p cost check in flag_sched_last_insn_heuristic
       [not found] <jiejie_rong@c-sky.com@Add_bypass_p_cost_check_in_flag_sched_last_insn_heuristic>
  2020-11-05  8:24 ` [PATCH] Add bypass_p cost check in flag_sched_last_insn_heuristic Jojo R
@ 2020-11-06  2:10 ` Jojo R
  2020-11-06  2:52   ` Jim Wilson
  1 sibling, 1 reply; 5+ messages in thread
From: Jojo R @ 2020-11-06  2:10 UTC (permalink / raw)
  To: jiejie_rong, gcc-patches, wilson, gnu, law, vmakarov, yunhai.syh

	gcc/
	* haifa-sched.c (rank_for_schedule): Add bypass_p
	cost check in flag_sched_last_insn_heuristic.

---
 gcc/haifa-sched.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index 62d1816a55d..adf63659d15 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -2780,10 +2780,14 @@ rank_for_schedule (const void *x, const void *y)
          1) Data dependent on last schedule insn.
          2) Anti/Output dependent on last scheduled insn.
          3) Independent of last scheduled insn, or has latency of one.
+         4) bypass of last scheduled insn, and has latency of zero.
          Choose the insn from the highest numbered class if different.  */
       dep1 = sd_find_dep_between (last, tmp, true);
 
-      if (dep1 == NULL || dep_cost (dep1) == 1)
+      if (dep1 == NULL || dep_cost (dep1) == 1
+	  || (INSN_CODE (DEP_PRO (dep1)) >= 0 && bypass_p (DEP_PRO (dep1))
+	      && recog_memoized (DEP_CON (dep1)) >= 0
+	      && !dep_cost (dep1)))
 	tmp_class = 3;
       else if (/* Data dependence.  */
 	       DEP_TYPE (dep1) == REG_DEP_TRUE)
@@ -2793,7 +2797,10 @@ rank_for_schedule (const void *x, const void *y)
 
       dep2 = sd_find_dep_between (last, tmp2, true);
 
-      if (dep2 == NULL || dep_cost (dep2)  == 1)
+      if (dep2 == NULL || dep_cost (dep2)  == 1
+	  || (INSN_CODE (DEP_PRO (dep2)) >= 0 && bypass_p (DEP_PRO (dep2))
+	      && recog_memoized (DEP_CON (dep2)) >= 0
+	      && !dep_cost (dep2)))
 	tmp2_class = 3;
       else if (/* Data dependence.  */
 	       DEP_TYPE (dep2) == REG_DEP_TRUE)
-- 
2.24.3 (Apple Git-128)


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

* Re: [PATCH v2] Add bypass_p cost check in flag_sched_last_insn_heuristic
  2020-11-06  2:10 ` [PATCH v2] " Jojo R
@ 2020-11-06  2:52   ` Jim Wilson
  2020-11-06  3:18     ` Jeff Law
  0 siblings, 1 reply; 5+ messages in thread
From: Jim Wilson @ 2020-11-06  2:52 UTC (permalink / raw)
  To: Jojo R
  Cc: GCC Patches, Jim Wilson, gnu, Jeff Law, vmakarov,
	尚云海

On Thu, Nov 5, 2020 at 6:10 PM Jojo R <jiejie_rong@c-sky.com> wrote:

>         gcc/
>         * haifa-sched.c (rank_for_schedule): Add bypass_p
>         cost check in flag_sched_last_insn_heuristic.
>
> +         || (INSN_CODE (DEP_PRO (dep1)) >= 0 && bypass_p (DEP_PRO (dep1))
> +             && recog_memoized (DEP_CON (dep1)) >= 0
> +             && !dep_cost (dep1)))
>

This is using the same idiom at the previous patch.  Do the two patches
depend on each other?  It isn't clear.  Since this idiom is used 3 times
across the 2 patches, maybe it should be a macro or an inline function.

As with the other patch, some explanation would be nice, and some testing
on multiple targets too.

Jim

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

* Re: [PATCH v2] Add bypass_p cost check in flag_sched_last_insn_heuristic
  2020-11-06  2:52   ` Jim Wilson
@ 2020-11-06  3:18     ` Jeff Law
  2020-11-06  9:39       ` Jojo R
  0 siblings, 1 reply; 5+ messages in thread
From: Jeff Law @ 2020-11-06  3:18 UTC (permalink / raw)
  To: Jim Wilson, Jojo R
  Cc: GCC Patches, Jim Wilson, gnu, vmakarov, 尚云海


On 11/5/20 7:52 PM, Jim Wilson wrote:
> On Thu, Nov 5, 2020 at 6:10 PM Jojo R <jiejie_rong@c-sky.com
> <mailto:jiejie_rong@c-sky.com>> wrote:
>
>             gcc/
>             * haifa-sched.c (rank_for_schedule): Add bypass_p
>             cost check in flag_sched_last_insn_heuristic.
>
>     +         || (INSN_CODE (DEP_PRO (dep1)) >= 0 && bypass_p (DEP_PRO
>     (dep1))
>     +             && recog_memoized (DEP_CON (dep1)) >= 0
>     +             && !dep_cost (dep1)))
>
>
> This is using the same idiom at the previous patch.  Do the two
> patches depend on each other?  It isn't clear.  Since this idiom is
> used 3 times across the 2 patches, maybe it should be a macro or an
> inline function.

FWIW, I'd just let the inliner make the decision.


>
> As with the other patch, some explanation would be nice, and some
> testing on multiple targets too.

Agreed.

jeff


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

* Re: [PATCH v2] Add bypass_p cost check in flag_sched_last_insn_heuristic
  2020-11-06  3:18     ` Jeff Law
@ 2020-11-06  9:39       ` Jojo R
  0 siblings, 0 replies; 5+ messages in thread
From: Jojo R @ 2020-11-06  9:39 UTC (permalink / raw)
  To: Jim Wilson, Jeff Law
  Cc: GCC Patches, Jim Wilson, gnu, vmakarov, 尚云海


Jojo
在 2020年11月6日 +0800 AM11:18,Jeff Law <law@redhat.com>,写道:

On 11/5/20 7:52 PM, Jim Wilson wrote:
	On Thu, Nov 5, 2020 at 6:10 PM Jojo R <jiejie_rong@c-sky.com> wrote:
> >         gcc/
> >         * haifa-sched.c (rank_for_schedule): Add bypass_p
> >         cost check in flag_sched_last_insn_heuristic.
> >
> > +         || (INSN_CODE (DEP_PRO (dep1)) >= 0 && bypass_p (DEP_PRO (dep1))
> > +             && recog_memoized (DEP_CON (dep1)) >= 0
> > +             && !dep_cost (dep1)))
>
> This is using the same idiom at the previous patch.  Do the two patches depend on each other?  It isn't clear.  Since this idiom is used 3 times across the 2 patches, maybe it should be a macro or an inline function.
FWIW, I'd just let the inliner make the decision.

	>
> As with the other patch, some explanation would be nice, and some testing on multiple targets too.
Agreed.
Ok & Thanks,

It’s fixed in patch v3.
	jeff


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

end of thread, other threads:[~2020-11-06  9:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <jiejie_rong@c-sky.com@Add_bypass_p_cost_check_in_flag_sched_last_insn_heuristic>
2020-11-05  8:24 ` [PATCH] Add bypass_p cost check in flag_sched_last_insn_heuristic Jojo R
2020-11-06  2:10 ` [PATCH v2] " Jojo R
2020-11-06  2:52   ` Jim Wilson
2020-11-06  3:18     ` Jeff Law
2020-11-06  9:39       ` Jojo R

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