Re: [mpm@selenic.com: Re: buggy ia64_fls() ? (was Re: /dev/random problem on 2.6.12-rc1)]

From: Grant Grundler <iod00d_at_hp.com>
Date: 2005-04-09 10:46:03
On Fri, Apr 08, 2005 at 04:15:43PM -0700, Matt Mackall wrote:
> > static inline int
> > fls (int x)
> > {
> > 	if (!x)
> > 		return 0;
> > 	return ia64_fls((unsigned int) x) + 1;
> > }
> 
> I was trying desperately to avoid the branch, as I understand there
> are issues there on IA64. 

ia64 will inline this routine (no return branch) and the "if ()" case
will be predicated (which is very efficient).

parisc/et al pay a penalty for un-/mis-predicted branches.
But not as bad a cache miss by a long shot.
Adding "likely()" (or unlikely as approrpiate) can help
mitigate where the compiler doesn't pick the right thing.

grant
-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Fri Apr 8 20:45:27 2005

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:37 EST