diff options
author | Chris Lattner <sabre@nondot.org> | 2010-09-06 05:19:44 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-09-06 05:19:44 +0000 |
commit | 9c7f0752704222a210a7f5a01993f4031c7ab1da (patch) | |
tree | 5319c543225cf2bec89d5ab6fac408954a3adca1 /lib/System/Host.cpp | |
parent | 0cccd7633e4a0ba36b5ff9a3dfda2a09d16dc337 (diff) | |
download | external_llvm-9c7f0752704222a210a7f5a01993f4031c7ab1da.zip external_llvm-9c7f0752704222a210a7f5a01993f4031c7ab1da.tar.gz external_llvm-9c7f0752704222a210a7f5a01993f4031c7ab1da.tar.bz2 |
compute the HasSSE3 bit correctly, patch by Nikolai Saoukh.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113147 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System/Host.cpp')
-rw-r--r-- | lib/System/Host.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/System/Host.cpp b/lib/System/Host.cpp index e7193db..176fe8a 100644 --- a/lib/System/Host.cpp +++ b/lib/System/Host.cpp @@ -92,7 +92,8 @@ static bool GetX86CpuIDAndInfo(unsigned value, unsigned *rEAX, return true; } -static void DetectX86FamilyModel(unsigned EAX, unsigned &Family, unsigned &Model) { +static void DetectX86FamilyModel(unsigned EAX, unsigned &Family, + unsigned &Model) { Family = (EAX >> 8) & 0xf; // Bits 8 - 11 Model = (EAX >> 4) & 0xf; // Bits 4 - 7 if (Family == 6 || Family == 0xf) { @@ -112,9 +113,9 @@ std::string sys::getHostCPUName() { unsigned Model = 0; DetectX86FamilyModel(EAX, Family, Model); + bool HasSSE3 = (ECX & 0x1); GetX86CpuIDAndInfo(0x80000001, &EAX, &EBX, &ECX, &EDX); bool Em64T = (EDX >> 29) & 0x1; - bool HasSSE3 = (ECX & 0x1); union { unsigned u[3]; @@ -277,14 +278,12 @@ std::string sys::getHostCPUName() { default: return "athlon"; } case 15: - if (HasSSE3) { + if (HasSSE3) return "k8-sse3"; - } else { - switch (Model) { - case 1: return "opteron"; - case 5: return "athlon-fx"; // also opteron - default: return "athlon64"; - } + switch (Model) { + case 1: return "opteron"; + case 5: return "athlon-fx"; // also opteron + default: return "athlon64"; } case 16: return "amdfam10"; |