Commit dc549f34 by Ramana Radhakrishnan Committed by Kyrylo Tkachov

[sched-deps] Generalise usage of macro fusion to work on any two insns.

	* sched-deps.c (try_group_insn): Generalise macro fusion hook usage
	to any two insns.  Update comment.  Rename to sched_macro_fuse_insns.
	(sched_analyze_insn): Update use of try_group_insn to
	sched_macro_fuse_insns.
	* config/i386/i386.c (ix86_macro_fusion_pair_p): Reject 2nd
	arguments that are not conditional jumps.

Co-Authored-By: Kyrylo Tkachov <kyrylo.tkachov@arm.com>

From-SVN: r213551
parent bb304287
2014-07-14 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* sched-deps.c (try_group_insn): Generalise macro fusion hook usage
to any two insns. Update comment. Rename to sched_macro_fuse_insns.
(sched_analyze_insn): Update use of try_group_insn to
sched_macro_fuse_insns.
* config/i386/i386.c (ix86_macro_fusion_pair_p): Reject 2nd
arguments that are not conditional jumps.
2014-08-04 Ganesh Gopalasubramanian <Ganesh.Gopalasubramanian@amd.com> 2014-08-04 Ganesh Gopalasubramanian <Ganesh.Gopalasubramanian@amd.com>
* config/i386/driver-i386.c (host_detect_local_cpu): Handle AMD's extended * config/i386/driver-i386.c (host_detect_local_cpu): Handle AMD's extended
......
...@@ -25808,6 +25808,9 @@ ix86_macro_fusion_pair_p (rtx condgen, rtx condjmp) ...@@ -25808,6 +25808,9 @@ ix86_macro_fusion_pair_p (rtx condgen, rtx condjmp)
rtx compare_set = NULL_RTX, test_if, cond; rtx compare_set = NULL_RTX, test_if, cond;
rtx alu_set = NULL_RTX, addr = NULL_RTX; rtx alu_set = NULL_RTX, addr = NULL_RTX;
if (!any_condjump_p (condjmp))
return false;
if (get_attr_type (condgen) != TYPE_TEST if (get_attr_type (condgen) != TYPE_TEST
&& get_attr_type (condgen) != TYPE_ICMP && get_attr_type (condgen) != TYPE_ICMP
&& get_attr_type (condgen) != TYPE_INCDEC && get_attr_type (condgen) != TYPE_INCDEC
...@@ -2821,20 +2821,18 @@ sched_analyze_2 (struct deps_desc *deps, rtx x, rtx insn) ...@@ -2821,20 +2821,18 @@ sched_analyze_2 (struct deps_desc *deps, rtx x, rtx insn)
sched_deps_info->finish_rhs (); sched_deps_info->finish_rhs ();
} }
/* Try to group comparison and the following conditional jump INSN if /* Try to group two fuseable insns together to prevent scheduler
they're already adjacent. This is to prevent scheduler from scheduling from scheduling them apart. */
them apart. */
static void static void
try_group_insn (rtx insn) sched_macro_fuse_insns (rtx insn)
{ {
unsigned int condreg1, condreg2;
rtx cc_reg_1;
rtx prev; rtx prev;
if (!any_condjump_p (insn)) if (any_condjump_p (insn))
return; {
unsigned int condreg1, condreg2;
rtx cc_reg_1;
targetm.fixed_condition_code_regs (&condreg1, &condreg2); targetm.fixed_condition_code_regs (&condreg1, &condreg2);
cc_reg_1 = gen_rtx_REG (CCmode, condreg1); cc_reg_1 = gen_rtx_REG (CCmode, condreg1);
prev = prev_nonnote_nondebug_insn (insn); prev = prev_nonnote_nondebug_insn (insn);
...@@ -2842,14 +2840,23 @@ try_group_insn (rtx insn) ...@@ -2842,14 +2840,23 @@ try_group_insn (rtx insn)
|| !prev || !prev
|| !modified_in_p (cc_reg_1, prev)) || !modified_in_p (cc_reg_1, prev))
return; return;
}
else
{
rtx insn_set = single_set (insn);
/* Different microarchitectures support macro fusions for different prev = prev_nonnote_nondebug_insn (insn);
combinations of insn pairs. */ if (!prev
if (!targetm.sched.macro_fusion_pair_p || !insn_set
|| !targetm.sched.macro_fusion_pair_p (prev, insn)) || !single_set (prev)
|| !modified_in_p (SET_DEST (insn_set), prev))
return; return;
}
if (targetm.sched.macro_fusion_pair_p (prev, insn))
SCHED_GROUP_P (insn) = 1; SCHED_GROUP_P (insn) = 1;
} }
/* Analyze an INSN with pattern X to find all dependencies. */ /* Analyze an INSN with pattern X to find all dependencies. */
...@@ -2878,7 +2885,7 @@ sched_analyze_insn (struct deps_desc *deps, rtx x, rtx insn) ...@@ -2878,7 +2885,7 @@ sched_analyze_insn (struct deps_desc *deps, rtx x, rtx insn)
/* Group compare and branch insns for macro-fusion. */ /* Group compare and branch insns for macro-fusion. */
if (targetm.sched.macro_fusion_p if (targetm.sched.macro_fusion_p
&& targetm.sched.macro_fusion_p ()) && targetm.sched.macro_fusion_p ())
try_group_insn (insn); sched_macro_fuse_insns (insn);
if (may_trap_p (x)) if (may_trap_p (x))
/* Avoid moving trapping instructions across function calls that might /* Avoid moving trapping instructions across function calls that might
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment