This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] warnings for swp{b} deprecated instructions in GAS


The attached patch adds some warnings when deprecated swp{b} are being assembled.

I tested this with the ld, binutls, and gas testsuites (the latter including a new test I added).

Please let me know if OK to commit.

Thanks,
	Daniel.

ChangeLog:
    gas/config/
    * tc-arm.c (do_rd_rm_rn): Added warning.

    gas/testsuite/
    * gas/arm/depr-swp.d: New test case.
    * gas/arm/depr-swp.s: New file.
    * gas/arm/depr-swp.l: New file.

--
Daniel Gutson
CodeSourcery
www.codesourcery.com
? deprecated.patch
? ladif
? validations.patch
? gas/config/blm
? gas/config/log
Index: gas/config/tc-arm.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-arm.c,v
retrieving revision 1.432
diff -u -p -r1.432 tc-arm.c
--- gas/config/tc-arm.c	22 Feb 2010 10:24:56 -0000	1.432
+++ gas/config/tc-arm.c	22 Feb 2010 16:30:28 -0000
@@ -6970,8 +6970,16 @@ do_rd_rm_rn (void)
   unsigned Rn = inst.operands[2].reg;
   /* Enforce restrictions on SWP instruction.  */
   if ((inst.instruction & 0x0fbfffff) == 0x01000090)
-    constraint (Rn == inst.operands[0].reg || Rn == inst.operands[1].reg,
-		_("Rn must not overlap other operands"));
+    {
+      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"));
+
+    }
   inst.instruction |= inst.operands[0].reg << 12;
   inst.instruction |= inst.operands[1].reg;
   inst.instruction |= Rn << 16;
Index: gas/testsuite/gas/arm/depr-swp.d
===================================================================
RCS file: gas/testsuite/gas/arm/depr-swp.d
diff -N gas/testsuite/gas/arm/depr-swp.d
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gas/testsuite/gas/arm/depr-swp.d	22 Feb 2010 16:30:28 -0000
@@ -0,0 +1,3 @@
+#name: Deprecated swp{b} instructions
+#source: depr-swp.s
+#error-output: depr-swp.l
Index: gas/testsuite/gas/arm/depr-swp.l
===================================================================
RCS file: gas/testsuite/gas/arm/depr-swp.l
diff -N gas/testsuite/gas/arm/depr-swp.l
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gas/testsuite/gas/arm/depr-swp.l	22 Feb 2010 16:30:28 -0000
@@ -0,0 +1,3 @@
+[^:]*: Assembler messages:
+[^:]*:5: Warning: swp{b} use is deprecated for this architecture
+[^:]*:7: Warning: swp{b} use is deprecated for this architecture
Index: gas/testsuite/gas/arm/depr-swp.s
===================================================================
RCS file: gas/testsuite/gas/arm/depr-swp.s
diff -N gas/testsuite/gas/arm/depr-swp.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gas/testsuite/gas/arm/depr-swp.s	22 Feb 2010 16:30:28 -0000
@@ -0,0 +1,7 @@
+.syntax unified
+.arch armv4
+swp r0, r1, [r2]
+.arch armv6
+swp r0, r1, [r2]
+.arch armv7-a
+swp r0, r1, [r2]

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]