ARM patch: optimize consecutive Thumb comparisons, PR 41514
Richard Earnshaw
rearnsha@arm.com
Thu Apr 15 14:59:00 GMT 2010
On Tue, 2010-03-30 at 13:18 +0100, Bernd Schmidt wrote:
> Since Thumb mode conditional branches are represented as cbranchsi
> patterns, none of the mechanisms for optimizing multiple comparisons of
> the same arguments work for the Thumb. Attached is a simple patch that
> in the cbranchsi4_insn output code looks at the previous insn and
> determines if it's also a cbranch with the same comparison. If so, we
> can omit the compare.
>
> I wouldn't necessarily disagree with anyone who thought this was a bit
> crude; for one thing we overestimate the size of optimized cbranch
> insns. The alternative I see is to add another cbranch instruction
> pattern that does not output the compare and look for opportunities to
> use it in arm_reorg.
>
> Will test on arm-eabi{,mthumb} overnight (it takes forever). Ok for
> 4.6, or should I use a different approach?
>
>
> Bernd
I can't immediately think of a better way (and indeed, this is
essentially what is done generically for CC1 targets, where there is a
similar loss of accounting). It wouldn't be the only place where we
estimate more bytes than are finally needed.
OK
R.
More information about the Gcc-patches
mailing list