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]
Other format: [Raw text]

[PATCH] operands_match_p for multiple hard registers


	My recent change to trunctfdf2 for AIX/Darwin/PPC64 Linux long
double format exposed a failure where GCC would match an alternative
requiring matching constraints for a case where the two operands are
different registers.  With help from Richard Earnshaw, I finally tracked
this down to a piece of code in reload.c:operands_match_p() that considers
the different operands a match on purpose.

	The code specifically matches the *last* register of a multiple
hard register group, as explained in the comment:

      /* On a WORDS_BIG_ENDIAN machine, point to the last register of a
         multiple hard register group, so that for example (reg:DI 0) and
         (reg:SI 1) will be considered the same register.  */

Due to the specific register allocation occuring for the example, the code
adjusted the register numbers to cause a match.

	This behavior only seems to make sense for scalar integers, so I
am proposing restricting the behavior to that subset of modes.  I
considered using CANNOT_CHANGE_MODE_CLASS, but I cannot see where the
benefit would justify the more extensive changes necessary to invoke that
optional macro.

	Okay for mainline?

David

	* reload.c (operands_match_p): Only match SCALAR_INT_MODE_P
	modes in multiple hard registers.

Index: reload.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/reload.c,v
retrieving revision 1.267
diff -c -p -r1.267 reload.c
*** reload.c	14 Feb 2005 15:07:05 -0000	1.267
--- reload.c	24 Feb 2005 01:00:22 -0000
*************** operands_match_p (rtx x, rtx y)
*** 2163,2171 ****
--- 2163,2173 ----
  	 multiple hard register group, so that for example (reg:DI 0) and
  	 (reg:SI 1) will be considered the same register.  */
        if (WORDS_BIG_ENDIAN && GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD
+ 	  && SCALAR_INT_MODE_P (GET_MODE (x))
  	  && i < FIRST_PSEUDO_REGISTER)
  	i += hard_regno_nregs[i][GET_MODE (x)] - 1;
        if (WORDS_BIG_ENDIAN && GET_MODE_SIZE (GET_MODE (y)) > UNITS_PER_WORD
+ 	  && SCALAR_INT_MODE_P (GET_MODE (y))
  	  && j < FIRST_PSEUDO_REGISTER)
  	j += hard_regno_nregs[j][GET_MODE (y)] - 1;
  


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