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 address_cost tweek



Hi,
the is second half of the strength reduction tweek.  I wanted to benchmark it
first and I got only improvements (noticeable - 12% in artifical benchmarks, I
am not sure how much in practical, at least I got no degradation).

Bootstrapped/regtested i386 toghether with my previous patch.
Honza

Tue Aug  7 21:58:43 CEST 2001  Jan Hubicka  <jh@suse.cz>
	* i386.c (ix86_address_cost): Be more curefull about preferring
	complex addresses.

Index: gcc/config/i386/i386.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/i386/i386.c,v
retrieving revision 1.292
diff -c -3 -p -r1.292 i386.c
*** i386.c	2001/08/04 16:46:00	1.292
--- i386.c	2001/08/07 18:36:27
*************** ix86_address_cost (x)
*** 3039,3045 ****
       rtx x;
  {
    struct ix86_address parts;
!   int cost = 1;
  
    if (!ix86_decompose_address (x, &parts))
      abort ();
--- 3039,3045 ----
       rtx x;
  {
    struct ix86_address parts;
!   int cost = 3;
  
    if (!ix86_decompose_address (x, &parts))
      abort ();
*************** ix86_address_cost (x)
*** 3047,3052 ****
--- 3047,3056 ----
    /* More complex memory references are better.  */
    if (parts.disp && parts.disp != const0_rtx)
      cost--;
+   if (parts.disp && GET_CODE (parts.disp) == CONST)
+     cost--;
+   if (parts.scale != 1)
+     cost--;
  
    /* Attempt to minimize number of registers in the address.  */
    if ((parts.base
*************** ix86_address_cost (x)
*** 3054,3067 ****
        || (parts.index
  	  && (!REG_P (parts.index)
  	      || REGNO (parts.index) >= FIRST_PSEUDO_REGISTER)))
!     cost++;
  
    if (parts.base
        && (!REG_P (parts.base) || REGNO (parts.base) >= FIRST_PSEUDO_REGISTER)
        && parts.index
        && (!REG_P (parts.index) || REGNO (parts.index) >= FIRST_PSEUDO_REGISTER)
        && parts.base != parts.index)
!     cost++;
  
    /* AMD-K6 don't like addresses with ModR/M set to 00_xxx_100b,
       since it's predecode logic can't detect the length of instructions
--- 3058,3071 ----
        || (parts.index
  	  && (!REG_P (parts.index)
  	      || REGNO (parts.index) >= FIRST_PSEUDO_REGISTER)))
!     cost += 3;
  
    if (parts.base
        && (!REG_P (parts.base) || REGNO (parts.base) >= FIRST_PSEUDO_REGISTER)
        && parts.index
        && (!REG_P (parts.index) || REGNO (parts.index) >= FIRST_PSEUDO_REGISTER)
        && parts.base != parts.index)
!     cost += 3;
  
    /* AMD-K6 don't like addresses with ModR/M set to 00_xxx_100b,
       since it's predecode logic can't detect the length of instructions


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