This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] optimizing predictable branches on x86

> On Monday 03 March 2008 22:38, Jan Hubicka wrote:
> > Hi,
> > I had to tweak the testcase a bit to not compute minimum: GCC optimizes
> > this early into MIN_EXPR throwing away any profile information.  If we
> > get serious here we can maintain it via histogram, but I am not sure it
> > is worth the effort at least until IL is sanitized and expansion cleaned
> > up with tupple branch.
> >
> > I also had to fix bug in branch prediction ignoring __builtin_expect of
> > any early inlined function and update your testcase to not use
> > __buliltin_expect in predictable case.
> I guess you mean, not to use it in the _unpredictable_ case?

Sure ;)
> I hope so too. For the kernel we have some parts where
> __builtin_expect is used quite a lot and noticably helps, and could
> help even more if we cut down the use of cmov too. I guess on
> architectures with even more predictated instructions it could be
> even more useful too.

Looking at kernel's __builtin_expect usage, I think we ought to do a lot
better on taking the hints than we do now.  In particular we should
be able to derrive more from
 likely (test1||test2) and likely (test1&&test2)
and similar cases.  I will try to prepare patch for this later too.

I am glad to hear that __builtin_expect does useful job for you and
would be interested knowing cases where it does not.

> Thanks,
> Nick

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]