On Mon, 2024-10-14 at 11:37 +0900, Oleg Endo wrote: > For memory loads/stores (that contain a MEM rtx) sh_rtx_costs would wrongly > report a cost lower than 1 insn which is not accurate as it makes > loads/stores appear cheaper than simple arithmetic insns. The cost of a > load/store insn is at least 1 insn plus the cost of the address expression > (some addressing modes can be considered more expensive than others due to > additional constraints). > > Tested with make -k check RUNTESTFLAGS="--target_board=sh-sim\{-m2/-ml,-m2/- > mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}" > > CSiBE set shows a little bit of +/- code size movement due to some insn > reordering. Difficult to judge whether it's all good or bad. Doesn't seem > that significant. > > Thanks to Roger for the original patch proposal. > Committed to master. >
The previous patch had a typo. Committed the attached amendment to master after re-testing. Best regards, Oleg Endo
From 2390cbad85cbd122d4e58c94f7891d7c5fde49b3 Mon Sep 17 00:00:00 2001 From: Oleg Endo <olege...@gcc.gnu.org> Date: Thu, 17 Oct 2024 21:40:14 +0900 Subject: [PATCH] SH: Fix typo of commit b717c462b96e gcc/ChangeLog: PR target/113533 * config/sh/sh.cc (sh_rtx_costs): Delete wrong semicolon. --- gcc/config/sh/sh.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/config/sh/sh.cc b/gcc/config/sh/sh.cc index 6ad202f..f69ede0 100644 --- a/gcc/config/sh/sh.cc +++ b/gcc/config/sh/sh.cc @@ -3353,17 +3353,17 @@ sh_rtx_costs (rtx x, machine_mode mode ATTRIBUTE_UNUSED, int outer_code, if (GET_CODE (xx) == SET && MEM_P (XEXP (xx, 0))) { *total = sh_address_cost (XEXP (XEXP (xx, 0), 0), GET_MODE (XEXP (xx, 0)), - MEM_ADDR_SPACE (XEXP (xx, 0)), speed); + MEM_ADDR_SPACE (XEXP (xx, 0)), speed) + COSTS_N_INSNS (1); return true; } if (GET_CODE (xx) == SET && MEM_P (XEXP (xx, 1))) { *total = sh_address_cost (XEXP (XEXP (xx, 1), 0), GET_MODE (XEXP (xx, 1)), - MEM_ADDR_SPACE (XEXP (xx, 1)), speed); + MEM_ADDR_SPACE (XEXP (xx, 1)), speed) + COSTS_N_INSNS (1); return true; } } -- libgit2 1.7.2