Skip to content

Commit 3f5ca7b

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 73ca056 commit 3f5ca7b

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
@@ -11520,6 +11520,31 @@ riscv_sched_can_speculate_insn (rtx_insn *insn)
1152011520
}
1152111521
}
1152211522

11523+
static int
11524+
riscv_sched_adjust_priority (rtx_insn *insn, int priority)
11525+
{
11526+
if (!riscv_is_micro_arch (arcv_rhx100))
11527+
return priority;
11528+
11529+
if (DEBUG_INSN_P (insn) || GET_CODE (PATTERN (insn)) == USE
11530+
|| GET_CODE (PATTERN (insn)) == CLOBBER)
11531+
return priority;
11532+
11533+
/* Bump the priority of fused load-store pairs for easier
11534+
scheduling of the memory pipe. The specific increase
11535+
value is determined empirically. */
11536+
if (next_insn (insn) && INSN_P (next_insn (insn))
11537+
&& SCHED_GROUP_P (next_insn (insn))
11538+
&& ((get_attr_type (insn) == TYPE_STORE
11539+
&& get_attr_type (next_insn (insn)) == TYPE_STORE)
11540+
|| (get_attr_type (insn) == TYPE_LOAD
11541+
&& get_attr_type (next_insn (insn)) == TYPE_LOAD)))
11542+
return priority + 1;
11543+
11544+
return priority;
11545+
}
11546+
11547+
1152311548
static void
1152411549
riscv_sched_init (FILE *file ATTRIBUTE_UNUSED,
1152511550
int verbose ATTRIBUTE_UNUSED,
@@ -16248,10 +16273,12 @@ riscv_prefetch_offset_address_p (rtx x, machine_mode mode)
1624816273
#undef TARGET_SCHED_ADJUST_COST
1624916274
#define TARGET_SCHED_ADJUST_COST riscv_sched_adjust_cost
1625016275

16251-
1625216276
#undef TARGET_SCHED_CAN_SPECULATE_INSN
1625316277
#define TARGET_SCHED_CAN_SPECULATE_INSN riscv_sched_can_speculate_insn
1625416278

16279+
#undef TARGET_SCHED_ADJUST_PRIORITY
16280+
#define TARGET_SCHED_ADJUST_PRIORITY riscv_sched_adjust_priority
16281+
1625516282
#undef TARGET_SCHED_REORDER2
1625616283
#define TARGET_SCHED_REORDER2 riscv_sched_reorder2
1625716284

0 commit comments

Comments
 (0)