Re: option to control code straightening

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

 



Ian Lance Taylor wrote:
Tim Prince <TimothyPrince@xxxxxxxxxxxxx> writes:

Is there an option in gcc 4.4 or 4.5 to avoid code straightening in
loops with conditionals or select?  Intel Core i7 Loop Stream Detector
seems to give up when the code path has more than minimum number of
branches.

Code straightening is normally a purely beneficial optimization.  That
said, gcc 4.5 is much better than 4.4 at avoiding having more than four
jumps in a 16 byte span, which I think is what is required to avoid
branch mispredictions on Intel/AMD processors.

You may be able to avoid some code straightening using
-fno-thread-jumps.

If this does not help, then I recommend that you file a bug report with
a standalone example showing a case where mainline gcc generates
suboptimal code.  See http://gcc.gnu.org/bugs.html .  Thanks.

Ian
This does make the difference for one of the cases I was looking at, a switch where the same branch is taken repeatedly. I agree, the code straightening is better consistently for the older Intel CPUs, where the Loop Stream Detector isn't as effective.
Thanks.

[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