From df9909b8675c8c9b6fa88c5d13afd2efa66dcf68 Mon Sep 17 00:00:00 2001 From: Thomas Preud'homme Date: Mon, 15 Jan 2018 14:09:28 +0000 Subject: [PATCH] [ARM] No IT usage deprecation for ARMv8-M Deprecations related to the use of the IT instruction introduced in Armv8-A do not apply to Armv8-M Baseline and mainline. However the warning logic do not distinguish between the various profiles and warn whenever the architecture version is 8. This patch adds a check to exclude M profile architectures from this warning. This works as expected when -march is specified on the command-line or a .arch/.cpu directive exist. However, in autodetection mode the CPU/architecture targeted is only known once the instructions have been all processed but this code is run when IT instruction is processed. It is therefore not possible to distinguish between Armv8-M and Armv8-A in that mode. The approach chosen here is not to warn in autodetection mode. The udf.d testcase that relied on that behavior to test deprecation warning for Armv8-A is therefore updated to explicitely pass -march=armv8-a. 2018-01-15 Thomas Preud'homme gas/ * config/tc-arm.c (it_fsm_post_encode): Do not warn if targeting M profile architecture or if in autodetection mode. Clarify that deprecation is for performance reason and concerns Armv8-A and Armv8-R. * testsuite/gas/arm/armv8-ar-bad.l: Adapt to new IT deprecation warning message. * testsuite/gas/arm/armv8-ar-it-bad.l: Likewise. * testsuite/gas/arm/sp-pc-validations-bad-t-v8a.l: Likewise. * testsuite/gas/arm/udf.l: Likewise. * testsuite/gas/arm/udf.d: Assemble for Armv8-A explicitely. --- gas/ChangeLog | 12 ++++ gas/config/tc-arm.c | 15 +++-- gas/testsuite/gas/arm/armv8-ar-bad.l | 2 +- gas/testsuite/gas/arm/armv8-ar-it-bad.l | 30 +++++----- .../gas/arm/sp-pc-validations-bad-t-v8a.l | 60 +++++++++---------- gas/testsuite/gas/arm/udf.d | 1 + gas/testsuite/gas/arm/udf.l | 4 +- 7 files changed, 70 insertions(+), 54 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 41663592405..391912c0e2d 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,15 @@ +2018-01-15 Thomas Preud'homme + + * config/tc-arm.c (it_fsm_post_encode): Do not warn if targeting M + profile architecture or if in autodetection mode. Clarify that + deprecation is for performance reason and concerns Armv8-A and Armv8-R. + * testsuite/gas/arm/armv8-ar-bad.l: Adapt to new IT deprecation warning + message. + * testsuite/gas/arm/armv8-ar-it-bad.l: Likewise. + * testsuite/gas/arm/sp-pc-validations-bad-t-v8a.l: Likewise. + * testsuite/gas/arm/udf.l: Likewise. + * testsuite/gas/arm/udf.d: Assemble for Armv8-A explicitely. + 2018-01-15 Nick Clifton * po/uk.po: Updated Ukranian translation. diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index 0e166888e1f..c07362ae7d7 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -18559,12 +18559,13 @@ it_fsm_post_encode (void) if (now_it.insn_cond && !now_it.warn_deprecated && warn_on_deprecated - && ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v8)) + && ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v8) + && !ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_m)) { if (inst.instruction >= 0x10000) { as_tsktsk (_("IT blocks containing 32-bit Thumb instructions are " - "deprecated in ARMv8")); + "performance deprecated in ARMv8-A and ARMv8-R")); now_it.warn_deprecated = TRUE; } else @@ -18575,9 +18576,10 @@ it_fsm_post_encode (void) { if ((inst.instruction & p->mask) == p->pattern) { - as_tsktsk (_("IT blocks containing 16-bit Thumb instructions " - "of the following class are deprecated in ARMv8: " - "%s"), p->description); + as_tsktsk (_("IT blocks containing 16-bit Thumb " + "instructions of the following class are " + "performance deprecated in ARMv8-A and " + "ARMv8-R: %s"), p->description); now_it.warn_deprecated = TRUE; break; } @@ -18589,7 +18591,8 @@ it_fsm_post_encode (void) if (now_it.block_length > 1) { as_tsktsk (_("IT blocks containing more than one conditional " - "instruction are deprecated in ARMv8")); + "instruction are performance deprecated in ARMv8-A and " + "ARMv8-R")); now_it.warn_deprecated = TRUE; } } diff --git a/gas/testsuite/gas/arm/armv8-ar-bad.l b/gas/testsuite/gas/arm/armv8-ar-bad.l index ae9a3d1add9..f70de358831 100644 --- a/gas/testsuite/gas/arm/armv8-ar-bad.l +++ b/gas/testsuite/gas/arm/armv8-ar-bad.l @@ -10,7 +10,7 @@ .*:23: Error: immediate value out of range -- `hlt 0x10000' .*:24: Error: instruction cannot be conditional -- `hltne 0x1' .*:28: Error: immediate value out of range -- `hlt 64' -.*:30: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Miscellaneous 16-bit instructions +.*:30: IT blocks containing 16-bit Thumb instructions of the following class are performance deprecated in ARMv8-A and ARMv8-R: Miscellaneous 16-bit instructions .*:30: Error: instruction is always unconditional -- `hltne 0' .*:34: Error: r15 not allowed here -- `stlb pc,\[r0\]' .*:35: Error: r15 not allowed here -- `stlb r0,\[pc\]' diff --git a/gas/testsuite/gas/arm/armv8-ar-it-bad.l b/gas/testsuite/gas/arm/armv8-ar-it-bad.l index a69938dfce6..de3ed973a24 100644 --- a/gas/testsuite/gas/arm/armv8-ar-it-bad.l +++ b/gas/testsuite/gas/arm/armv8-ar-it-bad.l @@ -1,18 +1,18 @@ .*: Assembler messages: -.*:6: IT blocks containing 32-bit Thumb instructions are deprecated in ARMv8 -.*:14: IT blocks containing more than one conditional instruction are deprecated in ARMv8 -.*:19: IT blocks containing more than one conditional instruction are deprecated in ARMv8 -.*:29: IT blocks containing 32-bit Thumb instructions are deprecated in ARMv8 -.*:35: IT blocks containing more than one conditional instruction are deprecated in ARMv8 -.*:39: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM -.*:42: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Miscellaneous 16-bit instructions -.*:48: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Literal loads -.*:51: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Hi-register ADD, MOV, CMP, BX, BLX using pc -.*:54: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM +.*:6: IT blocks containing 32-bit Thumb instructions are performance deprecated in ARMv8-A and ARMv8-R +.*:14: IT blocks containing more than one conditional instruction are performance deprecated in ARMv8-A and ARMv8-R +.*:19: IT blocks containing more than one conditional instruction are performance deprecated in ARMv8-A and ARMv8-R +.*:29: IT blocks containing 32-bit Thumb instructions are performance deprecated in ARMv8-A and ARMv8-R +.*:35: IT blocks containing more than one conditional instruction are performance deprecated in ARMv8-A and ARMv8-R +.*:39: IT blocks containing 16-bit Thumb instructions of the following class are performance deprecated in ARMv8-A and ARMv8-R: Short branches, Undefined, SVC, LDM/STM +.*:42: IT blocks containing 16-bit Thumb instructions of the following class are performance deprecated in ARMv8-A and ARMv8-R: Miscellaneous 16-bit instructions +.*:48: IT blocks containing 16-bit Thumb instructions of the following class are performance deprecated in ARMv8-A and ARMv8-R: Literal loads +.*:51: IT blocks containing 16-bit Thumb instructions of the following class are performance deprecated in ARMv8-A and ARMv8-R: Hi-register ADD, MOV, CMP, BX, BLX using pc +.*:54: IT blocks containing 16-bit Thumb instructions of the following class are performance deprecated in ARMv8-A and ARMv8-R: Short branches, Undefined, SVC, LDM/STM .*:54: Error: r15 not allowed here -- `addeq r0,pc,pc' -.*:57: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM +.*:57: IT blocks containing 16-bit Thumb instructions of the following class are performance deprecated in ARMv8-A and ARMv8-R: Short branches, Undefined, SVC, LDM/STM .*:57: Error: r15 not allowed here -- `addeq pc,r0,r0' -.*:60: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: ADD/SUB sp, sp #imm -.*:64: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: ADD/SUB sp, sp #imm -.*:67: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: ADD/SUB sp, sp #imm -.*:71: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: ADD/SUB sp, sp #imm +.*:60: IT blocks containing 16-bit Thumb instructions of the following class are performance deprecated in ARMv8-A and ARMv8-R: ADD/SUB sp, sp #imm +.*:64: IT blocks containing 16-bit Thumb instructions of the following class are performance deprecated in ARMv8-A and ARMv8-R: ADD/SUB sp, sp #imm +.*:67: IT blocks containing 16-bit Thumb instructions of the following class are performance deprecated in ARMv8-A and ARMv8-R: ADD/SUB sp, sp #imm +.*:71: IT blocks containing 16-bit Thumb instructions of the following class are performance deprecated in ARMv8-A and ARMv8-R: ADD/SUB sp, sp #imm diff --git a/gas/testsuite/gas/arm/sp-pc-validations-bad-t-v8a.l b/gas/testsuite/gas/arm/sp-pc-validations-bad-t-v8a.l index 0da47017e4b..07261005b12 100644 --- a/gas/testsuite/gas/arm/sp-pc-validations-bad-t-v8a.l +++ b/gas/testsuite/gas/arm/sp-pc-validations-bad-t-v8a.l @@ -1,48 +1,48 @@ [^:]*: Assembler messages: -[^:]*:27: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM -[^:]*:27: IT blocks containing more than one conditional instruction are deprecated in ARMv8 +[^:]*:27: IT blocks containing 16-bit Thumb instructions of the following class are performance deprecated in ARMv8-A and ARMv8-R: Short branches, Undefined, SVC, LDM/STM +[^:]*:27: IT blocks containing more than one conditional instruction are performance deprecated in ARMv8-A and ARMv8-R [^:]*:27: Error: branch must be last instruction in IT block -- `ldreq r15,\[r0\]' -[^:]*:28: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM -[^:]*:28: IT blocks containing more than one conditional instruction are deprecated in ARMv8 +[^:]*:28: IT blocks containing 16-bit Thumb instructions of the following class are performance deprecated in ARMv8-A and ARMv8-R: Short branches, Undefined, SVC, LDM/STM +[^:]*:28: IT blocks containing more than one conditional instruction are performance deprecated in ARMv8-A and ARMv8-R [^:]*:28: Error: branch must be last instruction in IT block -- `ldreq r15,\[r0,#0\]' -[^:]*:29: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM -[^:]*:29: IT blocks containing more than one conditional instruction are deprecated in ARMv8 +[^:]*:29: IT blocks containing 16-bit Thumb instructions of the following class are performance deprecated in ARMv8-A and ARMv8-R: Short branches, Undefined, SVC, LDM/STM +[^:]*:29: IT blocks containing more than one conditional instruction are performance deprecated in ARMv8-A and ARMv8-R [^:]*:29: Error: branch must be last instruction in IT block -- `ldreq r15,\[sp\]' -[^:]*:30: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM -[^:]*:30: IT blocks containing more than one conditional instruction are deprecated in ARMv8 +[^:]*:30: IT blocks containing 16-bit Thumb instructions of the following class are performance deprecated in ARMv8-A and ARMv8-R: Short branches, Undefined, SVC, LDM/STM +[^:]*:30: IT blocks containing more than one conditional instruction are performance deprecated in ARMv8-A and ARMv8-R [^:]*:30: Error: branch must be last instruction in IT block -- `ldreq r15,\[sp,#0\]' -[^:]*:31: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM -[^:]*:31: IT blocks containing more than one conditional instruction are deprecated in ARMv8 +[^:]*:31: IT blocks containing 16-bit Thumb instructions of the following class are performance deprecated in ARMv8-A and ARMv8-R: Short branches, Undefined, SVC, LDM/STM +[^:]*:31: IT blocks containing more than one conditional instruction are performance deprecated in ARMv8-A and ARMv8-R [^:]*:31: Error: branch must be last instruction in IT block -- `ldreq.w r15,\[r0\]' -[^:]*:32: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM -[^:]*:32: IT blocks containing more than one conditional instruction are deprecated in ARMv8 +[^:]*:32: IT blocks containing 16-bit Thumb instructions of the following class are performance deprecated in ARMv8-A and ARMv8-R: Short branches, Undefined, SVC, LDM/STM +[^:]*:32: IT blocks containing more than one conditional instruction are performance deprecated in ARMv8-A and ARMv8-R [^:]*:32: Error: branch must be last instruction in IT block -- `ldreq.w r15,\[r0,#0\]' -[^:]*:33: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM -[^:]*:33: IT blocks containing more than one conditional instruction are deprecated in ARMv8 +[^:]*:33: IT blocks containing 16-bit Thumb instructions of the following class are performance deprecated in ARMv8-A and ARMv8-R: Short branches, Undefined, SVC, LDM/STM +[^:]*:33: IT blocks containing more than one conditional instruction are performance deprecated in ARMv8-A and ARMv8-R [^:]*:33: Error: branch must be last instruction in IT block -- `ldreq r15,\[r0,#-4\]' -[^:]*:34: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM -[^:]*:34: IT blocks containing more than one conditional instruction are deprecated in ARMv8 +[^:]*:34: IT blocks containing 16-bit Thumb instructions of the following class are performance deprecated in ARMv8-A and ARMv8-R: Short branches, Undefined, SVC, LDM/STM +[^:]*:34: IT blocks containing more than one conditional instruction are performance deprecated in ARMv8-A and ARMv8-R [^:]*:34: Error: branch must be last instruction in IT block -- `ldreq r15,\[r0\],#4' -[^:]*:35: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM -[^:]*:35: IT blocks containing more than one conditional instruction are deprecated in ARMv8 +[^:]*:35: IT blocks containing 16-bit Thumb instructions of the following class are performance deprecated in ARMv8-A and ARMv8-R: Short branches, Undefined, SVC, LDM/STM +[^:]*:35: IT blocks containing more than one conditional instruction are performance deprecated in ARMv8-A and ARMv8-R [^:]*:35: Error: branch must be last instruction in IT block -- `ldreq r15,\[r0,#0\]!' -[^:]*:38: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM -[^:]*:38: IT blocks containing more than one conditional instruction are deprecated in ARMv8 +[^:]*:38: IT blocks containing 16-bit Thumb instructions of the following class are performance deprecated in ARMv8-A and ARMv8-R: Short branches, Undefined, SVC, LDM/STM +[^:]*:38: IT blocks containing more than one conditional instruction are performance deprecated in ARMv8-A and ARMv8-R [^:]*:38: Error: branch must be last instruction in IT block -- `ldreq r15,label' -[^:]*:39: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM -[^:]*:39: IT blocks containing more than one conditional instruction are deprecated in ARMv8 +[^:]*:39: IT blocks containing 16-bit Thumb instructions of the following class are performance deprecated in ARMv8-A and ARMv8-R: Short branches, Undefined, SVC, LDM/STM +[^:]*:39: IT blocks containing more than one conditional instruction are performance deprecated in ARMv8-A and ARMv8-R [^:]*:39: Error: branch must be last instruction in IT block -- `ldreq.w r15,label' -[^:]*:40: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM -[^:]*:40: IT blocks containing more than one conditional instruction are deprecated in ARMv8 +[^:]*:40: IT blocks containing 16-bit Thumb instructions of the following class are performance deprecated in ARMv8-A and ARMv8-R: Short branches, Undefined, SVC, LDM/STM +[^:]*:40: IT blocks containing more than one conditional instruction are performance deprecated in ARMv8-A and ARMv8-R [^:]*:40: Error: branch must be last instruction in IT block -- `ldreq.w r15,\[pc,#-0\]' -[^:]*:43: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM -[^:]*:43: IT blocks containing more than one conditional instruction are deprecated in ARMv8 +[^:]*:43: IT blocks containing 16-bit Thumb instructions of the following class are performance deprecated in ARMv8-A and ARMv8-R: Short branches, Undefined, SVC, LDM/STM +[^:]*:43: IT blocks containing more than one conditional instruction are performance deprecated in ARMv8-A and ARMv8-R [^:]*:43: Error: branch must be last instruction in IT block -- `ldreq r15,\[r0,r1\]' -[^:]*:44: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM -[^:]*:44: IT blocks containing more than one conditional instruction are deprecated in ARMv8 +[^:]*:44: IT blocks containing 16-bit Thumb instructions of the following class are performance deprecated in ARMv8-A and ARMv8-R: Short branches, Undefined, SVC, LDM/STM +[^:]*:44: IT blocks containing more than one conditional instruction are performance deprecated in ARMv8-A and ARMv8-R [^:]*:44: Error: branch must be last instruction in IT block -- `ldreq.w r15,\[r0,r1\]' -[^:]*:45: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM -[^:]*:45: IT blocks containing more than one conditional instruction are deprecated in ARMv8 +[^:]*:45: IT blocks containing 16-bit Thumb instructions of the following class are performance deprecated in ARMv8-A and ARMv8-R: Short branches, Undefined, SVC, LDM/STM +[^:]*:45: IT blocks containing more than one conditional instruction are performance deprecated in ARMv8-A and ARMv8-R [^:]*:45: Error: branch must be last instruction in IT block -- `ldreq.w r15,\[r0,r1,LSL#2\]' [^:]*:48: Error: r15 not allowed here -- `ldrb pc,\[r0,#4\]' [^:]*:51: Error: r15 not allowed here -- `ldrb.w pc,\[r0,#4\]' diff --git a/gas/testsuite/gas/arm/udf.d b/gas/testsuite/gas/arm/udf.d index db41080f415..04e31451d6c 100644 --- a/gas/testsuite/gas/arm/udf.d +++ b/gas/testsuite/gas/arm/udf.d @@ -1,5 +1,6 @@ #objdump: -dr --prefix-addresses --show-raw-insn #name: UDF +#as: -march=armv8-a #error-output: udf.l .*: +file format .*arm.* diff --git a/gas/testsuite/gas/arm/udf.l b/gas/testsuite/gas/arm/udf.l index 2e154b6fc21..21aff94de51 100644 --- a/gas/testsuite/gas/arm/udf.l +++ b/gas/testsuite/gas/arm/udf.l @@ -1,3 +1,3 @@ ^[^:]*: Assembler messages: -^[^:]*:16: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM -^[^:]*:21: IT blocks containing 32-bit Thumb instructions are deprecated in ARMv8 +^[^:]*:16: IT blocks containing 16-bit Thumb instructions of the following class are performance deprecated in ARMv8-A and ARMv8-R: Short branches, Undefined, SVC, LDM/STM +^[^:]*:21: IT blocks containing 32-bit Thumb instructions are performance deprecated in ARMv8-A and ARMv8-R -- 2.30.2