[PATCH] powerpc: optimise WARN_ON()
Segher Boessenkool
segher at kernel.crashing.org
Sun Aug 18 22:01:35 AEST 2019
On Sat, Aug 17, 2019 at 09:04:42AM +0000, Christophe Leroy wrote:
> Unlike BUG_ON(x), WARN_ON(x) uses !!(x) as the trigger
> of the t(d/w)nei instruction instead of using directly the
> value of x.
>
> This leads to GCC adding unnecessary pair of addic/subfe.
And it has to, it is passed as an "r" to an asm, GCC has to put the "!!"
value into a register.
> By using (x) instead of !!(x) like BUG_ON() does, the additional
> instructions go away:
But is it correct? What happens if you pass an int to WARN_ON, on a
64-bit kernel?
(You might want to have 64-bit generate either tw or td. But, with
your __builtin_trap patch, all that will be automatic).
Segher
More information about the Linuxppc-dev
mailing list