[llvm-commits] [llvm] r113147 - /llvm/trunk/lib/System/Host.cpp

Chris Lattner sabre at nondot.org
Sun Sep 5 22:19:45 PDT 2010


Author: lattner
Date: Mon Sep  6 00:19:44 2010
New Revision: 113147

URL: http://llvm.org/viewvc/llvm-project?rev=113147&view=rev
Log:
compute the HasSSE3 bit correctly, patch by Nikolai Saoukh.

Modified:
    llvm/trunk/lib/System/Host.cpp

Modified: llvm/trunk/lib/System/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Host.cpp?rev=113147&r1=113146&r2=113147&view=diff
==============================================================================
--- llvm/trunk/lib/System/Host.cpp (original)
+++ llvm/trunk/lib/System/Host.cpp Mon Sep  6 00:19:44 2010
@@ -92,7 +92,8 @@
   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 @@
   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 @@
         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";





More information about the llvm-commits mailing list