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]
Other format: [Raw text]

Re: [PATCH] Fix up ix86_avoid_lea_for_addr (PR target/59880)


On Mon, Jan 20, 2014 at 1:12 PM, Uros Bizjak <ubizjak@gmail.com> wrote:
> On Mon, Jan 20, 2014 at 10:11 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
>
>>> As mentioned in the PR or even in the comment below, ix86_decompose_address
>>> sometimes sets parts.base to some REG and parts.disp to const0_rtx, even
>>> when the operands aren't of a lea insn, but normal or zero extending mov.
>>>
>>> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
>>> trunk?
>>>
>>> 2014-01-20  Jakub Jelinek  <jakub@redhat.com>
>>>
>>>         PR target/59880
>>>         * config/i386/i386.c (ix86_avoid_lea_for_addr): Return false
>>>         if operands[1] is a REG or ZERO_EXTEND of a REG.
>>>
>>>         * gcc.target/i386/pr59880.c: New test.
>
>> This is OK for mainline, I will take care for a backport (together
>> with 59379) to other release branches.
>
> There are some additional zero-extension insns (SUBREG and AND, all
> conveniently detected in SImode_address_operand predicate) that should
> be considered here. I am testing following patch:

Tested on x86_64-pc-linux-gnu and committed to mainline with following
ChangeLog:

2014-01-20  Uros Bizjak  <ubizjak@gmail.com>

    * config/i386/i386.c (ix86_avoid_lea_for_addr): Return false
    for SImode_address_operand operands, having only a REG argument.

> Index: config/i386/i386.c
> ===================================================================
> --- config/i386/i386.c  (revision 206792)
> +++ config/i386/i386.c  (working copy)
> @@ -18160,13 +18160,12 @@ ix86_avoid_lea_for_addr (rtx insn, rtx operands[])
>      return false;
>
>    /* The "at least two components" test below might not catch simple
> -     *mov[sd]i_internal or *zero_extendsidi2 insns if parts.base is
> -     non-NULL and parts.disp is const0_rtx as the only components in
> -     the address, e.g. if the register is %rbp or %r13.  As this
> -     test is much cheaper and moves or zero extensions are the common
> -     case, do this check first.  */
> +     move or zero extension insns if parts.base is non-NULL and parts.disp
> +     is const0_rtx as the only components in the address, e.g. if the
> +     register is %rbp or %r13.  As this test is much cheaper and moves or
> +     zero extensions are the common case, do this check first.  */
>    if (REG_P (operands[1])
> -      || (GET_CODE (operands[1]) == ZERO_EXTEND
> +      || (SImode_address_operand (operands[1], VOIDmode)
>           && REG_P (XEXP (operands[1], 0))))
>      return false;
>

Uros.


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