This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Add X86_TUNE_AVOID_LEA_FOR_ADDR
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Uros Bizjak <ubizjak at gmail dot com>
- Date: Fri, 17 Jan 2014 06:50:19 -0800
- Subject: Re: [PATCH] Add X86_TUNE_AVOID_LEA_FOR_ADDR
- Authentication-results: sourceware.org; auth=none
- References: <20140117141937 dot GA1174 at intel dot com> <20140117143031 dot GI892 at tucnak dot redhat dot com>
On Fri, Jan 17, 2014 at 6:30 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Fri, Jan 17, 2014 at 06:19:37AM -0800, H.J. Lu wrote:
>> ix86_split_lea_for_addr transforms a single LEA instruction into a series
>> of MOV and ADD instructions. For
>>
>> lea 0x400(%eax, %ecx, 8), %edx
>>
>> we get
>>
>> mov %eax, %edx
>> add %ecx, %edx
>> add %ecx, %edx
>> add %ecx, %edx
>> add %ecx, %edx
>> add %ecx, %edx
>> add %ecx, %edx
>> add %ecx, %edx
>> add %ecx, %edx
>> add $0x400, %edx
>
> Ugh, is that really want you want for silvermont, as opposed to (at least
> if the output operand isn't equal to the base):
> mov %ecx, %edx ! if base is equal to index this would go away
> add %ecx, %edx
> add %edx, %edx
> add %edx, %edx
> add %eax, %edx
> add $0x400, %edx
> ?
Wrong example. It should be
lea 0x400(%edx, %ecx, 8), %edx
we get
add %ecx, %edx
add %ecx, %edx
add %ecx, %edx
add %ecx, %edx
add %ecx, %edx
add %ecx, %edx
add %ecx, %edx
add %ecx, %edx
add $0x400, %edx
For
lea 0x400(%eax, %ecx, 8), %edx
we get
mov %ecx, %edx
shl $3, %edx
add %eax, %edx
add $0x400, %edx
--
H.J.