On 10/02/2020 15:51, Richard Earnshaw wrote:

The peephole that detects a mov of one register to another followed by
a comparison of the original register against zero is only used in Arm
state; but the instruction that matches this is generic to all 32-bit
compilation states.  That instruction lacks support for SP which is
permitted in Arm state, but has restrictions in Thumb2 code.

This patch fixes the problem by allowing SP when in ARM state for all
registers; in Thumb state it allows SP only as a source when the
register really is copied to another target.

        * config/arm/arm.md (movsi_compare0): Allow SP as a source register
        in Thumb state and also as a destination in Arm state.  Add T16
        variants.
---
  gcc/config/arm/arm.md | 11 ++++++++---
  1 file changed, 8 insertions(+), 3 deletions(-)


I've now backported this (along with Jakub's test) to gcc-8 and gcc-9.

R.

Reply via email to