On Sun, May 20, 2012 at 10:37:13AM -0700, H.J. Lu wrote: > 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); > }
Try it without the loop, unroll it by hand, see if without the patch the rdrand insns are still CSEd together? Jakub