[ARM] Fix Coprocessor instructions availability
authorThomas Preud'homme <thomas.preudhomme@arm.com>
Wed, 1 Nov 2017 09:49:13 +0000 (09:49 +0000)
committerThomas Preud'homme <thomas.preudhomme@arm.com>
Wed, 1 Nov 2017 09:49:13 +0000 (09:49 +0000)
commit4070243b5c1f66a36dd43a7b722e991ac9fc40e1
treea9d44d584124c23d2de53366fa7d18ff523f5126
parent3988aed54acce3c682a877b51b0e09cce1079e81
[ARM] Fix Coprocessor instructions availability

A few coprocessor instructions introduced in ARMv2 are currently
accepted by GAS when targeting ARMv1 due to a typo in the code. This
patch fixes the issue and introduce a more fine grained testing for
coprocessor instructions availability. Coprocessor instructions are
grouped as follows:

* ARM coprocessor instructions introduced in ARMv2
  Includes: ldc, stc, mcr, mrc, cdp, ldcl, stcl
  Guarded by: ARM_EXT_V2
  Tests: copro-arm_v2plus-arm_v*.d

* ARM coprocessor instructions introduced in ARMv5
  Includes: ldc2, ldc2l, stc2, stc2l, cdp2, mcr2, mrc2
  Guarded by: ARM_EXT_V5
  Tests: copro-arm_v5plus-arm_v*.d

* ARM coprocessor instructions introduced in ARMv5TE
  Includes: mcrr, mrrc
  Guarded by: ARM_EXT_V5E
  Tests: copro-arm_v5teplus-arm_v*.d

* ARM coprocessor instructions introduced in ARMv6
  Includes: mcrr2, mrrc2
  Guarded by: ARM_EXT_V6
  Tests: copro-arm_v6plus-arm_v*.d

* Thumb coprocessor instructions introduced in ARMv6T2
  Includes: ldc, ldcl, stc, stcl, mcr, mrc, mcrr, mrrc, cdp, ldc2,
  ldc2l, stc2, stc2l, cdp2, mcr2, mrc2, mcrr2, mrrc2
  Guarded by: ARM_EXT_V6T2
  Tests: copro-thumb_v6t2plus-thumb_v*.d

For each of these groups, at least 2 tests are performed:
* instructions are not available in earlier architecture
* instructions are available in architecture where they were introduced
More tests need to be performed when instructions in a group span
several assembly files.

Note that an instruction in the original coprocessor testcase is
changed to unified syntax to allow the testcase to be assembled for ARM
and Thumb state. Correct processing of legacy syntax is covered in other
testcases.

2017-11-01  Thomas Preud'homme  <thomas.preudhomme@arm.com>

gas/
* config/tc-arm.c (arm_ext_v2): Define to ARM_EXT_V2 feature bit.
* testsuite/gas/arm/copro.s: Split into ...
* testsuite/gas/arm/copro-arm_v2plus-thumb_v6t2plus.s: This while
changing it to unified syntax and ...
* testsuite/gas/arm/copro-arm_v5plus-thumb_v6t2plus.s: this and ...
* testsuite/gas/arm/copro-arm_v5teplus-thumb_v6t2plus.s: This and ...
* testsuite/gas/arm/copro-arm_v6plus-thumb_v6t2plus.s: This.
* testsuite/gas/arm/copro.d: Split into ...
* testsuite/gas/arm/copro-arm_v2plus-arm_v2.d: This but target ARMv2
and ...
* testsuite/gas/arm/copro-arm_v5plus-arm_v5.d: this but target ARMv5
and ...
* testsuite/gas/arm/copro-arm_v5teplus-arm_v5te.d: This but target
ARMv5TE and ...
* testsuite/gas/arm/copro-arm_v6plus-arm_v6.d: This but target ARMv6.
* testsuite/gas/arm/copro-arm_v2plus-arm_v1.d: New testcase.
* testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v4t-1.d: New testcase.
* testsuite/gas/arm/copro-arm_v2plus-thumb_v6t2plus-unavail.l: Expected
errors for the above two testcases.
* testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v6t2-1.d: New testcase.
* testsuite/gas/arm/copro-arm_v5plus-arm_v4.d: New testcase.
* testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v4t-2.d: New testcase.
* testsuite/gas/arm/copro-arm_v5plus-thumb_v6t2plus-unavail.l:
Expected errors for the above two testcases.
* testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v6t2-2.d: New testcase.
* testsuite/gas/arm/copro-arm_v5teplus-arm_v5.d: New testcase.
* testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v4t-3.d: New testcase.
* testsuite/gas/arm/copro-arm_v5teplus-thumb_v6t2plus-unavail.l:
Expected errors for the above two testcases.
* testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v6t2-3.d: New testcase.
* testsuite/gas/arm/copro-arm_v6plus-arm_v5te.d: New testcase.
* testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v4t-4.d: New testcase.
* testsuite/gas/arm/copro-arm_v6plus-thumb_v6t2plus-unavail.l:
Expected errors for the above two testcases.
* testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v6t2-4.d: New testcase.
28 files changed:
gas/ChangeLog
gas/config/tc-arm.c
gas/testsuite/gas/arm/copro-arm_v2plus-arm_v1.d [new file with mode: 0644]
gas/testsuite/gas/arm/copro-arm_v2plus-arm_v2.d [new file with mode: 0644]
gas/testsuite/gas/arm/copro-arm_v2plus-thumb_v6t2plus-unavail.l [new file with mode: 0644]
gas/testsuite/gas/arm/copro-arm_v2plus-thumb_v6t2plus.s [new file with mode: 0644]
gas/testsuite/gas/arm/copro-arm_v5plus-arm_v4.d [new file with mode: 0644]
gas/testsuite/gas/arm/copro-arm_v5plus-arm_v5.d [new file with mode: 0644]
gas/testsuite/gas/arm/copro-arm_v5plus-thumb_v6t2plus-unavail.l [new file with mode: 0644]
gas/testsuite/gas/arm/copro-arm_v5plus-thumb_v6t2plus.s [new file with mode: 0644]
gas/testsuite/gas/arm/copro-arm_v5teplus-arm_v5.d [new file with mode: 0644]
gas/testsuite/gas/arm/copro-arm_v5teplus-arm_v5te.d [new file with mode: 0644]
gas/testsuite/gas/arm/copro-arm_v5teplus-thumb_v6t2plus-unavail.l [new file with mode: 0644]
gas/testsuite/gas/arm/copro-arm_v5teplus-thumb_v6t2plus.s [new file with mode: 0644]
gas/testsuite/gas/arm/copro-arm_v6plus-arm_v5te.d [new file with mode: 0644]
gas/testsuite/gas/arm/copro-arm_v6plus-arm_v6.d [new file with mode: 0644]
gas/testsuite/gas/arm/copro-arm_v6plus-thumb_v6t2plus-unavail.l [new file with mode: 0644]
gas/testsuite/gas/arm/copro-arm_v6plus-thumb_v6t2plus.s [new file with mode: 0644]
gas/testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v4t-1.d [new file with mode: 0644]
gas/testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v4t-2.d [new file with mode: 0644]
gas/testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v4t-3.d [new file with mode: 0644]
gas/testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v4t-4.d [new file with mode: 0644]
gas/testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v6t2-1.d [new file with mode: 0644]
gas/testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v6t2-2.d [new file with mode: 0644]
gas/testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v6t2-3.d [new file with mode: 0644]
gas/testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v6t2-4.d [new file with mode: 0644]
gas/testsuite/gas/arm/copro.d [deleted file]
gas/testsuite/gas/arm/copro.s [deleted file]