public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/111139] New: RISC-V: improve scalar constants cost model
@ 2023-08-24 17:44 vineetg at gcc dot gnu.org
2023-08-24 17:46 ` [Bug target/111139] " palmer at gcc dot gnu.org
2023-08-25 20:12 ` vineetg at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: vineetg at gcc dot gnu.org @ 2023-08-24 17:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111139
Bug ID: 111139
Summary: RISC-V: improve scalar constants cost model
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: vineetg at gcc dot gnu.org
CC: jeffreyalaw at gmail dot com, kito.cheng at gmail dot com,
palmer at dabbelt dot com
Target Milestone: ---
The current const cost determination in riscv_rtx_costs () and its children
such as riscv_const_insns () needs improvements.
1. There's some likely inaccuracies with various heuristics.
2. Those heuristics are distributed in a bunch of places and better be
consolidated.
3. We need to make const cost cpu/uarch tunable as hardware widgets like macro
fusions could ammortize multi-insn const costs.
Some of the heuristics to cleanup/revisit:
1a. riscv_rtx_cost() returns 1 insn even if riscv_const_insns () returns > 1.
case CONST:
if ((cost = riscv_const_insns (x)) > 0)
{
if (cost == 1 && outer_code == SET)
*total = COSTS_N_INSNS (1);
else if (outer_code == SET || GET_MODE (x) == VOIDmode)
*total = COSTS_N_INSNS (1);
}
1b. riscv_const_insns () caps the const cost to 4 even if it higher with intent
to force const pool. RV backend in general no longer favors const pools for
large constants since 2e886eef7f2b5a ("RISC-V: Produce better code with complex
constants [PR95632] [PR106602]"). This heuristic needs to be revisited.
1c. riscv_split_integer_cost () adds 2 to initial cost computed.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug target/111139] RISC-V: improve scalar constants cost model
2023-08-24 17:44 [Bug target/111139] New: RISC-V: improve scalar constants cost model vineetg at gcc dot gnu.org
@ 2023-08-24 17:46 ` palmer at gcc dot gnu.org
2023-08-25 20:12 ` vineetg at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: palmer at gcc dot gnu.org @ 2023-08-24 17:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111139
palmer at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2023-08-24
Ever confirmed|0 |1
CC| |palmer at gcc dot gnu.org
Status|UNCONFIRMED |NEW
--- Comment #1 from palmer at gcc dot gnu.org ---
I think maybe Jeff said he was going to look at this? IMO even just a
refactoring here would be great, like Vineet is pointing out it's become a bit
of a mess.
Also: Edwin is refactoring the rest of the types.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug target/111139] RISC-V: improve scalar constants cost model
2023-08-24 17:44 [Bug target/111139] New: RISC-V: improve scalar constants cost model vineetg at gcc dot gnu.org
2023-08-24 17:46 ` [Bug target/111139] " palmer at gcc dot gnu.org
@ 2023-08-25 20:12 ` vineetg at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: vineetg at gcc dot gnu.org @ 2023-08-25 20:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111139
--- Comment #2 from Vineet Gupta <vineetg at gcc dot gnu.org> ---
Test case to help drive some of this:
unsigned long long f5(unsigned long long i)
{
return i * 0x0202020202020202ULL;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-08-25 20:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-24 17:44 [Bug target/111139] New: RISC-V: improve scalar constants cost model vineetg at gcc dot gnu.org
2023-08-24 17:46 ` [Bug target/111139] " palmer at gcc dot gnu.org
2023-08-25 20:12 ` vineetg at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).