ARM: Issue a warning when the MRRC and MRRC2 instructions are used with the same...
authorTamar Christina <tamar.christina@arm.com>
Fri, 19 Aug 2016 11:57:20 +0000 (12:57 +0100)
committerNick Clifton <nickc@redhat.com>
Fri, 19 Aug 2016 11:58:49 +0000 (12:58 +0100)
* config/tc-arm.c (do_co_reg2c): Added constraint.
* testsuite/gas/arm/dest-unpredictable.s: New.
* testsuite/gas/arm/dest-unpredictable.l: New.
* testsuite/gas/arm/dest-unpredictable.d: New.

gas/ChangeLog
gas/config/tc-arm.c
gas/testsuite/gas/arm/dest-unpredictable.d [new file with mode: 0644]
gas/testsuite/gas/arm/dest-unpredictable.l [new file with mode: 0644]
gas/testsuite/gas/arm/dest-unpredictable.s [new file with mode: 0644]

index d14b0d9ceff875d0580d71ecbf004c02ba5eca2f..1744cf878041663adf692af873d172f4e10e6721 100644 (file)
@@ -1,3 +1,10 @@
+2016-08-19  Tamar Christina  <tamar.christina@arm.com>
+
+       * config/tc-arm.c (do_co_reg2c): Added constraint.
+       * testsuite/gas/arm/dest-unpredictable.s: New.
+       * testsuite/gas/arm/dest-unpredictable.l: New.
+       * testsuite/gas/arm/dest-unpredictable.d: New.
+
 2016-08-19  Nick Clifton  <nickc@redhat.com>
 
        * testsuite/gas/i386/ilp32/x86-64-unwind.d: Adjust expected
index a8d9556c05b4f24f28cc266a3d40c6ab70ddc6ab..040fee4b67d7849b4489cf636fb23ca8336ebe10 100644 (file)
@@ -8691,6 +8691,14 @@ do_co_reg2c (void)
       constraint (Rn == REG_PC, BAD_PC);
     }
 
+  /* Only check the MRRC{2} variants.  */
+  if ((inst.instruction & 0x0FF00000) == 0x0C500000)
+    {
+       /* If Rd == Rn, error that the operation is
+         unpredictable (example MRRC p3,#1,r1,r1,c4).  */
+       constraint (Rd == Rn, BAD_OVERLAP);
+    }
+
   inst.instruction |= inst.operands[0].reg << 8;
   inst.instruction |= inst.operands[1].imm << 4;
   inst.instruction |= Rd << 12;
diff --git a/gas/testsuite/gas/arm/dest-unpredictable.d b/gas/testsuite/gas/arm/dest-unpredictable.d
new file mode 100644 (file)
index 0000000..129d08c
--- /dev/null
@@ -0,0 +1,2 @@
+# name: Unpredictable MRRC and MRRC2 instructions. - ARM
+# error-output: dest-unpredictable.l
diff --git a/gas/testsuite/gas/arm/dest-unpredictable.l b/gas/testsuite/gas/arm/dest-unpredictable.l
new file mode 100644 (file)
index 0000000..7c17c25
--- /dev/null
@@ -0,0 +1,5 @@
+[^:]*: Assembler messages:
+[^:]*:6: Error: registers may not be the same -- `mrrc p0,#1,r1,r1,c4'
+[^:]*:7: Error: registers may not be the same -- `mrrc2 p0,#1,r1,r1,c4'
+[^:]*:20: Error: registers may not be the same -- `mrrc p0,#1,r1,r1,c4'
+[^:]*:21: Error: registers may not be the same -- `mrrc2 p0,#1,r1,r1,c4'
diff --git a/gas/testsuite/gas/arm/dest-unpredictable.s b/gas/testsuite/gas/arm/dest-unpredictable.s
new file mode 100644 (file)
index 0000000..fae22be
--- /dev/null
@@ -0,0 +1,29 @@
+.syntax unified
+
+.arm
+
+@ warnings
+mrrc  p0,#1,r1,r1,c4           @ unpredictable
+mrrc2 p0,#1,r1,r1,c4           @ ditto
+
+@ normal
+mrrc  p0,#1,r1,r2,c4           @ predictable
+mrrc2 p0,#1,r1,r2,c4           @ ditto
+mcrr  p0,#1,r1,r2,c4           @ ditto
+mcrr2 p0,#1,r1,r2,c4           @ ditto
+mcrr  p0,#1,r1,r1,c4           @ ditto
+mcrr2 p0,#1,r1,r1,c4           @ ditto
+
+.thumb
+
+@ warnings
+mrrc  p0,#1,r1,r1,c4           @ unpredictable
+mrrc2 p0,#1,r1,r1,c4           @ ditto
+
+@ normal
+mrrc  p0,#1,r1,r2,c4           @ predictable
+mrrc2 p0,#1,r1,r2,c4           @ ditto
+mcrr  p0,#1,r1,r2,c4           @ ditto
+mcrr2 p0,#1,r1,r2,c4           @ ditto
+mcrr  p0,#1,r1,r1,c4           @ ditto
+mcrr2 p0,#1,r1,r1,c4           @ ditto