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]

PPC failure bootstrap fix


Hi,
the PPC failure is actually quite interesting bug.  Zdenek's code does
(quite inovatively) create reduction of induction variables that results
in expression -(symbol + offset) being computed.  Simplify_rtx actually
knows that this can be converted to (-offset)-symbol and fold_rtx
decides to wrap it within CONST rtx that is later put into REG_EQUAL
note.  This note is taken by loop optimizer that verify that it is
immediate_operand that passes since it is LEGITIMATE_CONSTANT_P like on
many other targets and and finally move_movables calls emit_move_insn on
it that produces this expression in instruction stream.  It survives
till final and results in instruction assembler chokes on.

I am not sure who exactly is guilty for this failure but it looks safest to
prevent these constructs from being wrapped by CONST (I would say that
it should not be LEGITIMATE_CONSTANT_P at first places but there seems
to be no such checks anywhere in most backends).

I am just testing the patch on ppc-linux.  Does it seem to make sense at all?

Honza

2004-09-06  Jan Hubicka  <jh@suse.cz>
	* cse.c (fold_rtx):  Avoid building of
	(CONST (MINUS (CONST_INT) (SYMBOL_REF)))
Index: cse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cse.c,v
retrieving revision 1.311
diff -c -3 -p -r1.311 cse.c
*** cse.c	25 Aug 2004 12:30:56 -0000	1.311
--- cse.c	6 Sep 2004 20:28:46 -0000
*************** fold_rtx (rtx x, rtx insn)
*** 3784,3790 ****
  	new = simplify_unary_operation (code, mode,
  					const_arg0 ? const_arg0 : folded_arg0,
  					mode_arg0);
! 	if (new != 0 && is_const)
  	  new = gen_rtx_CONST (mode, new);
        }
        break;
--- 3784,3795 ----
  	new = simplify_unary_operation (code, mode,
  					const_arg0 ? const_arg0 : folded_arg0,
  					mode_arg0);
! 	/* NEG of PLUS is converted it into MINUS that makes assemblers to
! 	   fail.  */
! 	if (new != 0 && is_const
! 	    && (GET_CODE (new) != MINUS
! 	        || (GET_CODE (XEXP (new, 1)) != SYMBOL_REF
! 		    && GET_CODE (XEXP (new, 1)) != LABEL_REF)))
  	  new = gen_rtx_CONST (mode, new);
        }
        break;


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