From: Joseph Myers <josmyers@redhat.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH] v2: Use gcc __builtin_stdc_* builtins in stdbit.h if possible
Date: Mon, 22 Jan 2024 17:58:22 +0000 (UTC) [thread overview]
Message-ID: <1b65b9a1-2ae6-52f-c352-8ae2ba52ee24@redhat.com> (raw)
In-Reply-To: <Za4zBGmXL+GIHjxp@tucnak>
On Mon, 22 Jan 2024, Jakub Jelinek wrote:
> When the type-specific macros need to use inline functions, it means
> they won't be usable in constant expressions (sure, the standard doesn't
> require that).
Indeed - usability in constant expressions might wait for a future version
of C to have some form of constexpr functions, rather than being expected
now.
> Anyway, so do you want instead to just use the new GCC builtins only for the
> type-generic macros (as done in the following patch, tested like the earlier
> one on x86_64), or should the type-specific macros use different
> type-specific inlines then which would use the new builtins? I guess if
> one can't use them in constant expressions, then the current implementations
> of those type-specific macros is just fine.
I think just use the new builtins for the type-generic macros. I don't
think there's any need to have different implementations of the inline
functions. (If any of them don't get compiled to essentially the same
code as versions that do use the new builtins, that's best addressed as an
optimization improvement in GCC.)
> diff --git a/manual/stdbit.texi b/manual/stdbit.texi
> index fe41c671d8..0878015cc7 100644
> --- a/manual/stdbit.texi
> +++ b/manual/stdbit.texi
> @@ -32,7 +32,9 @@ and @code{unsigned long long int}. In addition, there is a
> corresponding type-generic macro (not listed below), named the same as
> the functions but without any suffix such as @samp{_uc}. The
> type-generic macro can only be used with an argument of an unsigned
> -integer type with a width of 8, 16, 32 or 64 bits.
> +integer type with a width of 8, 16, 32 or 64 bits, or when using
> +a compiler with support for stdc builtins such as GCC 14.1 or later
> +any unsigned integer type those builtins support.
I don't think a reference to "stdc builtins" is very useful for glibc
users (but mentioning unsigned __int128 and unsigned _BitInt types as
examples supported with GCC 14 would be).
--
Joseph S. Myers
josmyers@redhat.com
next prev parent reply other threads:[~2024-01-22 17:58 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-20 18:04 [PATCH] " Jakub Jelinek
2024-01-20 23:27 ` Joseph Myers
2024-01-22 9:19 ` [PATCH] v2: " Jakub Jelinek
2024-01-22 17:58 ` Joseph Myers [this message]
2024-01-26 10:12 ` [PATCH] v3: " Jakub Jelinek
2024-01-29 21:07 ` Joseph Myers
2024-01-29 21:18 ` Jakub Jelinek
2024-01-29 21:30 ` Joseph Myers
2024-01-29 22:10 ` [PATCH] v4: " Jakub Jelinek
2024-01-30 0:28 ` Andreas K. Huettel
2024-01-31 18:03 ` Joseph Myers
2024-02-01 10:12 ` Mark Wielaard
2024-02-01 10:23 ` Mark Wielaard
2024-02-01 10:33 ` [PATCH] Fix up stdbit.texi Jakub Jelinek
2024-02-01 11:05 ` Mark Wielaard
2024-02-01 14:42 ` Carlos O'Donell
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=1b65b9a1-2ae6-52f-c352-8ae2ba52ee24@redhat.com \
--to=josmyers@redhat.com \
--cc=jakub@redhat.com \
--cc=libc-alpha@sourceware.org \
/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).