This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] rs6000: Add a builtin to read the time base register on PowerPC
Point being, for simulator environments, you may not want the
loop that was suggested later. On the other hand, that might
not be an observable period, either.
I don't think looping a million times would be too slow for the
testsuite: there are many tests that do a lot more work than that,
already.
The worst case for hardware that I know of can take about 100
clock cycles for one timebase tick.
But how about this then, which only iterates much if the test
fails:
int
main (void)
{
uint64_t t = __builtin_ppc_get_timebase ();
int j;
for (j = 0; j < 1000000; j++)
if (t != __builtin_ppc_get_timebase ())
break;
return (j == 1000000);
}
Segher