[PATCH 3/X, i386, PR54232] Enable EBX for x86 in 32bits PIC code

Uros Bizjak ubizjak@gmail.com
Fri Oct 10 11:27:00 GMT 2014


On Fri, Oct 10, 2014 at 9:58 AM, Evgeny Stupachenko <evstupac@gmail.com> wrote:
> the patch improves performance when previous are applied.
> It makes RTL loop invariant behavior for GOT loads same as it was
> before the 2 previous patches.

> The patch fixes x86 address cost so that cost for addresses with GOT
> register becomes less, how it was before enabling EBX.
>
> In x86_address_cost the result of “REGNO (parts.base) >=
> FIRST_PSEUDO_REGISTER” for hard ebx was always false. The patch makes
> condition result
> the same when parts.base is GOT register (the same for parts.index).
>
> 2014-10-08  Evgeny Stupachenko  <evstupac@gmail.com>
>         * gcc/config/i386/i386.c (ix86_address_cost): Lower cost for
>         when address contains GOT register.
>
> diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
> index b43e870..9d8cfd1 100644
> --- a/gcc/config/i386/i386.c
> +++ b/gcc/config/i386/i386.c
> @@ -12497,8 +12497,12 @@ ix86_address_cost (rtx x, enum machine_mode,
> addr_space_t, bool)
>      cost++;

Please add a short comment here, explaining the reason for new condition.

>    if (parts.base
> +      && (!pic_offset_table_rtx
> +         || REGNO (pic_offset_table_rtx) != REGNO(parts.base))
>        && (!REG_P (parts.base) || REGNO (parts.base) >= FIRST_PSEUDO_REGISTER)
>        && parts.index
> +      && (!pic_offset_table_rtx
> +         || REGNO (pic_offset_table_rtx) != REGNO(parts.index))
>        && (!REG_P (parts.index) || REGNO (parts.index) >= FIRST_PSEUDO_REGISTER)
>        && parts.base != parts.index)
>      cost++;

Otherwise LGTM, but please repost the patch with a comment.

Uros.



More information about the Gcc-patches mailing list