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] [ARC] Fix handling of ARCv2 H-register class.


From: claziss <claziss@synopsys.com>

Hi Nick,

I've forgot to upstram this patch before the pc-pretty printing patch. Thus,
that patch introduces a test which fails at this moment (pcl-print). To fix that, this
patch is required.

For ARCv2, h-regs are only valid unitl r31.

Thanks,
Claudiu

gas/
2017-11-21  Claudiu Zissulescu <claziss@synopsys.com>

        * testsuite/gas/arc/hregs-err.s: New test.

opcodes/
2017-11-21  Claudiu Zissulescu <claziss@synopsys.com>

        * arc-opc.c (insert_rhv2): Check h-regs range.
---
 gas/testsuite/gas/arc/hregs-err.s | 11 +++++++++++
 opcodes/arc-opc.c                 |  2 ++
 2 files changed, 13 insertions(+)
 create mode 100644 gas/testsuite/gas/arc/hregs-err.s

diff --git a/gas/testsuite/gas/arc/hregs-err.s b/gas/testsuite/gas/arc/hregs-err.s
new file mode 100644
index 0000000..f5fa5e8
--- /dev/null
+++ b/gas/testsuite/gas/arc/hregs-err.s
@@ -0,0 +1,11 @@
+; { dg-do assemble { target arc*-*-* } }
+	.cpu	HS
+	.text
+	ld_s	r0,[r32,28]	; { dg-error "Error: register must be R1 for instruction 'ld_s'" }
+	ld_s	r0,[r28,28]
+	ld_s	r1,[r32,28]	; { dg-error "Error: register must be GP for instruction 'ld_s'" }
+	ld_s	r2,[r32,28]	; { dg-error "Error: register must be R1 for instruction 'ld_s'" }
+	ld_s	r3,[pcl,0x10]
+	add_s	r0,r0,r32	; { dg-error "Error: inappropriate arguments for opcode 'add_s'" }
+	add_s	r0,r0,r28
+	mov_s.ne r0,r32		; { dg-error "Error: inappropriate arguments for opcode 'mov_s'" }
diff --git a/opcodes/arc-opc.c b/opcodes/arc-opc.c
index 56c9aaf..a17df4b 100644
--- a/opcodes/arc-opc.c
+++ b/opcodes/arc-opc.c
@@ -171,6 +171,8 @@ insert_rhv2 (unsigned long long  insn,
 {
   if (value == 0x1E)
     *errmsg = _("register R30 is a limm indicator");
+  else if (value < 0 || value > 31)
+    *errmsg = _("register out of range");
   return insn |= ((value & 0x07) << 5) | ((value >> 3) & 0x03);
 }
 
-- 
1.9.1


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