https://bugs.llvm.org/show_bug.cgi?id=42490

            Bug ID: 42490
           Summary: Suboptimal LEA codegen
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

Haswell X86-64

int extra_lea(int *p, int xp) {
    *p = xp + 21;
    return *p * 2;
}

Clang -O3 trunk:

extra_lea(int*, int):                        # @extra_lea(int*, int)
        lea     eax, [rsi + 21]
        mov     dword ptr [rdi], eax
        lea     eax, [rsi + rsi]
        add     eax, 42
        ret

GCC -O3 trunk:
extra_lea(int*, int):
        lea     eax, [rsi+21]
        mov     DWORD PTR [rdi], eax
        add     eax, eax
        ret

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to