diff options
author | Christophe Lyon <christophe.lyon@linaro.org> | 2020-11-02 07:31:22 +0000 |
---|---|---|
committer | Christophe Lyon <christophe.lyon@linaro.org> | 2020-11-02 07:31:22 +0000 |
commit | 4d9af90d6a216822fe117337fb9836ba656dc3af (patch) | |
tree | ba0dcb7edd4d81c1746dd136ae4e85e1e13c582d /gcc/config/arm/arm.c | |
parent | 590febb5f6624f78b36402a7c9a9c318978f1efa (diff) | |
download | gcc-4d9af90d6a216822fe117337fb9836ba656dc3af.zip gcc-4d9af90d6a216822fe117337fb9836ba656dc3af.tar.gz gcc-4d9af90d6a216822fe117337fb9836ba656dc3af.tar.bz2 |
arm: Avoid indirection with -mpure-code on v6m (PR96967)
With -mpure-code on v6m (thumb-1), to avoid a useless indirection when
building the address of a symbol, we want to consider SYMBOL_REF as a
legitimate constant. This way, we build the address using a series of
upper/lower relocations instead of loading the address from memory.
This patch also fixes a missing "clob" conds attribute for
thumb1_movsi_insn, needed because that alternative clobbers the flags.
2020-11-02 Christophe Lyon <christophe.lyon@linaro.org>
gcc/
PR target/96967
* config/arm/arm.c (thumb_legitimate_constant_p): Add support for
disabled literal pool in thumb-1.
* config/arm/thumb1.md (thumb1_movsi_symbol_ref): Remove.
(*thumb1_movsi_insn): Add support for SYMBOL_REF with -mpure-code.
gcc/testsuite
PR target/96967
* gcc.target/arm/pure-code/pr96767.c: New test.
Diffstat (limited to 'gcc/config/arm/arm.c')
-rw-r--r-- | gcc/config/arm/arm.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index dfadaca..d2387c3 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -9500,6 +9500,12 @@ thumb_legitimate_constant_p (machine_mode mode ATTRIBUTE_UNUSED, rtx x) || CONST_DOUBLE_P (x) || CONSTANT_ADDRESS_P (x) || (TARGET_HAVE_MOVT && GET_CODE (x) == SYMBOL_REF) + /* On Thumb-1 without MOVT/MOVW and literal pool disabled, + we build the symbol address with upper/lower + relocations. */ + || (TARGET_THUMB1 + && GET_CODE (x) == SYMBOL_REF + && arm_disable_literal_pool) || flag_pic); } |