optimizing predictable branches on x86

2008-02-25 Thread Nick Piggin
Hi list, gcc-4.3 appears to make quite heavy use of cmov to eliminate conditional branches on x86(-64) architecture, even for those branches that are determined to be predictable. The problem with this is that the data dependancy introduced by the cmov can restrict execution, wheras a predicted b

Re: optimizing predictable branches on x86

2008-02-26 Thread Nick Piggin
On Tuesday 26 February 2008 21:14, Jan Hubicka wrote: > Hi, > > > Core2 follows a similar pattern, although it's not seeing any > > slowdown in the "no deps, predictable, jmp" case like K8 does. > > > > Any comments? (please cc me) Should gcc be using conditional jumps > > more often eg. in the cas

Re: optimizing predictable branches on x86

2008-03-02 Thread Nick Piggin
On Wednesday 27 February 2008 03:06, J.C. Pizarro wrote: > Compiling and executing the code of Nick Piggin at > http://gcc.gnu.org/ml/gcc/2008-02/msg00601.html > > in my old Athlon64 Venice 3200+ 2.0 GHz, > 3 GiB DDR400, 32-bit kernel, gcc 3.4.6, i got > > $ gcc -O3 -falign

Re: [RFA] optimizing predictable branches on x86

2008-03-03 Thread Nick Piggin
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

Re: [RFA] optimizing predictable branches on x86

2008-03-03 Thread Nick Piggin
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