This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

mn10300 long-standing bug-fix


The mn10300 port emitted incorrect assembly for loading a pair of
registers with a double-word constant whose most significant word
could be represented as an unsigned byte or unsigned 24-bit constant.
This patch fixes it.  I'm checking it in, after regression-testing it
on i686-pc-linux-gnu-x-mn10300-elf.

I noticed the problem because ashldi-1.c started failing at some high
optimization levels, presumably as a result of better loop unrolling,
function inlining and constant propagation.  The constant_shift
function was inlined every time, and the shift result as computed and
stored in a register, but the test and call to abort unfortunately
wasn't short-circuited, which would get main() to be optimized into a
call to return.  I'm thinking we might want to mark variable_shift and
constant_shift uninlinable in this test, or some variant thereof,
otherwise we'll be testing compile-time, instead of run-time
shifting.  Comments?

Index: gcc/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* config/mn10300/mn10300.md (movdi, movdf): Use high/low for movu
	operands.

Index: gcc/config/mn10300/mn10300.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mn10300/mn10300.md,v
retrieving revision 1.55
diff -u -p -r1.55 mn10300.md
--- gcc/config/mn10300/mn10300.md 17 Mar 2004 05:16:17 -0000 1.55
+++ gcc/config/mn10300/mn10300.md 22 Jun 2004 18:23:39 -0000
@@ -547,7 +547,7 @@
 			 == EXTENDED_REGS)
 		     && (((val[0] & 0x80) && ! (val[0] & 0xffffff00))
 			 || ((val[0] & 0x800000) && ! (val[0] & 0xff000000))))
-	      output_asm_insn (\"movu %1,%0\", operands);
+	      output_asm_insn (\"movu %L1,%L0\", operands);
 	    else
 	      output_asm_insn (\"mov %L1,%L0\", operands);
 
@@ -570,7 +570,7 @@
 			 == EXTENDED_REGS)
 		     && (((val[1] & 0x80) && ! (val[1] & 0xffffff00))
 			 || ((val[1] & 0x800000) && ! (val[1] & 0xff000000))))
-	      output_asm_insn (\"movu %1,%0\", operands);
+	      output_asm_insn (\"movu %H1,%H0\", operands);
 	    else
 	      output_asm_insn (\"mov %H1,%H0\", operands);
 	    return \"\";
@@ -759,7 +759,7 @@
 			 == EXTENDED_REGS)
 		     && (((val[0] & 0x80) && ! (val[0] & 0xffffff00))
 			 || ((val[0] & 0x800000) && ! (val[0] & 0xff000000))))
-	      output_asm_insn (\"movu %1,%0\", operands);
+	      output_asm_insn (\"movu %L1,%L0\", operands);
 	    else
 	      output_asm_insn (\"mov %L1,%L0\", operands);
 
@@ -782,7 +782,7 @@
 			 == EXTENDED_REGS)
 		     && (((val[1] & 0x80) && ! (val[1] & 0xffffff00))
 			 || ((val[1] & 0x800000) && ! (val[1] & 0xff000000))))
-	      output_asm_insn (\"movu %1,%0\", operands);
+	      output_asm_insn (\"movu %H1,%H0\", operands);
 	    else
 	      output_asm_insn (\"mov %H1,%H0\", operands);
 	    return \"\";
-- 
Alexandre Oliva             http://www.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}

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