public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-4953] libstdc++: Add [[unlikely]] attributes to std::random_device routines
@ 2021-11-05 18:15 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2021-11-05 18:15 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

https://gcc.gnu.org/g:2627e3b7fd820876bc45c99be48aea05351d210a

commit r12-4953-g2627e3b7fd820876bc45c99be48aea05351d210a
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Nov 5 12:18:52 2021 +0000

    libstdc++: Add [[unlikely]] attributes to std::random_device routines
    
    libstdc++-v3/ChangeLog:
    
            * src/c++11/random.cc (__x86_rdrand, __x86_rdseed): Add
            [[unlikely]] attribute.

Diff:
---
 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)
 	    {


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-05 18:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-05 18:15 [gcc r12-4953] libstdc++: Add [[unlikely]] attributes to std::random_device routines Jonathan Wakely

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).