blob: 632bb63244b36a62bd43c2565bfda4b87bea5bcf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
/* { dg-do compile } */
/* { dg-options "-O2 -march=core2" } */
unsigned int
__attribute__ ((target("arch=haswell")))
__x86_rdrand(void)
{
unsigned int retries = 100;
unsigned int val;
while (__builtin_ia32_rdrand32_step(&val) == 0)
if (--retries == 0)
return 0;
return val;
}
|