Tim Prince <TimothyPrince@sbcglobal.net> 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