This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 3/X, i386, PR54232] Enable EBX for x86 in 32bits PIC code
- From: Uros Bizjak <ubizjak at gmail dot com>
- To: Evgeny Stupachenko <evstupac at gmail dot com>
- Cc: Jeff Law <law at redhat dot com>, Vladimir Makarov <vmakarov at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 13 Oct 2014 18:10:26 +0200
- Subject: Re: [PATCH 3/X, i386, PR54232] Enable EBX for x86 in 32bits PIC code
- Authentication-results: sourceware.org; auth=none
- References: <CAOvf_xxeCuyAFDU6UOwO9_XU4dcXViHj5e2G36vghUVLDGG8Kg at mail dot gmail dot com> <CAFULd4YcB3eogtfnYd2EPfbLeqq5DrqtTdHiZno7Bcx_+0wC7Q at mail dot gmail dot com> <CAOvf_xwYSxEKbXssBAH2KBUZQzMDJzBHXvM5R4tJZ=hvihccKw at mail dot gmail dot com>
On Mon, Oct 13, 2014 at 5:17 PM, Evgeny Stupachenko <evstupac@gmail.com> wrote:
> Patch updated with the comment:
>
> diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
> index 2a64d2d..5fd6a82 100644
> --- a/gcc/config/i386/i386.c
> +++ b/gcc/config/i386/i386.c
> @@ -12455,9 +12455,18 @@ ix86_address_cost (rtx x, enum machine_mode,
> addr_space_t, bool)
> || REGNO (parts.index) >= FIRST_PSEUDO_REGISTER)))
> cost++;
>
> + /* When address base or index is "pic_offset_table_rtx" we don't increase
> + address cost. When a memop with "pic_offset_table_rtx" is not invariant
> + itself it most likely means that base or index is not invariant.
> + Therefore only "pic_offset_table_rtx" could be hoisted out, which is not
> + profitable for x86. */
> 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++;
LGTM.
OK.
Thanks,
Uros.