On Tuesday 04 March 2008 00:01, Jan Hubicka wrote: > > On Monday 03 March 2008 22:38, Jan Hubicka wrote:
> > 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. Yes, it is used for multiple conditions like that. I would also like it to work nicely for: if (likely(test1) lop unlikely(test2)) It may seem unusual, but I have used it before, and also often the __builtin_expect is hidden inside macros/inlines.