This is the mail archive of the binutils-cvs@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]

[binutils-gdb] [ARC] Fix handling of ARCv2 H-register class.


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=dc958481429708ecf91f9b2c445063d43397f07e

commit dc958481429708ecf91f9b2c445063d43397f07e
Author: claziss <claziss@synopsys.com>
Date:   Wed Nov 22 10:46:45 2017 +0100

    [ARC] Fix handling of ARCv2 H-register class.
    
    For ARCv2, h-regs are only valid unitl r31.
    
    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.

Diff:
---
 gas/ChangeLog                     |  4 ++++
 gas/testsuite/gas/arc/hregs-err.s | 11 +++++++++++
 opcodes/ChangeLog                 |  4 ++++
 opcodes/arc-opc.c                 |  2 ++
 4 files changed, 21 insertions(+)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index fd4f379..fa18fb3 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,7 @@
+2017-11-22  Claudiu Zissulescu  <claziss@synopsys.com>
+
+	* testsuite/gas/arc/hregs-err.s: New test.
+
 2017-11-21  H.J. Lu  <hongjiu.lu@intel.com>
 
 	PR gas/22464
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/ChangeLog b/opcodes/ChangeLog
index 1d835c9..7789b3e 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,7 @@
+2017-11-22  Claudiu Zissulescu  <claziss@synopsys.com>
+
+	*arc-opc (insert_rhv2): Check h-regs range.
+
 2017-11-21  Claudiu Zissulescu <claziss@synopsys.com>
 
 	* arc-dis.c (print_insn_arc): Pretty print pc-relative offsets.
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);
 }


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