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

2012-09-04 Thread Segher Boessenkool
For things that do mftb with high frequency, maybe you should also add a builtin that does just an mftb, i.e. returns a 32-bit result on 32-bit implementations. Are you thinking in a function that returns only the TBL? On 32-bit, just TBL; on 64-bit, the whole TB (there is no machine instr

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

2012-09-04 Thread David Edelsohn
On Wed, Aug 29, 2012 at 3:09 PM, Segher Boessenkool wrote: >>> For things that do mftb with high frequency, maybe you should also add a >>> builtin that does just an mftb, i.e. returns a 32-bit result on 32-bit >>> implementations. >> >> Are you thinking in a function that returns only the TBL? >

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

2012-08-29 Thread Segher Boessenkool
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, alre

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

2012-08-29 Thread Tulio Magno Quites Machado Filho
Segher Boessenkool writes: For things that do mftb with high frequency, maybe you should also add a builtin that does just an mftb, i.e. returns a 32-bit result on 32- bit implementations. Are you thinking in a function that returns only the TBL? On 32-bit, just TBL; on 64-bit, the whole

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

2012-08-29 Thread Hans-Peter Nilsson
On Wed, 29 Aug 2012, Michael Meissner wrote: > On Wed, Aug 29, 2012 at 01:56:05PM -0400, Hans-Peter Nilsson wrote: > > On Wed, 29 Aug 2012, Segher Boessenkool wrote: > > > On some systems the timebase runs at a rather low frequency, say 20MHz. > > > This test will spuriously fail there. Waste a mi

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

2012-08-29 Thread Segher Boessenkool
For things that do mftb with high frequency, maybe you should also add a builtin that does just an mftb, i.e. returns a 32-bit result on 32- bit implementations. Are you thinking in a function that returns only the TBL? On 32-bit, just TBL; on 64-bit, the whole TB (there is no machine instr

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

2012-08-29 Thread Segher Boessenkool
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

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

2012-08-29 Thread Tulio Magno Quites Machado Filho
Hi Segher, Segher Boessenkool writes: Add __builtin_ppc_get_timebase to read the time base register on PowerPC. This is required for applications that measure time at high frequencies with high precision that can't afford a syscall. For things that do mftb with high frequency, maybe you sh

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

2012-08-29 Thread Michael Meissner
On Wed, Aug 29, 2012 at 01:56:05PM -0400, Hans-Peter Nilsson wrote: > On Wed, 29 Aug 2012, Segher Boessenkool wrote: > > 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 tim

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

2012-08-29 Thread Hans-Peter Nilsson
On Wed, 29 Aug 2012, Segher Boessenkool wrote: > > +++ b/gcc/testsuite/gcc.target/powerpc/ppc-get-timebase.c > > @@ -0,0 +1,22 @@ > > +/* { dg-do run { target { powerpc*-*-* } } } */ > > + > > +/* Test if __builtin_ppc_get_timebase() is compatible with the current > > + processor and if it's chan

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

2012-08-29 Thread Andrew Pinski
On Wed, Aug 29, 2012 at 6:56 AM, Tulio Magno Quites Machado Filho wrote: > Add __builtin_ppc_get_timebase to read the time base register on PowerPC. > This is required for applications that measure time at high frequencies > with high precision that can't afford a syscall. > > [gcc] > 2012-08-29 T

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

2012-08-29 Thread Segher Boessenkool
Hi Tulio, Add __builtin_ppc_get_timebase to read the time base register on PowerPC. This is required for applications that measure time at high frequencies with high precision that can't afford a syscall. For things that do mftb with high frequency, maybe you should also add a builtin that

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

2012-08-29 Thread Tulio Magno Quites Machado Filho
Add __builtin_ppc_get_timebase to read the time base register on PowerPC. This is required for applications that measure time at high frequencies with high precision that can't afford a syscall. [gcc] 2012-08-29 Tulio Magno Quites Machado Filho * config/rs6000/rs6000-builtin.def: Add __b