This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix up ix86_avoid_lea_for_addr (PR target/59880)
- From: Uros Bizjak <ubizjak at gmail dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 20 Jan 2014 13:12:38 +0100
- Subject: Re: [PATCH] Fix up ix86_avoid_lea_for_addr (PR target/59880)
- Authentication-results: sourceware.org; auth=none
- References: <20140120083828 dot GV892 at tucnak dot redhat dot com> <CAFULd4YxEJL4XMoY9umSQ-5D=UHTXcVXC+F9hM93+AYzELSKdA at mail dot gmail dot com>
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:
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.