Skip to content

Commit

Permalink
[Thumb] Add support for tMUL in the compare instruction peephole opti…
Browse files Browse the repository at this point in the history
…mizer.

We also want to optimise tests like this: return a*b == 0.  The MULS
instruction is flag setting, so we don't need the CMP instruction but can
instead branch on the result of the MULS. The generated instructions sequence
for this example was: MULS, MOVS, MOVS, CMP. The MOVS instruction load the
boolean values resulting from the select instruction, but these MOVS
instructions are flag setting and were thus preventing this optimisation. Now
we first reorder and move the MULS to before the CMP and generate sequence
MOVS, MOVS, MULS, CMP so that the optimisation could trigger. Reordering of the
MULS and MOVS is safe to do because the subsequent MOVS instructions just set
the CPSR register and don't use it, i.e. the CPSR is dead.

Differential Revision: https://reviews.llvm.org/D27990

llvm-svn: 292608
  • Loading branch information
Sjoerd Meijer committed Jan 20, 2017
1 parent 78bfa04 commit 2db2a94
Show file tree
Hide file tree
Showing 3 changed files with 392 additions and 169 deletions.

0 comments on commit 2db2a94

Please sign in to comment.