summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gas/ChangeLog4
-rw-r--r--gas/config/tc-mips.c15
-rw-r--r--gas/testsuite/ChangeLog6
-rw-r--r--gas/testsuite/gas/mips/jalr.l5
-rw-r--r--gas/testsuite/gas/mips/jalr.s4
-rw-r--r--gas/testsuite/gas/mips/mips.exp1
6 files changed, 34 insertions, 1 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 7cd0a4a363..4dd3d094eb 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,7 @@
+2008-01-02 Catherine Moore <clm@codesourcery.com>
+
+ * config/tc-mips.c (mips_ip): Check operands on jalr instruction.
+
2007-12-29 H.J. Lu <hongjiu.lu@intel.com>
* config/tc-i386.c (md_show_usage): Add -mmnemonic, -msyntax,
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index f19299e1c3..e29041cf72 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -1,6 +1,6 @@
/* tc-mips.c -- assemble code for a MIPS chip.
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
Contributed by the OSF and Ralph Campbell.
Written by Keith Knowles and Ralph Campbell, working independently.
Modified for ECOFF and R4000 support by Ian Lance Taylor of Cygnus
@@ -9133,6 +9133,19 @@ do_msbd:
if (c == 'z' && regno != 0)
break;
+ if (c == 's' && !strcmp (ip->insn_mo->name, "jalr"))
+ {
+ if (regno == lastregno)
+ {
+ insn_error = _("source and destinationations must be different");
+ continue;
+ }
+ if (regno == 31 && lastregno == 0)
+ {
+ insn_error = _("a destination register must be supplied");
+ continue;
+ }
+ }
/* Now that we have assembled one operand, we use the args string
* to figure out where it goes in the instruction. */
switch (c)
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index 9b4849d455..74b0a18e02 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2008-01-02 Catherine Moore <clm@codesourcery.com>
+
+ * gas/mips/jalr.s: New test.
+ * gas/mips/jalr.l: New test output.
+ * gas/mips/mips.exp: Run new test.
+
2007-12-31 H.J. Lu <hongjiu.lu@intel.com>
* gas/i386/inval.s: Add test for cvtsi2ss/cvtsi2sd.
diff --git a/gas/testsuite/gas/mips/jalr.l b/gas/testsuite/gas/mips/jalr.l
new file mode 100644
index 0000000000..fe4a5b9cdd
--- /dev/null
+++ b/gas/testsuite/gas/mips/jalr.l
@@ -0,0 +1,5 @@
+.*: Assembler messages:
+.*:1: Error: illegal operands.*
+.*:2: Error: a destination register must be supplied.*
+.*:3: Error: source and destinationations must be different.*
+
diff --git a/gas/testsuite/gas/mips/jalr.s b/gas/testsuite/gas/mips/jalr.s
new file mode 100644
index 0000000000..fa63e43be7
--- /dev/null
+++ b/gas/testsuite/gas/mips/jalr.s
@@ -0,0 +1,4 @@
+ jalr $32
+ jalr $31
+ jalr $7, $7
+ jalr $31, $2
diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp
index dd2eaef6c5..b9d7dd5e0e 100644
--- a/gas/testsuite/gas/mips/mips.exp
+++ b/gas/testsuite/gas/mips/mips.exp
@@ -573,6 +573,7 @@ if { [istarget mips*-*-vxworks*] } {
run_list_test "illegal" "-32"
run_list_test "baddata1" "-32"
+ run_list_test "jalr" ""
# LOSE: As of 2002-02-08, the next 4 tests fail for target mips-ecoff.
# It's unknown whether they _should_ pass as-is, or whether different
OpenPOWER on IntegriCloud