public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/106439] New: RISC-V suboptimal codegen for large constants
@ 2022-07-25 20:25 vineet.gupta at linux dot dev
2022-07-25 20:39 ` [Bug target/106439] " pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: vineet.gupta at linux dot dev @ 2022-07-25 20:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106439
Bug ID: 106439
Summary: RISC-V suboptimal codegen for large constants
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: vineet.gupta at linux dot dev
CC: cmuellner at linux dot com, kito at gcc dot gnu.org,
wilson at gcc dot gnu.org
Target Milestone: ---
Target: riscv
As part of experiments to create smaller tests for
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106265, ran into a slightly
different issue involving large constants (> S12) and stack access.
RISC-V codegen for stack accesses with offsets > S12 is terrible.
long foo(void)
{
long a[512];
return a[500];
}
output for rv64 -O2 : gcc trunk as of June 14 (commit 6abe341558ab)
foo:
li t0,-4096
li a5,4096
add sp,sp,t0
addi a5,a5,-96
add a5,a5,sp
li t0,4096
ld a0,0(a5)
add sp,sp,t0
jr ra
Compare the same code to aarch64:
foo:
sub sp, sp, #4096
ldr x0, [sp, 4000]
add sp, sp, 4096
Of course part of the problem is limited S12 offset encoding in RV LD, but the
compiler can definitely do much better.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug target/106439] RISC-V suboptimal codegen for large constants
2022-07-25 20:25 [Bug c/106439] New: RISC-V suboptimal codegen for large constants vineet.gupta at linux dot dev
@ 2022-07-25 20:39 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-07-25 20:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106439
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |DUPLICATE
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is a dup of bug 105733.
*** This bug has been marked as a duplicate of bug 105733 ***
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-25 20:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-25 20:25 [Bug c/106439] New: RISC-V suboptimal codegen for large constants vineet.gupta at linux dot dev
2022-07-25 20:39 ` [Bug target/106439] " pinskia 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).