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]

mn10300/AM33: Simplify movhi patterns


Interesting...  movqi tolerates input address registers better than
movhi.  I got best code size improvements with the patch below.  Ok to
install?

v mn10300-elf/am33/libio/libio.a 23690 23681
v mn10300-elf/am33/libio/libiostream.a 64949 64822
v mn10300-elf/am33/libstdc++/libstdc++.a 70787 70660
v mn10300-elf/am33/newlib/libc.a 47631 47596
v mn10300-elf/am33/newlib/libc/libc.a 46184 46149
v mn10300-elf/am33/newlib/libc/stdio/lib.a 16976 16967
v mn10300-elf/am33/newlib/libc/stdlib/lib.a 20345 20319
v mn10300-elf/am33/newlib/libg.a 47631 47596

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

	* config/mn10300/mn10300.md (movhi): Simplify.  Prefer data
	registers.

Index: gcc/config/mn10300/mn10300.md
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/mn10300/mn10300.md,v
retrieving revision 1.31
diff -u -r1.31 mn10300.md
--- gcc/config/mn10300/mn10300.md	2000/04/26 00:09:52	1.31
+++ gcc/config/mn10300/mn10300.md	2000/04/26 07:24:18
@@ -156,8 +146,8 @@
 }")
 
 (define_insn ""
-  [(set (match_operand:HI 0 "general_operand" "=dx,a,dx,a,dx,a,dx,a,dxa,m")
-	(match_operand:HI 1 "general_operand" "0,0,I,I,a,dx,dxi,ia,m,dxa"))]
+  [(set (match_operand:HI 0 "general_operand" "=d*x*a,d*x*a,d*x*a,d*x*a,m")
+	(match_operand:HI 1 "general_operand" "0,I,d*x*ai,m,d*x*a"))]
   "TARGET_AM33
    && (register_operand (operands[0], HImode)
        || register_operand (operands[1], HImode))"
@@ -166,15 +156,10 @@
   switch (which_alternative)
     {
     case 0:
-    case 1:
       return \"nop\";
-    case 2:
+    case 1:
       return \"clr %0\";
-    case 3:
-    case 4:
-    case 5:
-    case 6:
-    case 7:
+    case 2:
       if (GET_CODE (operands[1]) == CONST_DOUBLE)
 	{
 	  rtx xoperands[2];
@@ -194,18 +179,18 @@
 	    return \"movu %1,%0\";
 	}
       return \"mov %1,%0\";
-    case 8:
-    case 9:
+    case 3:
+    case 4:
       return \"movhu %1,%0\";
     default:
       abort ();
     }
 }"
-  [(set_attr "cc" "none,none,clobber,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit")])
+  [(set_attr "cc" "none,clobber,none_0hit,none_0hit,none_0hit")])
 
 (define_insn ""
-  [(set (match_operand:HI 0 "general_operand" "=dx,*a,dx,*a,dx,*a,dx,*a,dx,m")
-	(match_operand:HI 1 "general_operand" "0,0,I,I,a,dx,dxi,ia,m,dx"))]
+  [(set (match_operand:HI 0 "general_operand" "=d*a,d,d*a,d,m")
+	(match_operand:HI 1 "general_operand" "0,I,dai,m,d"))]
   "register_operand (operands[0], HImode)
    || register_operand (operands[1], HImode)"
   "*
@@ -213,15 +198,10 @@
   switch (which_alternative)
     {
     case 0:
-    case 1:
       return \"nop\";
-    case 2:
+    case 1:
       return \"clr %0\";
-    case 3:
-    case 4:
-    case 5:
-    case 6:
-    case 7:
+    case 2:
       if (GET_CODE (operands[1]) == CONST_DOUBLE)
 	{
 	  rtx xoperands[2];
@@ -231,14 +211,14 @@
 	  return \"\";
 	}
       return \"mov %1,%0\";
-    case 8:
-    case 9:
+    case 3:
+    case 4:
       return \"movhu %1,%0\";
     default:
       abort ();
     }
 }"
-  [(set_attr "cc" "none,none,clobber,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit")])
+  [(set_attr "cc" "none,clobber,none_0hit,none_0hit,none_0hit")])
 
 ;; movsi and helpers
 

-- 
Alexandre Oliva    Enjoy Guaranį, see http://www.ic.unicamp.br/~oliva/
Cygnus Solutions, a Red Hat company        aoliva@{redhat, cygnus}.com
Free Software Developer and Evangelist    CS PhD student at IC-Unicamp
oliva@{lsd.ic.unicamp.br, gnu.org}   Write to mailing lists, not to me

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