mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-27 14:45:50 +00:00
Don't use inline assembly in 64-bit Visual Studio. Unfortunately, this means that cpuid leaf 7 can't be queried on versions of Visual Studio earlier than VS 2008 SP1. Fixes PR11147.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142177 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
24bb925566
commit
4b2dc74d3f
@ -126,22 +126,16 @@ bool X86_MC::GetCpuIDAndInfoEx(unsigned value, unsigned subleaf, unsigned *rEAX,
|
||||
"c" (subleaf));
|
||||
return false;
|
||||
#elif defined(_MSC_VER)
|
||||
// can't use __cpuidex because it isn't available in all supported versions
|
||||
// of MSC
|
||||
__asm {
|
||||
mov eax,value
|
||||
mov ecx,subleaf
|
||||
cpuid
|
||||
mov rsi,rEAX
|
||||
mov dword ptr [rsi],eax
|
||||
mov rsi,rEBX
|
||||
mov dword ptr [rsi],ebx
|
||||
mov rsi,rECX
|
||||
mov dword ptr [rsi],ecx
|
||||
mov rsi,rEDX
|
||||
mov dword ptr [rsi],edx
|
||||
}
|
||||
return false;
|
||||
// __cpuidex was added in MSVC++ 9.0 SP1
|
||||
#if (_MSC_VER > 1500) || (_MSC_VER == 1500 && _MSC_FULL_VER >= 150030729)
|
||||
int registers[4];
|
||||
__cpuidex(registers, value, subleaf);
|
||||
*rEAX = registers[0];
|
||||
*rEBX = registers[1];
|
||||
*rECX = registers[2];
|
||||
*rEDX = registers[3];
|
||||
return false;
|
||||
#endif
|
||||
#endif
|
||||
#elif defined(i386) || defined(__i386__) || defined(__x86__) || defined(_M_IX86)
|
||||
#if defined(__GNUC__)
|
||||
|
@ -278,14 +278,15 @@ void X86Subtarget::AutoDetectSubtargetFeatures() {
|
||||
}
|
||||
|
||||
if (IsIntel && MaxLevel >= 7) {
|
||||
X86_MC::GetCpuIDAndInfoEx(0x7, 0x0, &EAX, &EBX, &ECX, &EDX);
|
||||
if ((EBX >> 3) & 0x1) {
|
||||
HasBMI = true;
|
||||
ToggleFeature(X86::FeatureBMI);
|
||||
}
|
||||
if ((EBX >> 8) & 0x1) {
|
||||
HasBMI2 = true;
|
||||
ToggleFeature(X86::FeatureBMI2);
|
||||
if (!X86_MC::GetCpuIDAndInfoEx(0x7, 0x0, &EAX, &EBX, &ECX, &EDX)) {
|
||||
if ((EBX >> 3) & 0x1) {
|
||||
HasBMI = true;
|
||||
ToggleFeature(X86::FeatureBMI);
|
||||
}
|
||||
if ((EBX >> 8) & 0x1) {
|
||||
HasBMI2 = true;
|
||||
ToggleFeature(X86::FeatureBMI2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user