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]

i386 CONST_COSTS take 2


Hi,
this patch sets costs to 0 instead of negative values.
I've checked on compiling combine.c, that it basically just avoids
extra register used to hold "funny" constants we used previously.

Code size grows slightly (<1%), but I believe it to be win perofrmance wise.

Honza

Fri Jun  8 21:38:15 CEST 2001  Jan Hubicka  <jh@suse.cz>
	* i386.h (CONST_COSTS): set cost of constants representable in
	immediate fields to 0.
Index: i386.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/i386/i386.h,v
retrieving revision 1.186
diff -c -3 -p -r1.186 i386.h
*** i386.h	2001/06/06 12:57:31	1.186
--- i386.h	2001/06/08 19:37:06
*************** while (0)
*** 2370,2391 ****
  
  #define CONST_COSTS(RTX,CODE,OUTER_CODE) \
    case CONST_INT:						\
-     return (unsigned) INTVAL (RTX) < 256 ? 0 : 1;		\
    case CONST:							\
    case LABEL_REF:						\
    case SYMBOL_REF:						\
!     return flag_pic && SYMBOLIC_CONST (RTX) ? 2 : 1;		\
  								\
    case CONST_DOUBLE:						\
      {								\
        int code;							\
        if (GET_MODE (RTX) == VOIDmode)				\
! 	return 2;						\
  								\
        code = standard_80387_constant_p (RTX);			\
!       return code == 1 ? 0 :					\
! 	     code == 2 ? 1 :					\
! 			 2;					\
      }
  
  /* Delete the definition here when TOPLEVEL_COSTS_N_INSNS gets added to cse.c */
--- 2370,2390 ----
  
  #define CONST_COSTS(RTX,CODE,OUTER_CODE) \
    case CONST_INT:						\
    case CONST:							\
    case LABEL_REF:						\
    case SYMBOL_REF:						\
!     return flag_pic && SYMBOLIC_CONST (RTX) ? 1 : 0;		\
  								\
    case CONST_DOUBLE:						\
      {								\
        int code;							\
        if (GET_MODE (RTX) == VOIDmode)				\
! 	return 0;						\
  								\
        code = standard_80387_constant_p (RTX);			\
!       return code == 1 ? 1 :					\
! 	     code == 2 ? 2 :					\
! 			 3;					\
      }
  
  /* Delete the definition here when TOPLEVEL_COSTS_N_INSNS gets added to cse.c */


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