[Top] [All Lists]

Re: [PATCH v2] Alchemy: cpu feature override constants.

To: Ralf Baechle <>
Subject: Re: [PATCH v2] Alchemy: cpu feature override constants.
From: Manuel Lauss <>
Date: Wed, 26 Nov 2008 09:08:08 +0100
Cc: David Daney <>, LMO <>
In-reply-to: <>
Original-recipient: rfc822;
References: <> <> <> <>
User-agent: Mutt/1.5.16 (2007-06-09)
On Wed, Nov 26, 2008 at 07:51:04AM +0000, Ralf Baechle wrote:
> On Wed, Nov 26, 2008 at 06:50:53AM +0100, Manuel Lauss wrote:
> > > The probe routines in cpu-probe.c should get at least some of that 
> > > correct. 
> > >  How about just overriding the things that cpu-probe.c doesn't get right?
> > 
> > CPU detection gets them all right, it's just that somehow GCC does not use
> > the information correctly;  i.e. in the __fls() case it blindly falls back
> > on the C version instead of using the asm macro with clz in it.  I scanned
> > a few callsites of __fls() and there's not 'clz' to be found anywhere.  With
> > this addition the clz is used and the binary is a _lot_ smaller.
> > 
> You should define all values as constants, as far as known.  GCC will
> then be able to use constant propagation and dead code elemination to
> optimize the code for a particular target system.
> The way fls() is written it will only use of CLZ if the expression
> cpu_has_mips_r is a constant, that is if the kernel is being built
> exclusivly for MIPS32 / MIPS64 revision 1 or higher.  The reason that

Ah, so the __builtin_constat_p() is a compiletime check as to whether a
given symbol is a constant or needs to be evaluated at runtime?  That
explains a lot.

        Manuel Lauss

<Prev in Thread] Current Thread [Next in Thread>