2018-11-07 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / g++.dg / other / pr59492.C
blob92694ae6dde23099bca4bb2ebad1d65a98a4e789
1 // { dg-do assemble { target { { i?86-*-* x86_64-*-* } && fpic } } }
2 // { dg-options "-mx32 -fPIC" }
3 // { dg-require-ifunc "" }
4 // { dg-require-effective-target maybe_x32 }
5 // { dg-require-effective-target rdrand }
7 void
8 __throw_runtime_error(const char*) __attribute__((__noreturn__));
9 unsigned int
10 __attribute__ ((target("rdrnd")))
11 __x86_rdrand(void)
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;