http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54419

--- Comment #7 from Jack Howarth <howarth at nitro dot med.uc.edu> 2012-08-31 
15:40:25 UTC ---
Would the approach used in the proposed linux kernel patch be feasible?

+    /* RDRAND sets carry bit on success, otherwise we should try
+     * again. */
+    movl    $0x10, %ecx
+2:
+    /* rdrand %eax */
+    .byte    0x0f, 0xc7, 0xf0
+    jc    4f
+    loop    2b
+
+    /* Fall through: if RDRAND is supported but fails, use RDTSC,
+     * which is guaranteed to be supported. */
+3:
+    rdtsc
+    shll    $0xc, %eax
+4:
+    /* Maximum offset at 64mb to be safe */

Since rdrand is only supported on Ivy Bridge processors, shouldn't
src/c++11/random.cc have a fall through using rdtsc in case the processor
doesn't support rdrand?

Reply via email to