------- Comment #2 from ubizjak at gmail dot com 2007-03-09 18:21 ------- No, this is not a target problem. I have traced the problem down to reload_cse_simplify(), where insn that loads flags (either test or sahf) gets cleared. This is highly suspicious part of code (why value is set to 0 ?):
if (!count && reload_cse_noop_set_p (body)) { rtx value = SET_DEST (body); if (REG_P (value) && ! REG_FUNCTION_VALUE_P (value)) value = 0; delete_insn_and_edges (insn); return; } So, reload_cse_noop_set_p() through rtx_equal_for_cse_lib_p() finds many copies of: (set (reg:CCNO 17 flags) (compare:CCNO (and:SI (zero_extract:SI (reg:HI 0 ax [73]) (const_int 8 [0x8]) (const_int 8 [0x8])) (const_int 4 [0x4])) (const_int 0 [0x0]))) And since postreload CSE pass thinks it can copy them from previous flag register (neglecting the fact that ax is changed in a preceeding insn), it clears all but the first two occurences of flags loading insn. Following this, second postreload CSE pass removes also fnstsw instructions. -- ubizjak at gmail dot com changed: What |Removed |Added ---------------------------------------------------------------------------- Component|target |rtl-optimization Summary|Problem with -funroll-all- |Problem with -funroll-all- |loops |loops (postreload CSE | |problems) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31101