Fix, was: Re: [Fwd: CVS trunk bootstrap failure on alphaev6-unknown-linux-gnu]

Toon Moene toon@moene.indiv.nluug.nl
Sun Jul 8 08:57:00 GMT 2001


Alexandre Oliva wrote:

> On Jul  7, 2001, Toon Moene <toon@moene.indiv.nluug.nl> wrote:
> 
> > The problem, I think, is in that in reload1.c:9220ff you check for an
> > add insn, but do not have any check for whether the constant to be added
> > is acceptable for that add insn.
> 
> That is a summary of my reply to your previous report of the problem.
> Did you miss the reply or just didn't feel like implementing my
> suggestion?

OK, how about this one [attached].  Passed make bootstrap / make check /
make install on i686-pc-linux-gnu.

I updated have_add2_insn to do the same checks as gen_add2_insn does, to
prevent the latter from aborting because the former let an x,y
combination pass that doesn't actually *have* a corresponding add insn.

Fixing have_add2_insn is simpler, because it's only used in two places
(I also fixed have_sub2_insn, although that one isn't used at all, yet).

OK to install ?

-- 
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
Join GNU Fortran 95: http://g95.sourceforge.net/ (under construction)
2001-07-08  Toon Moene  <toon@moene.indiv.nluug.nl>

	* expr.h: Adjust prototypes for have_add2_insn, have_sub2_insn.
	* optabs.c (have_add2_insn): Check whether the add insn chosen
	really accepts the operands.  (have_sub2_insn): Ditto for sub insn.
	* reload1.c (reload_cse_move2add): Adjust call of have_add2_insn.

*** expr.h.orig	Wed Jul  4 21:09:19 2001
--- expr.h	Sun Jul  8 12:39:47 2001
*************** extern rtx gen_add2_insn PARAMS ((rtx, r
*** 842,847 ****
  extern rtx gen_sub2_insn PARAMS ((rtx, rtx));
  extern rtx gen_move_insn PARAMS ((rtx, rtx));
! extern int have_add2_insn PARAMS ((enum machine_mode));
! extern int have_sub2_insn PARAMS ((enum machine_mode));
  
  /* Return the INSN_CODE to use for an extend operation.  */
--- 842,847 ----
  extern rtx gen_sub2_insn PARAMS ((rtx, rtx));
  extern rtx gen_move_insn PARAMS ((rtx, rtx));
! extern int have_add2_insn PARAMS ((rtx, rtx));
! extern int have_sub2_insn PARAMS ((rtx, rtx));
  
  /* Return the INSN_CODE to use for an extend operation.  */
*** optabs.c.orig	Fri Jun 22 19:19:50 2001
--- optabs.c	Sun Jul  8 12:41:29 2001
*************** gen_add2_insn (x, y)
*** 3766,3773 ****
  
  int
! have_add2_insn (mode)
!      enum machine_mode mode;
  {
!   return add_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing;
  }
  
--- 3766,3786 ----
  
  int
! have_add2_insn (x, y)
!      rtx x, y;
  {
!   int icode = (int) add_optab->handlers[(int) GET_MODE (x)].insn_code; 
! 
!   if (icode == CODE_FOR_nothing)
!     return 0;
! 
!   if (! ((*insn_data[icode].operand[0].predicate)
! 	 (x, insn_data[icode].operand[0].mode))
!       || ! ((*insn_data[icode].operand[1].predicate)
! 	    (x, insn_data[icode].operand[1].mode))
!       || ! ((*insn_data[icode].operand[2].predicate)
! 	    (y, insn_data[icode].operand[2].mode)))
!     return 0;
! 
!   return 1;
  }
  
*************** gen_sub2_insn (x, y)
*** 3792,3799 ****
  
  int
! have_sub2_insn (mode)
!      enum machine_mode mode;
  {
!   return sub_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing;
  }
  
--- 3805,3825 ----
  
  int
! have_sub2_insn (x, y)
!      rtx x, y;
  {
!   int icode = (int) sub_optab->handlers[(int) GET_MODE (x)].insn_code; 
! 
!   if (icode == CODE_FOR_nothing)
!     return 0;
! 
!   if (! ((*insn_data[icode].operand[0].predicate)
! 	 (x, insn_data[icode].operand[0].mode))
!       || ! ((*insn_data[icode].operand[1].predicate)
! 	    (x, insn_data[icode].operand[1].mode))
!       || ! ((*insn_data[icode].operand[2].predicate)
! 	    (y, insn_data[icode].operand[2].mode)))
!     return 0;
! 
!   return 1;
  }
  
*** reload1.c.orig	Fri Jun 22 19:19:51 2001
--- reload1.c	Sun Jul  8 12:32:07 2001
*************** reload_cse_move2add (first)
*** 9173,9177 ****
  		    success = validate_change (insn, &SET_SRC (pat), reg, 0);
  		  else if (rtx_cost (new_src, PLUS) < rtx_cost (src, SET)
! 			   && have_add2_insn (GET_MODE (reg)))
  		    success = validate_change (insn, &PATTERN (insn),
  					       gen_add2_insn (reg, new_src), 0);
--- 9173,9177 ----
  		    success = validate_change (insn, &SET_SRC (pat), reg, 0);
  		  else if (rtx_cost (new_src, PLUS) < rtx_cost (src, SET)
! 			   && have_add2_insn (reg, new_src))
  		    success = validate_change (insn, &PATTERN (insn),
  					       gen_add2_insn (reg, new_src), 0);
*************** reload_cse_move2add (first)
*** 9224,9228 ****
  		      else if ((rtx_cost (new_src, PLUS)
  				< COSTS_N_INSNS (1) + rtx_cost (src3, SET))
! 			       && have_add2_insn (GET_MODE (reg)))
  			success
  			  = validate_change (next, &PATTERN (next),
--- 9224,9228 ----
  		      else if ((rtx_cost (new_src, PLUS)
  				< COSTS_N_INSNS (1) + rtx_cost (src3, SET))
! 			       && have_add2_insn (reg, new_src))
  			success
  			  = validate_change (next, &PATTERN (next),


More information about the Gcc-patches mailing list