public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/100265] New: [RISCV] Use proper fences for atomic load/store
@ 2021-04-26 12:06 christophm30 at gmail dot com
2021-04-26 12:47 ` [Bug target/100265] " christophm30 at gmail dot com
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: christophm30 at gmail dot com @ 2021-04-26 12:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100265
Bug ID: 100265
Summary: [RISCV] Use proper fences for atomic load/store
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: christophm30 at gmail dot com
Target Milestone: ---
On RISC-V we don't have load/store instructions with memory ordering bits.
To enforce memory ordering we need to use FENCE instructions.
The good thing is, we can have support for sub-word load/store.
The particular FENCE arguments (i.e. how to map the C ordering to RISC-V
ordering is documented in the RISC-V unpriv spec in section "Code Porting and
Mapping Guidelines").
Currenlty, GCC generates the following:
load_u32_n:
lw a0,0(a0)
sext.w a0,a0
ret
load_u32_aq_n:
lw a0,0(a0)
fence iorw,iorw
sext.w a0,a0
ret
store_u32_n:
amoswap.w zero,a1,0(a0)
ret
store_u32_rl_n:
fence iorw,ow
amoswap.w zero,a1,0(a0)
ret
The goal would be to generate this as follows:
load_u32_n:
lw a0,0(a0)
ret
load_u32_aq_n:
lw a0,0(a0)
fence r,rw
ret
store_au32_n:
sw a1,0(a0)
ret
store_au32_rl_n:
fence rw,w
sw a1,0(a0)
ret
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/100265] [RISCV] Use proper fences for atomic load/store
2021-04-26 12:06 [Bug target/100265] New: [RISCV] Use proper fences for atomic load/store christophm30 at gmail dot com
@ 2021-04-26 12:47 ` christophm30 at gmail dot com
2023-10-23 21:09 ` patrick at rivosinc dot com
2023-10-24 8:37 ` christophm30 at gmail dot com
2 siblings, 0 replies; 4+ messages in thread
From: christophm30 at gmail dot com @ 2021-04-26 12:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100265
--- Comment #1 from Christoph M. <christophm30 at gmail dot com> ---
A patchset to resolve this can be found here:
https://gcc.gnu.org/pipermail/gcc-patches/2021-April/568684.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/100265] [RISCV] Use proper fences for atomic load/store
2021-04-26 12:06 [Bug target/100265] New: [RISCV] Use proper fences for atomic load/store christophm30 at gmail dot com
2021-04-26 12:47 ` [Bug target/100265] " christophm30 at gmail dot com
@ 2023-10-23 21:09 ` patrick at rivosinc dot com
2023-10-24 8:37 ` christophm30 at gmail dot com
2 siblings, 0 replies; 4+ messages in thread
From: patrick at rivosinc dot com @ 2023-10-23 21:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100265
Patrick O'Neill <patrick at rivosinc dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |patrick at rivosinc dot com
--- Comment #2 from Patrick O'Neill <patrick at rivosinc dot com> ---
I believe this issue should be resolved now that the atomics fixes from a few
months ago have landed/the atomics mappings are defined in the RISC-V PSABI
doc.
https://inbox.sourceware.org/gcc-patches/20230427162301.1151333-1-patrick@rivosinc.com/
Also backported for GCC 13.3
https://inbox.sourceware.org/gcc-patches/20230725180206.284777-1-patrick@rivosinc.com/
Thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/100265] [RISCV] Use proper fences for atomic load/store
2021-04-26 12:06 [Bug target/100265] New: [RISCV] Use proper fences for atomic load/store christophm30 at gmail dot com
2021-04-26 12:47 ` [Bug target/100265] " christophm30 at gmail dot com
2023-10-23 21:09 ` patrick at rivosinc dot com
@ 2023-10-24 8:37 ` christophm30 at gmail dot com
2 siblings, 0 replies; 4+ messages in thread
From: christophm30 at gmail dot com @ 2023-10-24 8:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100265
Christoph Müllner <christophm30 at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |FIXED
--- Comment #3 from Christoph Müllner <christophm30 at gmail dot com> ---
Yes, this got fixed.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-10-24 8:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-26 12:06 [Bug target/100265] New: [RISCV] Use proper fences for atomic load/store christophm30 at gmail dot com
2021-04-26 12:47 ` [Bug target/100265] " christophm30 at gmail dot com
2023-10-23 21:09 ` patrick at rivosinc dot com
2023-10-24 8:37 ` christophm30 at gmail dot com
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).