This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
mn10300: immediates moved to sp and other xrs are zero-extended
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: binutils at sources dot redhat dot com
- Date: 16 Jan 2004 01:15:35 -0200
- Subject: mn10300: immediates moved to sp and other xrs are zero-extended
- Organization: GCC Team, Red Hat
I guess people don't move small negative constants to sp very often.
This bug went unnoticed for longer than I've know about the mn10300
platform. This patch fixes the problem. I'm checking it in.
Index: opcodes/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* m10300-opc.c (mov): 8- and 24-bit immediates are zero-extended
when loaded into XR registers.
Index: opcodes/m10300-opc.c
===================================================================
RCS file: /cvs/src/src/opcodes/m10300-opc.c,v
retrieving revision 1.9
diff -u -p -r1.9 m10300-opc.c
--- opcodes/m10300-opc.c 10 Jul 2003 02:53:27 -0000 1.9
+++ opcodes/m10300-opc.c 16 Jan 2004 03:13:28 -0000
@@ -1,5 +1,5 @@
/* Assemble Matsushita MN10300 instructions.
- Copyright 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2004 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -561,8 +561,8 @@ const struct mn10300_opcode mn10300_opco
{ "mov", 0xfb080000, 0xffff0000, 0, FMT_D7, AM33, {SIMM8, RN02}},
{ "mov", 0xfd080000, 0xffff0000, 0, FMT_D8, AM33, {SIMM24, RN02}},
{ "mov", 0xfe080000, 0xffff0000, 0, FMT_D9, AM33, {IMM32_HIGH8, RN02}},
-{ "mov", 0xfbf80000, 0xffff0000, 0, FMT_D7, AM33, {SIMM8, XRN02}},
-{ "mov", 0xfdf80000, 0xffff0000, 0, FMT_D8, AM33, {SIMM24, XRN02}},
+{ "mov", 0xfbf80000, 0xffff0000, 0, FMT_D7, AM33, {IMM8, XRN02}},
+{ "mov", 0xfdf80000, 0xffff0000, 0, FMT_D8, AM33, {IMM24, XRN02}},
{ "mov", 0xfef80000, 0xffff0000, 0, FMT_D9, AM33, {IMM32_HIGH8, XRN02}},
{ "mov", 0xfe0e0000, 0xffff0f00, 0, FMT_D9, AM33, {MEM(IMM32_HIGH8_MEM), RN2}},
{ "mov", 0xfe1e0000, 0xffff0f00, 0, FMT_D9, AM33, {RM2, MEM(IMM32_HIGH8_MEM)}},
Index: gas/testsuite/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* gas/mn10300/mov5.s: New.
* gas/mn10300/basic.exp (do_mov5): New.
Index: gas/testsuite/gas/mn10300/basic.exp
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/mn10300/basic.exp,v
retrieving revision 1.8
diff -u -p -r1.8 basic.exp
--- gas/testsuite/gas/mn10300/basic.exp 10 Jul 2003 02:49:46 -0000 1.8
+++ gas/testsuite/gas/mn10300/basic.exp 16 Jan 2004 03:13:30 -0000
@@ -1,4 +1,4 @@
-# Copyright (C) 1996, 2000, 2002 Free Software Foundation, Inc.
+# Copyright (C) 1996, 2000, 2002, 2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -499,6 +499,40 @@ proc do_mov4 {} {
if [expr $x==16] then { pass $testname } else { fail $testname }
}
+proc do_mov5 {} {
+ set testname "mov5.s: mov5 tests"
+ set x 0
+
+ gas_start "mov5.s" "-al"
+
+ # Instead of having a variable for each match string just increment the
+ # total number of matches seen. That's simpler when testing large numbers
+ # of instructions (as these tests to).
+ while 1 {
+ expect {
+ -re "^ +\[0-9\]+ 0000 FBF80008\[^\n\]*\n" { set x [expr $x+1] }
+ -re "^ +\[0-9\]+ 0004 FDF80000\[^\n\]*\n" { set x [expr $x+1] }
+ -re "^ +4 +0100\[^\n\]*\n" { set x [expr $x+1] }
+ -re "^ +\[0-9\]+ 000a FDF800FF\[^\n\]*\n" { set x [expr $x+1] }
+ -re "^ +5 +FF7F\[^\n\]*\n" { set x [expr $x+1] }
+ -re "^ +\[0-9\]+ 0010 FEF80080\[^\n\]*\n" { set x [expr $x+1] }
+ -re "^ +6 +FFFFFF\[^\n\]*\n" { set x [expr $x+1] }
+ -re "^ +\[0-9\]+ 0017 FEF80000\[^\n\]*\n" { set x [expr $x+1] }
+ -re "^ +7 +0080FF\[^\n\]*\n" { set x [expr $x+1] }
+ -re "\[^\n\]*\n" { }
+ timeout { perror "timeout\n"; break }
+ eof { break }
+ }
+ }
+
+ # This was intended to do any cleanup necessary. It kinda looks like it
+ # isn't needed, but just in case, please keep it in for now.
+ gas_finish
+
+ # Did we find what we were looking for? If not, flunk it.
+ if [expr $x==9] then { pass $testname } else { fail $testname }
+}
+
proc do_movbu {} {
set testname "movbu.s: movbu tests"
set x 0
@@ -1762,6 +1796,7 @@ if [istarget mn10300*-*-*] then {
do_mov2
do_mov3
do_mov4
+ do_mov5
do_movbu
do_movhu
do_movm
Index: gas/testsuite/gas/mn10300/mov5.s
===================================================================
RCS file: gas/testsuite/gas/mn10300/mov5.s
diff -N gas/testsuite/gas/mn10300/mov5.s
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gas/testsuite/gas/mn10300/mov5.s 16 Jan 2004 03:13:30 -0000
@@ -0,0 +1,7 @@
+ .am33
+ .text
+ mov 8,sp
+ mov 256,sp
+ mov +((1<<23)-1),sp
+ mov -128,sp
+ mov +((-1)<<23),sp
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Happy GNU Year! oliva@{lsd.ic.unicamp.br, gnu.org}
Red Hat GCC Developer aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist Professional serial bug killer