[LLVMbugs] [Bug 4076] New: bug in inline asm constraint
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Sat Apr 25 17:54:02 PDT 2009
http://llvm.org/bugs/show_bug.cgi?id=4076
Summary: bug in inline asm constraint
Product: libraries
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: Backend: X86
AssignedTo: unassignedbugs at nondot.org
ReportedBy: nicholas at mxc.ca
CC: llvmbugs at cs.uiuc.edu, nlewycky at google.com
Created an attachment (id=2886)
--> (http://llvm.org/bugs/attachment.cgi?id=2886)
.ll testcase
The attached .ll file demonstrates a problem where LLVM is picking %eax to
serve in a ptr computation even though it's already reserved as another input
to the inline asm.
$ llvm-as < b.ll | llc -disable-fp-elim
[...]
.LBB1_16: #
movl %esi, %edx
xorl %eax, %eax
movl 20(%ebp), %eax
#APP
lock; cmpxchgl %edx,(%eax,%edi,8)
#NO_APP
Note that cmpxchgl takes %eax as input and output, and it needs to be zero as
per the xorl instruction. The original inline asm statement in C looks like:
inline int32_t NoBarrier_CompareAndSwap(volatile int32_t* ptr,
int32_t old_value,
int32_t new_value) {
int32_t prev;
__asm__ __volatile__("lock; cmpxchgl %1,%2"
: "=a" (prev)
: "q" (new_value), "m" (*ptr), "0" (old_value)
: "memory");
return prev;
}
which compiles fine as a standalone function. The problem only surfaces with
inlining.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list