This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

ARM patch: optimize consecutive Thumb comparisons, PR 41514


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

Attachment: thumb-41514.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]