[compiler-rt] 033bf61 - [X86] Remove brand_id check from cpu_indicator_init.

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


Author: Craig Topper
Date: 2020-06-12T20:35:48-07:00
New Revision: 033bf61cc514dfa271e0bc9dd2c7e11240328c8c

URL: https://github.com/llvm/llvm-project/commit/033bf61cc514dfa271e0bc9dd2c7e11240328c8c
DIFF: https://github.com/llvm/llvm-project/commit/033bf61cc514dfa271e0bc9dd2c7e11240328c8c.diff

LOG: [X86] Remove brand_id check from cpu_indicator_init.

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. None of the CPUs that had a non-zero
brand index are supported by __builtin_cpu_is or target
multi-versioning so this should have no real effect.

Added: 
    

Modified: 
    compiler-rt/lib/builtins/cpu_model.c

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/builtins/cpu_model.c b/compiler-rt/lib/builtins/cpu_model.c
index 1281a3d1197d..86d77d816f81 100644
--- a/compiler-rt/lib/builtins/cpu_model.c
+++ b/compiler-rt/lib/builtins/cpu_model.c
@@ -270,14 +270,11 @@ static void detectX86FamilyModel(unsigned EAX, unsigned *Family,
 }
 
 static void getIntelProcessorTypeAndSubtype(unsigned Family, unsigned Model,
-                                            unsigned Brand_id,
                                             const unsigned *Features,
                                             unsigned *Type, unsigned *Subtype) {
 #define testFeature(F)                                                         \
   (Features[F / 32] & (F % 32)) != 0
 
-  if (Brand_id != 0)
-    return;
   switch (Family) {
   case 6:
     switch (Model) {
@@ -651,7 +648,7 @@ int CONSTRUCTOR_ATTRIBUTE __cpu_indicator_init(void) {
   unsigned EAX, EBX, ECX, EDX;
   unsigned MaxLeaf = 5;
   unsigned Vendor;
-  unsigned Model, Family, Brand_id;
+  unsigned Model, Family;
   unsigned Features[2];
 
   // This function needs to run just once.
@@ -668,7 +665,6 @@ int CONSTRUCTOR_ATTRIBUTE __cpu_indicator_init(void) {
   }
   getX86CpuIDAndInfo(1, &EAX, &EBX, &ECX, &EDX);
   detectX86FamilyModel(EAX, &Family, &Model);
-  Brand_id = EBX & 0xff;
 
   // Find available features.
   getAvailableFeatures(ECX, EDX, MaxLeaf, &Features[0]);
@@ -677,7 +673,7 @@ int CONSTRUCTOR_ATTRIBUTE __cpu_indicator_init(void) {
 
   if (Vendor == SIG_INTEL) {
     // Get CPU type.
-    getIntelProcessorTypeAndSubtype(Family, Model, Brand_id, &Features[0],
+    getIntelProcessorTypeAndSubtype(Family, Model, &Features[0],
                                     &(__cpu_model.__cpu_type),
                                     &(__cpu_model.__cpu_subtype));
     __cpu_model.__cpu_vendor = VENDOR_INTEL;


        


More information about the llvm-commits mailing list