This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, i386]: Convert some more simple LEAs to ADD.
On Fri, Jul 6, 2012 at 5:24 PM, Andi Kleen <andi@firstfloor.org> wrote:
> Uros Bizjak <ubizjak@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.