Skip to content

Commit 9e7d3cc

Browse files
artemiy-volkovMichielDerhaeg
authored andcommitted
arcv: adjust scheduling priority of memop pairs for RHX-100
This patch implements riscv_sched_adjust_priority () for the RHX-100 microarchitecture by slightly bumping the priority of load/store pairs. As a consequence of this change, it becomes easier for riscv_sched_reorder2 () to schedule instructions in the memory pipe. Signed-off-by: Artemiy Volkov <artemiy@synopsys.com>
1 parent 19f2bee commit 9e7d3cc

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

gcc/config/riscv/riscv.cc

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12147,6 +12147,31 @@ riscv_sched_can_speculate_insn (rtx_insn *insn)
1214712147
}
1214812148
}
1214912149

12150+
static int
12151+
riscv_sched_adjust_priority (rtx_insn *insn, int priority)
12152+
{
12153+
if (!riscv_is_micro_arch (arcv_rhx100))
12154+
return priority;
12155+
12156+
if (DEBUG_INSN_P (insn) || GET_CODE (PATTERN (insn)) == USE
12157+
|| GET_CODE (PATTERN (insn)) == CLOBBER)
12158+
return priority;
12159+
12160+
/* Bump the priority of fused load-store pairs for easier
12161+
scheduling of the memory pipe. The specific increase
12162+
value is determined empirically. */
12163+
if (next_insn (insn) && INSN_P (next_insn (insn))
12164+
&& SCHED_GROUP_P (next_insn (insn))
12165+
&& ((get_attr_type (insn) == TYPE_STORE
12166+
&& get_attr_type (next_insn (insn)) == TYPE_STORE)
12167+
|| (get_attr_type (insn) == TYPE_LOAD
12168+
&& get_attr_type (next_insn (insn)) == TYPE_LOAD)))
12169+
return priority + 1;
12170+
12171+
return priority;
12172+
}
12173+
12174+
1215012175
static void
1215112176
riscv_sched_init (FILE *file ATTRIBUTE_UNUSED,
1215212177
int verbose ATTRIBUTE_UNUSED,
@@ -16896,10 +16921,12 @@ riscv_prefetch_offset_address_p (rtx x, machine_mode mode)
1689616921
#undef TARGET_SCHED_ADJUST_COST
1689716922
#define TARGET_SCHED_ADJUST_COST riscv_sched_adjust_cost
1689816923

16899-
1690016924
#undef TARGET_SCHED_CAN_SPECULATE_INSN
1690116925
#define TARGET_SCHED_CAN_SPECULATE_INSN riscv_sched_can_speculate_insn
1690216926

16927+
#undef TARGET_SCHED_ADJUST_PRIORITY
16928+
#define TARGET_SCHED_ADJUST_PRIORITY riscv_sched_adjust_priority
16929+
1690316930
#undef TARGET_SCHED_REORDER2
1690416931
#define TARGET_SCHED_REORDER2 riscv_sched_reorder2
1690516932

0 commit comments

Comments
 (0)