This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCHv2] PowerPC - Add a faster way to read the Time Base register
- From: Richard Henderson <rth at twiddle dot net>
- To: Tulio Magno Quites Machado Filho <tuliom at linux dot vnet dot ibm dot com>
- Cc: libc-alpha at sourceware dot org, ryan dot arnold at gmail dot com
- Date: Wed, 22 Feb 2012 11:22:05 -0800
- Subject: Re: [PATCHv2] PowerPC - Add a faster way to read the Time Base register
- Authentication-results: mr.google.com; spf=pass (google.com: domain of rth7680@gmail.com designates 10.50.178.38 as permitted sender) smtp.mail=rth7680@gmail.com; dkim=pass header.i=rth7680@gmail.com
- References: <20120215195109.GB3592@linux.vnet.ibm.com> <1329932962-8962-1-git-send-email-tuliom@linux.vnet.ibm.com>
On 02/22/12 09:49, Tulio Magno Quites Machado Filho wrote:
> + __ppc_timebase __tb;
> + __asm__ volatile (
> + "mfspr %[tb], 268\n"
> + : [tb]"=r" (__tb)
> + : );
> + return __tb;
> +}
> +#else /* not __powerpc64__ */
> +static inline __ppc_timebase
> +__ppc_get_timebase (void)
> +{
> + register unsigned long __tbu, __tbl, __tmp; \
> + __asm__ volatile (
> + "0:\n"
> + "mftbu %[tbu]\n"
> + "mftbl %[tbl]\n"
> + "mftbu %[tmp]\n"
> + "cmpw %[tbu], %[tmp]\n"
> + "bne- 0b\n"
> + : [tbu]"=r" (__tbu), [tbl]"=r" (__tbl), [tmp]"=r" (__tmp)
The only comment I have is that there's little point in using __ names for
the variables if the assembler labels are still in the user's namespace.
I'd suggest dropping the assembler labels and using %[0-9]; these asm blocks
are small enough that it may even be easier to read that way.
Otherwise the patch looks good.
r~