[llvm] 2831f78 - [X86] Remove brand_id check from getHostCPUName.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 12 20:44:30 PDT 2020


Author: Craig Topper
Date: 2020-06-12T20:38:30-07:00
New Revision: 2831f7852f724b2638fb686142f7c04b9e00b7b4

URL: https://github.com/llvm/llvm-project/commit/2831f7852f724b2638fb686142f7c04b9e00b7b4
DIFF: https://github.com/llvm/llvm-project/commit/2831f7852f724b2638fb686142f7c04b9e00b7b4.diff

LOG: [X86] Remove brand_id check from getHostCPUName.

Brand index was a feature some Pentium III and Pentium 4 CPUs.
It provided an index into a software lookup table to provide a
brand name for the CPU. This is separate from the family/model.

It's unclear to me why this index being non-zero was used to
block checking family/model. I think the effect of this is that
-march=native was not working correctly on the CPUs that have a
non-zero brand index. They are all about 20 years old so this
probably hasn't affected many users.

Added: 
    

Modified: 
    llvm/lib/Support/Host.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Support/Host.cpp b/llvm/lib/Support/Host.cpp
index 854f3cc947d7..c6b12e6516a4 100644
--- a/llvm/lib/Support/Host.cpp
+++ b/llvm/lib/Support/Host.cpp
@@ -582,15 +582,12 @@ static void detectX86FamilyModel(unsigned EAX, unsigned *Family,
 
 static void
 getIntelProcessorTypeAndSubtype(unsigned Family, unsigned Model,
-                                unsigned Brand_id,
                                 const unsigned (&Features)[3],
                                 unsigned *Type, unsigned *Subtype) {
   auto testFeature = [&](unsigned F) {
     return (Features[F / 32] & (1U << (F % 32))) != 0;
   };
 
-  if (Brand_id != 0)
-    return;
   switch (Family) {
   case 3:
     *Type = X86::INTEL_i386;
@@ -1159,7 +1156,6 @@ StringRef sys::getHostCPUName() {
     return "generic";
   getX86CpuIDAndInfo(0x1, &EAX, &EBX, &ECX, &EDX);
 
-  unsigned Brand_id = EBX & 0xff;
   unsigned Family = 0, Model = 0;
   unsigned Features[3] = {0, 0, 0};
   detectX86FamilyModel(EAX, &Family, &Model);
@@ -1169,8 +1165,7 @@ StringRef sys::getHostCPUName() {
   unsigned Subtype = 0;
 
   if (Vendor == SIG_INTEL) {
-    getIntelProcessorTypeAndSubtype(Family, Model, Brand_id, Features,
-                                    &Type, &Subtype);
+    getIntelProcessorTypeAndSubtype(Family, Model, Features, &Type, &Subtype);
   } else if (Vendor == SIG_AMD) {
     getAMDProcessorTypeAndSubtype(Family, Model, Features, &Type, &Subtype);
   }


        


More information about the llvm-commits mailing list