* gas/config/tc-arm.c (check_obsolete): New function.

(do_rd_rm_rn): Check swp{b} for obsoletion.
	* gas/testsuite/gas/arm/armv8-a-bad.d: New testcase.
	* gas/testsuite/gas/arm/armv8-a-bad.l: Likewise.
	* gas/testsuite/gas/arm/armv8-a-bad.s: Likewise.
	* gas/testsuite/gas/arm/depr-swp.l: Update for change in expected output.
	* gas/testsuite/gas/arm/depr-swp.s: Add additional test.
	* include/opcode/arm.h (ARM_CPU_IS_ANY): New define.
This commit is contained in:
Matthew Gretton-Dann
2012-08-24 07:52:49 +00:00
parent bca3892142
commit 59d09be6f5
10 changed files with 60 additions and 7 deletions

View File

@ -1,3 +1,8 @@
2012-08-24 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
* config/tc-arm.c (check_obsolete): New function.
(do_rd_rm_rn): Check swp{b} for obsoletion.
2012-08-24 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
* config/tc-arm.h (arm_ext_v8): New variable.

View File

@ -7373,6 +7373,23 @@ do_rn_rd (void)
inst.instruction |= inst.operands[1].reg << 12;
}
static bfd_boolean
check_obsolete (const arm_feature_set *feature, const char *msg)
{
if (ARM_CPU_IS_ANY (cpu_variant))
{
as_warn ("%s", msg);
return TRUE;
}
else if (ARM_CPU_HAS_FEATURE (cpu_variant, *feature))
{
as_bad ("%s", msg);
return TRUE;
}
return FALSE;
}
static void
do_rd_rm_rn (void)
{
@ -7383,12 +7400,15 @@ do_rd_rm_rn (void)
constraint (Rn == inst.operands[0].reg || Rn == inst.operands[1].reg,
_("Rn must not overlap other operands"));
/* SWP{b} is deprecated for ARMv6* and ARMv7. */
if (warn_on_deprecated
&& ARM_CPU_HAS_FEATURE (selected_cpu, arm_ext_v6))
as_warn (_("swp{b} use is deprecated for this architecture"));
/* SWP{b} is obsolete for ARMv8-A, and deprecated for ARMv6* and ARMv7.
*/
if (!check_obsolete (&arm_ext_v8,
_("swp{b} use is obsoleted for ARMv8 and later"))
&& warn_on_deprecated
&& ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v6))
as_warn (_("swp{b} use is deprecated for ARMv6 and ARMv7"));
}
inst.instruction |= inst.operands[0].reg << 12;
inst.instruction |= inst.operands[1].reg;
inst.instruction |= Rn << 16;

View File

@ -1,3 +1,11 @@
2012-08-24 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
* gas/arm/armv8-a-bad.d: New testcase.
* gas/arm/armv8-a-bad.l: Likewise.
* gas/arm/armv8-a-bad.s: Likewise.
* gas/arm/depr-swp.l: Update for change in expected output.
* gas/arm/depr-swp.s: Add additional test.
2012-08-24 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
* gas/arm/attr-march-all.d: Update for change in expected

View File

@ -0,0 +1,2 @@
#name: Invalid v8-a
#error-output: armv8-a-bad.l

View File

@ -0,0 +1,2 @@
.*: Assembler messages:
.*:7: Error: swp{b} use is obsoleted for ARMv8 and later

View File

@ -0,0 +1,7 @@
.syntax unified
.text
.arch armv8-a
// SWP
.arm
swp r0, r1, [r2]

View File

@ -1,3 +1,4 @@
[^:]*: Assembler messages:
[^:]*:5: Warning: swp{b} use is deprecated for this architecture
[^:]*:7: Warning: swp{b} use is deprecated for this architecture
[^:]*:2: Warning: swp{b} use is obsoleted for ARMv8 and later
[^:]*:6: Warning: swp{b} use is deprecated for ARMv6 and ARMv7
[^:]*:8: Warning: swp{b} use is deprecated for ARMv6 and ARMv7

View File

@ -1,4 +1,5 @@
.syntax unified
swp r0, r1, [r2]
.arch armv4
swp r0, r1, [r2]
.arch armv6

View File

@ -1,3 +1,7 @@
2012-08-24 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
* opcode/arm.h (ARM_CPU_IS_ANY): New define.
2012-08-24 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
* elf/arm.h (TAG_CPU_ARCH_V8): New define.

View File

@ -269,6 +269,9 @@ typedef struct
#define ARM_CPU_HAS_FEATURE(CPU,FEAT) \
(((CPU).core & (FEAT).core) != 0 || ((CPU).coproc & (FEAT).coproc) != 0)
#define ARM_CPU_IS_ANY(CPU) \
((CPU).core == ((arm_feature_set)ARM_ANY).core)
#define ARM_MERGE_FEATURE_SETS(TARG,F1,F2) \
do { \
(TARG).core = (F1).core | (F2).core; \