From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Thomas Rodgers <rodgert@appliantology.com>,
Thomas Rodgers <trodgers@redhat.com>,
"libstdc++" <libstdc++@gcc.gnu.org>,
gcc-patches <gcc-patches@gcc.gnu.org>,
Thomas Rodgers <rodgert@twrodgers.com>
Subject: Re: [PATCH] libstdc++: Clear padding bits in atomic compare_exchange
Date: Thu, 23 Sep 2021 21:15:41 +0100 [thread overview]
Message-ID: <CAH6eHdSKVrMhhBDCWmnBr22dSPs0yx_WEcO-J1CjrH5BMHg0WQ@mail.gmail.com> (raw)
In-Reply-To: <20210923190708.GM304296@tucnak>
On Thu, 23 Sep 2021, 20:07 Jakub Jelinek via Libstdc++, <
libstdc++@gcc.gnu.org> wrote:
> On Thu, Sep 23, 2021 at 11:08:37AM -0700, Thomas Rodgers wrote:
> > From: Thomas Rodgers <rodgert@twrodgers.com>
> >
> > This change implements P0528 which requires that padding bits not
> > participate in atomic compare exchange operations. All arguments to the
>
> Thanks for working on this.
>
> > generic template are 'sanitized' by the __builtin_clear_padding intrinsic
> > before they are used in atomic compare_exchange. This alrequires that any
> > stores also sanitize the incoming value.
>
> Not a review, just random nit.
> Shouldn't the __builtin_clear_padding calls be guarded with
> #if __has_builtin(__builtin_clear_padding)
> or #ifdef _GLIBCXX_HAVE_BUILTIN_CLEAR_PADDING defined based on that?
>
Yes. It can just use __has_builtin directly. All the compilers we care
about support that now.
I think clang doesn't support it (yet?), and it doesn't support the MSVC
> __builtin_zero_non_value_bits (with very similar, but slightly different,
> behavior).
>
> > Signed-off-by: Thomas Rodgers <trodgers@redhat.com>
> >
> > libstdc++=v3/ChangeLog:
> >
> > * include/std/atomic (atomic<T>::atomic(_Tp) clear padding for
> > __cplusplus > 201703L.
> > (atomic<T>::store()) Clear padding.
> > (atomic<T>::exchange()) Likewise.
> > (atomic<T>::compare_exchange_weak()) Likewise.
> > (atomic<T>::compare_exchange_strong()) Likewise.
> > * testsuite/29_atomics/atomic/compare_exchange_padding.cc: New
> > test.
>
> Jakub
>
>
next prev parent reply other threads:[~2021-09-23 20:15 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-23 18:08 Thomas Rodgers
2021-09-23 19:07 ` Jakub Jelinek
2021-09-23 20:15 ` Thomas Rodgers
2021-09-23 20:15 ` Jonathan Wakely [this message]
2021-09-27 14:10 ` Thomas Rodgers
2021-09-29 12:13 ` Jonathan Wakely
2021-09-29 12:18 ` Jonathan Wakely
2021-09-29 12:28 ` Jakub Jelinek
2021-09-29 18:22 ` Thomas Rodgers
2021-09-29 18:29 ` Jakub Jelinek
2021-11-02 1:25 ` Thomas Rodgers
2021-11-02 7:49 ` Jakub Jelinek
2021-11-03 3:06 ` Thomas Rodgers
2021-11-02 8:49 ` Daniel Krügler
2022-01-18 21:48 ` Jonathan Wakely
2022-08-25 10:11 ` Patch ping (was Re: [PATCH] libstdc++: Clear padding bits in atomic compare_exchange) Jakub Jelinek
2022-09-01 22:57 ` Thomas Rodgers
2022-09-07 11:56 ` Jonathan Wakely
2022-09-07 22:06 ` Thomas Rodgers
2022-09-09 18:36 ` Rainer Orth
2022-09-09 18:46 ` Iain Sandoe
2022-09-09 19:01 ` Thomas Rodgers
2022-09-09 20:14 ` Jonathan Wakely
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAH6eHdSKVrMhhBDCWmnBr22dSPs0yx_WEcO-J1CjrH5BMHg0WQ@mail.gmail.com \
--to=jwakely.gcc@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=libstdc++@gcc.gnu.org \
--cc=rodgert@appliantology.com \
--cc=rodgert@twrodgers.com \
--cc=trodgers@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).