arm: Fix -mpure-code support/-mslow-flash-data for armv8-m.base [PR94538]
authorChristophe Lyon <christophe.lyon@linaro.org>
Wed, 19 Aug 2020 09:02:21 +0000 (09:02 +0000)
committerChristophe Lyon <christophe.lyon@linaro.org>
Mon, 24 Aug 2020 09:08:30 +0000 (09:08 +0000)
commit259d072067997ab8f55afcf735c91b6740fd0425
treebf352a8395dda6acdf1098f669a4a69923478d3d
parentcdb2e365fc0dba2ee052827e5ca65234ca82d605
arm: Fix -mpure-code support/-mslow-flash-data for armv8-m.base [PR94538]

armv8-m.base (cortex-m23) has the movt instruction, so we need to
disable the define_split to generate a constant in this case,
otherwise we get incorrect insn constraints as described in PR94538.

We also need to fix the pure-code alternative for thumb1_movsi_insn
because the assembler complains with instructions like
movs r0, #:upper8_15:1234
(Internal error in md_apply_fix)
We now generate movs r0, 4 instead.

2020-08-24  Christophe Lyon  <christophe.lyon@linaro.org>

PR target/94538
gcc/
* config/arm/thumb1.md: Disable set-constant splitter when
TARGET_HAVE_MOVT.
(thumb1_movsi_insn): Fix -mpure-code
alternative.

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