arm: correct constraints on movsi_compare0 [PR91913]
commit1cad5e89a9e1b4ffa47bc6e3551643b342f6cfe8
authorRichard Earnshaw <rearnsha@arm.com>
Mon, 10 Feb 2020 15:37:23 +0000 (10 15:37 +0000)
committerRichard Earnshaw <rearnsha@arm.com>
Mon, 10 Feb 2020 15:53:12 +0000 (10 15:53 +0000)
tree467db9181b039c80af070cadd4f7a45a013e83bf
parent339ab27a7de411ec69d35ccb1f3c5b0877367660
arm: correct constraints on movsi_compare0 [PR91913]

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/ChangeLog
gcc/config/arm/arm.md