LCOV - code coverage report
Current view: top level - gcc/common/config/i386 - cpuinfo.h (source / functions) Coverage Total Hit
Test: gcc.info Lines: 30.0 % 800 240
Test Date: 2025-10-18 14:39:06 Functions: 66.7 % 6 4
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: - 0 0

             Branch data     Line data    Source code
       1                 :             : /* Get CPU type and Features for x86 processors.
       2                 :             :    Copyright (C) 2012-2025 Free Software Foundation, Inc.
       3                 :             :    Contributed by Sriraman Tallam (tmsriram@google.com)
       4                 :             : 
       5                 :             : This file is part of GCC.
       6                 :             : 
       7                 :             : GCC is free software; you can redistribute it and/or modify it under
       8                 :             : the terms of the GNU General Public License as published by the Free
       9                 :             : Software Foundation; either version 3, or (at your option) any later
      10                 :             : version.
      11                 :             : 
      12                 :             : GCC is distributed in the hope that it will be useful, but WITHOUT ANY
      13                 :             : WARRANTY; without even the implied warranty of MERCHANTABILITY or
      14                 :             : FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
      15                 :             : for more details.
      16                 :             : 
      17                 :             : Under Section 7 of GPL version 3, you are granted additional
      18                 :             : permissions described in the GCC Runtime Library Exception, version
      19                 :             : 3.1, as published by the Free Software Foundation.
      20                 :             : 
      21                 :             : You should have received a copy of the GNU General Public License and
      22                 :             : a copy of the GCC Runtime Library Exception along with this program;
      23                 :             : see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
      24                 :             : <http://www.gnu.org/licenses/>.  */
      25                 :             : 
      26                 :             : struct __processor_model
      27                 :             : {
      28                 :             :   unsigned int __cpu_vendor;
      29                 :             :   unsigned int __cpu_type;
      30                 :             :   unsigned int __cpu_subtype;
      31                 :             :   /* The first 32 features are stored as bitmasks in __cpu_features.
      32                 :             :      The rest of features are stored as bitmasks in a separate array
      33                 :             :      of unsigned int.  */
      34                 :             :   unsigned int __cpu_features[1];
      35                 :             : };
      36                 :             : 
      37                 :             : struct __processor_model2
      38                 :             : {
      39                 :             :   unsigned int __cpu_family;
      40                 :             :   unsigned int __cpu_model;
      41                 :             :   unsigned int __cpu_max_level;
      42                 :             :   unsigned int __cpu_ext_level;
      43                 :             : };
      44                 :             : 
      45                 :             : #ifndef CHECK___builtin_cpu_is
      46                 :             : # define CHECK___builtin_cpu_is(cpu)
      47                 :             : #endif
      48                 :             : 
      49                 :             : #ifndef CHECK___builtin_cpu_supports
      50                 :             : # define CHECK___builtin_cpu_supports(isa)
      51                 :             : #endif
      52                 :             : 
      53                 :             : /* Return non-zero if the processor has feature F.  */
      54                 :             : 
      55                 :             : static inline int
      56                 :      157895 : has_cpu_feature (struct __processor_model *cpu_model,
      57                 :             :                  unsigned int *cpu_features2,
      58                 :             :                  enum processor_features feature)
      59                 :             : {
      60                 :      157895 :   unsigned index, offset;
      61                 :      157895 :   unsigned f = feature;
      62                 :             : 
      63                 :      133328 :   if (f < 32)
      64                 :             :     {
      65                 :             :       /* The first 32 features.  */
      66                 :       35907 :       return cpu_model->__cpu_features[0] & (1U << f);
      67                 :             :     }
      68                 :             :   else
      69                 :             :     {
      70                 :             :       /* The rest of features.  cpu_features2[i] contains features from
      71                 :             :          (32 + i * 32) to (31 + 32 + i * 32), inclusively.  */
      72                 :      111644 :       f -= 32;
      73                 :      111644 :       index = f / 32;
      74                 :      111644 :       offset = f % 32;
      75                 :      102593 :       return cpu_features2[index] & (1U << offset);
      76                 :             :     }
      77                 :             : }
      78                 :             : 
      79                 :             : /* Save FEATURE to either CPU_MODEL or CPU_FEATURES2.  */
      80                 :             : 
      81                 :             : static inline void
      82                 :       60771 : set_cpu_feature (struct __processor_model *cpu_model,
      83                 :             :                  unsigned int *cpu_features2,
      84                 :             :                  enum processor_features feature)
      85                 :             : {
      86                 :       60771 :   unsigned index, offset;
      87                 :       60771 :   unsigned f = feature;
      88                 :             : 
      89                 :       60771 :   if (f < 32)
      90                 :             :     {
      91                 :             :       /* The first 32 features.  */
      92                 :       23274 :       cpu_model->__cpu_features[0] |= (1U << f);
      93                 :             :     }
      94                 :             :   else
      95                 :             :     {
      96                 :             :       /* The rest of features.  cpu_features2[i] contains features from
      97                 :             :          (32 + i * 32) to (31 + 32 + i * 32), inclusively.  */
      98                 :       37497 :       f -= 32;
      99                 :       37497 :       index = f / 32;
     100                 :       37497 :       offset = f % 32;
     101                 :       37497 :       cpu_features2[index] |= (1U << offset);
     102                 :             :     }
     103                 :       56892 : }
     104                 :             : 
     105                 :             : /* Drop FEATURE from either CPU_MODEL or CPU_FEATURES2.  */
     106                 :             : 
     107                 :             : static inline void
     108                 :           0 : reset_cpu_feature (struct __processor_model *cpu_model,
     109                 :             :                    unsigned int *cpu_features2,
     110                 :             :                    enum processor_features feature)
     111                 :             : {
     112                 :           0 :   unsigned index, offset;
     113                 :           0 :   unsigned f = feature;
     114                 :             : 
     115                 :           0 :   if (f < 32)
     116                 :             :     {
     117                 :             :       /* The first 32 features.  */
     118                 :           0 :       cpu_model->__cpu_features[0] &= ~(1U << f);
     119                 :             :     }
     120                 :             :   else
     121                 :             :     {
     122                 :             :       /* The rest of features.  cpu_features2[i] contains features from
     123                 :             :          (32 + i * 32) to (31 + 32 + i * 32), inclusively.  */
     124                 :           0 :       f -= 32;
     125                 :           0 :       index = f / 32;
     126                 :           0 :       offset = f % 32;
     127                 :           0 :       cpu_features2[index] &= ~(1U << offset);
     128                 :             :     }
     129                 :             : }
     130                 :             : 
     131                 :             : /* Get the specific type of AMD CPU and return AMD CPU name.  Return
     132                 :             :    NULL for unknown AMD CPU.  */
     133                 :             : 
     134                 :             : static inline const char *
     135                 :        1293 : get_amd_cpu (struct __processor_model *cpu_model,
     136                 :             :              struct __processor_model2 *cpu_model2,
     137                 :             :              unsigned int *cpu_features2)
     138                 :             : {
     139                 :        1293 :   const char *cpu = NULL;
     140                 :        1293 :   unsigned int family = cpu_model2->__cpu_family;
     141                 :        1293 :   unsigned int model = cpu_model2->__cpu_model;
     142                 :             : 
     143                 :        1293 :   switch (family)
     144                 :             :     {
     145                 :           0 :     case 0x10:
     146                 :             :       /* AMD Family 10h.  */
     147                 :           0 :       cpu = "amdfam10";
     148                 :           0 :       cpu_model->__cpu_type = AMDFAM10H;
     149                 :           0 :       switch (model)
     150                 :             :         {
     151                 :           0 :         case 0x2:
     152                 :             :           /* Barcelona.  */
     153                 :           0 :           CHECK___builtin_cpu_is ("amdfam10h");
     154                 :           0 :           CHECK___builtin_cpu_is ("barcelona");
     155                 :           0 :           cpu_model->__cpu_subtype = AMDFAM10H_BARCELONA;
     156                 :           0 :           break;
     157                 :           0 :         case 0x4:
     158                 :             :           /* Shanghai.  */
     159                 :           0 :           CHECK___builtin_cpu_is ("amdfam10h");
     160                 :           0 :           CHECK___builtin_cpu_is ("shanghai");
     161                 :           0 :           cpu_model->__cpu_subtype = AMDFAM10H_SHANGHAI;
     162                 :           0 :           break;
     163                 :           0 :         case 0x8:
     164                 :             :           /* Istanbul.  */
     165                 :           0 :           CHECK___builtin_cpu_is ("amdfam10h");
     166                 :           0 :           CHECK___builtin_cpu_is ("istanbul");
     167                 :           0 :           cpu_model->__cpu_subtype = AMDFAM10H_ISTANBUL;
     168                 :           0 :           break;
     169                 :             :         default:
     170                 :             :           break;
     171                 :             :         }
     172                 :             :       break;
     173                 :           0 :     case 0x14:
     174                 :             :       /* AMD Family 14h "btver1". */
     175                 :           0 :       cpu = "btver1";
     176                 :           0 :       CHECK___builtin_cpu_is ("btver1");
     177                 :           0 :       cpu_model->__cpu_type = AMD_BTVER1;
     178                 :           0 :       break;
     179                 :           0 :     case 0x15:
     180                 :             :       /* AMD Family 15h "Bulldozer".  */
     181                 :           0 :       cpu_model->__cpu_type = AMDFAM15H;
     182                 :           0 :       if (model == 0x2)
     183                 :             :         {
     184                 :             :           /* Bulldozer version 2 "Piledriver" */
     185                 :           0 :           cpu = "bdver2";
     186                 :           0 :           CHECK___builtin_cpu_is ("bdver2");
     187                 :           0 :           cpu_model->__cpu_subtype = AMDFAM15H_BDVER2;
     188                 :             :         }
     189                 :           0 :       else if (model <= 0xf)
     190                 :             :         {
     191                 :             :           /* Bulldozer version 1.  */
     192                 :           0 :           cpu = "bdver1";
     193                 :           0 :           CHECK___builtin_cpu_is ("bdver1");
     194                 :           0 :           cpu_model->__cpu_subtype = AMDFAM15H_BDVER1;
     195                 :             :         }
     196                 :           0 :       else if (model <= 0x2f)
     197                 :             :         {
     198                 :             :           /* Bulldozer version 2 "Piledriver" */
     199                 :           0 :           cpu = "bdver2";
     200                 :           0 :           CHECK___builtin_cpu_is ("bdver2");
     201                 :           0 :           cpu_model->__cpu_subtype = AMDFAM15H_BDVER2;
     202                 :             :         }
     203                 :           0 :       else if (model <= 0x4f)
     204                 :             :         {
     205                 :             :           /* Bulldozer version 3 "Steamroller"  */
     206                 :           0 :           cpu = "bdver3";
     207                 :           0 :           CHECK___builtin_cpu_is ("bdver3");
     208                 :           0 :           cpu_model->__cpu_subtype = AMDFAM15H_BDVER3;
     209                 :             :         }
     210                 :           0 :       else if (model <= 0x7f)
     211                 :             :         {
     212                 :             :           /* Bulldozer version 4 "Excavator"   */
     213                 :           0 :           cpu = "bdver4";
     214                 :           0 :           CHECK___builtin_cpu_is ("bdver4");
     215                 :           0 :           cpu_model->__cpu_subtype = AMDFAM15H_BDVER4;
     216                 :             :         }
     217                 :           0 :       else if (has_cpu_feature (cpu_model, cpu_features2,
     218                 :             :                                 FEATURE_AVX2))
     219                 :             :         {
     220                 :           0 :           cpu = "bdver4";
     221                 :           0 :           CHECK___builtin_cpu_is ("bdver4");
     222                 :           0 :           cpu_model->__cpu_subtype = AMDFAM15H_BDVER4;
     223                 :             :         }
     224                 :           0 :       else if (has_cpu_feature (cpu_model, cpu_features2,
     225                 :             :                                 FEATURE_XSAVEOPT))
     226                 :             :         {
     227                 :           0 :           cpu = "bdver3";
     228                 :           0 :           CHECK___builtin_cpu_is ("bdver3");
     229                 :           0 :           cpu_model->__cpu_subtype = AMDFAM15H_BDVER3;
     230                 :             :         }
     231                 :           0 :       else if (has_cpu_feature (cpu_model, cpu_features2,
     232                 :             :                                 FEATURE_BMI))
     233                 :             :         {
     234                 :           0 :           cpu = "bdver2";
     235                 :           0 :           CHECK___builtin_cpu_is ("bdver2");
     236                 :           0 :           cpu_model->__cpu_subtype = AMDFAM15H_BDVER2;
     237                 :             :         }
     238                 :           0 :       else if (has_cpu_feature (cpu_model, cpu_features2,
     239                 :             :                                 FEATURE_XOP))
     240                 :             :         {
     241                 :           0 :           cpu = "bdver1";
     242                 :           0 :           CHECK___builtin_cpu_is ("bdver1");
     243                 :           0 :           cpu_model->__cpu_subtype = AMDFAM15H_BDVER1;
     244                 :             :         }
     245                 :             :       break;
     246                 :           0 :     case 0x16:
     247                 :             :       /* AMD Family 16h "btver2" */
     248                 :           0 :       cpu = "btver2";
     249                 :           0 :       CHECK___builtin_cpu_is ("btver2");
     250                 :           0 :       cpu_model->__cpu_type = AMD_BTVER2;
     251                 :           0 :       break;
     252                 :        1293 :     case 0x17:
     253                 :        1293 :       cpu_model->__cpu_type = AMDFAM17H;
     254                 :        1293 :       if (model <= 0x1f)
     255                 :             :         {
     256                 :             :           /* AMD family 17h version 1.  */
     257                 :           0 :           cpu = "znver1";
     258                 :           0 :           CHECK___builtin_cpu_is ("znver1");
     259                 :           0 :           cpu_model->__cpu_subtype = AMDFAM17H_ZNVER1;
     260                 :             :         }
     261                 :        1293 :       else if (model >= 0x30)
     262                 :             :         {
     263                 :        1293 :           cpu = "znver2";
     264                 :        1293 :           CHECK___builtin_cpu_is ("znver2");
     265                 :        1293 :           cpu_model->__cpu_subtype = AMDFAM17H_ZNVER2;
     266                 :             :         }
     267                 :           0 :       else if (has_cpu_feature (cpu_model, cpu_features2,
     268                 :             :                                 FEATURE_CLWB))
     269                 :             :         {
     270                 :           0 :           cpu = "znver2";
     271                 :           0 :           CHECK___builtin_cpu_is ("znver2");
     272                 :           0 :           cpu_model->__cpu_subtype = AMDFAM17H_ZNVER2;
     273                 :             :         }
     274                 :           0 :       else if (has_cpu_feature (cpu_model, cpu_features2,
     275                 :             :                                 FEATURE_CLZERO))
     276                 :             :         {
     277                 :           0 :           cpu = "znver1";
     278                 :           0 :           CHECK___builtin_cpu_is ("znver1");
     279                 :           0 :           cpu_model->__cpu_subtype = AMDFAM17H_ZNVER1;
     280                 :             :         }
     281                 :             :       break;
     282                 :           0 :     case 0x19:
     283                 :           0 :       cpu_model->__cpu_type = AMDFAM19H;
     284                 :             :       /* AMD family 19h.  */
     285                 :           0 :       if (model <= 0x0f)
     286                 :             :         {
     287                 :           0 :           cpu = "znver3";
     288                 :           0 :           CHECK___builtin_cpu_is ("znver3");
     289                 :           0 :           cpu_model->__cpu_subtype = AMDFAM19H_ZNVER3;
     290                 :             :         }
     291                 :           0 :       else if ((model >= 0x10 && model <= 0x1f)
     292                 :           0 :                 || (model >= 0x60 && model <= 0xaf))
     293                 :             :         {
     294                 :           0 :           cpu = "znver4";
     295                 :           0 :           CHECK___builtin_cpu_is ("znver4");
     296                 :           0 :           cpu_model->__cpu_subtype = AMDFAM19H_ZNVER4;
     297                 :             :         }
     298                 :           0 :       else if (has_cpu_feature (cpu_model, cpu_features2,
     299                 :             :                                 FEATURE_AVX512F))
     300                 :             :         {
     301                 :           0 :           cpu = "znver4";
     302                 :           0 :           CHECK___builtin_cpu_is ("znver4");
     303                 :           0 :           cpu_model->__cpu_subtype = AMDFAM19H_ZNVER4;
     304                 :             :         }
     305                 :           0 :       else if (has_cpu_feature (cpu_model, cpu_features2,
     306                 :             :                                 FEATURE_VAES))
     307                 :             :         {
     308                 :           0 :           cpu = "znver3";
     309                 :           0 :           CHECK___builtin_cpu_is ("znver3");
     310                 :           0 :           cpu_model->__cpu_subtype = AMDFAM19H_ZNVER3;
     311                 :             :         }
     312                 :             :       break;
     313                 :           0 :     case 0x1a:
     314                 :           0 :       cpu_model->__cpu_type = AMDFAM1AH;
     315                 :           0 :       if (model <= 0x4f || (model >= 0x60 && model <= 0x77) ||
     316                 :           0 :           (model >= 0xd0 && model <= 0xd7))
     317                 :             :         {
     318                 :           0 :           cpu = "znver5";
     319                 :           0 :           CHECK___builtin_cpu_is ("znver5");
     320                 :           0 :           cpu_model->__cpu_subtype = AMDFAM1AH_ZNVER5;
     321                 :             :         }
     322                 :           0 :       else if (has_cpu_feature (cpu_model, cpu_features2,
     323                 :             :                                 FEATURE_AVX512VP2INTERSECT))
     324                 :             :         {
     325                 :           0 :           cpu = "znver5";
     326                 :           0 :           CHECK___builtin_cpu_is ("znver5");
     327                 :           0 :           cpu_model->__cpu_subtype = AMDFAM1AH_ZNVER5;
     328                 :             :         }
     329                 :             :       break;
     330                 :             :     default:
     331                 :             :       break;
     332                 :             :     }
     333                 :             : 
     334                 :        1293 :   return cpu;
     335                 :             : }
     336                 :             : 
     337                 :             : /* Get the specific type of Intel CPU and return Intel CPU name.  Return
     338                 :             :    NULL for unknown Intel CPU.  */
     339                 :             : 
     340                 :             : static inline const char *
     341                 :           0 : get_intel_cpu (struct __processor_model *cpu_model,
     342                 :             :                struct __processor_model2 *cpu_model2,
     343                 :             :                unsigned int *cpu_features2)
     344                 :             : {
     345                 :           0 :   const char *cpu = NULL;
     346                 :             : 
     347                 :             :   /* Parse family and model for family 0x6.  */
     348                 :           0 :   if (cpu_model2->__cpu_family == 0x6)
     349                 :           0 :     switch (cpu_model2->__cpu_model)
     350                 :             :       {
     351                 :           0 :       case 0x1c:
     352                 :           0 :       case 0x26:
     353                 :             :         /* Bonnell.  */
     354                 :           0 :         cpu = "bonnell";
     355                 :           0 :         CHECK___builtin_cpu_is ("atom");
     356                 :           0 :         cpu_model->__cpu_type = INTEL_BONNELL;
     357                 :           0 :         break;
     358                 :           0 :       case 0x37:
     359                 :           0 :       case 0x4a:
     360                 :           0 :       case 0x4d:
     361                 :           0 :       case 0x5d:
     362                 :             :         /* Silvermont.  */
     363                 :           0 :       case 0x4c:
     364                 :           0 :       case 0x5a:
     365                 :           0 :       case 0x75:
     366                 :             :         /* Airmont.  */
     367                 :           0 :         cpu = "silvermont";
     368                 :           0 :         CHECK___builtin_cpu_is ("silvermont");
     369                 :           0 :         cpu_model->__cpu_type = INTEL_SILVERMONT;
     370                 :           0 :         break;
     371                 :           0 :       case 0x5c:
     372                 :           0 :       case 0x5f:
     373                 :             :         /* Goldmont.  */
     374                 :           0 :         cpu = "goldmont";
     375                 :           0 :         CHECK___builtin_cpu_is ("goldmont");
     376                 :           0 :         cpu_model->__cpu_type = INTEL_GOLDMONT;
     377                 :           0 :         break;
     378                 :           0 :       case 0x7a:
     379                 :             :         /* Goldmont Plus.  */
     380                 :           0 :         cpu = "goldmont-plus";
     381                 :           0 :         CHECK___builtin_cpu_is ("goldmont-plus");
     382                 :           0 :         cpu_model->__cpu_type = INTEL_GOLDMONT_PLUS;
     383                 :           0 :         break;
     384                 :           0 :       case 0x86:
     385                 :           0 :       case 0x96:
     386                 :           0 :       case 0x9c:
     387                 :             :         /* Tremont.  */
     388                 :           0 :         cpu = "tremont";
     389                 :           0 :         CHECK___builtin_cpu_is ("tremont");
     390                 :           0 :         cpu_model->__cpu_type = INTEL_TREMONT;
     391                 :           0 :         break;
     392                 :           0 :       case 0x17:
     393                 :           0 :       case 0x1d:
     394                 :             :         /* Penryn.  */
     395                 :           0 :       case 0x0f:
     396                 :             :         /* Merom.  */
     397                 :           0 :         cpu = "core2";
     398                 :           0 :         CHECK___builtin_cpu_is ("core2");
     399                 :           0 :         cpu_model->__cpu_type = INTEL_CORE2;
     400                 :           0 :         break;
     401                 :           0 :       case 0x1a:
     402                 :           0 :       case 0x1e:
     403                 :           0 :       case 0x1f:
     404                 :           0 :       case 0x2e:
     405                 :             :         /* Nehalem.  */
     406                 :           0 :         cpu = "nehalem";
     407                 :           0 :         CHECK___builtin_cpu_is ("corei7");
     408                 :           0 :         CHECK___builtin_cpu_is ("nehalem");
     409                 :           0 :         cpu_model->__cpu_type = INTEL_COREI7;
     410                 :           0 :         cpu_model->__cpu_subtype = INTEL_COREI7_NEHALEM;
     411                 :           0 :         break;
     412                 :           0 :       case 0x25:
     413                 :           0 :       case 0x2c:
     414                 :           0 :       case 0x2f:
     415                 :             :         /* Westmere.  */
     416                 :           0 :         cpu = "westmere";
     417                 :           0 :         CHECK___builtin_cpu_is ("corei7");
     418                 :           0 :         CHECK___builtin_cpu_is ("westmere");
     419                 :           0 :         cpu_model->__cpu_type = INTEL_COREI7;
     420                 :           0 :         cpu_model->__cpu_subtype = INTEL_COREI7_WESTMERE;
     421                 :           0 :         break;
     422                 :           0 :       case 0x2a:
     423                 :           0 :       case 0x2d:
     424                 :             :         /* Sandy Bridge.  */
     425                 :           0 :         cpu = "sandybridge";
     426                 :           0 :         CHECK___builtin_cpu_is ("corei7");
     427                 :           0 :         CHECK___builtin_cpu_is ("sandybridge");
     428                 :           0 :         cpu_model->__cpu_type = INTEL_COREI7;
     429                 :           0 :         cpu_model->__cpu_subtype = INTEL_COREI7_SANDYBRIDGE;
     430                 :           0 :         break;
     431                 :           0 :       case 0x3a:
     432                 :           0 :       case 0x3e:
     433                 :             :         /* Ivy Bridge.  */
     434                 :           0 :         cpu = "ivybridge";
     435                 :           0 :         CHECK___builtin_cpu_is ("corei7");
     436                 :           0 :         CHECK___builtin_cpu_is ("ivybridge");
     437                 :           0 :         cpu_model->__cpu_type = INTEL_COREI7;
     438                 :           0 :         cpu_model->__cpu_subtype = INTEL_COREI7_IVYBRIDGE;
     439                 :           0 :         break;
     440                 :           0 :       case 0x3c:
     441                 :           0 :       case 0x3f:
     442                 :           0 :       case 0x45:
     443                 :           0 :       case 0x46:
     444                 :             :         /* Haswell.  */
     445                 :           0 :         cpu = "haswell";
     446                 :           0 :         CHECK___builtin_cpu_is ("corei7");
     447                 :           0 :         CHECK___builtin_cpu_is ("haswell");
     448                 :           0 :         cpu_model->__cpu_type = INTEL_COREI7;
     449                 :           0 :         cpu_model->__cpu_subtype = INTEL_COREI7_HASWELL;
     450                 :           0 :         break;
     451                 :           0 :       case 0x3d:
     452                 :           0 :       case 0x47:
     453                 :           0 :       case 0x4f:
     454                 :           0 :       case 0x56:
     455                 :             :         /* Broadwell.  */
     456                 :           0 :         cpu = "broadwell";
     457                 :           0 :         CHECK___builtin_cpu_is ("corei7");
     458                 :           0 :         CHECK___builtin_cpu_is ("broadwell");
     459                 :           0 :         cpu_model->__cpu_type = INTEL_COREI7;
     460                 :           0 :         cpu_model->__cpu_subtype = INTEL_COREI7_BROADWELL;
     461                 :           0 :         break;
     462                 :           0 :       case 0x4e:
     463                 :           0 :       case 0x5e:
     464                 :             :         /* Skylake.  */
     465                 :           0 :       case 0x8e:
     466                 :           0 :       case 0x9e:
     467                 :             :         /* Kaby Lake.  */
     468                 :           0 :       case 0xa5:
     469                 :           0 :       case 0xa6:
     470                 :             :         /* Comet Lake.  */
     471                 :           0 :         cpu = "skylake";
     472                 :           0 :         CHECK___builtin_cpu_is ("corei7");
     473                 :           0 :         CHECK___builtin_cpu_is ("skylake");
     474                 :           0 :         cpu_model->__cpu_type = INTEL_COREI7;
     475                 :           0 :         cpu_model->__cpu_subtype = INTEL_COREI7_SKYLAKE;
     476                 :           0 :         break;
     477                 :           0 :       case 0x55:
     478                 :           0 :         CHECK___builtin_cpu_is ("corei7");
     479                 :           0 :         cpu_model->__cpu_type = INTEL_COREI7;
     480                 :           0 :         if (has_cpu_feature (cpu_model, cpu_features2,
     481                 :             :                             FEATURE_AVX512BF16))
     482                 :             :           {
     483                 :             :             /* Cooper Lake.  */
     484                 :           0 :             cpu = "cooperlake";
     485                 :           0 :             CHECK___builtin_cpu_is ("cooperlake");
     486                 :           0 :             cpu_model->__cpu_subtype = INTEL_COREI7_COOPERLAKE;
     487                 :             :           }
     488                 :           0 :         else if (has_cpu_feature (cpu_model, cpu_features2,
     489                 :             :                                   FEATURE_AVX512VNNI))
     490                 :             :           {
     491                 :             :             /* Cascade Lake.  */
     492                 :           0 :             cpu = "cascadelake";
     493                 :           0 :             CHECK___builtin_cpu_is ("cascadelake");
     494                 :           0 :             cpu_model->__cpu_subtype = INTEL_COREI7_CASCADELAKE;
     495                 :             :           }
     496                 :             :         else
     497                 :             :           {
     498                 :             :             /* Skylake with AVX-512 support.  */
     499                 :           0 :             cpu = "skylake-avx512";
     500                 :           0 :             CHECK___builtin_cpu_is ("skylake-avx512");
     501                 :           0 :             cpu_model->__cpu_subtype = INTEL_COREI7_SKYLAKE_AVX512;
     502                 :             :           }
     503                 :             :         break;
     504                 :           0 :       case 0x66:
     505                 :             :         /* Cannon Lake.  */
     506                 :           0 :         cpu = "cannonlake";
     507                 :           0 :         CHECK___builtin_cpu_is ("corei7");
     508                 :           0 :         CHECK___builtin_cpu_is ("cannonlake");
     509                 :           0 :         cpu_model->__cpu_type = INTEL_COREI7;
     510                 :           0 :         cpu_model->__cpu_subtype = INTEL_COREI7_CANNONLAKE;
     511                 :           0 :         break;
     512                 :           0 :       case 0x7e:
     513                 :           0 :       case 0x7d:
     514                 :           0 :       case 0x9d:
     515                 :             :         /* Ice Lake client.  */
     516                 :           0 :         cpu = "icelake-client";
     517                 :           0 :         CHECK___builtin_cpu_is ("corei7");
     518                 :           0 :         CHECK___builtin_cpu_is ("icelake-client");
     519                 :           0 :         cpu_model->__cpu_type = INTEL_COREI7;
     520                 :           0 :         cpu_model->__cpu_subtype = INTEL_COREI7_ICELAKE_CLIENT;
     521                 :           0 :         break;
     522                 :           0 :       case 0x6a:
     523                 :           0 :       case 0x6c:
     524                 :             :         /* Ice Lake server.  */
     525                 :           0 :         cpu = "icelake-server";
     526                 :           0 :         CHECK___builtin_cpu_is ("corei7");
     527                 :           0 :         CHECK___builtin_cpu_is ("icelake-server");
     528                 :           0 :         cpu_model->__cpu_type = INTEL_COREI7;
     529                 :           0 :         cpu_model->__cpu_subtype = INTEL_COREI7_ICELAKE_SERVER;
     530                 :           0 :         break;
     531                 :           0 :       case 0xa7:
     532                 :             :         /* Rocket Lake.  */
     533                 :           0 :         cpu = "rocketlake";
     534                 :           0 :         CHECK___builtin_cpu_is ("corei7");
     535                 :           0 :         CHECK___builtin_cpu_is ("rocketlake");
     536                 :           0 :         cpu_model->__cpu_type = INTEL_COREI7;
     537                 :           0 :         cpu_model->__cpu_subtype = INTEL_COREI7_ROCKETLAKE;
     538                 :           0 :         break;
     539                 :           0 :       case 0x8c:
     540                 :           0 :       case 0x8d:
     541                 :             :         /* Tiger Lake.  */
     542                 :           0 :         cpu = "tigerlake";
     543                 :           0 :         CHECK___builtin_cpu_is ("corei7");
     544                 :           0 :         CHECK___builtin_cpu_is ("tigerlake");
     545                 :           0 :         cpu_model->__cpu_type = INTEL_COREI7;
     546                 :           0 :         cpu_model->__cpu_subtype = INTEL_COREI7_TIGERLAKE;
     547                 :           0 :         break;
     548                 :           0 :       case 0xbe:
     549                 :             :         /* Alder Lake N, E-core only.  */
     550                 :           0 :       case 0x97:
     551                 :           0 :       case 0x9a:
     552                 :             :         /* Alder Lake.  */
     553                 :           0 :       case 0xb7:
     554                 :           0 :       case 0xba:
     555                 :           0 :       case 0xbf:
     556                 :             :         /* Raptor Lake.  */
     557                 :           0 :       case 0xaa:
     558                 :           0 :       case 0xac:
     559                 :             :         /* Meteor Lake.  */
     560                 :           0 :         cpu = "alderlake";
     561                 :           0 :         CHECK___builtin_cpu_is ("corei7");
     562                 :           0 :         CHECK___builtin_cpu_is ("alderlake");
     563                 :           0 :         cpu_model->__cpu_type = INTEL_COREI7;
     564                 :           0 :         cpu_model->__cpu_subtype = INTEL_COREI7_ALDERLAKE;
     565                 :           0 :         break;
     566                 :           0 :       case 0x8f:
     567                 :             :         /* Sapphire Rapids.  */
     568                 :           0 :       case 0xcf:
     569                 :             :         /* Emerald Rapids.  */
     570                 :           0 :         cpu = "sapphirerapids";
     571                 :           0 :         CHECK___builtin_cpu_is ("corei7");
     572                 :           0 :         CHECK___builtin_cpu_is ("sapphirerapids");
     573                 :           0 :         cpu_model->__cpu_type = INTEL_COREI7;
     574                 :           0 :         cpu_model->__cpu_subtype = INTEL_COREI7_SAPPHIRERAPIDS;
     575                 :           0 :         break;
     576                 :           0 :       case 0xaf:
     577                 :             :         /* Sierra Forest.  */
     578                 :           0 :         cpu = "sierraforest";
     579                 :           0 :         CHECK___builtin_cpu_is ("sierraforest");
     580                 :           0 :         cpu_model->__cpu_type = INTEL_SIERRAFOREST;
     581                 :           0 :         break;
     582                 :           0 :       case 0xad:
     583                 :             :         /* Granite Rapids.  */
     584                 :           0 :         cpu = "graniterapids";
     585                 :           0 :         CHECK___builtin_cpu_is ("corei7");
     586                 :           0 :         CHECK___builtin_cpu_is ("graniterapids");
     587                 :           0 :         cpu_model->__cpu_type = INTEL_COREI7;
     588                 :           0 :         cpu_model->__cpu_subtype = INTEL_COREI7_GRANITERAPIDS;
     589                 :           0 :         break;
     590                 :           0 :       case 0xae:
     591                 :             :         /* Granite Rapids D.  */
     592                 :           0 :         cpu = "graniterapids-d";
     593                 :           0 :         CHECK___builtin_cpu_is ("corei7");
     594                 :           0 :         CHECK___builtin_cpu_is ("graniterapids-d");
     595                 :           0 :         cpu_model->__cpu_type = INTEL_COREI7;
     596                 :           0 :         cpu_model->__cpu_subtype = INTEL_COREI7_GRANITERAPIDS_D;
     597                 :           0 :         break;
     598                 :           0 :       case 0xb6:
     599                 :             :         /* Grand Ridge.  */
     600                 :           0 :         cpu = "grandridge";
     601                 :           0 :         CHECK___builtin_cpu_is ("grandridge");
     602                 :           0 :         cpu_model->__cpu_type = INTEL_GRANDRIDGE;
     603                 :           0 :         break;
     604                 :           0 :       case 0xb5:
     605                 :           0 :       case 0xc5:
     606                 :             :         /* Arrow Lake.  */
     607                 :           0 :         cpu = "arrowlake";
     608                 :           0 :         CHECK___builtin_cpu_is ("corei7");
     609                 :           0 :         CHECK___builtin_cpu_is ("arrowlake");
     610                 :           0 :         cpu_model->__cpu_type = INTEL_COREI7;
     611                 :           0 :         cpu_model->__cpu_subtype = INTEL_COREI7_ARROWLAKE;
     612                 :           0 :         break;
     613                 :           0 :       case 0xc6:
     614                 :             :         /* Arrow Lake S.  */
     615                 :           0 :       case 0xbd:
     616                 :             :         /* Lunar Lake.  */
     617                 :           0 :         cpu = "arrowlake-s";
     618                 :           0 :         CHECK___builtin_cpu_is ("corei7");
     619                 :           0 :         CHECK___builtin_cpu_is ("arrowlake-s");
     620                 :           0 :         cpu_model->__cpu_type = INTEL_COREI7;
     621                 :           0 :         cpu_model->__cpu_subtype = INTEL_COREI7_ARROWLAKE_S;
     622                 :           0 :         break;
     623                 :           0 :       case 0xdd:
     624                 :             :         /* Clearwater Forest.  */
     625                 :           0 :         cpu = "clearwaterforest";
     626                 :           0 :         CHECK___builtin_cpu_is ("clearwaterforest");
     627                 :           0 :         cpu_model->__cpu_type = INTEL_CLEARWATERFOREST;
     628                 :           0 :         break;
     629                 :           0 :       case 0xcc:
     630                 :             :         /* Panther Lake.  */
     631                 :           0 :       case 0xd5:
     632                 :             :         /* Wildcat Lake.  */
     633                 :           0 :         cpu = "pantherlake";
     634                 :           0 :         CHECK___builtin_cpu_is ("corei7");
     635                 :           0 :         CHECK___builtin_cpu_is ("pantherlake");
     636                 :           0 :         cpu_model->__cpu_type = INTEL_COREI7;
     637                 :           0 :         cpu_model->__cpu_subtype = INTEL_COREI7_PANTHERLAKE;
     638                 :           0 :         break;
     639                 :             :       default:
     640                 :             :         break;
     641                 :             :       }
     642                 :             :   /* Parse family and model for family 0x13.  */
     643                 :           0 :   else if (cpu_model2->__cpu_family == 0x13)
     644                 :           0 :     switch (cpu_model2->__cpu_model)
     645                 :             :       {
     646                 :           0 :       case 0x01:
     647                 :             :         /* Diamond Rapids.  */
     648                 :           0 :         cpu = "diamondrapids";
     649                 :           0 :         CHECK___builtin_cpu_is ("corei7");
     650                 :           0 :         CHECK___builtin_cpu_is ("diamondrapids");
     651                 :           0 :         cpu_model->__cpu_type = INTEL_COREI7;
     652                 :           0 :         cpu_model->__cpu_subtype = INTEL_COREI7_DIAMONDRAPIDS;
     653                 :           0 :         break;
     654                 :             :       default:
     655                 :             :         break;
     656                 :             :       }
     657                 :             : 
     658                 :           0 :   return cpu;
     659                 :             : }
     660                 :             : 
     661                 :             : /* Get the specific type of ZHAOXIN CPU and return ZHAOXIN CPU name.
     662                 :             :    Return NULL for unknown ZHAOXIN CPU.  */
     663                 :             : 
     664                 :             : static inline const char *
     665                 :           0 : get_zhaoxin_cpu (struct __processor_model *cpu_model,
     666                 :             :                  struct __processor_model2 *cpu_model2,
     667                 :             :                  unsigned int *cpu_features2)
     668                 :             : {
     669                 :           0 :   const char *cpu = NULL;
     670                 :           0 :   unsigned int family = cpu_model2->__cpu_family;
     671                 :           0 :   unsigned int model = cpu_model2->__cpu_model;
     672                 :             : 
     673                 :           0 :   switch (family)
     674                 :             :     {
     675                 :             :     /* ZHAOXIN family 7h.  */
     676                 :           0 :     case 0x07:
     677                 :           0 :       cpu_model->__cpu_type = ZHAOXIN_FAM7H;
     678                 :           0 :       if (model == 0x3b)
     679                 :             :         {
     680                 :           0 :           cpu = "lujiazui";
     681                 :           0 :           CHECK___builtin_cpu_is ("lujiazui");
     682                 :           0 :           reset_cpu_feature (cpu_model, cpu_features2, FEATURE_AVX);
     683                 :           0 :           reset_cpu_feature (cpu_model, cpu_features2, FEATURE_F16C);
     684                 :           0 :           cpu_model->__cpu_subtype = ZHAOXIN_FAM7H_LUJIAZUI;
     685                 :             :         }
     686                 :           0 :      else if (model == 0x5b)
     687                 :             :         {
     688                 :           0 :           cpu = "yongfeng";
     689                 :           0 :           CHECK___builtin_cpu_is ("yongfeng");
     690                 :           0 :           cpu_model->__cpu_subtype = ZHAOXIN_FAM7H_YONGFENG;
     691                 :             :         }
     692                 :           0 :      else if (model >= 0x6b)
     693                 :             :         {
     694                 :           0 :           cpu = "shijidadao";
     695                 :           0 :           CHECK___builtin_cpu_is ("shijidadao");
     696                 :           0 :           cpu_model->__cpu_subtype = ZHAOXIN_FAM7H_SHIJIDADAO;
     697                 :             :         }
     698                 :             :       break;
     699                 :             :     default:
     700                 :             :       break;
     701                 :             :     }
     702                 :             : 
     703                 :           0 :   return cpu;
     704                 :             : }
     705                 :             : 
     706                 :             : /* ECX and EDX are output of CPUID at level one.  */
     707                 :             : static inline void
     708                 :        1293 : get_available_features (struct __processor_model *cpu_model,
     709                 :             :                         struct __processor_model2 *cpu_model2,
     710                 :             :                         unsigned int *cpu_features2,
     711                 :             :                         unsigned int ecx, unsigned int edx)
     712                 :             : {
     713                 :        1293 :   unsigned int max_cpuid_level = cpu_model2->__cpu_max_level;
     714                 :        1293 :   unsigned int eax, ebx;
     715                 :        1293 :   unsigned int ext_level;
     716                 :             : 
     717                 :             :   /* Get XCR_XFEATURE_ENABLED_MASK register with xgetbv.  */
     718                 :             : #define XCR_XFEATURE_ENABLED_MASK       0x0
     719                 :             : #define XSTATE_FP                       0x1
     720                 :             : #define XSTATE_SSE                      0x2
     721                 :             : #define XSTATE_YMM                      0x4
     722                 :             : #define XSTATE_OPMASK                   0x20
     723                 :             : #define XSTATE_ZMM                      0x40
     724                 :             : #define XSTATE_HI_ZMM                   0x80
     725                 :             : #define XSTATE_TILECFG                  0x20000
     726                 :             : #define XSTATE_TILEDATA         0x40000
     727                 :             : #define XSTATE_APX_F                    0x80000
     728                 :             : 
     729                 :             : #define XCR_AVX_ENABLED_MASK \
     730                 :             :   (XSTATE_SSE | XSTATE_YMM)
     731                 :             : #define XCR_AVX512F_ENABLED_MASK \
     732                 :             :   (XSTATE_SSE | XSTATE_YMM | XSTATE_OPMASK | XSTATE_ZMM | XSTATE_HI_ZMM)
     733                 :             : #define XCR_AMX_ENABLED_MASK \
     734                 :             :   (XSTATE_TILECFG | XSTATE_TILEDATA)
     735                 :             : #define XCR_APX_F_ENABLED_MASK XSTATE_APX_F
     736                 :             : 
     737                 :             :   /* Check if AVX, AVX512 and APX are usable.  */
     738                 :        1293 :   int avx_usable = 0;
     739                 :        1293 :   int avx512_usable = 0;
     740                 :        1293 :   int amx_usable = 0;
     741                 :        1293 :   int apx_usable = 0;
     742                 :             :   /* Check if KL is usable.  */
     743                 :        1293 :   int has_kl = 0;
     744                 :             :   /* Record AVX10 version.  */
     745                 :        1293 :   int avx10_set = 0;
     746                 :        1293 :   int version = 0;
     747                 :        1293 :   if ((ecx & bit_OSXSAVE))
     748                 :             :     {
     749                 :             :       /* Check if XMM, YMM, OPMASK, upper 256 bits of ZMM0-ZMM15 and
     750                 :             :          ZMM16-ZMM31 states are supported by OSXSAVE.  */
     751                 :        1293 :       unsigned int xcrlow;
     752                 :        1293 :       unsigned int xcrhigh;
     753                 :        1293 :       __asm__ (".byte 0x0f, 0x01, 0xd0"
     754                 :             :                : "=a" (xcrlow), "=d" (xcrhigh)
     755                 :             :                : "c" (XCR_XFEATURE_ENABLED_MASK));
     756                 :        1293 :       if ((xcrlow & XCR_AVX_ENABLED_MASK) == XCR_AVX_ENABLED_MASK)
     757                 :             :         {
     758                 :        1293 :           avx_usable = 1;
     759                 :        1293 :           avx512_usable = ((xcrlow & XCR_AVX512F_ENABLED_MASK)
     760                 :        1293 :                            == XCR_AVX512F_ENABLED_MASK);
     761                 :             :         }
     762                 :        1293 :       amx_usable = ((xcrlow & XCR_AMX_ENABLED_MASK)
     763                 :        1293 :                     == XCR_AMX_ENABLED_MASK);
     764                 :        1293 :       apx_usable = ((xcrlow & XCR_APX_F_ENABLED_MASK)
     765                 :        1293 :                     == XCR_APX_F_ENABLED_MASK);
     766                 :             :     }
     767                 :             : 
     768                 :             : #define set_feature(f) \
     769                 :             :   set_cpu_feature (cpu_model, cpu_features2, f)
     770                 :             : 
     771                 :        1293 :   if (edx & bit_CMOV)
     772                 :        1293 :     set_feature (FEATURE_CMOV);
     773                 :        1293 :   if (edx & bit_MMX)
     774                 :        1293 :     set_feature (FEATURE_MMX);
     775                 :        1293 :   if (edx & bit_SSE)
     776                 :        1293 :     set_feature (FEATURE_SSE);
     777                 :        1293 :   if (edx & bit_SSE2)
     778                 :        1293 :     set_feature (FEATURE_SSE2);
     779                 :        1293 :   if (edx & bit_CMPXCHG8B)
     780                 :        1293 :     set_feature (FEATURE_CMPXCHG8B);
     781                 :        1293 :   if (edx & bit_FXSAVE)
     782                 :        1293 :     set_feature (FEATURE_FXSAVE);
     783                 :             : 
     784                 :        1293 :   if (ecx & bit_POPCNT)
     785                 :        1293 :     set_feature (FEATURE_POPCNT);
     786                 :        1293 :   if (ecx & bit_AES)
     787                 :        1293 :     set_feature (FEATURE_AES);
     788                 :        1293 :   if (ecx & bit_PCLMUL)
     789                 :        1293 :     set_feature (FEATURE_PCLMUL);
     790                 :        1293 :   if (ecx & bit_SSE3)
     791                 :        1293 :     set_feature (FEATURE_SSE3);
     792                 :        1293 :   if (ecx & bit_SSSE3)
     793                 :        1293 :     set_feature (FEATURE_SSSE3);
     794                 :        1293 :   if (ecx & bit_SSE4_1)
     795                 :        1293 :     set_feature (FEATURE_SSE4_1);
     796                 :        1293 :   if (ecx & bit_SSE4_2)
     797                 :        1293 :     set_feature (FEATURE_SSE4_2);
     798                 :        1293 :   if (ecx & bit_OSXSAVE)
     799                 :        1293 :     set_feature (FEATURE_OSXSAVE);
     800                 :        1293 :   if (ecx & bit_CMPXCHG16B)
     801                 :        1293 :     set_feature (FEATURE_CMPXCHG16B);
     802                 :        1293 :   if (ecx & bit_MOVBE)
     803                 :        1293 :     set_feature (FEATURE_MOVBE);
     804                 :        1293 :   if (ecx & bit_AES)
     805                 :        1293 :     set_feature (FEATURE_AES);
     806                 :        1293 :   if (ecx & bit_RDRND)
     807                 :        1293 :     set_feature (FEATURE_RDRND);
     808                 :        1293 :   if (ecx & bit_XSAVE)
     809                 :        1293 :     set_feature (FEATURE_XSAVE);
     810                 :        1293 :   if (avx_usable)
     811                 :             :     {
     812                 :        1293 :       if (ecx & bit_AVX)
     813                 :        1293 :         set_feature (FEATURE_AVX);
     814                 :        1293 :       if (ecx & bit_FMA)
     815                 :        1293 :         set_feature (FEATURE_FMA);
     816                 :        1293 :       if (ecx & bit_F16C)
     817                 :        1293 :         set_feature (FEATURE_F16C);
     818                 :             :     }
     819                 :             : 
     820                 :             :   /* Get Advanced Features at level 7 (eax = 7, ecx = 0/1). */
     821                 :        1293 :   if (max_cpuid_level >= 7)
     822                 :             :     {
     823                 :        1293 :       unsigned int max_subleaf_level;
     824                 :             : 
     825                 :        1293 :       __cpuid_count (7, 0, max_subleaf_level, ebx, ecx, edx);
     826                 :        1293 :       if (ebx & bit_BMI)
     827                 :        1293 :         set_feature (FEATURE_BMI);
     828                 :        1293 :       if (ebx & bit_SGX)
     829                 :           0 :         set_feature (FEATURE_SGX);
     830                 :        1293 :       if (ebx & bit_HLE)
     831                 :           0 :         set_feature (FEATURE_HLE);
     832                 :        1293 :       if (ebx & bit_RTM)
     833                 :           0 :         set_feature (FEATURE_RTM);
     834                 :        1293 :       if (avx_usable)
     835                 :             :         {
     836                 :        1293 :           if (ebx & bit_AVX2)
     837                 :        1293 :             set_feature (FEATURE_AVX2);
     838                 :        1293 :           if (ecx & bit_VPCLMULQDQ)
     839                 :           0 :             set_feature (FEATURE_VPCLMULQDQ);
     840                 :        1293 :           if (ecx & bit_VAES)
     841                 :           0 :             set_feature (FEATURE_VAES);
     842                 :             :         }
     843                 :        1293 :       if (ebx & bit_BMI2)
     844                 :        1293 :         set_feature (FEATURE_BMI2);
     845                 :        1293 :       if (ebx & bit_FSGSBASE)
     846                 :        1293 :         set_feature (FEATURE_FSGSBASE);
     847                 :        1293 :       if (ebx & bit_RDSEED)
     848                 :        1293 :         set_feature (FEATURE_RDSEED);
     849                 :        1293 :       if (ebx & bit_ADX)
     850                 :        1293 :         set_feature (FEATURE_ADX);
     851                 :        1293 :       if (ebx & bit_SHA)
     852                 :        1293 :         set_feature (FEATURE_SHA);
     853                 :        1293 :       if (ebx & bit_CLFLUSHOPT)
     854                 :        1293 :         set_feature (FEATURE_CLFLUSHOPT);
     855                 :        1293 :       if (ebx & bit_CLWB)
     856                 :        1293 :         set_feature (FEATURE_CLWB);
     857                 :             :       /* NB: bit_OSPKE indicates that OS supports PKU.  */
     858                 :        1293 :       if (ecx & bit_OSPKE)
     859                 :           0 :         set_feature (FEATURE_PKU);
     860                 :        1293 :       if (ecx & bit_RDPID)
     861                 :        1293 :         set_feature (FEATURE_RDPID);
     862                 :        1293 :       if (ecx & bit_GFNI)
     863                 :           0 :         set_feature (FEATURE_GFNI);
     864                 :        1293 :       if (ecx & bit_MOVDIRI)
     865                 :           0 :         set_feature (FEATURE_MOVDIRI);
     866                 :        1293 :       if (ecx & bit_MOVDIR64B)
     867                 :           0 :         set_feature (FEATURE_MOVDIR64B);
     868                 :        1293 :       if (ecx & bit_ENQCMD)
     869                 :           0 :         set_feature (FEATURE_ENQCMD);
     870                 :        1293 :       if (ecx & bit_CLDEMOTE)
     871                 :           0 :         set_feature (FEATURE_CLDEMOTE);
     872                 :        1293 :       if (ecx & bit_WAITPKG)
     873                 :           0 :         set_feature (FEATURE_WAITPKG);
     874                 :        1293 :       if (ecx & bit_SHSTK)
     875                 :           0 :         set_feature (FEATURE_SHSTK);
     876                 :        1293 :       if (ecx & bit_KL)
     877                 :           0 :         has_kl = 1;
     878                 :        1293 :       if (edx & bit_SERIALIZE)
     879                 :           0 :         set_feature (FEATURE_SERIALIZE);
     880                 :        1293 :       if (edx & bit_TSXLDTRK)
     881                 :           0 :         set_feature (FEATURE_TSXLDTRK);
     882                 :        1293 :       if (edx & bit_PCONFIG)
     883                 :           0 :         set_feature (FEATURE_PCONFIG);
     884                 :        1293 :       if (edx & bit_IBT)
     885                 :           0 :         set_feature (FEATURE_IBT);
     886                 :        1293 :       if (edx & bit_UINTR)
     887                 :           0 :         set_feature (FEATURE_UINTR);
     888                 :        1293 :       if (amx_usable)
     889                 :             :         {
     890                 :           0 :           if (edx & bit_AMX_TILE)
     891                 :           0 :             set_feature (FEATURE_AMX_TILE);
     892                 :           0 :           if (edx & bit_AMX_INT8)
     893                 :           0 :             set_feature (FEATURE_AMX_INT8);
     894                 :           0 :           if (edx & bit_AMX_BF16)
     895                 :           0 :             set_feature (FEATURE_AMX_BF16);
     896                 :             :         }
     897                 :        1293 :       if (avx512_usable)
     898                 :             :         {
     899                 :           0 :           if (ebx & bit_AVX512F)
     900                 :           0 :             set_feature (FEATURE_AVX512F);
     901                 :           0 :           if (ebx & bit_AVX512VL)
     902                 :           0 :             set_feature (FEATURE_AVX512VL);
     903                 :           0 :           if (ebx & bit_AVX512BW)
     904                 :           0 :             set_feature (FEATURE_AVX512BW);
     905                 :           0 :           if (ebx & bit_AVX512DQ)
     906                 :           0 :             set_feature (FEATURE_AVX512DQ);
     907                 :           0 :           if (ebx & bit_AVX512CD)
     908                 :           0 :             set_feature (FEATURE_AVX512CD);
     909                 :           0 :           if (ebx & bit_AVX512IFMA)
     910                 :           0 :             set_feature (FEATURE_AVX512IFMA);
     911                 :           0 :           if (ecx & bit_AVX512VBMI)
     912                 :           0 :             set_feature (FEATURE_AVX512VBMI);
     913                 :           0 :           if (ecx & bit_AVX512VBMI2)
     914                 :           0 :             set_feature (FEATURE_AVX512VBMI2);
     915                 :           0 :           if (ecx & bit_AVX512VNNI)
     916                 :           0 :             set_feature (FEATURE_AVX512VNNI);
     917                 :           0 :           if (ecx & bit_AVX512BITALG)
     918                 :           0 :             set_feature (FEATURE_AVX512BITALG);
     919                 :           0 :           if (ecx & bit_AVX512VPOPCNTDQ)
     920                 :           0 :             set_feature (FEATURE_AVX512VPOPCNTDQ);
     921                 :           0 :           if (edx & bit_AVX512VP2INTERSECT)
     922                 :           0 :             set_feature (FEATURE_AVX512VP2INTERSECT);
     923                 :           0 :           if (edx & bit_AVX512FP16)
     924                 :           0 :             set_feature (FEATURE_AVX512FP16);
     925                 :             :         }
     926                 :             : 
     927                 :        1293 :       if (max_subleaf_level >= 1)
     928                 :             :         {
     929                 :           0 :           __cpuid_count (7, 1, eax, ebx, ecx, edx);
     930                 :           0 :           if (eax & bit_HRESET)
     931                 :           0 :             set_feature (FEATURE_HRESET);
     932                 :           0 :           if (eax & bit_CMPCCXADD)
     933                 :           0 :             set_feature(FEATURE_CMPCCXADD);
     934                 :           0 :           if (edx & bit_PREFETCHI)
     935                 :           0 :             set_feature (FEATURE_PREFETCHI);
     936                 :           0 :           if (eax & bit_RAOINT)
     937                 :           0 :             set_feature (FEATURE_RAOINT);
     938                 :           0 :           if (edx & bit_USER_MSR)
     939                 :           0 :             set_feature (FEATURE_USER_MSR);
     940                 :           0 :           if (eax & bit_MOVRS)
     941                 :           0 :             set_feature (FEATURE_MOVRS);
     942                 :           0 :           if (avx_usable)
     943                 :             :             {
     944                 :           0 :               if (eax & bit_AVXVNNI)
     945                 :           0 :                 set_feature (FEATURE_AVXVNNI);
     946                 :           0 :               if (eax & bit_AVXIFMA)
     947                 :           0 :                 set_feature (FEATURE_AVXIFMA);
     948                 :           0 :               if (edx & bit_AVXVNNIINT8)
     949                 :           0 :                 set_feature (FEATURE_AVXVNNIINT8);
     950                 :           0 :               if (edx & bit_AVXNECONVERT)
     951                 :           0 :                 set_feature (FEATURE_AVXNECONVERT);
     952                 :           0 :               if (edx & bit_AVXVNNIINT16)
     953                 :           0 :                 set_feature (FEATURE_AVXVNNIINT16);
     954                 :           0 :               if (eax & bit_SM3)
     955                 :           0 :                 set_feature (FEATURE_SM3);
     956                 :           0 :               if (eax & bit_SHA512)
     957                 :           0 :                 set_feature (FEATURE_SHA512);
     958                 :           0 :               if (eax & bit_SM4)
     959                 :           0 :                 set_feature (FEATURE_SM4);
     960                 :             :             }
     961                 :           0 :           if (avx512_usable)
     962                 :             :             {
     963                 :           0 :               if (eax & bit_AVX512BF16)
     964                 :           0 :                 set_feature (FEATURE_AVX512BF16);
     965                 :             :               /* AVX10 has the same XSTATE with AVX512.  */
     966                 :           0 :               if (edx & bit_AVX10)
     967                 :           0 :                 avx10_set = 1;
     968                 :             :             }
     969                 :           0 :           if (amx_usable)
     970                 :             :             {
     971                 :           0 :               if (eax & bit_AMX_FP16)
     972                 :           0 :                 set_feature (FEATURE_AMX_FP16);
     973                 :           0 :               if (edx & bit_AMX_COMPLEX)
     974                 :           0 :                 set_feature (FEATURE_AMX_COMPLEX);
     975                 :             :             }
     976                 :           0 :           if (apx_usable)
     977                 :             :             {
     978                 :           0 :               if (edx & bit_APX_F)
     979                 :           0 :                 set_feature (FEATURE_APX_F);
     980                 :             :             }
     981                 :             :         }
     982                 :             :     }
     983                 :             : 
     984                 :             :   /* Get Advanced Features at level 0xd (eax = 0xd, ecx = 1). */
     985                 :        1293 :   if (max_cpuid_level >= 0xd)
     986                 :             :     {
     987                 :        1293 :       __cpuid_count (0xd, 1, eax, ebx, ecx, edx);
     988                 :        1293 :       if (eax & bit_XSAVEOPT)
     989                 :        1293 :         set_feature (FEATURE_XSAVEOPT);
     990                 :        1293 :       if (eax & bit_XSAVEC)
     991                 :        1293 :         set_feature (FEATURE_XSAVEC);
     992                 :        1293 :       if (eax & bit_XSAVES)
     993                 :        1293 :         set_feature (FEATURE_XSAVES);
     994                 :             :     }
     995                 :             : 
     996                 :             :   /* Get Advanced Features at level 0x14 (eax = 0x14, ecx = 0). */
     997                 :        1293 :   if (max_cpuid_level >= 0x14)
     998                 :             :     {
     999                 :           0 :       __cpuid_count (0x14, 0, eax, ebx, ecx, edx);
    1000                 :           0 :       if (ebx & bit_PTWRITE)
    1001                 :           0 :         set_feature (FEATURE_PTWRITE);
    1002                 :             :     }
    1003                 :             : 
    1004                 :             :   /* Get Advanced Features at level 0x19 (eax = 0x19).  */
    1005                 :           0 :   if (max_cpuid_level >= 0x19)
    1006                 :             :     {
    1007                 :           0 :       __cpuid (0x19, eax, ebx, ecx, edx);
    1008                 :             :       /* Check if OS support keylocker.  */
    1009                 :           0 :       if (ebx & bit_AESKLE)
    1010                 :             :         {
    1011                 :           0 :           set_feature (FEATURE_AESKLE);
    1012                 :           0 :           if (ebx & bit_WIDEKL)
    1013                 :           0 :             set_feature (FEATURE_WIDEKL);
    1014                 :           0 :           if (has_kl)
    1015                 :           0 :             set_feature (FEATURE_KL);
    1016                 :             :         }
    1017                 :             :     }
    1018                 :             : 
    1019                 :             :   /* Get Advanced Features at level 0x1e (eax = 0x1e, ecx = 1). */
    1020                 :           0 :   if (max_cpuid_level >= 0x1e)
    1021                 :             :     {
    1022                 :           0 :       __cpuid_count (0x1e, 1, eax, ebx, ecx, edx);
    1023                 :           0 :       if (amx_usable)
    1024                 :             :         {
    1025                 :           0 :           if (eax & bit_AMX_AVX512)
    1026                 :           0 :             set_feature (FEATURE_AMX_AVX512);
    1027                 :           0 :           if (eax & bit_AMX_TF32)
    1028                 :           0 :             set_feature (FEATURE_AMX_TF32);
    1029                 :           0 :           if (eax & bit_AMX_FP8)
    1030                 :           0 :             set_feature (FEATURE_AMX_FP8);
    1031                 :           0 :           if (eax & bit_AMX_MOVRS)
    1032                 :           0 :             set_feature (FEATURE_AMX_MOVRS);
    1033                 :             :         }
    1034                 :             :     }
    1035                 :             : 
    1036                 :             :   /* Get Advanced Features at level 0x24 (eax = 0x24, ecx = 0).  */
    1037                 :        1293 :   if (avx10_set && max_cpuid_level >= 0x24)
    1038                 :             :     {
    1039                 :           0 :       __cpuid_count (0x24, 0, eax, ebx, ecx, edx);
    1040                 :           0 :       version = ebx & 0xff;
    1041                 :           0 :       switch (version)
    1042                 :             :         {
    1043                 :           0 :         case 2:
    1044                 :           0 :           set_feature (FEATURE_AVX10_2);
    1045                 :             :           /* Fall through.  */
    1046                 :           0 :         case 1:
    1047                 :           0 :           set_feature (FEATURE_AVX10_1);
    1048                 :           0 :           break;
    1049                 :           0 :         default:
    1050                 :           0 :           set_feature (FEATURE_AVX10_1);
    1051                 :           0 :           break;
    1052                 :             :         }
    1053                 :             :     }
    1054                 :             : 
    1055                 :             :   /* Check cpuid level of extended features.  */
    1056                 :        1293 :   __cpuid (0x80000000, ext_level, ebx, ecx, edx);
    1057                 :             : 
    1058                 :        1293 :   cpu_model2->__cpu_ext_level = ext_level;
    1059                 :             : 
    1060                 :        1293 :   if (ext_level >= 0x80000001)
    1061                 :             :     {
    1062                 :        1293 :       __cpuid (0x80000001, eax, ebx, ecx, edx);
    1063                 :             : 
    1064                 :        1293 :       if (ecx & bit_SSE4a)
    1065                 :        1293 :         set_feature (FEATURE_SSE4_A);
    1066                 :        1293 :       if (ecx & bit_LAHF_LM)
    1067                 :        1293 :         set_feature (FEATURE_LAHF_LM);
    1068                 :        1293 :       if (ecx & bit_ABM)
    1069                 :        1293 :         set_feature (FEATURE_ABM);
    1070                 :        1293 :       if (ecx & bit_LWP)
    1071                 :           0 :         set_feature (FEATURE_LWP);
    1072                 :        1293 :       if (ecx & bit_TBM)
    1073                 :           0 :         set_feature (FEATURE_TBM);
    1074                 :        1293 :       if (ecx & bit_LZCNT)
    1075                 :        1293 :         set_feature (FEATURE_LZCNT);
    1076                 :        1293 :       if (ecx & bit_PRFCHW)
    1077                 :        1293 :         set_feature (FEATURE_PRFCHW);
    1078                 :        1293 :       if (ecx & bit_MWAITX)
    1079                 :        1293 :         set_feature (FEATURE_MWAITX);
    1080                 :             : 
    1081                 :        1293 :       if (edx & bit_LM)
    1082                 :        1293 :         set_feature (FEATURE_LM);
    1083                 :        1293 :       if (edx & bit_3DNOWP)
    1084                 :           0 :         set_feature (FEATURE_3DNOWP);
    1085                 :        1293 :       if (edx & bit_3DNOW)
    1086                 :           0 :         set_feature (FEATURE_3DNOW);
    1087                 :             : 
    1088                 :        1293 :       if (avx_usable)
    1089                 :             :         {
    1090                 :        1293 :           if (ecx & bit_FMA4)
    1091                 :           0 :             set_feature (FEATURE_FMA4);
    1092                 :        1293 :           if (ecx & bit_XOP)
    1093                 :           0 :             set_feature (FEATURE_XOP);
    1094                 :             :         }
    1095                 :             :     }
    1096                 :             : 
    1097                 :        1293 :   if (ext_level >= 0x80000008)
    1098                 :             :     {
    1099                 :        1293 :       __cpuid (0x80000008, eax, ebx, ecx, edx);
    1100                 :        1293 :       if (ebx & bit_CLZERO)
    1101                 :        1293 :         set_feature (FEATURE_CLZERO);
    1102                 :        1293 :       if (ebx & bit_WBNOINVD)
    1103                 :        1293 :         set_feature (FEATURE_WBNOINVD);
    1104                 :             :     }
    1105                 :             : 
    1106                 :        1293 :   if (ext_level >= 0x80000021)
    1107                 :             :     {
    1108                 :           0 :       __cpuid (0x80000021, eax, ebx, ecx, edx);
    1109                 :           0 :       if (eax & bit_AMD_PREFETCHI)
    1110                 :             :         {
    1111                 :           0 :           set_feature (FEATURE_PREFETCHI);
    1112                 :             :         }
    1113                 :             :     }
    1114                 :             : 
    1115                 :             : #undef set_feature
    1116                 :        1293 : }
    1117                 :             : 
    1118                 :             : static inline int
    1119                 :        1293 : cpu_indicator_init (struct __processor_model *cpu_model,
    1120                 :             :                     struct __processor_model2 *cpu_model2,
    1121                 :             :                     unsigned int *cpu_features2)
    1122                 :             : {
    1123                 :        1293 :   unsigned int eax, ebx, ecx, edx;
    1124                 :             : 
    1125                 :        1293 :   int max_level;
    1126                 :        1293 :   unsigned int vendor;
    1127                 :        1293 :   unsigned int model, family;
    1128                 :        1293 :   unsigned int extended_model, extended_family;
    1129                 :             : 
    1130                 :             :   /* This function needs to run just once.  */
    1131                 :        1293 :   if (cpu_model->__cpu_vendor)
    1132                 :             :     return 0;
    1133                 :             : 
    1134                 :             :   /* Assume cpuid insn present. Run in level 0 to get vendor id. */
    1135                 :        1293 :   if (!__get_cpuid (0, &eax, &ebx, &ecx, &edx))
    1136                 :             :     {
    1137                 :           0 :       cpu_model->__cpu_vendor = VENDOR_OTHER;
    1138                 :           0 :       return -1;
    1139                 :             :     }
    1140                 :             : 
    1141                 :        1293 :   vendor = ebx;
    1142                 :        1293 :   max_level = eax;
    1143                 :             : 
    1144                 :        1293 :   if (max_level < 1)
    1145                 :             :     {
    1146                 :           0 :       cpu_model->__cpu_vendor = VENDOR_OTHER;
    1147                 :           0 :       return -1;
    1148                 :             :     }
    1149                 :             : 
    1150                 :        1293 :   if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx))
    1151                 :             :     {
    1152                 :           0 :       cpu_model->__cpu_vendor = VENDOR_OTHER;
    1153                 :           0 :       return -1;
    1154                 :             :     }
    1155                 :             : 
    1156                 :        1293 :   cpu_model2->__cpu_max_level = max_level;
    1157                 :             : 
    1158                 :        1293 :   model = (eax >> 4) & 0x0f;
    1159                 :        1293 :   family = (eax >> 8) & 0x0f;
    1160                 :        1293 :   extended_model = (eax >> 12) & 0xf0;
    1161                 :        1293 :   extended_family = (eax >> 20) & 0xff;
    1162                 :             : 
    1163                 :             :   /* Find available features. */
    1164                 :        1293 :   get_available_features (cpu_model, cpu_model2, cpu_features2,
    1165                 :             :                           ecx, edx);
    1166                 :             : 
    1167                 :        1293 :   if (vendor == signature_INTEL_ebx)
    1168                 :             :     {
    1169                 :             :       /* Adjust model and family for Intel CPUS. */
    1170                 :           0 :       if (family == 0x0f)
    1171                 :             :         {
    1172                 :           0 :           family += extended_family;
    1173                 :           0 :           model += extended_model;
    1174                 :             :         }
    1175                 :           0 :       else if (family == 0x06)
    1176                 :           0 :         model += extended_model;
    1177                 :             : 
    1178                 :           0 :       cpu_model2->__cpu_family = family;
    1179                 :           0 :       cpu_model2->__cpu_model = model;
    1180                 :             : 
    1181                 :             :       /* Get CPU type.  */
    1182                 :           0 :       get_intel_cpu (cpu_model, cpu_model2, cpu_features2);
    1183                 :           0 :       cpu_model->__cpu_vendor = VENDOR_INTEL;
    1184                 :             :     }
    1185                 :        1293 :   else if (vendor == signature_AMD_ebx)
    1186                 :             :     {
    1187                 :             :       /* Adjust model and family for AMD CPUS. */
    1188                 :        1293 :       if (family == 0x0f)
    1189                 :             :         {
    1190                 :        1293 :           family += extended_family;
    1191                 :        1293 :           model += extended_model;
    1192                 :             :         }
    1193                 :             : 
    1194                 :        1293 :       cpu_model2->__cpu_family = family;
    1195                 :        1293 :       cpu_model2->__cpu_model = model;
    1196                 :             : 
    1197                 :             :       /* Get CPU type.  */
    1198                 :        1293 :       get_amd_cpu (cpu_model, cpu_model2, cpu_features2);
    1199                 :        1293 :       cpu_model->__cpu_vendor = VENDOR_AMD;
    1200                 :             :     }
    1201                 :           0 :   else if (vendor == signature_CENTAUR_ebx && family < 0x07)
    1202                 :           0 :     cpu_model->__cpu_vendor = VENDOR_CENTAUR;
    1203                 :           0 :   else if (vendor == signature_SHANGHAI_ebx
    1204                 :           0 :            || vendor == signature_CENTAUR_ebx)
    1205                 :             :     {
    1206                 :             :       /* Adjust model and family for ZHAOXIN CPUS.  */
    1207                 :           0 :       if (family == 0x07)
    1208                 :           0 :         model += extended_model;
    1209                 :             : 
    1210                 :           0 :       cpu_model2->__cpu_family = family;
    1211                 :           0 :       cpu_model2->__cpu_model = model;
    1212                 :             : 
    1213                 :             :       /* Get CPU type.  */
    1214                 :           0 :       get_zhaoxin_cpu (cpu_model, cpu_model2, cpu_features2);
    1215                 :           0 :       cpu_model->__cpu_vendor = VENDOR_ZHAOXIN;
    1216                 :             :     }
    1217                 :           0 :   else if (vendor == signature_CYRIX_ebx)
    1218                 :           0 :     cpu_model->__cpu_vendor = VENDOR_CYRIX;
    1219                 :           0 :   else if (vendor == signature_NSC_ebx)
    1220                 :           0 :     cpu_model->__cpu_vendor = VENDOR_NSC;
    1221                 :             :   else
    1222                 :           0 :     cpu_model->__cpu_vendor = VENDOR_OTHER;
    1223                 :             : 
    1224                 :        1293 :   if (has_cpu_feature (cpu_model, cpu_features2, FEATURE_LM)
    1225                 :        1293 :       && has_cpu_feature (cpu_model, cpu_features2, FEATURE_SSE2))
    1226                 :             :     {
    1227                 :        1293 :       CHECK___builtin_cpu_supports ("x86-64");
    1228                 :        1293 :       set_cpu_feature (cpu_model, cpu_features2,
    1229                 :             :                        FEATURE_X86_64_BASELINE);
    1230                 :        1293 :       if (has_cpu_feature (cpu_model, cpu_features2, FEATURE_CMPXCHG16B)
    1231                 :        1293 :           && has_cpu_feature (cpu_model, cpu_features2, FEATURE_POPCNT)
    1232                 :        1293 :           && has_cpu_feature (cpu_model, cpu_features2, FEATURE_LAHF_LM)
    1233                 :        2586 :           && has_cpu_feature (cpu_model, cpu_features2, FEATURE_SSE4_2))
    1234                 :             :         {
    1235                 :        1293 :           CHECK___builtin_cpu_supports ("x86-64-v2");
    1236                 :        1293 :           set_cpu_feature (cpu_model, cpu_features2,
    1237                 :             :                            FEATURE_X86_64_V2);
    1238                 :        1293 :           if (has_cpu_feature (cpu_model, cpu_features2, FEATURE_AVX2)
    1239                 :        1293 :               && has_cpu_feature (cpu_model, cpu_features2, FEATURE_BMI)
    1240                 :        1293 :               && has_cpu_feature (cpu_model, cpu_features2, FEATURE_BMI2)
    1241                 :        1293 :               && has_cpu_feature (cpu_model, cpu_features2, FEATURE_F16C)
    1242                 :        1293 :               && has_cpu_feature (cpu_model, cpu_features2, FEATURE_FMA)
    1243                 :        1293 :               && has_cpu_feature (cpu_model, cpu_features2,
    1244                 :             :                                   FEATURE_LZCNT)
    1245                 :        2586 :               && has_cpu_feature (cpu_model, cpu_features2,
    1246                 :             :                                   FEATURE_MOVBE))
    1247                 :             :             {
    1248                 :        1293 :               CHECK___builtin_cpu_supports ("x86-64-v3");
    1249                 :        1293 :               set_cpu_feature (cpu_model, cpu_features2,
    1250                 :             :                                FEATURE_X86_64_V3);
    1251                 :        1293 :               if (has_cpu_feature (cpu_model, cpu_features2,
    1252                 :             :                                    FEATURE_AVX512BW)
    1253                 :           0 :                   && has_cpu_feature (cpu_model, cpu_features2,
    1254                 :             :                                       FEATURE_AVX512CD)
    1255                 :           0 :                   && has_cpu_feature (cpu_model, cpu_features2,
    1256                 :             :                                       FEATURE_AVX512DQ)
    1257                 :        1293 :                   && has_cpu_feature (cpu_model, cpu_features2,
    1258                 :             :                                       FEATURE_AVX512VL))
    1259                 :             :                 {
    1260                 :           0 :                   CHECK___builtin_cpu_supports ("x86-64-v4");
    1261                 :           0 :                   set_cpu_feature (cpu_model, cpu_features2,
    1262                 :             :                                    FEATURE_X86_64_V4);
    1263                 :             :                 }
    1264                 :             :             }
    1265                 :             :         }
    1266                 :             :     }
    1267                 :             : 
    1268                 :        1293 :   gcc_assert (cpu_model->__cpu_vendor < VENDOR_MAX);
    1269                 :        1293 :   gcc_assert (cpu_model->__cpu_type < CPU_TYPE_MAX);
    1270                 :        1293 :   gcc_assert (cpu_model->__cpu_subtype < CPU_SUBTYPE_MAX);
    1271                 :             : 
    1272                 :             :   return 0;
    1273                 :             : }
        

Generated by: LCOV version 2.1-beta

LCOV profile is generated on x86_64 machine using following configure options: configure --disable-bootstrap --enable-coverage=opt --enable-languages=c,c++,fortran,go,jit,lto,rust,m2 --enable-host-shared. GCC test suite is run with the built compiler.