[llvm-bugs] [Bug 47530] New: clang asm chooses poorly for "=rm"

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Sep 14 14:55:11 PDT 2020


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

            Bug ID: 47530
           Summary: clang asm chooses poorly for "=rm"
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: luto at mit.edu
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

With this trivial input:

unsigned long mov_zero(void)
{
        unsigned long ret;
        asm ("movq $0, %0" : "=rm" (ret));
        return ret;
}

clang -O2 generates this very suboptimal output:

mov_zero:
 movq $0x0,-0x8(%rsp)
 mov -0x8(%rsp),%rax
 ret

gcc does much better:

mov_zero:
 mov $0x0,%rax
 retq

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200914/765d1ee4/attachment.html>


More information about the llvm-bugs mailing list