On 8/3/23 11:12, Jeff Law via Gcc-patches wrote:
On Thu, 03 Aug 2023 08:05:09 PDT (-0700), gcc-patches@gcc.gnu.org wrote:
[...]

There's a bigger TODO in this space WRT a top-to-bottom evaluation of
the costing on RISC-V.  I'm still formulating what that evaluation is
going to look like, so don't hold your breath waiting on it.

[...]
Right.  I think we're probably tackling different issues.

The problem I'm looking at right now is when we ask for the cost of a sequence of insns, the underlying costs we get per insn are not at all in line with expectations.  We have likely either failed to provide one of the desired hook entries or we're missing toplevel constructs like INSN & SET in our riscv_rtx_costs. I'm not sure which it is yet, but there's clearly something wrong in there.  IMHO it falls into the "fix the stupid stuff" space.

As discussed in Tue call, I definitely have 1 fix to riscv_rtx_costs (), which is worth pondering. It adjusts the cost of consts and helps Hoist GCSE constants (which granted kicks in only at -Os). However it does affect codegen in subtle ways since CSE1 now for some cases generates additional REG_EQUAL note.

Again it might not help your issue. I'll post a RFC patch along with a test case - which in turns comes from an old PR I stumbled upon during research on const remat.

On a different but slightly related note, I was playing with Zicond this morning (enabling by default in toolchain build and qemu) and I was surprised to see that glibc build currently doesn't have a single czero* insn - although gcc has bene configured with

Point being, I can help with riscv_rtx_costs and friends, if you have something specific, but seems like you are in the thick of it and have that handled so I'll stay out of the way and refrain from zicond work/testing for the time being.

Thx,
-Vineet

Reply via email to