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: Uros Bizjak <ubizjak at gmail dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: Jakub Jelinek <jakub at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 17 Jan 2014 16:24:50 +0100
- 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> <CAMe9rOo+_sEh9=-MRK41ErB9+KFRvJnSoUPGG-OC+HZK_hrMVQ at mail dot gmail dot com>
On Fri, Jan 17, 2014 at 3:50 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>
> 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
Even for this example, the code can be substantially improved:
shl $3, %ecx
add %ecx, %edx
add $0x400, %edx
Uros.