* gas/config/tc-arm.c (check_obsolete): New function.
authorMatthew Gretton-Dann <matthew.gretton-dann@arm.com>
Fri, 24 Aug 2012 07:52:49 +0000 (07:52 +0000)
committerMatthew Gretton-Dann <matthew.gretton-dann@arm.com>
Fri, 24 Aug 2012 07:52:49 +0000 (07:52 +0000)
(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.

gas/ChangeLog
gas/config/tc-arm.c
gas/testsuite/ChangeLog
gas/testsuite/gas/arm/armv8-a-bad.d [new file with mode: 0644]
gas/testsuite/gas/arm/armv8-a-bad.l [new file with mode: 0644]
gas/testsuite/gas/arm/armv8-a-bad.s [new file with mode: 0644]
gas/testsuite/gas/arm/depr-swp.l
gas/testsuite/gas/arm/depr-swp.s
include/ChangeLog
include/opcode/arm.h

index 0af7f05dc8d7707833e7d8162a1bc41cfbec3aac..7148cb1937537e6d01a390e70c0c4a8a9ea57526 100644 (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.
index 101f86b337ea1e06e0d1a408b13668393d8703c8..af4a1e58ce272ddc2667d3efb2834084e8cfb72d 100644 (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;
index dd0254d149c0c94038b803cb47935d8dbcda7bf3..6b8d34a0b228e0f25106cedd1d5b6712cbe9af05 100644 (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
diff --git a/gas/testsuite/gas/arm/armv8-a-bad.d b/gas/testsuite/gas/arm/armv8-a-bad.d
new file mode 100644 (file)
index 0000000..94e130c
--- /dev/null
@@ -0,0 +1,2 @@
+#name: Invalid v8-a
+#error-output: armv8-a-bad.l
diff --git a/gas/testsuite/gas/arm/armv8-a-bad.l b/gas/testsuite/gas/arm/armv8-a-bad.l
new file mode 100644 (file)
index 0000000..2c9a147
--- /dev/null
@@ -0,0 +1,2 @@
+.*: Assembler messages:
+.*:7: Error: swp{b} use is obsoleted for ARMv8 and later
diff --git a/gas/testsuite/gas/arm/armv8-a-bad.s b/gas/testsuite/gas/arm/armv8-a-bad.s
new file mode 100644 (file)
index 0000000..a6d55c7
--- /dev/null
@@ -0,0 +1,7 @@
+       .syntax unified
+       .text
+       .arch armv8-a
+
+       // SWP
+       .arm
+       swp r0, r1, [r2]
index e5052a7f10c8bb06755a7aa26b8a0deaf9d8896d..830f13ba557cd129262162c62222a39c33402512 100644 (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
index e5c1df32271e955025dae95f8057a2934bd5e3d4..ceb7d41277446492bbe307709dcf3f3cf7631bfe 100644 (file)
@@ -1,4 +1,5 @@
 .syntax unified
+swp r0, r1, [r2]
 .arch armv4
 swp r0, r1, [r2]
 .arch armv6
index 58ad5ae252c14f35113db1203d935ffb60ecf2c4..d6b329f963f64624a8fa397092c61d6effe74068 100644 (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.
index 1c350c8b3bf2cd0d4894584748ffbe0f70235d41..1ac38a06fb1a7200348c16ff456156895ec42d8c 100644 (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;       \
This page took 0.039385 seconds and 4 git commands to generate.