This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] rs6000: Add a builtin to read the time base register on PowerPC


On some systems the timebase runs at a rather low frequency, say 20MHz.
This test will spuriously fail there. Waste a million CPU cycles before
reading TB the second time?

Waste said million cycles portably by calling sched_yield()? (Available only on POSIX systems. :)

I was thinking more along the lines of


	int j;
	for (j = 0; j < 1000000; j++)
		asm("" : : "r"(j));

which is more portable (and a lot more predictable).


Segher



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]