1 // { dg-do assemble { target { fpic } } }
2 // { dg-options "-mx32 -fPIC" }
3 // { dg-require-ifunc "" }
4 // { dg-require-effective-target maybe_x32 }
5 // { dg-require-effective-target rdrand }
6 
7 void
8 __throw_runtime_error(const char*) __attribute__((__noreturn__));
9 unsigned int
10 __attribute__ ((target("rdrnd")))
__x86_rdrand(void)11 __x86_rdrand(void)
12 {
13   unsigned int retries = 100;
14   unsigned int val;
15   while (__builtin_ia32_rdrand32_step(&val) == 0)
16     if (--retries == 0)
17       __throw_runtime_error(("random_device::__x86_rdrand(void)"));
18   return val;
19 }
20