[Patch, ARM] Relax the restrictions on REG_SP under Thumb mode on ARMv8-A
authorJiong Wang <jiong.wang@arm.com>
Thu, 25 May 2017 09:40:07 +0000 (10:40 +0100)
committerJiong Wang <jiong.wang@arm.com>
Tue, 6 Jun 2017 14:02:25 +0000 (15:02 +0100)
commit5c8ed6a4a1d197658086e9175f820227ebffebec
treeb6ef8e1ea33ff81b4974059472cb9537d999e6d8
parentd24b756188bd63a422671a73e31af718007264ca
[Patch, ARM] Relax the restrictions on REG_SP under Thumb mode on ARMv8-A

  For Thumb mode, since ARMv8-A, REG_SP is allowed in most of the places in
Rd/Rt/Rt2 etc while it was disallowed before ARMv8-A, and was rejected through
the "reject_bad_reg" macro and several scattered checks.

  This patch only rejects REG_SP in "reject_bad_reg" and several related places
for legacy architectures before ARMv8-A. I have checked those affected instructions
, all of them qualify such relaxations.

  Testcases adjusted accordingly.
    * ld-sp-warn.d was written without .arch and without -march options passed.
      By default it assumes all architectures, so I deleted the REG_SP warning
      on ldrsb as it's supported on ARMv8-A.  There are actually quite a few
      seperate tests on other architectures, for example ld-sp-warn-v7.l etc.,
      so there the test for ldrsb on legacy architectures are still covered.
    * sp-pc-validations-bad-t has been extended to armv8-a.
    * strex-bad-t.d restricted on armv7-a.
    * Some new tests for REG_SP used as Rd/Rt etc added in sp-usage-thumb2-relax*.

gas/
* config/tc-arm.c (reject_bad_reg): Allow REG_SP on ARMv8-A.
(parse_operands): Allow REG_SP for OP_oRRnpcsp and OP_RRnpcsp on
ARMv8-A.
(do_co_reg): Allow REG_SP for Rd on ARMv8-A.
(do_t_add_sub): Likewise.
(do_t_mov_cmp): Likewise.
(do_t_tb): Likewise.
* testsuite/gas/arm/ld-sp-warn.l: Delete the warning on REG_SP as Rt for
ldrsb.
* testsuite/gas/arm/sp-pc-validations-bad-t-v8a.d: New test.
* testsuite/gas/arm/sp-pc-validations-bad-t-v8a.l: New test.
* testsuite/gas/arm/sp-pc-validations-bad-t.d: Specifies -march=armv7-a.
* testsuite/gas/arm/sp-pc-validations-bad-t.s: Remove ".arch armv7-a".
* testsuite/gas/arm/sp-usage-thumb2-relax-on-v7.d: New test.
* testsuite/gas/arm/sp-usage-thumb2-relax-on-v7.l: New test.
* testsuite/gas/arm/sp-usage-thumb2-relax-on-v8.d: New test.
* testsuite/gas/arm/sp-usage-thumb2-relax.s: New test.
* testsuite/gas/arm/strex-bad-t.d: Specifies -march=armv7-a.
12 files changed:
gas/ChangeLog
gas/config/tc-arm.c
gas/testsuite/gas/arm/ld-sp-warn.l
gas/testsuite/gas/arm/sp-pc-validations-bad-t-v8a.d [new file with mode: 0644]
gas/testsuite/gas/arm/sp-pc-validations-bad-t-v8a.l [new file with mode: 0644]
gas/testsuite/gas/arm/sp-pc-validations-bad-t.d
gas/testsuite/gas/arm/sp-pc-validations-bad-t.s
gas/testsuite/gas/arm/sp-usage-thumb2-relax-on-v7.d [new file with mode: 0644]
gas/testsuite/gas/arm/sp-usage-thumb2-relax-on-v7.l [new file with mode: 0644]
gas/testsuite/gas/arm/sp-usage-thumb2-relax-on-v8.d [new file with mode: 0644]
gas/testsuite/gas/arm/sp-usage-thumb2-relax.s [new file with mode: 0644]
gas/testsuite/gas/arm/strex-bad-t.d