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]

MIPS PATCH: Fix reload pattern



Attached is a proposed patch for PR275.  However, I am a little unsure
as to whether the patch is correct or not, and I would welcome outside
opinion.

The problem occurs during reload.  We were getting into the
reload_outdi pattern with:

  - Operand 0 a MEM with an invalid address, i.e., one such that
    memory_address_p didn't hold.

  - Operand 1 a REG.

When we tried to do this (towards the bottom of the output template)

  emit_move_insn (operands[0], scratch);

we aborted because the address was invalid.

I made the reload_outdi pattern match the SImode pattern by making
sure that operand 0 was a general_operand; that allowed the
compilation to complete.

I don't have access to a MIPS box at the moment, and there are some
problems bootstrapping on IRIX at the moment, so it will take me a
little while to test the patch.  I'll do that ASAP, though, and
check-in at that point -- unless someone tells me that my change is
incorrect.

Here's the test-case, for reference.  Compile for mips-sgi-irix6.5,
with "-mabi=64 -O1" to see the abort.

	SUBROUTINE SGBTRF( M, KL, KU, AB, LDAB )

  *  PR fortran/275
  *  ICE in `change_address', at emit-rtl.c:1589 with -O1 and above
  *  g77 version 2.96 20000530 (experimental) on mips-sgi-irix6.5/-mabi=64
  *
  *  Originally derived from LAPACK 3.0 test suite failure.
  *
  *  David Billinghurst, (David.Billinghurst@riotinto.com.au)
  *  1 June 2000

	INTEGER   KL, KU, LDAB, M
	REAL      AB( LDAB, * )

	INTEGER   J, JB, JJ, JP, KV, KM
	REAL      WORK13(65,64), WORK31(65,64)
	KV = KU + KL
	DO J = 1, M
	   JB = MIN( 1, M-J+1 )
	   DO JJ = J, J + JB - 1
	      KM = MIN( KL, M-JJ )
	      JP = MAX( KM+1, AB( KV+1, JJ ) )
	      CALL SSWAP( JB, AB( KV+1+JJ-J, J ), LDAB-1,
       $           AB( KV+JP+JJ-J, J ), LDAB-1 )
	   END DO
	END DO
	RETURN
	END

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

Index: mips.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.md,v
retrieving revision 1.87
diff -c -p -r1.87 mips.md
*** mips.md	2000/11/28 21:31:44	1.87
--- mips.md	2001/04/18 21:24:26
*************** move\\t%0,%z4\\n\\
*** 5087,5093 ****
  ;; use a TImode scratch reg.
  
  (define_expand "reload_outdi"
!   [(set (match_operand:DI 0 "" "=b")
  	(match_operand:DI 1 "se_register_operand" "b"))
     (clobber (match_operand:TI 2 "register_operand" "=&d"))]
    "TARGET_64BIT"
--- 5087,5093 ----
  ;; use a TImode scratch reg.
  
  (define_expand "reload_outdi"
!   [(set (match_operand:DI 0 "general_operand" "=b")
  	(match_operand:DI 1 "se_register_operand" "b"))
     (clobber (match_operand:TI 2 "register_operand" "=&d"))]
    "TARGET_64BIT"


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