arm: Improve handling of relocations with small offsets with -mpure-code on v6m ...
authorChristophe Lyon <christophe.lyon@linaro.org>
Mon, 2 Nov 2020 07:34:50 +0000 (07:34 +0000)
committerChristophe Lyon <christophe.lyon@linaro.org>
Mon, 2 Nov 2020 07:34:50 +0000 (07:34 +0000)
commitc3c3e2c9e88e25a410a2fe089782b094e911bb39
treecc599d3f1f27e0a044f7d9ac74490aacb5131139
parent4d9af90d6a216822fe117337fb9836ba656dc3af
arm: Improve handling of relocations with small offsets with -mpure-code on v6m (PR96770)

With -mpure-code on v6m (thumb-1), we can use small offsets with
upper/lower relocations to avoid the extra addition of the
offset.

This patch accepts expressions symbol+offset as legitimate constants
when the literal pool is disabled, making sure that the offset is
within the range supported by thumb-1 [0..255] as described in the
AAELF32 documentation.

It also makes sure that thumb1_movsi_insn emits an error in case we
try to use it with an unsupported RTL construct.

2020-09-28  Christophe Lyon  <christophe.lyon@linaro.org>

gcc/
PR target/96770
* config/arm/arm.c (thumb_legitimate_constant_p): Accept
(symbol_ref + addend) when literal pool is disabled.
(arm_valid_symbolic_address_p): Add support for thumb-1 without
MOVT/MOVW.
* config/arm/thumb1.md (*thumb1_movsi_insn): Accept (symbol_ref +
addend) in the pure-code alternative.

gcc/testsuite/
PR target/96770
* gcc.target/arm/pure-code/pr96770.c: New test.
gcc/config/arm/arm.c
gcc/config/arm/thumb1.md
gcc/testsuite/gcc.target/arm/pure-code/pr96770.c [new file with mode: 0644]