The define_memory_constraint allows for the address operand to be reloaded into a base register. However, for the constraints 'Us<' and 'Us>', which are used for matching 'push' and 'pop' instructions moving the address into a base register is not helpful. The constraints then should be define_constraint, not define_memory_constraint.
Similarly the Usd constraint, used for generating small data area memory accesses, can't have its operand loaded into a register as the relocation for small data area symbols only works within ld/st instructions. gcc/ChangeLog: * config/arc/constraints.md (Usd): Convert to define_constraint. (Us<): Likewise. (Us>): Likewise. --- gcc/ChangeLog.NPS400 | 7 +++++++ gcc/config/arc/constraints.md | 18 +++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/gcc/ChangeLog.NPS400 b/gcc/ChangeLog.NPS400 index 71463df..5d1533c 100644 --- a/gcc/ChangeLog.NPS400 +++ b/gcc/ChangeLog.NPS400 @@ -1,3 +1,10 @@ +2016-03-01 Joern Rennecke <joern.renne...@embecosm.com> + Andrew Burgess <andrew.burg...@embecosm.com> + + * config/arc/constraints.md (Usd): Convert to define_constraint. + (Us<): Likewise. + (Us>): Likewise. + 2016-02-01 Andrew Burgess <andrew.burg...@embecosm.com> * config/arc/arc.md (*loadqi_update): Replace use of 'rI' diff --git a/gcc/config/arc/constraints.md b/gcc/config/arc/constraints.md index 668b60a..b6954ad 100644 --- a/gcc/config/arc/constraints.md +++ b/gcc/config/arc/constraints.md @@ -269,11 +269,15 @@ (and (match_code "mem") (match_test "compact_store_memory_operand (op, VOIDmode)"))) -(define_memory_constraint "Usd" - "@internal - A valid _small-data_ memory operand for ARCompact instructions" - (and (match_code "mem") - (match_test "compact_sda_memory_operand (op, VOIDmode)"))) +; Don't use define_memory_constraint here as the relocation patching +; for small data symbols only works within a ld/st instruction and +; define_memory_constraint may result in the address being calculated +; into a register first. +(define_constraint "Usd" + "@internal + A valid _small-data_ memory operand for ARCompact instructions" + (and (match_code "mem") + (match_test "compact_sda_memory_operand (op, VOIDmode)"))) (define_memory_constraint "Usc" "@internal @@ -283,7 +287,7 @@ ;; ??? the assembler rejects stores of immediates to small data. (match_test "!compact_sda_memory_operand (op, VOIDmode)"))) -(define_memory_constraint "Us<" +(define_constraint "Us<" "@internal Stack pre-decrement" (and (match_code "mem") @@ -291,7 +295,7 @@ (match_test "REG_P (XEXP (XEXP (op, 0), 0))") (match_test "REGNO (XEXP (XEXP (op, 0), 0)) == SP_REG"))) -(define_memory_constraint "Us>" +(define_constraint "Us>" "@internal Stack post-increment" (and (match_code "mem") -- 2.6.4