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]

SH: don't tie SFmode to other FP modes


I've stumbled across a problem in the SH port that has existed for a
long time but, for some reason, had never shown up.  The tree in which
I observed the problem was actually quite different from the current
GCC sources, but I'm confident we do have a problem anyway.

Basically, before local register allocation, there was an insn like
this:

(set (reg:DF ##1) (float_extend:DF (reg:SF ##2)))

both operands were pseudos.

##1 was assigned to xd0, which is a register that we use only for
DFmode values.  Then, ##2 was tied to ##1, and we ended up with:

(set (reg:DF xd0) (float_extend:DF (reg:SF xd0)))

which is invalid not only because of unmatched constraint (that reload
would eventually fix up) but because HARD_REGNO_MODE_OK doesn't accept
SFmode in XD registers.  So, it seems to me that we should avoid tying
such registers together.

Ok to install?

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

	* config/sh/sh.h (MODES_TIEABLE_P): Don't tie SFmode to other FP
	modes.

Tue Nov  7 01:16:32 2000  Alexandre Oliva  <aoliva@redhat.com>

	* mklibgcc.in (EXTRA_MULTILIB_PARTS): Generate multilib parts
	in-place.

Index: gcc/config/sh/sh.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/sh/sh.h,v
retrieving revision 1.81
diff -u -p -r1.81 sh.h
--- gcc/config/sh/sh.h 2000/11/02 23:29:13 1.81
+++ gcc/config/sh/sh.h 2000/11/07 03:43:26
@@ -537,10 +537,14 @@ do {									\
 /* Value is 1 if it is a good idea to tie two pseudo registers
    when one has mode MODE1 and one has mode MODE2.
    If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
-   for any hard reg, then this must be 0 for correct output.  */
+   for any hard reg, then this must be 0 for correct output.
+   That's the case for xd registers: we don't hold SFmode values in them
+   pseudos with those in other floating-point modes.  */
 
 #define MODES_TIEABLE_P(MODE1, MODE2) \
-  ((MODE1) == (MODE2) || GET_MODE_CLASS (MODE1) == GET_MODE_CLASS (MODE2))
+  ((MODE1) == (MODE2) \
+   || (GET_MODE_CLASS (MODE1) == GET_MODE_CLASS (MODE2) \
+       && (MODE1) != SFmode && (MODE2) != SFmode))
 
 /* Specify the registers used for certain standard purposes.
    The values of these macros are register numbers.  */

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* 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]