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]

Patch mn10300 PREFERRED_RELOAD_CLASS


All

This patch fixes the "Insn does not satisfy its constraints:" failure
for the gcc.c-torture/compile/930120-1.c testcase (and a few others).

The problem was this insn 

(insn 819 816 37 (set (reg/v:QI 6 a2)
        (mem:QI (reg:SI 4 a0) 0)) 2 {tstsi-12} (nil)
    (nil))

which matched this define_insn in mn10300.md

(define_insn ""
  [(set (match_operand:QI 0 "general_operand" "=d*a,d,d*a,d,m")
        (match_operand:QI 1 "general_operand" "0,I,dai,m,d"))]
  "register_operand (operands[0], QImode)
   || register_operand (operands[1], QImode)"
  "*

The problem is the mn10300 cannot move from a mem:QI to an address.

The solution is to use PREFERRED_RELOAD_CLASS to restict the
reload class of a MEM:QI/HI to DATA_REG using LIMIT_RELOAD_CLASS

This patch has been approved by Jeff Law (Jeff can you check it
in as I don't have write access) 

Graham

ChangeLog

	* mn10300.h (PREFEREED_RELOAD_CLASS): Use LIMIT_RELOAD_CLASS
	to restrict the preferred reload class of a MEM.
	* Parenthesize macro arguments.

-----------------------------------------------------------------------
Index: mn10300.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/mn10300/mn10300.h,v
retrieving revision 1.36
diff -c -p -r1.36 mn10300.h
*** mn10300.h   2000/06/27 02:26:22     1.36
--- mn10300.h   2000/06/30 10:57:42
*************** enum reg_class {
*** 379,387 ****
     In general this is just CLASS; but on some machines
     in some cases it is preferable to use a more restrictive class.  */

! #define PREFERRED_RELOAD_CLASS(X,CLASS) \
!   (X == stack_pointer_rtx && CLASS != SP_REGS \
!    ? ADDRESS_OR_EXTENDED_REGS : CLASS)

  #define PREFERRED_OUTPUT_RELOAD_CLASS(X,CLASS) \
    (X == stack_pointer_rtx && CLASS != SP_REGS \
--- 379,390 ----
     In general this is just CLASS; but on some machines
     in some cases it is preferable to use a more restrictive class.  */

! #define PREFERRED_RELOAD_CLASS(X,CLASS)                       \
!   ((X) == stack_pointer_rtx && (CLASS) != SP_REGS     \
!    ? ADDRESS_OR_EXTENDED_REGS                         \
!    : (GET_CODE (X) == MEM                             \
!       ? LIMIT_RELOAD_CLASS (GET_MODE (X), CLASS)      \
!       : (CLASS)))

  #define PREFERRED_OUTPUT_RELOAD_CLASS(X,CLASS) \
    (X == stack_pointer_rtx && CLASS != SP_REGS \
-----------------------------------------------------------------------
Index: mn10300.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/mn10300/mn10300.h,v
retrieving revision 1.36
diff -c -p -r1.36 mn10300.h
*** mn10300.h	2000/06/27 02:26:22	1.36
--- mn10300.h	2000/06/30 10:57:42
*************** enum reg_class {
*** 379,387 ****
     In general this is just CLASS; but on some machines
     in some cases it is preferable to use a more restrictive class.  */
  
! #define PREFERRED_RELOAD_CLASS(X,CLASS) \
!   (X == stack_pointer_rtx && CLASS != SP_REGS \
!    ? ADDRESS_OR_EXTENDED_REGS : CLASS)
  
  #define PREFERRED_OUTPUT_RELOAD_CLASS(X,CLASS) \
    (X == stack_pointer_rtx && CLASS != SP_REGS \
--- 379,390 ----
     In general this is just CLASS; but on some machines
     in some cases it is preferable to use a more restrictive class.  */
  
! #define PREFERRED_RELOAD_CLASS(X,CLASS)			\
!   ((X) == stack_pointer_rtx && (CLASS) != SP_REGS	\
!    ? ADDRESS_OR_EXTENDED_REGS				\
!    : (GET_CODE (X) == MEM				\
!       ? LIMIT_RELOAD_CLASS (GET_MODE (X), CLASS)	\
!       : (CLASS)))
  
  #define PREFERRED_OUTPUT_RELOAD_CLASS(X,CLASS) \
    (X == stack_pointer_rtx && CLASS != SP_REGS \

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