* [Bug target/104338] RISC-V: Subword atomics result in library calls
2022-02-01 23:36 [Bug target/104338] New: RISC-V: Subword atomics result in library calls palmer at gcc dot gnu.org
@ 2022-02-01 23:41 ` patrick at rivosinc dot com
2022-02-01 23:41 ` pinskia at gcc dot gnu.org
` (21 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: patrick at rivosinc dot com @ 2022-02-01 23:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104338
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=89835
Last reconfirmed| |2022-02-01
Status|UNCONFIRMED |NEW
Patrick O'Neill <patrick at rivosinc dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |patrick at rivosinc dot com
Last reconfirmed|2022-02-01 00:00:00 |
Ever confirmed|1 |0
Status|NEW |UNCONFIRMED
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Bug 89835 comment #2 references this.
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug target/104338] RISC-V: Subword atomics result in library calls
2022-02-01 23:36 [Bug target/104338] New: RISC-V: Subword atomics result in library calls palmer at gcc dot gnu.org
2022-02-01 23:41 ` [Bug target/104338] " patrick at rivosinc dot com
@ 2022-02-01 23:41 ` pinskia at gcc dot gnu.org
2022-02-01 23:41 ` pinskia at gcc dot gnu.org
` (20 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-01 23:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104338
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=89835
Last reconfirmed| |2022-02-01
Status|UNCONFIRMED |NEW
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Bug 89835 comment #2 references this.
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug target/104338] RISC-V: Subword atomics result in library calls
2022-02-01 23:36 [Bug target/104338] New: RISC-V: Subword atomics result in library calls palmer at gcc dot gnu.org
2022-02-01 23:41 ` [Bug target/104338] " patrick at rivosinc dot com
2022-02-01 23:41 ` pinskia at gcc dot gnu.org
@ 2022-02-01 23:41 ` pinskia at gcc dot gnu.org
2022-02-02 8:48 ` schwab@linux-m68k.org
` (19 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-01 23:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104338
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Severity|normal |enhancement
Last reconfirmed| |2022-02-01
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug target/104338] RISC-V: Subword atomics result in library calls
2022-02-01 23:36 [Bug target/104338] New: RISC-V: Subword atomics result in library calls palmer at gcc dot gnu.org
` (2 preceding siblings ...)
2022-02-01 23:41 ` pinskia at gcc dot gnu.org
@ 2022-02-02 8:48 ` schwab@linux-m68k.org
2022-02-08 1:08 ` patrick at rivosinc dot com
` (18 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: schwab@linux-m68k.org @ 2022-02-02 8:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104338
--- Comment #2 from Andreas Schwab <schwab@linux-m68k.org> ---
This also causes a lot of packages to fail to build with undefined references
to the libatomic libcalls.
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug target/104338] RISC-V: Subword atomics result in library calls
2022-02-01 23:36 [Bug target/104338] New: RISC-V: Subword atomics result in library calls palmer at gcc dot gnu.org
` (3 preceding siblings ...)
2022-02-02 8:48 ` schwab@linux-m68k.org
@ 2022-02-08 1:08 ` patrick at rivosinc dot com
2022-04-07 14:50 ` i at rvalue dot moe
` (17 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: patrick at rivosinc dot com @ 2022-02-08 1:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104338
--- Comment #3 from Patrick O'Neill <patrick at rivosinc dot com> ---
Created attachment 52368
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52368&action=edit
Initial patch
Patch submitted to mailing list.
Subject: [PATCH v1] RISC-V: Add support for inlining subword atomic operations.
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug target/104338] RISC-V: Subword atomics result in library calls
2022-02-01 23:36 [Bug target/104338] New: RISC-V: Subword atomics result in library calls palmer at gcc dot gnu.org
` (4 preceding siblings ...)
2022-02-08 1:08 ` patrick at rivosinc dot com
@ 2022-04-07 14:50 ` i at rvalue dot moe
2022-04-07 14:57 ` palmer at gcc dot gnu.org
` (16 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: i at rvalue dot moe @ 2022-04-07 14:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104338
rvalue <i at rvalue dot moe> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |i at rvalue dot moe
--- Comment #4 from rvalue <i at rvalue dot moe> ---
In short term, maybe we can change the spec to link against libatomic by
default (implemented in
https://github.com/riscv-collab/riscv-gcc/commit/2c4857d0981501b7c50bbf228de9e287611f8ae5).
It will solve a lot of build errors if we revert the value of `LIB_SPEC`
instead of only link against libatomic when `-pthread` is present.
Detailed talk about this: https://github.com/riscv-collab/riscv-gcc/issues/337
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug target/104338] RISC-V: Subword atomics result in library calls
2022-02-01 23:36 [Bug target/104338] New: RISC-V: Subword atomics result in library calls palmer at gcc dot gnu.org
` (5 preceding siblings ...)
2022-04-07 14:50 ` i at rvalue dot moe
@ 2022-04-07 14:57 ` palmer at gcc dot gnu.org
2022-04-07 18:29 ` palmer at gcc dot gnu.org
` (15 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: palmer at gcc dot gnu.org @ 2022-04-07 14:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104338
--- Comment #5 from palmer at gcc dot gnu.org ---
(In reply to rvalue from comment #4)
> In short term, maybe we can change the spec to link against libatomic by
> default (implemented in
> https://github.com/riscv-collab/riscv-gcc/commit/
> 2c4857d0981501b7c50bbf228de9e287611f8ae5). It will solve a lot of build
> errors if we revert the value of `LIB_SPEC` instead of only link against
> libatomic when `-pthread` is present.
>
> Detailed talk about this:
> https://github.com/riscv-collab/riscv-gcc/issues/337
We talked through some options like that and decided it was too risky for
GCC-12. We already found one ABI break related to this (see 84568), and want
to make sure we give distros adequate advance notice before something that we
know to break ABIs.
That said, it's really not a GCC ABI break, it's a per-package configure issue.
We can fix the libstdcxx fallout, which is the only bit we know about right
now (though it's not like we've scrubbed builds for this). If the folks
building distros think it's better to risk the ABI breaks rather than chase
around the build failures, then I'm fine rushing something in to GCC-12.
I see Andreas is already here, I'm having some trouble adding anyone else
though (I can never quite figure out Bugzilla...).
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug target/104338] RISC-V: Subword atomics result in library calls
2022-02-01 23:36 [Bug target/104338] New: RISC-V: Subword atomics result in library calls palmer at gcc dot gnu.org
` (6 preceding siblings ...)
2022-04-07 14:57 ` palmer at gcc dot gnu.org
@ 2022-04-07 18:29 ` palmer at gcc dot gnu.org
2022-04-08 3:03 ` c141028 at gmail dot com
` (14 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: palmer at gcc dot gnu.org @ 2022-04-07 18:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104338
palmer at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kito.cheng at gmail dot com
--- Comment #6 from palmer at gcc dot gnu.org ---
Kito pointed out earlier today that it should already be possible to default to
libatomic via a --with-specs=... configure-time argument already, so one option
here would be to just add an example/reference spec to GCC. That would allow
distros to opt in to the "always link libatomic" behavior, if they want to risk
the ABI-related issues like we see in libstdcxx (which we'd of course have to
fix). It doesn't sort out the long-tail issues related to ABI compatibility
between GCC and LLVM (and the suggested mappings), but at least it gives folks
a unified mechanism for doing this.
I know it's pretty late, but that seems like something we could do on the
GCC-12 timeline. It seems like the distro folks are pretty fed up with waiting
so they're just going to backport/hack this if we miss GCC-12, might as well
have one way for that to happen.
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug target/104338] RISC-V: Subword atomics result in library calls
2022-02-01 23:36 [Bug target/104338] New: RISC-V: Subword atomics result in library calls palmer at gcc dot gnu.org
` (7 preceding siblings ...)
2022-04-07 18:29 ` palmer at gcc dot gnu.org
@ 2022-04-08 3:03 ` c141028 at gmail dot com
2022-04-19 17:25 ` patrick at rivosinc dot com
` (13 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: c141028 at gmail dot com @ 2022-04-08 3:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104338
SS JieJi <c141028 at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |c141028 at gmail dot com
--- Comment #7 from SS JieJi <c141028 at gmail dot com> ---
FYI Patch v2 has been submitted in the mailing list, see
https://www.mail-archive.com/gcc-patches@gcc.gnu.org/msg281336.html
I'm not sure why bugzilla lost sync with the mailing list.
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug target/104338] RISC-V: Subword atomics result in library calls
2022-02-01 23:36 [Bug target/104338] New: RISC-V: Subword atomics result in library calls palmer at gcc dot gnu.org
` (8 preceding siblings ...)
2022-04-08 3:03 ` c141028 at gmail dot com
@ 2022-04-19 17:25 ` patrick at rivosinc dot com
2022-04-19 17:48 ` redi at gcc dot gnu.org
` (12 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: patrick at rivosinc dot com @ 2022-04-19 17:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104338
Patrick O'Neill <patrick at rivosinc dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #52368|0 |1
is obsolete| |
--- Comment #8 from Patrick O'Neill <patrick at rivosinc dot com> ---
Created attachment 52835
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52835&action=edit
Patch v3
Patch submitted to mailing list.
Subject: [PATCH v3] RISC-V: Add support for inlining subword atomic operations.
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug target/104338] RISC-V: Subword atomics result in library calls
2022-02-01 23:36 [Bug target/104338] New: RISC-V: Subword atomics result in library calls palmer at gcc dot gnu.org
` (9 preceding siblings ...)
2022-04-19 17:25 ` patrick at rivosinc dot com
@ 2022-04-19 17:48 ` redi at gcc dot gnu.org
2022-08-16 20:36 ` aurelien at aurel32 dot net
` (11 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: redi at gcc dot gnu.org @ 2022-04-19 17:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104338
--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to RZ Pan (XieJiSS) from comment #7)
> I'm not sure why bugzilla lost sync with the mailing list.
There is no sync between gcc-patches and bugzilla, and never has been.
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug target/104338] RISC-V: Subword atomics result in library calls
2022-02-01 23:36 [Bug target/104338] New: RISC-V: Subword atomics result in library calls palmer at gcc dot gnu.org
` (10 preceding siblings ...)
2022-04-19 17:48 ` redi at gcc dot gnu.org
@ 2022-08-16 20:36 ` aurelien at aurel32 dot net
2023-01-26 22:50 ` pinskia at gcc dot gnu.org
` (10 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: aurelien at aurel32 dot net @ 2022-08-16 20:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104338
Aurelien Jarno <aurelien at aurel32 dot net> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |aurelien at aurel32 dot net
--- Comment #10 from Aurelien Jarno <aurelien at aurel32 dot net> ---
I am not subscribed to the mailing list, but I am not able to see any more
mails after the v3. Any update?
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug target/104338] RISC-V: Subword atomics result in library calls
2022-02-01 23:36 [Bug target/104338] New: RISC-V: Subword atomics result in library calls palmer at gcc dot gnu.org
` (11 preceding siblings ...)
2022-08-16 20:36 ` aurelien at aurel32 dot net
@ 2023-01-26 22:50 ` pinskia at gcc dot gnu.org
2023-01-26 23:30 ` palmer at gcc dot gnu.org
` (9 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-26 22:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104338
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |raj.khem at gmail dot com
--- Comment #11 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 108564 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug target/104338] RISC-V: Subword atomics result in library calls
2022-02-01 23:36 [Bug target/104338] New: RISC-V: Subword atomics result in library calls palmer at gcc dot gnu.org
` (12 preceding siblings ...)
2023-01-26 22:50 ` pinskia at gcc dot gnu.org
@ 2023-01-26 23:30 ` palmer at gcc dot gnu.org
2023-04-12 14:15 ` burnus at gcc dot gnu.org
` (8 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: palmer at gcc dot gnu.org @ 2023-01-26 23:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104338
--- Comment #12 from palmer at gcc dot gnu.org ---
I've got a somewhat recently rebased version of Patrick's patch floating
around, it passed testing but I got hung up on the futex_time64 thing and
forgot about it. Not sure if folks think it's too late for the upcoming CGC
release, but I wouldn't be opposed to taking it -- looks like distros aro going
to apply workarounds if we don't do something, so at least this way there'll be
a single workaround in trunk.
There's some bigger fixes in the works for the whole memory model as we've got
other issues, but since those are a bit tricker it might be worth just doing
the stop-gap thing for now.
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug target/104338] RISC-V: Subword atomics result in library calls
2022-02-01 23:36 [Bug target/104338] New: RISC-V: Subword atomics result in library calls palmer at gcc dot gnu.org
` (13 preceding siblings ...)
2023-01-26 23:30 ` palmer at gcc dot gnu.org
@ 2023-04-12 14:15 ` burnus at gcc dot gnu.org
2023-04-20 16:44 ` patrick at rivosinc dot com
` (7 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: burnus at gcc dot gnu.org @ 2023-04-12 14:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104338
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu.org
--- Comment #13 from Tobias Burnus <burnus at gcc dot gnu.org> ---
I see v3 of the patch at
https://gcc.gnu.org/pipermail/gcc-patches/2022-April/593378.html
And v4 at
https://gcc.gnu.org/pipermail/gcc-patches/2022-October/604584.html
with last reply at
https://gcc.gnu.org/pipermail/gcc-patches/2022-November/606366.html
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug target/104338] RISC-V: Subword atomics result in library calls
2022-02-01 23:36 [Bug target/104338] New: RISC-V: Subword atomics result in library calls palmer at gcc dot gnu.org
` (14 preceding siblings ...)
2023-04-12 14:15 ` burnus at gcc dot gnu.org
@ 2023-04-20 16:44 ` patrick at rivosinc dot com
2023-04-26 16:55 ` cvs-commit at gcc dot gnu.org
` (6 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: patrick at rivosinc dot com @ 2023-04-20 16:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104338
--- Comment #14 from Patrick O'Neill <patrick at rivosinc dot com> ---
I picked this back up, v7 is here:
https://gcc.gnu.org/pipermail/gcc-patches/2023-April/616080.html
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug target/104338] RISC-V: Subword atomics result in library calls
2022-02-01 23:36 [Bug target/104338] New: RISC-V: Subword atomics result in library calls palmer at gcc dot gnu.org
` (15 preceding siblings ...)
2023-04-20 16:44 ` patrick at rivosinc dot com
@ 2023-04-26 16:55 ` cvs-commit at gcc dot gnu.org
2023-05-16 17:00 ` cvs-commit at gcc dot gnu.org
` (5 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-26 16:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104338
--- Comment #15 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick O'Neill <poneill@gcc.gnu.org>:
https://gcc.gnu.org/g:f797260adaf52bee0ec0e16190bbefbe1bfc3692
commit r14-269-gf797260adaf52bee0ec0e16190bbefbe1bfc3692
Author: Patrick O'Neill <patrick@rivosinc.com>
Date: Tue Apr 18 14:33:13 2023 -0700
RISCV: Inline subword atomic ops
RISC-V has no support for subword atomic operations; code currently
generates libatomic library calls.
This patch changes the default behavior to inline subword atomic calls
(using the same logic as the existing library call).
Behavior can be specified using the -minline-atomics and
-mno-inline-atomics command line flags.
gcc/libgcc/config/riscv/atomic.c has the same logic implemented in asm.
This will need to stay for backwards compatibility and the
-mno-inline-atomics flag.
2023-04-18 Patrick O'Neill <patrick@rivosinc.com>
gcc/ChangeLog:
PR target/104338
* config/riscv/riscv-protos.h: Add helper function stubs.
* config/riscv/riscv.cc: Add helper functions for subword masking.
* config/riscv/riscv.opt: Add command-line flag.
* config/riscv/sync.md: Add masking logic and inline asm for
fetch_and_op,
fetch_and_nand, CAS, and exchange ops.
* doc/invoke.texi: Add blurb regarding command-line flag.
libgcc/ChangeLog:
PR target/104338
* config/riscv/atomic.c: Add reference to duplicate logic.
gcc/testsuite/ChangeLog:
PR target/104338
* gcc.target/riscv/inline-atomics-1.c: New test.
* gcc.target/riscv/inline-atomics-2.c: New test.
* gcc.target/riscv/inline-atomics-3.c: New test.
* gcc.target/riscv/inline-atomics-4.c: New test.
* gcc.target/riscv/inline-atomics-5.c: New test.
* gcc.target/riscv/inline-atomics-6.c: New test.
* gcc.target/riscv/inline-atomics-7.c: New test.
* gcc.target/riscv/inline-atomics-8.c: New test.
Signed-off-by: Patrick O'Neill <patrick@rivosinc.com>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug target/104338] RISC-V: Subword atomics result in library calls
2022-02-01 23:36 [Bug target/104338] New: RISC-V: Subword atomics result in library calls palmer at gcc dot gnu.org
` (16 preceding siblings ...)
2023-04-26 16:55 ` cvs-commit at gcc dot gnu.org
@ 2023-05-16 17:00 ` cvs-commit at gcc dot gnu.org
2023-05-16 17:04 ` patrick at rivosinc dot com
` (4 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-16 17:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104338
--- Comment #16 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Patrick O'Neill
<poneill@gcc.gnu.org>:
https://gcc.gnu.org/g:55088cf384d4c43e280ec794217e32fab64070ba
commit r13-7336-g55088cf384d4c43e280ec794217e32fab64070ba
Author: Patrick O'Neill <patrick@rivosinc.com>
Date: Tue Apr 18 14:33:13 2023 -0700
RISCV: Inline subword atomic ops
RISC-V has no support for subword atomic operations; code currently
generates libatomic library calls.
This patch changes the default behavior to inline subword atomic calls
(using the same logic as the existing library call).
Behavior can be specified using the -minline-atomics and
-mno-inline-atomics command line flags.
gcc/libgcc/config/riscv/atomic.c has the same logic implemented in asm.
This will need to stay for backwards compatibility and the
-mno-inline-atomics flag.
2023-05-03 Patrick O'Neill <patrick@rivosinc.com>
gcc/ChangeLog:
PR target/104338
* config/riscv/riscv-protos.h: Add helper function stubs.
* config/riscv/riscv.cc: Add helper functions for subword masking.
* config/riscv/riscv.opt: Add command-line flags
-minline-atomics and -mno-inline-atomics.
* config/riscv/sync.md: Add masking logic and inline asm for
fetch_and_op, fetch_and_nand, CAS, and exchange ops.
* doc/invoke.texi: Add blurb regarding new command-line flags
-minline-atomics and -mno-inline-atomics.
libgcc/ChangeLog:
PR target/104338
* config/riscv/atomic.c: Add reference to duplicate logic.
gcc/testsuite/ChangeLog:
PR target/104338
* gcc.target/riscv/inline-atomics-1.c: New test.
* gcc.target/riscv/inline-atomics-2.c: New test.
* gcc.target/riscv/inline-atomics-3.c: New test.
* gcc.target/riscv/inline-atomics-4.c: New test.
* gcc.target/riscv/inline-atomics-5.c: New test.
* gcc.target/riscv/inline-atomics-6.c: New test.
* gcc.target/riscv/inline-atomics-7.c: New test.
* gcc.target/riscv/inline-atomics-8.c: New test.
Signed-off-by: Patrick O'Neill <patrick@rivosinc.com>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug target/104338] RISC-V: Subword atomics result in library calls
2022-02-01 23:36 [Bug target/104338] New: RISC-V: Subword atomics result in library calls palmer at gcc dot gnu.org
` (17 preceding siblings ...)
2023-05-16 17:00 ` cvs-commit at gcc dot gnu.org
@ 2023-05-16 17:04 ` patrick at rivosinc dot com
2023-05-16 19:37 ` aurelien at aurel32 dot net
` (3 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: patrick at rivosinc dot com @ 2023-05-16 17:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104338
Patrick O'Neill <patrick at rivosinc dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #17 from Patrick O'Neill <patrick at rivosinc dot com> ---
Closing this issue since the fix is on trunk and was backported to
releases/gcc-13 to be included in the next release.
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug target/104338] RISC-V: Subword atomics result in library calls
2022-02-01 23:36 [Bug target/104338] New: RISC-V: Subword atomics result in library calls palmer at gcc dot gnu.org
` (18 preceding siblings ...)
2023-05-16 17:04 ` patrick at rivosinc dot com
@ 2023-05-16 19:37 ` aurelien at aurel32 dot net
2023-05-16 19:42 ` i at rvalue dot moe
` (2 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: aurelien at aurel32 dot net @ 2023-05-16 19:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104338
--- Comment #18 from Aurelien Jarno <aurelien at aurel32 dot net> ---
Thanks Patrick for working on that and for the backport to the gcc-13 branch. I
wonder if the following patch should also be backported, as it doesn't make
sense to link with -latomic anymore with inline subword atomic operations:
commit 203f3060dd363361b172f7295f42bb6bf5ac0b3b
Author: Andreas Schwab <schwab@suse.de>
Date: Sat Apr 23 15:48:42 2022 +0200
riscv/linux: Don't add -latomic with -pthread
Now that we have support for inline subword atomic operations, it is no
longer necessary to link against libatomic. This also fixes testsuite
failures because the framework does not properly set up the linker flags
for finding libatomic.
The use of atomic operations is also independent of the use of libpthread.
gcc/
* config/riscv/linux.h (LIB_SPEC): Don't redefine.
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug target/104338] RISC-V: Subword atomics result in library calls
2022-02-01 23:36 [Bug target/104338] New: RISC-V: Subword atomics result in library calls palmer at gcc dot gnu.org
` (19 preceding siblings ...)
2023-05-16 19:37 ` aurelien at aurel32 dot net
@ 2023-05-16 19:42 ` i at rvalue dot moe
2023-05-16 20:05 ` palmer at gcc dot gnu.org
2023-10-05 8:47 ` redi at gcc dot gnu.org
22 siblings, 0 replies; 24+ messages in thread
From: i at rvalue dot moe @ 2023-05-16 19:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104338
--- Comment #19 from rvalue <i at rvalue dot moe> ---
(In reply to Aurelien Jarno from comment #18)
> I wonder if the following patch should also be backported, as it
> doesn't make sense to link with -latomic anymore with inline subword atomic
> operations
Agreed. It's now meaningless to keep this workaround for RISC-V as the problem
has been resolved.
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug target/104338] RISC-V: Subword atomics result in library calls
2022-02-01 23:36 [Bug target/104338] New: RISC-V: Subword atomics result in library calls palmer at gcc dot gnu.org
` (20 preceding siblings ...)
2023-05-16 19:42 ` i at rvalue dot moe
@ 2023-05-16 20:05 ` palmer at gcc dot gnu.org
2023-10-05 8:47 ` redi at gcc dot gnu.org
22 siblings, 0 replies; 24+ messages in thread
From: palmer at gcc dot gnu.org @ 2023-05-16 20:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104338
--- Comment #20 from palmer at gcc dot gnu.org ---
(In reply to rvalue from comment #19)
> (In reply to Aurelien Jarno from comment #18)
> > I wonder if the following patch should also be backported, as it
> > doesn't make sense to link with -latomic anymore with inline subword atomic
> > operations
>
> Agreed. It's now meaningless to keep this workaround for RISC-V as the
> problem has been resolved.
Yep. Can someone send the backport?
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug target/104338] RISC-V: Subword atomics result in library calls
2022-02-01 23:36 [Bug target/104338] New: RISC-V: Subword atomics result in library calls palmer at gcc dot gnu.org
` (21 preceding siblings ...)
2023-05-16 20:05 ` palmer at gcc dot gnu.org
@ 2023-10-05 8:47 ` redi at gcc dot gnu.org
22 siblings, 0 replies; 24+ messages in thread
From: redi at gcc dot gnu.org @ 2023-10-05 8:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104338
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |13.2
^ permalink raw reply [flat|nested] 24+ messages in thread