[LLVMdev] [PATCH] simplify X86 LEA's assembly code

Craig Topper craig.topper at gmail.com
Mon Mar 23 10:25:27 PDT 2015


LGTM

On Mon, Mar 23, 2015 at 9:26 AM, Jun Koi <junkoi2004 at gmail.com> wrote:

> The current assembly of LEA instruction looks very weird.
> This patch simplifies it.
>
> Thanks.
>
>
> diff --git a/lib/Target/X86/X86InstrArithmetic.td
> b/lib/Target/X86/X86InstrArithmetic.td
> index 78efc4d..1a874b0 100644
> --- a/lib/Target/X86/X86InstrArithmetic.td
> +++ b/lib/Target/X86/X86InstrArithmetic.td
> @@ -18,23 +18,23 @@ let SchedRW = [WriteLEA] in {
>  let hasSideEffects = 0 in
>  def LEA16r   : I<0x8D, MRMSrcMem,
>                   (outs GR16:$dst), (ins anymem:$src),
> -                 "lea{w}\t{$src|$dst}, {$dst|$src}", [], IIC_LEA_16>,
> OpSize16;
> +                 "lea{w}\t{$src, $dst|$dst, $src}", [], IIC_LEA_16>,
> OpSize16;
>  let isReMaterializable = 1 in
>  def LEA32r   : I<0x8D, MRMSrcMem,
>                   (outs GR32:$dst), (ins anymem:$src),
> -                 "lea{l}\t{$src|$dst}, {$dst|$src}",
> +                 "lea{l}\t{$src, $dst|$dst, $src}",
>                   [(set GR32:$dst, lea32addr:$src)], IIC_LEA>,
>                   OpSize32, Requires<[Not64BitMode]>;
>
>  def LEA64_32r : I<0x8D, MRMSrcMem,
>                    (outs GR32:$dst), (ins lea64_32mem:$src),
> -                  "lea{l}\t{$src|$dst}, {$dst|$src}",
> +                  "lea{l}\t{$src, $dst|$dst, $src}",
>                    [(set GR32:$dst, lea64_32addr:$src)], IIC_LEA>,
>                    OpSize32, Requires<[In64BitMode]>;
>
>  let isReMaterializable = 1 in
>  def LEA64r   : RI<0x8D, MRMSrcMem, (outs GR64:$dst), (ins lea64mem:$src),
> -                  "lea{q}\t{$src|$dst}, {$dst|$src}",
> +                  "lea{q}\t{$src, $dst|$dst, $src}",
>                    [(set GR64:$dst, lea64addr:$src)], IIC_LEA>;
>  } // SchedRW
>
>
>


-- 
~Craig
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150323/34afbcf5/attachment.html>


More information about the llvm-dev mailing list