public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/94649] New: 16-byte aligned atomic_compare_exchange doesn not generate cmpxcg16b on x86_64
@ 2020-04-18 18:17 avi@cloudius-systems.com
  2020-04-20  7:03 ` [Bug target/94649] " rguenth at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: avi@cloudius-systems.com @ 2020-04-18 18:17 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94649
           Summary: 16-byte aligned atomic_compare_exchange doesn not
                    generate cmpxcg16b on x86_64
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: avi@cloudius-systems.com
  Target Milestone: ---

The code

#include <atomic>

struct alignas(16) a {
    long x;
    long y;
};

bool cmpxchg(std::atomic<a>& data, a expected, a newval) {
    return std::atomic_compare_exchange_weak(&data, &expected, newval);
}

compiles with -O3 -mcx16 generates a "lock cmpxchg16b" instruction with clang,
but not with gcc, where it generates a library call to
__atomic_compare_exchange_16. This is a missed optimization.

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

end of thread, other threads:[~2023-02-17  7:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-18 18:17 [Bug c++/94649] New: 16-byte aligned atomic_compare_exchange doesn not generate cmpxcg16b on x86_64 avi@cloudius-systems.com
2020-04-20  7:03 ` [Bug target/94649] " rguenth at gcc dot gnu.org
2020-04-20 11:37 ` avi@cloudius-systems.com
2021-03-14  3:10 ` wuyongwei at gmail dot com
2021-05-07 14:44 ` s_gccbugzilla at nedprod dot com
2023-02-15 10:56 ` balder at yahooinc dot com
2023-02-15 10:59 ` jakub at gcc dot gnu.org
2023-02-17  7:53 ` balder at yahooinc 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).