This is the mail archive of the 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]

[patch] fix address_cost for x86


ix86_address_cost considers offsetted addressing modes cheaper than
the modes without offset.  Ivopts thus try to introduce offsets to addresses
whenever it is possible, even in cases it does not give any gain.
This may result in larger code, or losing debug information (PR 32445).

The motivation for this behavior used to be that this encouraged cse to
create complex addressing modes, thus possibly eliminating some
computations.  However, at the moment the only pass (except for ivopts)
that looks at address_cost is fwprop; and fwprop:should_replace_address
prefers more complex addressing modes even if their cost is the same
as the cost of a simpler addressing mode.  Therefore, changing the
behavior of ix86_address_cost will not affect anything there.

The patch below (that makes the cost of complex addressing modes
the same as the cost of the simple ones) is performance neutral
on both i686 and x86_x64 for spec2000.  It was bootstrapped & regtested
on i686.


	* config/i386/i386.c (ix86_address_cost): Do not consider more complex
	addressing modes cheaper.

Index: config/i386/i386.c
*** config/i386/i386.c	(revision 126166)
--- config/i386/i386.c	(working copy)
*************** ix86_address_cost (rtx x)
*** 6564,6575 ****
    if (parts.index && GET_CODE (parts.index) == SUBREG)
      parts.index = SUBREG_REG (parts.index);
-   /* More complex memory references are better.  */
-   if (parts.disp && parts.disp != const0_rtx)
-     cost--;
-   if (parts.seg != SEG_DEFAULT)
-     cost--;
    /* Attempt to minimize number of registers in the address.  */
    if ((parts.base
         && (!REG_P (parts.base) || REGNO (parts.base) >= FIRST_PSEUDO_REGISTER))
--- 6564,6569 ----

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