On Sun, May 20, 2012 at 10:19 AM, Jakub Jelinek <ja...@redhat.com> wrote: > On Sun, May 20, 2012 at 10:04:26AM -0700, H.J. Lu wrote: >> rdrand<mode>_1 must be marked with unspec_volatile since it returns >> a different value every time. OK for trunk, 4.7 and 4.6? > > A testcase for this would be nice (runtime is not possible, since the > RNG in theory could return the same value twice, but scanning assembly > for a particular number of the rdrand insns would be nice). >
For unsigned int number = 0; volatile int result = 0; for (register int i = 0; i < 4; ++i) { result = _rdrand32_step(&number); printf("%d: %d\n", result, number); } the issue isn't about number of rdrand insns. As long as it isn't hoisted out of the loop, one rdrand insn is OK. I don't know how to scan for inside or outside of loop. -- H.J.