forked from OSchip/llvm-project
It appears the inline asm in GetCpuIDAndInfo() may clobbers some registers if it isn't inlined (at < -O3). Force it to be inlined.
llvm-svn: 30762
This commit is contained in:
parent
469ea0c94d
commit
4c1a804a5b
|
@ -28,7 +28,7 @@ AsmWriterFlavor("x86-asm-syntax", cl::init(X86Subtarget::unset),
|
||||||
|
|
||||||
/// GetCpuIDAndInfo - Execute the specified cpuid and return the 4 values in the
|
/// GetCpuIDAndInfo - Execute the specified cpuid and return the 4 values in the
|
||||||
/// specified arguments. If we can't run cpuid on the host, return true.
|
/// specified arguments. If we can't run cpuid on the host, return true.
|
||||||
static bool GetCpuIDAndInfo(unsigned value, unsigned *rEAX, unsigned *rEBX,
|
static inline bool GetCpuIDAndInfo(unsigned value, unsigned *rEAX, unsigned *rEBX,
|
||||||
unsigned *rECX, unsigned *rEDX) {
|
unsigned *rECX, unsigned *rEDX) {
|
||||||
#if defined(__x86_64__)
|
#if defined(__x86_64__)
|
||||||
asm ("pushq\t%%rbx\n\t"
|
asm ("pushq\t%%rbx\n\t"
|
||||||
|
@ -76,8 +76,8 @@ static const char *GetCurrentX86CPU() {
|
||||||
unsigned EAX = 0, EBX = 0, ECX = 0, EDX = 0;
|
unsigned EAX = 0, EBX = 0, ECX = 0, EDX = 0;
|
||||||
if (GetCpuIDAndInfo(0x1, &EAX, &EBX, &ECX, &EDX))
|
if (GetCpuIDAndInfo(0x1, &EAX, &EBX, &ECX, &EDX))
|
||||||
return "generic";
|
return "generic";
|
||||||
unsigned Family = (EAX & (0xffffffff >> (32 - 4)) << 8) >> 8; // Bits 8 - 11
|
unsigned Family = (EAX >> 8) & 0xf; // Bits 8 - 11
|
||||||
unsigned Model = (EAX & (0xffffffff >> (32 - 4)) << 4) >> 4; // Bits 4 - 7
|
unsigned Model = (EAX >> 4) & 0xf; // Bits 4 - 7
|
||||||
GetCpuIDAndInfo(0x80000001, &EAX, &EBX, &ECX, &EDX);
|
GetCpuIDAndInfo(0x80000001, &EAX, &EBX, &ECX, &EDX);
|
||||||
bool Em64T = EDX & (1 << 29);
|
bool Em64T = EDX & (1 << 29);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue