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]

Re: [PATCH v2, i386]: Handle zero extended addresses in ix86_avoid_lea_for_addr

On Fri, Jul 27, 2012 at 7:16 PM, Uros Bizjak <> wrote:
> On Fri, Jul 27, 2012 at 11:29 AM, Uros Bizjak <> wrote:
>> Attached patch enables ix86_avoid_lea_for_addr to process
>> zero-extended addresses. This patch should help atom performance,
>> especially in x32 mode.
>> Please note the complication with insn re-recognition in
>> ix86_avoid_lea_for_addr, to solve the problem as described in the
>> comment:
>>   /* ix86_avoid_lea_for_addr re-recognizes insn and changes operands[]
>>      array behind our backs.  To make things worse, zero-extended oeprands
>>      (zero_extend:DI (addr:SI)) are re-recognized as (addr:DI), since they
>>      also satisfy operand constraints of one of many *lea<mode> insn patterns.
> Actually, the instruction gets re-recognized as
> *zero_extendsidi2_rex64, this is the reason why we got DImode
> (addr:DI) operand. This fact further uncovers existing problem with
> ix86_avoid_lea_for_addr. This function should not mark addresses
> having less than two operands for splitting. These patterns are
> re-recognized as MOV (and now as zero-extending MOVL) due to the
> approach, described in the comment above, and due to the fact that we
> define *mov{si,di} and *zero_extendsidi2_rex64 patterns before
> *lea<mode> in the
> However, here is no point messing with these patterns in splitters,
> they are conditionally converted to LEAs at the insn emission phase
> (see i.e. *zero_extendsidi2_rex64 change in attached patch). The
> attached patch prevents splitting by a simple criteria function.
> As a bonus, the patch also includes conditional splitter for
> non-destructive zero-extended adds.
> 2012-07-27  Uros Bizjak  <>
>         * config/i386/i386.c (ix86_avoid_lea_for_addr): Handle
>         zero-extended addresses.  Return false if the address has less
>         than two components.
>         (ix86_split_lea_for_addr): Unconditionally convert target and
>         all address operands to requested mode.
>         * config/i386/ (*lea<mode>): Pass SImode to
>         ix86_split_lea_for_addr when splitting zero-extended address.
>         (zero-extended add splitter): New splitter to conditionally split
>         non-destructive adds.
>         (*zero_extendsidi2_rex64): Conditionally emit leal instead of movl.
> I am currently re-testing v2 patch.

... now with correct v2 patch attached.


Attachment: p2.diff.txt
Description: Text document

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