From bf3e5a1d7afb59e249401914f34706faa65f726e Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Tue, 17 Oct 2006 00:24:49 +0000 Subject: [PATCH] Proper fix. llvm-svn: 30993 --- lib/Target/X86/X86Subtarget.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/Target/X86/X86Subtarget.cpp b/lib/Target/X86/X86Subtarget.cpp index c26c1855d5e..804ba39f69a 100644 --- a/lib/Target/X86/X86Subtarget.cpp +++ b/lib/Target/X86/X86Subtarget.cpp @@ -32,16 +32,15 @@ AsmWriterFlavor("x86-asm-syntax", cl::init(X86Subtarget::unset), 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__)