public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Thomas Rodgers <trodgers@redhat.com>
Cc: Jonathan Wakely <jwakely@redhat.com>,
	gcc Patches <gcc-patches@gcc.gnu.org>,
	libstdc++ <libstdc++@gcc.gnu.org>,
	Thomas Rodgers <rodgert@twrodgers.com>
Subject: Re: [PATCH] libstdc++: Clear padding bits in atomic compare_exchange
Date: Tue, 2 Nov 2021 08:49:51 +0100	[thread overview]
Message-ID: <20211102074951.GZ304296@tucnak> (raw)
In-Reply-To: <CAMmuTO_LDCtQ5nkdLg4yhp-Ar97bATvQkq0s+mG-ggOdTn=WBQ@mail.gmail.com>

On Mon, Nov 01, 2021 at 06:25:45PM -0700, Thomas Rodgers via Gcc-patches wrote:
> +    template<typename _Tp>
> +      constexpr bool
> +      __maybe_has_padding()
> +      {
> +#if __has_builtin(__has_unique_object_representations)
> +	return !__has_unique_object_representations(_Tp)
> +	  && !is_floating_point<_Tp>::value;
> +#else
> +	return true;
> +#endif

I'm not sure I understand the && !is_floating_point<_Tp>::value.
Yes, float and double will never have padding, but long double often
will, e.g. on x86 or ia64 (but e.g. not on ppc, s390x, etc.).
So, unless we want to play with numeric_limits, it should be either
just return !__has_unique_object_representations(_Tp);
or return !__has_unique_object_representations(_Tp)
	  && (!is_floating_point<_Tp>::value
	      || is_same<__remove_cv_t<_Tp>,long double>::value);
or, with numeric_limits test numeric_limits<_Tp>::digits == 64
(but I'm sure Jonathan will not want including such a header dependency
unless it is already included).
Or I can always provide a new __builtin_clear_padding_p ...

	Jakub


  reply	other threads:[~2021-11-02  7:50 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
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 [this message]
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=20211102074951.GZ304296@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jwakely@redhat.com \
    --cc=libstdc++@gcc.gnu.org \
    --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).