[PATCH, GAS/ARM] Fix Coprocessor instructions availability
Thomas Preudhomme
thomas.preudhomme@foss.arm.com
Mon Jul 10 13:25:00 GMT 2017
Hi,
Coprocessor instructions are currently accepted by GAS for a number of
target architecture when they are actually not available. In particular,
many coprocessor instructions are not available in ARMv8-A but are
currently accepted. Similarly, many are not available in ARMv1 but are
accepted for that architecture because of a typo in the ARMv2 feature
bit definition.
This patch changes availability of co-processor instructions to the
following:
* ARM coprocessor instructions introduced in ARMv2 available in ARMv8-A
Includes: ldc, stc, mcr, mrc
Guarded by: ARM_EXT_V2
Tests: copro-arm_v2plus-arm_v*.d
* ARM coprocessor instructions introduced in ARMv2 but not available in
ARMv8-A
Includes: cdp, ldcl, stcl
Guarded by: ARM_EXT2_CP1X8
Tests: copro-arm_v2_nov8a-arm_v*.d
* ARM coprocessor instructions introduced in ARMv5 but not available in
ARMv8-A
Includes: ldc2, ldc2l, stc2, stc2l, cdp2, mcr2, mrc2
Guarded by: ARM_EXT2_CP2X8
Tests: copro-arm_v5_nov8a-arm_v*.d
* ARM coprocessor instructions introduced in ARMv5TE available in
ARMv8-A
Includes: mcrr, mrrc
Guarded by: ARM_EXT_V5E
Tests: copro-arm_v5teplus-arm_v*.d
* ARM coprocessor instructions introduced in ARMv6 but not available in
ARMv8-A
Includes: mcrr2, mrrc2
Guarded by: ARM_EXT2_CP4X8
Tests: copro-arm_v6_nov8a-arm_v*.d
* Thumb coprocessor instructions introduced in ARMv6T2 available in
ARMv8-A
Includes: ldc, ldcl, stc, stcl, mcr, mrc, mcrr, mrrc
Guarded by: ARM_EXT_V6T2
Tests: copro-thumb_v6t2plus-thumb_v*.d
* ARM coprocessor instructions introduced in ARMv6T2 but not available
in ARMv8-A
Includes: cdp, ldc2, ldc2l, stc2, stc2l, cdp2, mcr2, mrc2, mcrr2,
mrrc2
Guarded by: ARM_EXT2_CPTX8
Tests: copro-thumb_v6t2_nov8a-thumb_v*.d
For each of these groups, at least 3 tests are performed:
* instructions are not available in earlier architecture
* instructions are available in architecture where they were introduced
* instructions are (not, depending on group) available in ARMv8-A
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.
ChangeLog entries are as follow:
*** include/ChangeLog ***
2017-06-30 Thomas Preud'homme <thomas.preudhomme@arm.com>
* opcode/arm.h (ARM_EXT2_CP1X8, ARM_EXT2_CP2X8, ARM_EXT2_CP4X8,
ARM_EXT2_CPTX8, ARM_AEXT2_V2, ARM_AEXT2_V3, ARM_AEXT2_V4, ARM_AEXT2_V5,
ARM_AEXT2_V6, ARM_AEXT2_V6T2, ARM_AEXT2_V7): New feature bit macros.
(ARM_AEXT2_V8AR, ARM_AEXT2_V8A, ARM_AEXT2_V8_1A,
ARM_AEXT2_V8_2A, ARM_AEXT2_V8_3A, ARM_AEXT2_V8M, ARM_AEXT2_V8M_MAIN,
ARM_AEXT2_V8M_MAIN_DSP, ARM_AEXT2_V8R): Move definitions after the
above.
(ARM_ARCH_V2, ARM_ARCH_V2S, ARM_ARCH_V3, ARM_ARCH_V3M, ARM_ARCH_V4xM,
ARM_ARCH_V4, ARM_ARCH_V4TxM, ARM_ARCH_V4T, ARM_ARCH_V5xM, ARM_ARCH_V5,
ARM_ARCH_V5TxM, ARM_ARCH_V5T, ARM_ARCH_V5TExP, ARM_ARCH_V5TE,
ARM_ARCH_V5TEJ, ARM_ARCH_V6, ARM_ARCH_V6K, ARM_ARCH_V6Z, ARM_ARCH_V6KZ,
ARM_ARCH_V6T2, ARM_ARCH_V6KT2, ARM_ARCH_V6ZT2, ARM_ARCH_V6KZT2,
ARM_ARCH_V6M, ARM_ARCH_V6SM, ARM_ARCH_V7, ARM_ARCH_V7A, ARM_ARCH_V7VE,
ARM_ARCH_V7R, ARM_ARCH_V7M, ARM_ARCH_V7EM): Add feature bit for
supported coprocessor instructions in corresponding architectures.
*** gas/ChangeLog ***
2017-07-03 Thomas Preud'homme <thomas.preudhomme@arm.com>
* config/tc-arm.c (arm_ext_v2): Define to ARM_EXT_V2 feature bit.
(arm_ext_cp1x8, arm_ext_cp2x8, arm_ext_cp4x8, arm_ext_cptx8): Define
feature sets.
(insns): Guard ldc, stc, mcr and mrc by arm_ext_cptx8 for Thumb state.
Guard cdp, ldcl and stcl by arm_ext_cp1x8 for ARM state and
arm_ext_cptx8 for Thumb state. Guard ldc2, ldc2l, stc2, stc2l,
cdp2, mcr2 and mrc2 by arm_ext_cp2x8 for ARM state and arm_ext_cptx8
for Thumb state. Guard mcrr2 and mrrc2 by arm_ext_cp4x8 for ARM
state and arm_ext_cptx8 for Thumb state.
* 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_v2_nov8a-thumb_v6t2_nov8a.s: this and ...
* testsuite/gas/arm/copro-arm_v5_nov8a-thumb_v6t2_nov8a.s: this and ...
* testsuite/gas/arm/copro-arm_v5teplus-thumb_v6t2plus.s: This and ...
* testsuite/gas/arm/copro-arm_v6_nov8a-thumb_v6t2_nov8a.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_v2_nov8a-arm_v2.d: This but target ARMv2
and ...
* testsuite/gas/arm/copro-arm_v5_nov8a-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_v6_nov8a-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_v2plus-arm_v8a.d: New testcase.
* testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v8a-1.d: New testcase.
* testsuite/gas/arm/copro-arm_v2_nov8a-arm_v1.d: New testcase.
* testsuite/gas/arm/copro-thumb_v6t2_nov8a-thumb_v4t-1.d: New testcase.
* testsuite/gas/arm/copro-arm_v2_nov8a-arm_v8a.d: New testcase.
* testsuite/gas/arm/copro-thumb_v6t2_nov8a-thumb_v8a-1.d: New testcase.
* testsuite/gas/arm/copro-arm_v2_nov8a-thumb_v6t2_nov8a-unavail.l:
Expected errors for the above four testcases.
* testsuite/gas/arm/copro-arm_v5_nov8a-arm_v4.d: New testcase.
* testsuite/gas/arm/copro-thumb_v6t2_nov8a-thumb_v4t-2.d: New testcase.
* testsuite/gas/arm/copro-arm_v5_nov8a-arm_v8a.d: New testcase.
* testsuite/gas/arm/copro-thumb_v6t2_nov8a-thumb_v8a-2.d: New testcase.
* testsuite/gas/arm/copro-arm_v5_nov8a-thumb_v6t2_nov8a-unavail.l:
Expected errors for the above four testcases.
* testsuite/gas/arm/copro-arm_v5teplus-arm_v5.d: New testcase.
* testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v4t-2.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-2.d: New testcase.
* testsuite/gas/arm/copro-arm_v5teplus-arm_v8a.d: New testcase.
* testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v8a-2.d: New testcase.
* testsuite/gas/arm/copro-thumb_v6t2_nov8a-thumb_v4t-3.d: New testcase.
* testsuite/gas/arm/copro-arm_v6_nov8a-arm_v5te.d: New testcase.
* testsuite/gas/arm/copro-arm_v6_nov8a-arm_v8a.d: New testcase.
* testsuite/gas/arm/copro-thumb_v6t2_nov8a-thumb_v8a-3.d: New testcase.
* testsuite/gas/arm/copro-arm_v6_nov8a-thumb_v6t2_nov8a-unavail.l:
Expected errors for the above four testcases.
* testsuite/gas/arm/copro-arm_v6_nov8a-arm_v6.d: New testcase.
* testsuite/gas/arm/copro-thumb_v6t2_nov8a-thumb_v6t2-3.d: New testcase.
Tested against testsuite for arm-none-eabi targets without any
regression.
Is that ok for master?
Best regards,
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix_coproc_insns_availability.patch
Type: text/x-patch
Size: 52228 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20170710/fb1573ae/attachment.bin>
More information about the Binutils
mailing list