i960/i960.h (CONST_COSTS, case CONST_INT): Accept power2_operand...

Jim Wilson wilson@cygnus.com
Tue Dec 8 22:16:00 GMT 1998


I have checked in this patch to fix a bug found by running the testsuite on
my simulator.  Gcc aborted for a few testcases because reload_cse_move2add
created an invalid add insn.  It probably shouldn't do that, but the i960
CONST_COSTS was wrong anyways, so I fixed it there.  The reload_cse_move2add
problem should still be looked at.

Tue Dec  8 22:04:33 1998  Jim Wilson  <wilson@cygnus.com>

	* i960/i960.h (CONST_COSTS, case CONST_INT): Accept power2_operand
	only when OUTER_CODE is SET.

Index: i960.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/i960/i960.h,v
retrieving revision 1.16
diff -p -r1.16 i960.h
*** i960.h	1998/09/15 16:32:49	1.16
--- i960.h	1998/12/09 06:04:23
*************** extern struct rtx_def *gen_compare_reg (
*** 1185,1194 ****
     that can be non-ldconst operands in rare cases are cost 1.  Other constants
     have higher costs.  */
  
  #define CONST_COSTS(RTX, CODE, OUTER_CODE)				\
    case CONST_INT:							\
      if ((INTVAL (RTX) >= 0 && INTVAL (RTX) < 32)			\
! 	|| power2_operand (RTX, VOIDmode))				\
        return 0; 							\
      else if (INTVAL (RTX) >= -31 && INTVAL (RTX) < 0)			\
        return 1;								\
--- 1185,1198 ----
     that can be non-ldconst operands in rare cases are cost 1.  Other constants
     have higher costs.  */
  
+ /* Must check for OUTER_CODE of SET for power2_operand, because
+    reload_cse_move2add calls us with OUTER_CODE of PLUS to decide when
+    to replace set with add.  */
+ 
  #define CONST_COSTS(RTX, CODE, OUTER_CODE)				\
    case CONST_INT:							\
      if ((INTVAL (RTX) >= 0 && INTVAL (RTX) < 32)			\
! 	|| (OUTER_CODE == SET && power2_operand (RTX, VOIDmode)))	\
        return 0; 							\
      else if (INTVAL (RTX) >= -31 && INTVAL (RTX) < 0)			\
        return 1;								\



More information about the Gcc-patches mailing list