[LLVMbugs] [Bug 20311] New: Header cpuid.h assembly breaks
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Jul 15 15:43:11 PDT 2014
http://llvm.org/bugs/show_bug.cgi?id=20311
Bug ID: 20311
Summary: Header cpuid.h assembly breaks
Product: clang
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: gjasny at googlemail.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Hello,
the following occured with Xcode 5.1.1 but I don't see why it cannot occur also
with the header file shipped with clang.
I put the following into radar bug #17686779
Summary:
Hello,
I'm using Xcode 5.1.1(clang-503.0.40) on 10.10 DP3 and build 32bit i386
binaries.
The __cpuid macro from cupid.h:
__asm(" pushl %%ebx\n" \
" cpuid\n" \
" mov %%ebx,%1\n" \
" popl %%ebx" \
: "=a"(__eax), "=r" (__ebx), "=c"(__ecx), "=d"(__edx) \
: "0"(__level))
gets compiled into:
0x3921f5: cpuid
0x3921f7: movl %ebx, %ebx
0x3921f9: popl %ebx
The push/pop is used to preserve the pic register ebx across calls, but this
fails if ebx itself is picked as alternative register (=r) because the cpuid
output in ebx never reaches the target.
Steps to Reproduce:
I was not able to produce a minimal testcase because there esi was used instead
of ebx and the precondition for this bug was not met.
Expected Results:
The compiler must be told to not use ebx for the =r constraint.
Replacing =r in this macro with =S fixes the bug for me.
Actual Results:
Broken code
Version:
Xcode Version 5.1.1 (5B1008) (clang-503.0.40) on 10.10 DP3
--
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/20140715/c853e6d5/attachment.html>
More information about the llvm-bugs
mailing list