From: Jonathan Wakely <jwakely@redhat.com>
To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: [committed] libstdc++: Add [[unlikely]] attributes to std::random_device routines
Date: Fri, 5 Nov 2021 18:17:39 +0000 [thread overview]
Message-ID: <20211105181739.2245825-1-jwakely@redhat.com> (raw)
Tested x86+64-linux, pushed to trunk.
libstdc++-v3/ChangeLog:
* src/c++11/random.cc (__x86_rdrand, __x86_rdseed): Add
[[unlikely]] attribute.
---
libstdc++-v3/src/c++11/random.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libstdc++-v3/src/c++11/random.cc b/libstdc++-v3/src/c++11/random.cc
index 55a73c51fca..4b88818646f 100644
--- a/libstdc++-v3/src/c++11/random.cc
+++ b/libstdc++-v3/src/c++11/random.cc
@@ -97,7 +97,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
unsigned int retries = 100;
unsigned int val;
- while (__builtin_ia32_rdrand32_step(&val) == 0)
+ while (__builtin_ia32_rdrand32_step(&val) == 0) [[__unlikely__]]
if (--retries == 0)
std::__throw_runtime_error(__N("random_device: rdrand failed"));
@@ -113,7 +113,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
unsigned int retries = 100;
unsigned int val;
- while (__builtin_ia32_rdseed_si_step(&val) == 0)
+ while (__builtin_ia32_rdseed_si_step(&val) == 0) [[__unlikely__]]
{
if (--retries == 0)
{
--
2.31.1
reply other threads:[~2021-11-05 18:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20211105181739.2245825-1-jwakely@redhat.com \
--to=jwakely@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=libstdc++@gcc.gnu.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).