Re: [PATCH 2/7] PowerPC: add unlikely() to BUG_ON()

2 messages, 2 authors, 2011-01-28 · open the first message on its own page

Re: [PATCH 2/7] PowerPC: add unlikely() to BUG_ON()

From: Andreas Schwab <hidden>
Date: 2011-01-28 10:14:39

"David Laight" [off-list ref] writes:
Also, as (I think) in some of the generated code quoted,
use of __builtin_expect() with a boolean expression can
force some versions of gcc to generate the integer
value of the expression
That's more likely a side effect of the definition of likely/unlikely:
they expand to !!(x).

Andreas.

-- 
Andreas Schwab, schwab@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."

Re: [PATCH 2/7] PowerPC: add unlikely() to BUG_ON()

From: Coly Li <hidden>
Date: 2011-01-28 10:36:21

On 2011年01月28日 18:14, Andreas Schwab Wrote:
"David Laight"[off-list ref]  writes:
quoted
Also, as (I think) in some of the generated code quoted,
use of __builtin_expect() with a boolean expression can
force some versions of gcc to generate the integer
value of the expression
That's more likely a side effect of the definition of likely/unlikely:
they expand to !!(x).
It seems whether or not using unlikely() inside arch implemented BUG_ON() is arch dependent. Maybe a reasonable method 
to use BUG_ON() is,
1) do not explicitly use unlikely() when using macro BUG_ON().
2) whether or not using unlikely() inside BUG_ON(), it depends on the implementation of BUG_ON(), including arch 
implementation.

So from current feed back, doing "unlikely() optimization" here doesn't make anything better.

Thanks for all of your feed back :-)

-- 
Coly Li
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help