Setting branch probabilities manually

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi everybody,

After some google and gcc documentation browsing, I am in the position of turning to you for some help. Shortly, I am trying to set manually the branch probabilities with __builtin_expect(), but it seems to me that it doesn't take the probability I give into account, but it takes it at most as a hint (CPU: P4, gcc version: 3.3.2). For example, for a vector a[] with a[i] between 0 and 100, the following code achieves fast running times for param=0 and param=100 and slower for param=50 instead of growing linearly with param.

 for(i=0;i<n;i++)
   if(__builtin_expect(a[i]<param,0) )
     j++;
   else
     j--;

Anything I might have forgot (I compiled the code with -O3)? Any kernel patch/kernel option/gcc hidden option that would help this thing out?

Thanks,
Gabriel


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux