On Fri, Dec 05, 2014 at 06:09:11PM -0600, Segher Boessenkool wrote: > On Fri, Dec 05, 2014 at 03:36:01PM -0700, Jeff Law wrote: > > Zhenqiang, can you look at what happens if you provide a pattern for > > 6+7+8 (probably via a define_and_split)? > > I tried this out yesterday. There are a few options (a bridge pattern > for 6+7+8, or one for 7+8). I went with 6+7+8. > > So the code combine is asked to optimise is > > 6 A = M > 7 T = A + B > 8 M = T > 9 C = cmp T, 0
... and combine will never combine a write to memory (8 here) into a later insn (see can_combine_p). So this won't ever fly. I see no reasonably simple way combine can be convinced to do this. There are various possible schemes to pull insn 9 to before 8, but when does this help and when does it hurt? It all depends on the target :-( Segher