* gas/mips/jalr.s: New test.
authorCatherine Moore <clm@redhat.com>
Wed, 2 Jan 2008 20:59:47 +0000 (20:59 +0000)
committerCatherine Moore <clm@redhat.com>
Wed, 2 Jan 2008 20:59:47 +0000 (20:59 +0000)
    * gas/mips/jalr.l: New test output.
    * gas/mips/mips.exp: Run new test.

gas/ChangeLog
gas/config/tc-mips.c
gas/testsuite/ChangeLog
gas/testsuite/gas/mips/jalr.l [new file with mode: 0644]
gas/testsuite/gas/mips/jalr.s [new file with mode: 0644]
gas/testsuite/gas/mips/mips.exp

index 7cd0a4a363c5ec5e6137d4d42faac74c6ed40a40..4dd3d094ebbbe5511720eaca5413c7e5a28da2ff 100644 (file)
@@ -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,
index f19299e1c3000ea867d598325e1d6d1b929d2570..e29041cf72d34ec7dbd43d501185bbf42155b5b3 100644 (file)
@@ -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)
index 9b4849d45505f2f1c58472d6333ba6a73239de2c..74b0a18e02e323768c367805df1d4cbd9f0fdd47 100644 (file)
@@ -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 (file)
index 0000000..fe4a5b9
--- /dev/null
@@ -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 (file)
index 0000000..fa63e43
--- /dev/null
@@ -0,0 +1,4 @@
+       jalr    $32
+       jalr    $31
+       jalr    $7, $7
+       jalr    $31, $2
index dd2eaef6c56de85b48433ff475f615c628dc54d2..b9d7dd5e0e879959bf747ac71967465f2af3a4c6 100644 (file)
@@ -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