MIPS gcc generates bogus "sw 0,0($sp)"

Greg McGary gkm@eng.ascend.com
Wed Aug 5 17:29:00 GMT 1998


Jeffrey A Law <law@cygnus.com> writes:

>   In message < 199808040508.WAA16043@tucson-net-82.eng.ascend.com >you write:
>   > Shouldn't reload turn the (const_int 0) back into (reg:SI 0 $0) ??
> No.  The compiler does not know that (const_int 0) == (reg:SI 0)
> 
> The output templates in mips.md/mips.c have to detect this case and output
> correct code, or they must not allow a const_int to be used in the insn
> to start with.

Thanks for the guidance.  Here's the fix to "movsi_usw":

Wed Aug  5 17:28:42 1998  Greg McGary  <gkm@gnu.org>

	* mips.md (movsi_usw): Use %z1 to handle (const_int 0).


Index: config/mips/mips.md
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/mips/mips.md,v
retrieving revision 1.32
diff -u -p -r1.32 mips.md
--- mips.md	1998/07/20 19:53:04	1.32
+++ mips.md	1998/08/06 00:26:44
@@ -4361,7 +4361,7 @@ move\\t%0,%z4\\n\\
 
   if ((INTVAL (offset) & 3) == 0
       && (mem_addr == stack_pointer_rtx || mem_addr == frame_pointer_rtx))
-    return \"sw\\t%1,%0\";
+    return \"sw\\t%z1,%0\";
 
   return \"usw\\t%z1,%0\";
 }"



More information about the Gcc-bugs mailing list