1 /* Get CPU type and Features for x86 processors.
2    Copyright (C) 2012-2020 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 /* Processor Vendor and Models. */
27 
28 enum processor_vendor
29 {
30   VENDOR_INTEL = 1,
31   VENDOR_AMD,
32   VENDOR_OTHER,
33   BUILTIN_VENDOR_MAX = VENDOR_OTHER,
34   VENDOR_MAX
35 };
36 
37 /* Any new types or subtypes have to be inserted at the end. */
38 
39 enum processor_types
40 {
41   INTEL_BONNELL = 1,
42   INTEL_CORE2,
43   INTEL_COREI7,
44   AMDFAM10H,
45   AMDFAM15H,
46   INTEL_SILVERMONT,
47   INTEL_KNL,
48   AMD_BTVER1,
49   AMD_BTVER2,
50   AMDFAM17H,
51   INTEL_KNM,
52   INTEL_GOLDMONT,
53   INTEL_GOLDMONT_PLUS,
54   INTEL_TREMONT,
55   AMDFAM19H,
56   CPU_TYPE_MAX,
57   BUILTIN_CPU_TYPE_MAX = CPU_TYPE_MAX
58 };
59 
60 enum processor_subtypes
61 {
62   INTEL_COREI7_NEHALEM = 1,
63   INTEL_COREI7_WESTMERE,
64   INTEL_COREI7_SANDYBRIDGE,
65   AMDFAM10H_BARCELONA,
66   AMDFAM10H_SHANGHAI,
67   AMDFAM10H_ISTANBUL,
68   AMDFAM15H_BDVER1,
69   AMDFAM15H_BDVER2,
70   AMDFAM15H_BDVER3,
71   AMDFAM15H_BDVER4,
72   AMDFAM17H_ZNVER1,
73   INTEL_COREI7_IVYBRIDGE,
74   INTEL_COREI7_HASWELL,
75   INTEL_COREI7_BROADWELL,
76   INTEL_COREI7_SKYLAKE,
77   INTEL_COREI7_SKYLAKE_AVX512,
78   INTEL_COREI7_CANNONLAKE,
79   INTEL_COREI7_ICELAKE_CLIENT,
80   INTEL_COREI7_ICELAKE_SERVER,
81   AMDFAM17H_ZNVER2,
82   INTEL_COREI7_CASCADELAKE,
83   INTEL_COREI7_TIGERLAKE,
84   INTEL_COREI7_COOPERLAKE,
85   AMDFAM19H_ZNVER3,
86   CPU_SUBTYPE_MAX
87 };
88 
89 /* Priority of i386 features, greater value is higher priority.   This is
90    used to decide the order in which function dispatch must happen.  For
91    instance, a version specialized for SSE4.2 should be checked for dispatch
92    before a version for SSE3, as SSE4.2 implies SSE3.  */
93 enum feature_priority
94 {
95   P_NONE = 0,
96   P_MMX,
97   P_SSE,
98   P_SSE2,
99   P_SSE3,
100   P_SSSE3,
101   P_PROC_SSSE3,
102   P_SSE4_A,
103   P_PROC_SSE4_A,
104   P_SSE4_1,
105   P_SSE4_2,
106   P_PROC_SSE4_2,
107   P_POPCNT,
108   P_AES,
109   P_PCLMUL,
110   P_AVX,
111   P_PROC_AVX,
112   P_BMI,
113   P_PROC_BMI,
114   P_FMA4,
115   P_XOP,
116   P_PROC_XOP,
117   P_FMA,
118   P_PROC_FMA,
119   P_BMI2,
120   P_AVX2,
121   P_PROC_AVX2,
122   P_AVX512F,
123   P_PROC_AVX512F,
124   P_PROC_DYNAMIC
125 };
126 
127 /* These are the values for vendor types, cpu types and subtypes.  Cpu
128    types and subtypes should be subtracted by the corresponding start
129    value.  */
130 
131 #define M_CPU_TYPE_START (BUILTIN_VENDOR_MAX)
132 #define M_CPU_SUBTYPE_START \
133   (M_CPU_TYPE_START + BUILTIN_CPU_TYPE_MAX)
134 #define M_VENDOR(a) (a)
135 #define M_CPU_TYPE(a) (M_CPU_TYPE_START + a)
136 #define M_CPU_SUBTYPE(a) (M_CPU_SUBTYPE_START + a)
137