[llvm-commits] CVS: llvm/lib/Target/X86/X86Subtarget.cpp

Evan Cheng evan.cheng at apple.com
Mon Oct 16 17:25:03 PDT 2006



Changes in directory llvm/lib/Target/X86:

X86Subtarget.cpp updated: 1.37 -> 1.38
---
Log message:

Proper fix.

---
Diffs of the changes:  (+4 -5)

 X86Subtarget.cpp |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)


Index: llvm/lib/Target/X86/X86Subtarget.cpp
diff -u llvm/lib/Target/X86/X86Subtarget.cpp:1.37 llvm/lib/Target/X86/X86Subtarget.cpp:1.38
--- llvm/lib/Target/X86/X86Subtarget.cpp:1.37	Mon Oct 16 16:00:37 2006
+++ llvm/lib/Target/X86/X86Subtarget.cpp	Mon Oct 16 19:24:49 2006
@@ -32,16 +32,15 @@
 bool X86::GetCpuIDAndInfo(unsigned value, unsigned *rEAX, unsigned *rEBX,
                           unsigned *rECX, unsigned *rEDX) {
 #if defined(__x86_64__)
-  unsigned long long saveRBX;
-  asm ("nop" : "=b" (saveRBX));
-  asm ("cpuid\n\t"
-       "movl\t%%ebx, %%esi\n\t"
+  // gcc doesn't know cpuid would clobber ebx/rbx. Preseve it manually.
+  asm ("movq\t%%rbx, %%rsi\n\t"
+       "cpuid\n\t"
+       "xchgq\t%%rbx, %%rsi\n\t"
        : "=a" (*rEAX),
          "=S" (*rEBX),
          "=c" (*rECX),
          "=d" (*rEDX)
        :  "a" (value));
-  asm ("nop" :: "b" (saveRBX));
   return false;
 #elif defined(i386) || defined(__i386__) || defined(__x86__) || defined(_M_IX86)
 #if defined(__GNUC__)






More information about the llvm-commits mailing list