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 09:08:08AM +0100, Manuel Lauss wrote:

> > 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.

Yes.  See GCC documentation.  It's used all over place in the kernel for
optimizations.  In some occasions gcc is not able to determine the
constness of an expression, so the code should better prepared to handle
a 0 return value.  Another interesting property of __buitin_const_p() is
that side effects don't matter, that is for example

  __buitin_const_p(expr) && (expr)

will only execute any sideeffects the expression expr may have once which
is extremly handy in macro.

  Ralf


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

  Powered by Linux