From: Ralf Baechle <ralf@linux-mips.org>
To: Manuel Lauss <mano@roarinelk.homelinux.net>
Cc: David Daney <ddaney@caviumnetworks.com>, LMO <linux-mips@linux-mips.org>
Subject: Re: [PATCH v2] Alchemy: cpu feature override constants.
Date: Wed, 26 Nov 2008 08:34:35 +0000 [thread overview]
Message-ID: <20081126083435.GA10716@linux-mips.org> (raw)
In-Reply-To: <20081126080808.GA13230@roarinelk.homelinux.net>
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
next prev parent reply other threads:[~2008-11-26 8:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-25 23:12 [PATCH v2] Alchemy: cpu feature override constants Manuel Lauss
2008-11-25 23:23 ` David Daney
2008-11-26 5:50 ` Manuel Lauss
2008-11-26 7:51 ` Ralf Baechle
2008-11-26 8:08 ` Manuel Lauss
2008-11-26 8:34 ` Ralf Baechle [this message]
2008-11-26 12:48 ` Sergei Shtylyov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081126083435.GA10716@linux-mips.org \
--to=ralf@linux-mips.org \
--cc=ddaney@caviumnetworks.com \
--cc=linux-mips@linux-mips.org \
--cc=mano@roarinelk.homelinux.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox