[llvm-commits] [llvm] r142177 - in /llvm/trunk/lib/Target/X86: MCTargetDesc/X86MCTargetDesc.cpp X86Subtarget.cpp
Craig Topper
craig.topper at gmail.com
Sun Oct 16 22:33:10 PDT 2011
Author: ctopper
Date: Mon Oct 17 00:33:10 2011
New Revision: 142177
URL: http://llvm.org/viewvc/llvm-project?rev=142177&view=rev
Log:
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.
Modified:
llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp
llvm/trunk/lib/Target/X86/X86Subtarget.cpp
Modified: llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp?rev=142177&r1=142176&r2=142177&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp (original)
+++ llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp Mon Oct 17 00:33:10 2011
@@ -126,22 +126,16 @@
"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__)
Modified: llvm/trunk/lib/Target/X86/X86Subtarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.cpp?rev=142177&r1=142176&r2=142177&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86Subtarget.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86Subtarget.cpp Mon Oct 17 00:33:10 2011
@@ -278,14 +278,15 @@
}
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);
+ }
}
}
}
More information about the llvm-commits
mailing list