public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108659] New: Suboptimal 128 bit atomics codegen on AArch64 and x64
@ 2023-02-03 15:42 s_gccbugzilla at nedprod dot com
  2023-02-03 16:02 ` [Bug target/108659] " jakub at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: s_gccbugzilla at nedprod dot com @ 2023-02-03 15:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108659

            Bug ID: 108659
           Summary: Suboptimal 128 bit atomics codegen on AArch64 and x64
           Product: gcc
           Version: 12.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: s_gccbugzilla at nedprod dot com
  Target Milestone: ---

Related:
- https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80878
- https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94649
- https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104688

I got bitten by this again, latest GCC still does not emit single instruction
128 bit atomics, even when the -march is easily new enough. Here is a godbolt
comparing latest MSVC, latest GCC and latest clang for the skylake-avx512
architecture, which unquestionably supports cmpxchg16b. Only clang emits the
single instruction atomic:

https://godbolt.org/z/EnbeeW4az

I'm gathering from the issue comments and from the comments at
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104688 that you're going to wait
for AMD to guarantee atomicity of SSE instructions before changing the codegen
here, which makes sense. However I also wanted to raise potentially suboptimal
128 bit atomic codegen by GCC for AArch64 as compared to clang:

https://godbolt.org/z/oKv4o81nv

GCC emits `dmb` to force a global memory fence, whereas clang does not.

I think clang is in the right here, the seq_cst atomic semantics are not
supposed to globally memory fence.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2023-05-31 13:25 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-03 15:42 [Bug c++/108659] New: Suboptimal 128 bit atomics codegen on AArch64 and x64 s_gccbugzilla at nedprod dot com
2023-02-03 16:02 ` [Bug target/108659] " jakub at gcc dot gnu.org
2023-02-03 16:14 ` ktkachov at gcc dot gnu.org
2023-02-03 17:14 ` s_gccbugzilla at nedprod dot com
2023-02-03 17:20 ` pinskia at gcc dot gnu.org
2023-02-03 21:04 ` wilco at gcc dot gnu.org
2023-02-03 21:08 ` pinskia at gcc dot gnu.org
2023-02-03 21:22 ` s_gccbugzilla at nedprod dot com
2023-02-03 21:51 ` wilco at gcc dot gnu.org
2023-02-03 21:58 ` jakub at gcc dot gnu.org
2023-02-03 22:34 ` s_gccbugzilla at nedprod dot com
2023-02-03 22:45 ` wilco at gcc dot gnu.org
2023-05-31 13:25 ` [Bug target/108659] Suboptimal 128 bit atomics codegen x64 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).