[PATCH] simplify X86 LEA's assembly code

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

LGTM