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]

Re: AM30/AM33 SP handling


On Apr 25, 2000, Jeffrey A Law <law@cygnus.com> wrote:

>   In message <or3doae7t3.fsf@zecarneiro.lsd.ic.unicamp.br>you write:
>> On Apr 24, 2000, Jeffrey A Law <law@cygnus.com> wrote:

>> Well, there is this SP_REGS class that is quite suitable for a
>> register used in a MEM, as register 26 is.

> OK.  I suspect this happens because we consider SP a valid base
> register - see the calls to record_address_regs in regclass and
> how they use BASE_REG_CLASS.

I saw that, but I don't think that's the case.  It would indeed have
improved the score of SP_OR_ADDRESS_REGS, but see how ADDRESS_REGS and
SP_REGS get better scores by themselves.  They're `subunion'ed at the
end:

>> Register 26 costs: NO_REGS:30 DATA_REGS:36 ADDRESS_REGS:30 SP_REGS:30 DAT
>> A_OR_ADDRESS_REGS:42 SP_OR_ADDRESS_REGS:48 EXTENDED_REGS:54 DATA_OR_EXTENDE
>> D_REGS:54 ADDRESS_OR_EXTENDED_REGS:54 SP_OR_EXTENDED_REGS:54 SP_OR_ADDRESS_
>> OR_EXTENDED_REGS:54 GENERAL_REGS:54 ALL_REGS:54 MEM:45

> You would probably want to use '!' as the first constraint character in
> any alternative which includes 'y', and a '*' in front of 'y' itself.

Yep, this worked perfectly.  Ok to install?

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

	* config/mn10300/mn10300.h (REG_CLASS_FROM_LETTER): Return
	EXTENDED_REGS only if TARGET_AM33.
	* config/mn10300/mn10300.md (movsi, addsi): Do not allow
	reload for SP.

Index: gcc/config/mn10300/mn10300.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/mn10300/mn10300.h,v
retrieving revision 1.31
diff -u -r1.31 mn10300.h
--- gcc/config/mn10300/mn10300.h	2000/04/23 21:40:51	1.31
+++ gcc/config/mn10300/mn10300.h	2000/04/23 23:33:25
@@ -287,8 +287,10 @@
 #define REG_CLASS_FROM_LETTER(C) \
   ((C) == 'd' ? DATA_REGS : \
    (C) == 'a' ? ADDRESS_REGS : \
+   (C) == 'y' ? SP_REGS : \
+   ! TARGET_AM33 ? NO_REGS : \
    (C) == 'x' ? EXTENDED_REGS : \
-   (C) == 'y' ? SP_REGS : NO_REGS)
+   NO_REGS)
 
 /* Macros to check register numbers against specific register classes.  */
 
Index: gcc/config/mn10300/mn10300.md
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/mn10300/mn10300.md,v
retrieving revision 1.30
diff -u -r1.30 mn10300.md
--- gcc/config/mn10300/mn10300.md	2000/04/23 23:28:39	1.30
+++ gcc/config/mn10300/mn10300.md	2000/04/23 23:33:26
@@ -296,9 +296,9 @@
 
 (define_insn ""
   [(set (match_operand:SI 0 "general_operand"
-				"=dx,ax,dx,a,dxm,dxm,axm,axm,dx,dx,ax,ax,axR,y")
+				"=dx,ax,dx,a,dxm,dxm,axm,axm,dx,dx,ax,ax,axR,!*y")
 	(match_operand:SI 1 "general_operand"
-				"0,0,I,I,dx,ax,dx,ax,dixm,aixm,dixm,aixm,xy,axR"))]
+				"0,0,I,I,dx,ax,dx,ax,dixm,aixm,dixm,aixm,!*y,axR"))]
   "register_operand (operands[0], SImode)
    || register_operand (operands[1], SImode)"
   "*
@@ -744,23 +744,10 @@
 	(plus:SI (match_operand:SI 1 "register_operand" "")
 		 (match_operand:SI 2 "nonmemory_operand" "")))]
   ""
-  "
-{
-  /* We can't add a variable amount directly to the stack pointer;
-     so do so via a temporary register.  */
-  if (operands[0] == stack_pointer_rtx
-      && GET_CODE (operands[1]) != CONST_INT
-      && GET_CODE (operands[2]) != CONST_INT)
-   {
-     rtx temp = gen_reg_rtx (SImode);
-     emit_move_insn (temp, gen_rtx_PLUS (SImode, operands[1], operands[2]));
-     emit_move_insn (operands[0], temp);
-     DONE;
-   }
-}")
+  "")
 
 (define_insn ""
-  [(set (match_operand:SI 0 "register_operand" "=dx,a,x,a,dax,xy,!dax")
+  [(set (match_operand:SI 0 "register_operand" "=dx,a,x,a,dax,!*y,!dax")
 	(plus:SI (match_operand:SI 1 "register_operand" "%0,0,0,0,0,0,dax")
 		 (match_operand:SI 2 "nonmemory_operand" "J,J,L,L,daxi,i,dax")))]
   "TARGET_AM33"
@@ -839,7 +826,7 @@
   [(set_attr "cc" "set_zn,none_0hit,set_zn,none_0hit,set_zn,none_0hit,set_zn")])
 
 (define_insn ""
-  [(set (match_operand:SI 0 "register_operand" "=dx,a,a,dax,xy,!dax")
+  [(set (match_operand:SI 0 "register_operand" "=dx,a,a,dax,!*y,!dax")
 	(plus:SI (match_operand:SI 1 "register_operand" "%0,0,0,0,0,dax")
 		 (match_operand:SI 2 "nonmemory_operand" "J,J,L,daxi,i,dax")))]
   ""

-- 
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]