From e7c604dd092bc0e3d8c632549ae8232b3c7f57bf Mon Sep 17 00:00:00 2001 From: Catherine Moore Date: Wed, 2 Jan 2008 20:59:47 +0000 Subject: [PATCH] * gas/mips/jalr.s: New test. * gas/mips/jalr.l: New test output. * gas/mips/mips.exp: Run new test. --- gas/ChangeLog | 4 ++++ gas/config/tc-mips.c | 15 ++++++++++++++- gas/testsuite/ChangeLog | 6 ++++++ gas/testsuite/gas/mips/jalr.l | 5 +++++ gas/testsuite/gas/mips/jalr.s | 4 ++++ gas/testsuite/gas/mips/mips.exp | 1 + 6 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 gas/testsuite/gas/mips/jalr.l create mode 100644 gas/testsuite/gas/mips/jalr.s 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 + + * config/tc-mips.c (mips_ip): Check operands on jalr instruction. + 2007-12-29 H.J. Lu * 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 + + * 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 * 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 -- 2.34.1