On Fri, Jul 6, 2012 at 5:24 PM, Andi Kleen <a...@firstfloor.org> wrote:
> Uros Bizjak <ubiz...@gmail.com> writes:

>> Sometimes, gcc generates:
>>
>> leaq    (%rbx,%rax), %rax
>>
>> that is in fact equivalent (modulo flags reg clobber) to:
>>
>> addq    %rbx, %rax
>>
>> Attached patch adds additional peephole2 patterns that convert LEA to
>> ADD when second operand of PLUS RTX matches output operand.
>
> Are you sure this is a win?
>
> In the past on some CPUs this was done intentionally because the AGU
> had more execution resources than the ALU.

This is just a case of commutative operand handing, following existing
approach. Please note that there is a separate pass that converts ADDs
to LEAs when appropriate.

Uros.

Reply via email to