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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Thanks,
	Manuel Lauss


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux