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]

New mn10300 cmpsi breaks reload


Reload assumes that, when one operand is to match another, one of them
must be for input and the other must be for output.  No exceptions.
It has been like that forever (25-mar-91, as per the CVS log).  I
don't understand how this didn't break for you, Matt, but I've just
noticed it's broken now.  Perhaps it's some side effect or subreg byte
or something else, I don't know.  But it can't even build libgcc now.

Here's a patch that fixes this.  Sorry for having led you the wrong
path (I was the one who had suggested removing the `!'s :-(

I'm checking this in.

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

	* config/mn10300/mn10300.md (cmpsi): Tell reload to disregard the
	first alternative.

Index: gcc/config/mn10300/mn10300.md
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/mn10300/mn10300.md,v
retrieving revision 1.41
diff -u -p -r1.41 mn10300.md
--- gcc/config/mn10300/mn10300.md 2001/04/14 07:26:52 1.41
+++ gcc/config/mn10300/mn10300.md 2001/04/14 11:03:12
@@ -718,9 +718,17 @@
 ;; but will have the proper effect on cc0.  Using d0 is arbitrary; any
 ;; data register would work.)
 
+;; Even though the first alternative would be preferrable if it can
+;; possibly match, reload must not be given the opportunity to attempt
+;; to use it.  It assumes that such matches can only occur when one of
+;; the operands is used for input and the other for output.  Since
+;; this is not the case, it abort()s.  Indeed, such a reload cannot be
+;; possibly satisfied, so just mark the alternative with a `!', so
+;; that it is not considered by reload.
+
 (define_insn "cmpsi"
   [(set (cc0)
-	(compare (match_operand:SI 0 "register_operand" "*d*a*x,dax")
+	(compare (match_operand:SI 0 "register_operand" "!*d*a*x,dax")
 		 (match_operand:SI 1 "nonmemory_operand" "*0,daxi")))]
   ""
   "@

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