[llvm-bugs] [Bug 35489] New: +g and +X inline asm constraints generate worse code than +r
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Nov 30 18:22:20 PST 2017
https://bugs.llvm.org/show_bug.cgi?id=35489
Bug ID: 35489
Summary: +g and +X inline asm constraints generate worse code
than +r
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Common Code Generator Code
Assignee: unassignedbugs at nondot.org
Reporter: richard-llvm at metafoo.co.uk
CC: llvm-bugs at lists.llvm.org
Testcase:
int f(int n) { asm volatile("":"+g"(n)); return n; }
int k = f(4) + 1;
Targeting x86_64, we get this mess:
movl $4, -4(%rsp)
movl $4, %eax
#APP
#NO_APP
movl %eax, -4(%rsp)
addl $1, %eax
movl %eax, k(%rip)
A "+r" constraint, which should be *more* constraining (and thus produce worse
code in general) gives this:
movl $4, %eax
#APP
#NO_APP
addl $1, %eax
movl %eax, k(%rip)
GCC produces the better code for both constraints.
--
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/20171201/e3a73b97/attachment.html>
More information about the llvm-bugs
mailing list