LLVM 20.0.0git
X86TargetParser.cpp
Go to the documentation of this file.
1//===-- X86TargetParser - Parser for X86 features ---------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file implements a target parser to recognise X86 hardware features.
10//
11//===----------------------------------------------------------------------===//
12
14#include "llvm/ADT/Bitset.h"
16#include <numeric>
17
18using namespace llvm;
19using namespace llvm::X86;
20
21namespace {
22
24
25struct ProcInfo {
28 unsigned KeyFeature;
29 FeatureBitset Features;
30 char Mangling;
31 bool OnlyForCPUDispatchSpecific;
32};
33
34struct FeatureInfo {
35 StringLiteral NameWithPlus;
36 FeatureBitset ImpliedFeatures;
37
38 StringRef getName(bool WithPlus = false) const {
39 assert(NameWithPlus[0] == '+' && "Expected string to start with '+'");
40 if (WithPlus)
41 return NameWithPlus;
42 return NameWithPlus.drop_front();
43 }
44};
45
46} // end anonymous namespace
47
48#define X86_FEATURE(ENUM, STRING) \
49 constexpr FeatureBitset Feature##ENUM = {X86::FEATURE_##ENUM};
50#include "llvm/TargetParser/X86TargetParser.def"
51
52// Pentium with MMX.
54 FeatureX87 | FeatureCMPXCHG8B | FeatureMMX;
55
56// Pentium 2 and 3.
58 FeatureX87 | FeatureCMPXCHG8B | FeatureMMX | FeatureFXSR | FeatureCMOV;
60
61// Pentium 4 CPUs
65 FeaturesPrescott | Feature64BIT | FeatureCMPXCHG16B;
66
67// Basic 64-bit capable CPU.
70 FeaturePOPCNT | FeatureCRC32 |
71 FeatureSSE4_2 | FeatureCMPXCHG16B;
73 FeaturesX86_64_V2 | FeatureAVX2 | FeatureBMI | FeatureBMI2 | FeatureF16C |
74 FeatureFMA | FeatureLZCNT | FeatureMOVBE | FeatureXSAVE;
76 FeatureAVX512BW | FeatureAVX512CD |
77 FeatureAVX512DQ | FeatureAVX512VL;
78
79// Intel Core CPUs
81 FeaturesNocona | FeatureSAHF | FeatureSSSE3;
82constexpr FeatureBitset FeaturesPenryn = FeaturesCore2 | FeatureSSE4_1;
84 FeaturesPenryn | FeaturePOPCNT | FeatureCRC32 | FeatureSSE4_2;
87 FeaturesWestmere | FeatureAVX | FeatureXSAVE | FeatureXSAVEOPT;
89 FeaturesSandyBridge | FeatureF16C | FeatureFSGSBASE | FeatureRDRND;
91 FeaturesIvyBridge | FeatureAVX2 | FeatureBMI | FeatureBMI2 | FeatureFMA |
92 FeatureINVPCID | FeatureLZCNT | FeatureMOVBE;
94 FeaturesHaswell | FeatureADX | FeaturePRFCHW | FeatureRDSEED;
95
96// Intel Knights Landing and Knights Mill
97// Knights Landing has feature parity with Broadwell.
99 FeatureAVX512F | FeatureEVEX512 |
100 FeatureAVX512CD;
101constexpr FeatureBitset FeaturesKNM = FeaturesKNL | FeatureAVX512VPOPCNTDQ;
102
103// Intel Skylake processors.
105 FeaturesBroadwell | FeatureAES | FeatureCLFLUSHOPT | FeatureXSAVEC |
106 FeatureXSAVES | FeatureSGX;
107// SkylakeServer inherits all SkylakeClient features except SGX.
108// FIXME: That doesn't match gcc.
110 (FeaturesSkylakeClient & ~FeatureSGX) | FeatureAVX512F | FeatureEVEX512 |
111 FeatureAVX512CD | FeatureAVX512DQ | FeatureAVX512BW | FeatureAVX512VL |
112 FeatureCLWB | FeaturePKU;
114 FeaturesSkylakeServer | FeatureAVX512VNNI;
116 FeaturesCascadeLake | FeatureAVX512BF16;
117
118// Intel 10nm processors.
120 FeaturesSkylakeClient | FeatureAVX512F | FeatureEVEX512 | FeatureAVX512CD |
121 FeatureAVX512DQ | FeatureAVX512BW | FeatureAVX512VL | FeatureAVX512IFMA |
122 FeatureAVX512VBMI | FeaturePKU | FeatureSHA;
124 FeaturesCannonlake | FeatureAVX512BITALG | FeatureAVX512VBMI2 |
125 FeatureAVX512VNNI | FeatureAVX512VPOPCNTDQ | FeatureGFNI | FeatureRDPID |
126 FeatureVAES | FeatureVPCLMULQDQ;
129 FeaturesICLClient | FeatureCLWB | FeaturePCONFIG | FeatureWBNOINVD;
131 FeaturesICLClient | FeatureAVX512VP2INTERSECT | FeatureMOVDIR64B |
132 FeatureCLWB | FeatureMOVDIRI | FeatureSHSTK | FeatureKL | FeatureWIDEKL;
134 FeaturesICLServer | FeatureAMX_BF16 | FeatureAMX_INT8 | FeatureAMX_TILE |
135 FeatureAVX512BF16 | FeatureAVX512FP16 | FeatureAVXVNNI | FeatureCLDEMOTE |
136 FeatureENQCMD | FeatureMOVDIR64B | FeatureMOVDIRI | FeaturePTWRITE |
137 FeatureSERIALIZE | FeatureSHSTK | FeatureTSXLDTRK | FeatureUINTR |
138 FeatureWAITPKG;
140 FeaturesSapphireRapids | FeatureAMX_FP16 | FeaturePREFETCHI;
142 FeaturesGraniteRapids | FeatureAMX_COMPLEX | FeatureAVX10_2_512 |
143 FeatureCMPCCXADD | FeatureAVXIFMA | FeatureAVXNECONVERT |
144 FeatureAVXVNNIINT8 | FeatureAVXVNNIINT16 | FeatureSHA512 | FeatureSM3 |
145 FeatureSM4 | FeatureEGPR | FeatureZU | FeatureCCMP | FeaturePush2Pop2 |
146 FeaturePPX | FeatureNDD | FeatureNF | FeatureCF | FeatureMOVRS |
147 FeatureAMX_MOVRS | FeatureAMX_AVX512 | FeatureAMX_FP8 | FeatureAMX_TF32 |
148 FeatureAMX_TRANSPOSE | FeatureUSERMSR;
149
150// Intel Atom processors.
151// Bonnell has feature parity with Core2 and adds MOVBE.
152constexpr FeatureBitset FeaturesBonnell = FeaturesCore2 | FeatureMOVBE;
153// Silvermont has parity with Westmere and Bonnell plus PRFCHW and RDRND.
155 FeaturesBonnell | FeaturesWestmere | FeaturePRFCHW | FeatureRDRND;
157 FeaturesSilvermont | FeatureAES | FeatureCLFLUSHOPT | FeatureFSGSBASE |
158 FeatureRDSEED | FeatureSHA | FeatureXSAVE | FeatureXSAVEC |
159 FeatureXSAVEOPT | FeatureXSAVES;
161 FeaturesGoldmont | FeaturePTWRITE | FeatureRDPID | FeatureSGX;
163 FeaturesGoldmontPlus | FeatureCLWB | FeatureGFNI;
165 FeaturesTremont | FeatureADX | FeatureBMI | FeatureBMI2 | FeatureF16C |
166 FeatureFMA | FeatureINVPCID | FeatureLZCNT | FeaturePCONFIG | FeaturePKU |
167 FeatureSERIALIZE | FeatureSHSTK | FeatureVAES | FeatureVPCLMULQDQ |
168 FeatureCLDEMOTE | FeatureMOVDIR64B | FeatureMOVDIRI | FeatureWAITPKG |
169 FeatureAVXVNNI | FeatureHRESET | FeatureWIDEKL;
171 FeaturesAlderlake | FeatureCMPCCXADD | FeatureAVXIFMA | FeatureUINTR |
172 FeatureENQCMD | FeatureAVXNECONVERT | FeatureAVXVNNIINT8;
174 FeatureAVXVNNIINT16 | FeatureSHA512 | FeatureSM3 | FeatureSM4;
176 FeaturesArrowlakeS | FeaturePREFETCHI;
178 FeaturesArrowlakeS | FeatureUSERMSR | FeaturePREFETCHI;
179
180// Geode Processor.
182 FeatureX87 | FeatureCMPXCHG8B | FeatureMMX | FeaturePRFCHW;
183
184// K6 processor.
185constexpr FeatureBitset FeaturesK6 = FeatureX87 | FeatureCMPXCHG8B | FeatureMMX;
186
187// K7 and K8 architecture processors.
189 FeatureX87 | FeatureCMPXCHG8B | FeatureMMX | FeaturePRFCHW;
191 FeaturesAthlon | FeatureFXSR | FeatureSSE;
193 FeaturesAthlonXP | FeatureSSE2 | Feature64BIT;
194constexpr FeatureBitset FeaturesK8SSE3 = FeaturesK8 | FeatureSSE3;
196 FeaturesK8SSE3 | FeatureCMPXCHG16B | FeatureLZCNT | FeaturePOPCNT |
197 FeaturePRFCHW | FeatureSAHF | FeatureSSE4_A;
198
199// Bobcat architecture processors.
201 FeatureX87 | FeatureCMPXCHG8B | FeatureCMPXCHG16B | Feature64BIT |
202 FeatureFXSR | FeatureLZCNT | FeatureMMX | FeaturePOPCNT | FeaturePRFCHW |
203 FeatureSSE | FeatureSSE2 | FeatureSSE3 | FeatureSSSE3 | FeatureSSE4_A |
204 FeatureSAHF;
206 FeaturesBTVER1 | FeatureAES | FeatureAVX | FeatureBMI | FeatureCRC32 |
207 FeatureF16C | FeatureMOVBE | FeaturePCLMUL | FeatureXSAVE | FeatureXSAVEOPT;
208
209// AMD Bulldozer architecture processors.
211 FeatureX87 | FeatureAES | FeatureAVX | FeatureCMPXCHG8B |
212 FeatureCMPXCHG16B | FeatureCRC32 | Feature64BIT | FeatureFMA4 |
213 FeatureFXSR | FeatureLWP | FeatureLZCNT | FeatureMMX | FeaturePCLMUL |
214 FeaturePOPCNT | FeaturePRFCHW | FeatureSAHF | FeatureSSE | FeatureSSE2 |
215 FeatureSSE3 | FeatureSSSE3 | FeatureSSE4_1 | FeatureSSE4_2 | FeatureSSE4_A |
216 FeatureXOP | FeatureXSAVE;
218 FeaturesBDVER1 | FeatureBMI | FeatureFMA | FeatureF16C | FeatureTBM;
220 FeaturesBDVER2 | FeatureFSGSBASE | FeatureXSAVEOPT;
221constexpr FeatureBitset FeaturesBDVER4 = FeaturesBDVER3 | FeatureAVX2 |
222 FeatureBMI2 | FeatureMOVBE |
223 FeatureMWAITX | FeatureRDRND;
224
225// AMD Zen architecture processors.
227 FeatureX87 | FeatureADX | FeatureAES | FeatureAVX | FeatureAVX2 |
228 FeatureBMI | FeatureBMI2 | FeatureCLFLUSHOPT | FeatureCLZERO |
229 FeatureCMPXCHG8B | FeatureCMPXCHG16B | FeatureCRC32 | Feature64BIT |
230 FeatureF16C | FeatureFMA | FeatureFSGSBASE | FeatureFXSR | FeatureLZCNT |
231 FeatureMMX | FeatureMOVBE | FeatureMWAITX | FeaturePCLMUL | FeaturePOPCNT |
232 FeaturePRFCHW | FeatureRDRND | FeatureRDSEED | FeatureSAHF | FeatureSHA |
233 FeatureSSE | FeatureSSE2 | FeatureSSE3 | FeatureSSSE3 | FeatureSSE4_1 |
234 FeatureSSE4_2 | FeatureSSE4_A | FeatureXSAVE | FeatureXSAVEC |
235 FeatureXSAVEOPT | FeatureXSAVES;
236constexpr FeatureBitset FeaturesZNVER2 = FeaturesZNVER1 | FeatureCLWB |
237 FeatureRDPID | FeatureRDPRU |
238 FeatureWBNOINVD;
240 FeatureINVPCID | FeaturePKU |
241 FeatureVAES | FeatureVPCLMULQDQ;
243 FeaturesZNVER3 | FeatureAVX512F | FeatureEVEX512 | FeatureAVX512CD |
244 FeatureAVX512DQ | FeatureAVX512BW | FeatureAVX512VL | FeatureAVX512IFMA |
245 FeatureAVX512VBMI | FeatureAVX512VBMI2 | FeatureAVX512VNNI |
246 FeatureAVX512BITALG | FeatureAVX512VPOPCNTDQ | FeatureAVX512BF16 |
247 FeatureGFNI | FeatureSHSTK;
248
250 FeaturesZNVER4 | FeatureAVXVNNI | FeatureMOVDIRI | FeatureMOVDIR64B |
251 FeatureAVX512VP2INTERSECT | FeaturePREFETCHI | FeatureAVXVNNI;
252
253// D151696 tranplanted Mangling and OnlyForCPUDispatchSpecific from
254// X86TargetParser.def to here. They are assigned by following ways:
255// 1. Copy the mangling from the original CPU_SPEICIFC MACROs. If no, assign
256// to '\0' by default, which means not support cpu_specific/dispatch feature.
257// 2. set OnlyForCPUDispatchSpecific as true if this cpu name was not
258// listed here before, which means it doesn't support -march, -mtune and so on.
259// FIXME: Remove OnlyForCPUDispatchSpecific after all CPUs here support both
260// cpu_dispatch/specific() feature and -march, -mtune, and so on.
261// clang-format off
262constexpr ProcInfo Processors[] = {
263 // Empty processor. Include X87 and CMPXCHG8 for backwards compatibility.
264 { {""}, CK_None, ~0U, FeatureX87 | FeatureCMPXCHG8B, '\0', false },
265 { {"generic"}, CK_None, ~0U, FeatureX87 | FeatureCMPXCHG8B | Feature64BIT, 'A', true },
266 // i386-generation processors.
267 { {"i386"}, CK_i386, ~0U, FeatureX87, '\0', false },
268 // i486-generation processors.
269 { {"i486"}, CK_i486, ~0U, FeatureX87, '\0', false },
270 { {"winchip-c6"}, CK_WinChipC6, ~0U, FeaturesPentiumMMX, '\0', false },
271 { {"winchip2"}, CK_WinChip2, ~0U, FeaturesPentiumMMX | FeaturePRFCHW, '\0', false },
272 { {"c3"}, CK_C3, ~0U, FeaturesPentiumMMX | FeaturePRFCHW, '\0', false },
273 // i586-generation processors, P5 microarchitecture based.
274 { {"i586"}, CK_i586, ~0U, FeatureX87 | FeatureCMPXCHG8B, '\0', false },
275 { {"pentium"}, CK_Pentium, ~0U, FeatureX87 | FeatureCMPXCHG8B, 'B', false },
276 { {"pentium-mmx"}, CK_PentiumMMX, ~0U, FeaturesPentiumMMX, '\0', false },
277 { {"pentium_mmx"}, CK_PentiumMMX, ~0U, FeaturesPentiumMMX, 'D', true },
278 // i686-generation processors, P6 / Pentium M microarchitecture based.
279 { {"pentiumpro"}, CK_PentiumPro, ~0U, FeatureCMOV | FeatureX87 | FeatureCMPXCHG8B, 'C', false },
280 { {"pentium_pro"}, CK_PentiumPro, ~0U, FeatureCMOV | FeatureX87 | FeatureCMPXCHG8B, 'C', true },
281 { {"i686"}, CK_i686, ~0U, FeatureCMOV | FeatureX87 | FeatureCMPXCHG8B, '\0', false },
282 { {"pentium2"}, CK_Pentium2, ~0U, FeaturesPentium2, 'E', false },
283 { {"pentium_ii"}, CK_Pentium2, ~0U, FeaturesPentium2, 'E', true },
284 { {"pentium3"}, CK_Pentium3, ~0U, FeaturesPentium3, 'H', false },
285 { {"pentium3m"}, CK_Pentium3, ~0U, FeaturesPentium3, 'H', false },
286 { {"pentium_iii"}, CK_Pentium3, ~0U, FeaturesPentium3, 'H', true },
287 { {"pentium_iii_no_xmm_regs"}, CK_Pentium3, ~0U, FeaturesPentium3, 'H', true },
288 { {"pentium-m"}, CK_PentiumM, ~0U, FeaturesPentium4, '\0', false },
289 { {"pentium_m"}, CK_PentiumM, ~0U, FeaturesPentium4, 'K', true },
290 { {"c3-2"}, CK_C3_2, ~0U, FeaturesPentium3, '\0', false },
291 { {"yonah"}, CK_Yonah, ~0U, FeaturesPrescott, 'L', false },
292 // Netburst microarchitecture based processors.
293 { {"pentium4"}, CK_Pentium4, ~0U, FeaturesPentium4, 'J', false },
294 { {"pentium4m"}, CK_Pentium4, ~0U, FeaturesPentium4, 'J', false },
295 { {"pentium_4"}, CK_Pentium4, ~0U, FeaturesPentium4, 'J', true },
296 { {"pentium_4_sse3"}, CK_Prescott, ~0U, FeaturesPrescott, 'L', true },
297 { {"prescott"}, CK_Prescott, ~0U, FeaturesPrescott, 'L', false },
298 { {"nocona"}, CK_Nocona, ~0U, FeaturesNocona, 'L', false },
299 // Core microarchitecture based processors.
300 { {"core2"}, CK_Core2, FEATURE_SSSE3, FeaturesCore2, 'M', false },
301 { {"core_2_duo_ssse3"}, CK_Core2, ~0U, FeaturesCore2, 'M', true },
302 { {"penryn"}, CK_Penryn, ~0U, FeaturesPenryn, 'N', false },
303 { {"core_2_duo_sse4_1"}, CK_Penryn, ~0U, FeaturesPenryn, 'N', true },
304 // Atom processors
305 { {"bonnell"}, CK_Bonnell, FEATURE_SSSE3, FeaturesBonnell, 'O', false },
306 { {"atom"}, CK_Bonnell, FEATURE_SSSE3, FeaturesBonnell, 'O', false },
307 { {"silvermont"}, CK_Silvermont, FEATURE_SSE4_2, FeaturesSilvermont, 'c', false },
308 { {"slm"}, CK_Silvermont, FEATURE_SSE4_2, FeaturesSilvermont, 'c', false },
309 { {"atom_sse4_2"}, CK_Nehalem, FEATURE_SSE4_2, FeaturesNehalem, 'c', true },
310 { {"atom_sse4_2_movbe"}, CK_Goldmont, FEATURE_SSE4_2, FeaturesGoldmont, 'd', true },
311 { {"goldmont"}, CK_Goldmont, FEATURE_SSE4_2, FeaturesGoldmont, 'i', false },
312 { {"goldmont-plus"}, CK_GoldmontPlus, FEATURE_SSE4_2, FeaturesGoldmontPlus, '\0', false },
313 { {"goldmont_plus"}, CK_GoldmontPlus, FEATURE_SSE4_2, FeaturesGoldmontPlus, 'd', true },
314 { {"tremont"}, CK_Tremont, FEATURE_SSE4_2, FeaturesTremont, 'd', false },
315 // Nehalem microarchitecture based processors.
316 { {"nehalem"}, CK_Nehalem, FEATURE_SSE4_2, FeaturesNehalem, 'P', false },
317 { {"core_i7_sse4_2"}, CK_Nehalem, FEATURE_SSE4_2, FeaturesNehalem, 'P', true },
318 { {"corei7"}, CK_Nehalem, FEATURE_SSE4_2, FeaturesNehalem, 'P', false },
319 // Westmere microarchitecture based processors.
320 { {"westmere"}, CK_Westmere, FEATURE_PCLMUL, FeaturesWestmere, 'Q', false },
321 { {"core_aes_pclmulqdq"}, CK_Nehalem, FEATURE_SSE4_2, FeaturesNehalem, 'Q', true },
322 // Sandy Bridge microarchitecture based processors.
323 { {"sandybridge"}, CK_SandyBridge, FEATURE_AVX, FeaturesSandyBridge, 'R', false },
324 { {"core_2nd_gen_avx"}, CK_SandyBridge, FEATURE_AVX, FeaturesSandyBridge, 'R', true },
325 { {"corei7-avx"}, CK_SandyBridge, FEATURE_AVX, FeaturesSandyBridge, '\0', false },
326 // Ivy Bridge microarchitecture based processors.
327 { {"ivybridge"}, CK_IvyBridge, FEATURE_AVX, FeaturesIvyBridge, 'S', false },
328 { {"core_3rd_gen_avx"}, CK_IvyBridge, FEATURE_AVX, FeaturesIvyBridge, 'S', true },
329 { {"core-avx-i"}, CK_IvyBridge, FEATURE_AVX, FeaturesIvyBridge, '\0', false },
330 // Haswell microarchitecture based processors.
331 { {"haswell"}, CK_Haswell, FEATURE_AVX2, FeaturesHaswell, 'V', false },
332 { {"core-avx2"}, CK_Haswell, FEATURE_AVX2, FeaturesHaswell, '\0', false },
333 { {"core_4th_gen_avx"}, CK_Haswell, FEATURE_AVX2, FeaturesHaswell, 'V', true },
334 { {"core_4th_gen_avx_tsx"}, CK_Haswell, FEATURE_AVX2, FeaturesHaswell, 'W', true },
335 // Broadwell microarchitecture based processors.
336 { {"broadwell"}, CK_Broadwell, FEATURE_AVX2, FeaturesBroadwell, 'X', false },
337 { {"core_5th_gen_avx"}, CK_Broadwell, FEATURE_AVX2, FeaturesBroadwell, 'X', true },
338 { {"core_5th_gen_avx_tsx"}, CK_Broadwell, FEATURE_AVX2, FeaturesBroadwell, 'Y', true },
339 // Skylake client microarchitecture based processors.
340 { {"skylake"}, CK_SkylakeClient, FEATURE_AVX2, FeaturesSkylakeClient, 'b', false },
341 // Skylake server microarchitecture based processors.
342 { {"skylake-avx512"}, CK_SkylakeServer, FEATURE_AVX512F, FeaturesSkylakeServer, '\0', false },
343 { {"skx"}, CK_SkylakeServer, FEATURE_AVX512F, FeaturesSkylakeServer, 'a', false },
344 { {"skylake_avx512"}, CK_SkylakeServer, FEATURE_AVX512F, FeaturesSkylakeServer, 'a', true },
345 // Cascadelake Server microarchitecture based processors.
346 { {"cascadelake"}, CK_Cascadelake, FEATURE_AVX512VNNI, FeaturesCascadeLake, 'o', false },
347 // Cooperlake Server microarchitecture based processors.
348 { {"cooperlake"}, CK_Cooperlake, FEATURE_AVX512BF16, FeaturesCooperLake, 'f', false },
349 // Cannonlake client microarchitecture based processors.
350 { {"cannonlake"}, CK_Cannonlake, FEATURE_AVX512VBMI, FeaturesCannonlake, 'e', false },
351 // Icelake client microarchitecture based processors.
352 { {"icelake-client"}, CK_IcelakeClient, FEATURE_AVX512VBMI2, FeaturesICLClient, '\0', false },
353 { {"icelake_client"}, CK_IcelakeClient, FEATURE_AVX512VBMI2, FeaturesICLClient, 'k', true },
354 // Rocketlake microarchitecture based processors.
355 { {"rocketlake"}, CK_Rocketlake, FEATURE_AVX512VBMI2, FeaturesRocketlake, 'k', false },
356 // Icelake server microarchitecture based processors.
357 { {"icelake-server"}, CK_IcelakeServer, FEATURE_AVX512VBMI2, FeaturesICLServer, '\0', false },
358 { {"icelake_server"}, CK_IcelakeServer, FEATURE_AVX512VBMI2, FeaturesICLServer, 'k', true },
359 // Tigerlake microarchitecture based processors.
360 { {"tigerlake"}, CK_Tigerlake, FEATURE_AVX512VP2INTERSECT, FeaturesTigerlake, 'l', false },
361 // Sapphire Rapids microarchitecture based processors.
362 { {"sapphirerapids"}, CK_SapphireRapids, FEATURE_AVX512FP16, FeaturesSapphireRapids, 'n', false },
363 // Alderlake microarchitecture based processors.
364 { {"alderlake"}, CK_Alderlake, FEATURE_AVX2, FeaturesAlderlake, 'p', false },
365 // Raptorlake microarchitecture based processors.
366 { {"raptorlake"}, CK_Raptorlake, FEATURE_AVX2, FeaturesAlderlake, 'p', false },
367 // Meteorlake microarchitecture based processors.
368 { {"meteorlake"}, CK_Meteorlake, FEATURE_AVX2, FeaturesAlderlake, 'p', false },
369 // Arrowlake microarchitecture based processors.
370 { {"arrowlake"}, CK_Arrowlake, FEATURE_AVX2, FeaturesSierraforest, 'p', false },
371 { {"arrowlake-s"}, CK_ArrowlakeS, FEATURE_AVX2, FeaturesArrowlakeS, '\0', false },
372 { {"arrowlake_s"}, CK_ArrowlakeS, FEATURE_AVX2, FeaturesArrowlakeS, 'p', true },
373 // Lunarlake microarchitecture based processors.
374 { {"lunarlake"}, CK_Lunarlake, FEATURE_AVX2, FeaturesArrowlakeS, 'p', false },
375 // Gracemont microarchitecture based processors.
376 { {"gracemont"}, CK_Gracemont, FEATURE_AVX2, FeaturesAlderlake, 'p', false },
377 // Pantherlake microarchitecture based processors.
378 { {"pantherlake"}, CK_Lunarlake, FEATURE_AVX2, FeaturesPantherlake, 'p', false },
379 // Sierraforest microarchitecture based processors.
380 { {"sierraforest"}, CK_Sierraforest, FEATURE_AVX2, FeaturesSierraforest, 'p', false },
381 // Grandridge microarchitecture based processors.
382 { {"grandridge"}, CK_Grandridge, FEATURE_AVX2, FeaturesSierraforest, 'p', false },
383 // Granite Rapids microarchitecture based processors.
384 { {"graniterapids"}, CK_Graniterapids, FEATURE_AVX512FP16, FeaturesGraniteRapids, 'n', false },
385 // Granite Rapids D microarchitecture based processors.
386 { {"graniterapids-d"}, CK_GraniterapidsD, FEATURE_AVX512FP16, FeaturesGraniteRapids | FeatureAMX_COMPLEX, '\0', false },
387 { {"graniterapids_d"}, CK_GraniterapidsD, FEATURE_AVX512FP16, FeaturesGraniteRapids | FeatureAMX_COMPLEX, 'n', true },
388 // Emerald Rapids microarchitecture based processors.
389 { {"emeraldrapids"}, CK_Emeraldrapids, FEATURE_AVX512FP16, FeaturesSapphireRapids, 'n', false },
390 // Clearwaterforest microarchitecture based processors.
391 { {"clearwaterforest"}, CK_Lunarlake, FEATURE_AVX2, FeaturesClearwaterforest, 'p', false },
392 // Diamond Rapids microarchitecture based processors.
393 { {"diamondrapids"}, CK_Diamondrapids, FEATURE_AVX10_2_512, FeaturesDiamondRapids, 'z', false },
394 // Knights Landing processor.
395 { {"knl"}, CK_KNL, FEATURE_AVX512F, FeaturesKNL, 'Z', false },
396 { {"mic_avx512"}, CK_KNL, FEATURE_AVX512F, FeaturesKNL, 'Z', true },
397 // Knights Mill processor.
398 { {"knm"}, CK_KNM, FEATURE_AVX5124FMAPS, FeaturesKNM, 'j', false },
399 // Lakemont microarchitecture based processors.
400 { {"lakemont"}, CK_Lakemont, ~0U, FeatureCMPXCHG8B, '\0', false },
401 // K6 architecture processors.
402 { {"k6"}, CK_K6, ~0U, FeaturesK6, '\0', false },
403 { {"k6-2"}, CK_K6_2, ~0U, FeaturesK6 | FeaturePRFCHW, '\0', false },
404 { {"k6-3"}, CK_K6_3, ~0U, FeaturesK6 | FeaturePRFCHW, '\0', false },
405 // K7 architecture processors.
406 { {"athlon"}, CK_Athlon, ~0U, FeaturesAthlon, '\0', false },
407 { {"athlon-tbird"}, CK_Athlon, ~0U, FeaturesAthlon, '\0', false },
408 { {"athlon-xp"}, CK_AthlonXP, ~0U, FeaturesAthlonXP, '\0', false },
409 { {"athlon-mp"}, CK_AthlonXP, ~0U, FeaturesAthlonXP, '\0', false },
410 { {"athlon-4"}, CK_AthlonXP, ~0U, FeaturesAthlonXP, '\0', false },
411 // K8 architecture processors.
412 { {"k8"}, CK_K8, ~0U, FeaturesK8, '\0', false },
413 { {"athlon64"}, CK_K8, ~0U, FeaturesK8, '\0', false },
414 { {"athlon-fx"}, CK_K8, ~0U, FeaturesK8, '\0', false },
415 { {"opteron"}, CK_K8, ~0U, FeaturesK8, '\0', false },
416 { {"k8-sse3"}, CK_K8SSE3, ~0U, FeaturesK8SSE3, '\0', false },
417 { {"athlon64-sse3"}, CK_K8SSE3, ~0U, FeaturesK8SSE3, '\0', false },
418 { {"opteron-sse3"}, CK_K8SSE3, ~0U, FeaturesK8SSE3, '\0', false },
419 { {"amdfam10"}, CK_AMDFAM10, FEATURE_SSE4_A, FeaturesAMDFAM10, '\0', false },
420 { {"barcelona"}, CK_AMDFAM10, FEATURE_SSE4_A, FeaturesAMDFAM10, '\0', false },
421 // Bobcat architecture processors.
422 { {"btver1"}, CK_BTVER1, FEATURE_SSE4_A, FeaturesBTVER1, '\0', false },
423 { {"btver2"}, CK_BTVER2, FEATURE_BMI, FeaturesBTVER2, '\0', false },
424 // Bulldozer architecture processors.
425 { {"bdver1"}, CK_BDVER1, FEATURE_XOP, FeaturesBDVER1, '\0', false },
426 { {"bdver2"}, CK_BDVER2, FEATURE_FMA, FeaturesBDVER2, '\0', false },
427 { {"bdver3"}, CK_BDVER3, FEATURE_FMA, FeaturesBDVER3, '\0', false },
428 { {"bdver4"}, CK_BDVER4, FEATURE_AVX2, FeaturesBDVER4, '\0', false },
429 // Zen architecture processors.
430 { {"znver1"}, CK_ZNVER1, FEATURE_AVX2, FeaturesZNVER1, '\0', false },
431 { {"znver2"}, CK_ZNVER2, FEATURE_AVX2, FeaturesZNVER2, '\0', false },
432 { {"znver3"}, CK_ZNVER3, FEATURE_AVX2, FeaturesZNVER3, '\0', false },
433 { {"znver4"}, CK_ZNVER4, FEATURE_AVX512VBMI2, FeaturesZNVER4, '\0', false },
434 { {"znver5"}, CK_ZNVER5, FEATURE_AVX512VP2INTERSECT, FeaturesZNVER5, '\0', false },
435 // Generic 64-bit processor.
436 { {"x86-64"}, CK_x86_64, FEATURE_SSE2 , FeaturesX86_64, '\0', false },
437 { {"x86-64-v2"}, CK_x86_64_v2, FEATURE_SSE4_2 , FeaturesX86_64_V2, '\0', false },
438 { {"x86-64-v3"}, CK_x86_64_v3, FEATURE_AVX2, FeaturesX86_64_V3, '\0', false },
439 { {"x86-64-v4"}, CK_x86_64_v4, FEATURE_AVX512VL, FeaturesX86_64_V4, '\0', false },
440 // Geode processors.
441 { {"geode"}, CK_Geode, ~0U, FeaturesGeode, '\0', false },
442};
443// clang-format on
444
445constexpr const char *NoTuneList[] = {"x86-64-v2", "x86-64-v3", "x86-64-v4"};
446
448 for (const auto &P : Processors)
449 if (!P.OnlyForCPUDispatchSpecific && P.Name == CPU &&
450 (P.Features[FEATURE_64BIT] || !Only64Bit))
451 return P.Kind;
452
453 return CK_None;
454}
455
458 return CK_None;
459 return parseArchX86(CPU, Only64Bit);
460}
461
463 bool Only64Bit) {
464 for (const auto &P : Processors)
465 if (!P.OnlyForCPUDispatchSpecific && !P.Name.empty() &&
466 (P.Features[FEATURE_64BIT] || !Only64Bit))
467 Values.emplace_back(P.Name);
468}
469
471 bool Only64Bit) {
472 for (const ProcInfo &P : Processors)
473 if (!P.OnlyForCPUDispatchSpecific && !P.Name.empty() &&
474 (P.Features[FEATURE_64BIT] || !Only64Bit) &&
476 Values.emplace_back(P.Name);
477}
478
480 // FIXME: Can we avoid a linear search here? The table might be sorted by
481 // CPUKind so we could binary search?
482 for (const auto &P : Processors) {
483 if (P.Kind == Kind) {
484 assert(P.KeyFeature != ~0U && "Processor does not have a key feature.");
485 return static_cast<ProcessorFeatures>(P.KeyFeature);
486 }
487 }
488
489 llvm_unreachable("Unable to find CPU kind!");
490}
491
492// Features with no dependencies.
541
542// Not really CPU features, but need to be in the table because clang uses
543// target features to communicate them to the backend.
549
550// XSAVE features are dependent on basic XSAVE.
551constexpr FeatureBitset ImpliedFeaturesXSAVEC = FeatureXSAVE;
552constexpr FeatureBitset ImpliedFeaturesXSAVEOPT = FeatureXSAVE;
553constexpr FeatureBitset ImpliedFeaturesXSAVES = FeatureXSAVE;
554
555// SSE/AVX/AVX512F chain.
557constexpr FeatureBitset ImpliedFeaturesSSE2 = FeatureSSE;
558constexpr FeatureBitset ImpliedFeaturesSSE3 = FeatureSSE2;
559constexpr FeatureBitset ImpliedFeaturesSSSE3 = FeatureSSE3;
560constexpr FeatureBitset ImpliedFeaturesSSE4_1 = FeatureSSSE3;
561constexpr FeatureBitset ImpliedFeaturesSSE4_2 = FeatureSSE4_1;
562constexpr FeatureBitset ImpliedFeaturesAVX = FeatureSSE4_2;
563constexpr FeatureBitset ImpliedFeaturesAVX2 = FeatureAVX;
566 FeatureAVX2 | FeatureF16C | FeatureFMA;
567
568// Vector extensions that build on SSE or AVX.
569constexpr FeatureBitset ImpliedFeaturesAES = FeatureSSE2;
570constexpr FeatureBitset ImpliedFeaturesF16C = FeatureAVX;
571constexpr FeatureBitset ImpliedFeaturesFMA = FeatureAVX;
572constexpr FeatureBitset ImpliedFeaturesGFNI = FeatureSSE2;
573constexpr FeatureBitset ImpliedFeaturesPCLMUL = FeatureSSE2;
574constexpr FeatureBitset ImpliedFeaturesSHA = FeatureSSE2;
575constexpr FeatureBitset ImpliedFeaturesVAES = FeatureAES | FeatureAVX2;
576constexpr FeatureBitset ImpliedFeaturesVPCLMULQDQ = FeatureAVX | FeaturePCLMUL;
577constexpr FeatureBitset ImpliedFeaturesSM3 = FeatureAVX;
578constexpr FeatureBitset ImpliedFeaturesSM4 = FeatureAVX2;
579
580// AVX512 features.
581constexpr FeatureBitset ImpliedFeaturesAVX512CD = FeatureAVX512F;
582constexpr FeatureBitset ImpliedFeaturesAVX512BW = FeatureAVX512F;
583constexpr FeatureBitset ImpliedFeaturesAVX512DQ = FeatureAVX512F;
584constexpr FeatureBitset ImpliedFeaturesAVX512VL = FeatureAVX512F;
585
586constexpr FeatureBitset ImpliedFeaturesAVX512BF16 = FeatureAVX512BW;
587constexpr FeatureBitset ImpliedFeaturesAVX512BITALG = FeatureAVX512BW;
588constexpr FeatureBitset ImpliedFeaturesAVX512IFMA = FeatureAVX512F;
589constexpr FeatureBitset ImpliedFeaturesAVX512VNNI = FeatureAVX512F;
591constexpr FeatureBitset ImpliedFeaturesAVX512VBMI = FeatureAVX512BW;
592constexpr FeatureBitset ImpliedFeaturesAVX512VBMI2 = FeatureAVX512BW;
594
595// FIXME: These two aren't really implemented and just exist in the feature
596// list for __builtin_cpu_supports. So omit their dependencies.
599
600// SSE4_A->FMA4->XOP chain.
601constexpr FeatureBitset ImpliedFeaturesSSE4_A = FeatureSSE3;
602constexpr FeatureBitset ImpliedFeaturesFMA4 = FeatureAVX | FeatureSSE4_A;
603constexpr FeatureBitset ImpliedFeaturesXOP = FeatureFMA4;
604
605// AMX Features
607constexpr FeatureBitset ImpliedFeaturesAMX_BF16 = FeatureAMX_TILE;
608constexpr FeatureBitset ImpliedFeaturesAMX_FP16 = FeatureAMX_TILE;
609constexpr FeatureBitset ImpliedFeaturesAMX_INT8 = FeatureAMX_TILE;
610constexpr FeatureBitset ImpliedFeaturesAMX_COMPLEX = FeatureAMX_TILE;
611constexpr FeatureBitset ImpliedFeaturesAMX_FP8 = FeatureAMX_TILE;
612constexpr FeatureBitset ImpliedFeaturesAMX_TRANSPOSE = FeatureAMX_TILE;
613constexpr FeatureBitset ImpliedFeaturesAMX_MOVRS = FeatureAMX_TILE;
615 FeatureAMX_TILE | FeatureAVX10_2_512;
616constexpr FeatureBitset ImpliedFeaturesAMX_TF32 = FeatureAMX_TILE;
618
624constexpr FeatureBitset ImpliedFeaturesAVXIFMA = FeatureAVX2;
626constexpr FeatureBitset ImpliedFeaturesSHA512 = FeatureAVX2;
628 FeatureAVX512BW | FeatureAVX512DQ | FeatureAVX512VL;
629// Key Locker Features
630constexpr FeatureBitset ImpliedFeaturesKL = FeatureSSE2;
632
633// AVXVNNI Features
634constexpr FeatureBitset ImpliedFeaturesAVXVNNI = FeatureAVX2;
635
636// AVX10 Features
638 FeatureAVX512CD | FeatureAVX512VBMI | FeatureAVX512IFMA |
639 FeatureAVX512VNNI | FeatureAVX512BF16 | FeatureAVX512VPOPCNTDQ |
640 FeatureAVX512VBMI2 | FeatureAVX512BITALG | FeatureVAES | FeatureVPCLMULQDQ |
641 FeatureAVX512FP16;
643 FeatureAVX10_1 | FeatureEVEX512;
644constexpr FeatureBitset ImpliedFeaturesAVX10_2 = FeatureAVX10_1;
646 FeatureAVX10_2 | FeatureAVX10_1_512;
647
648// APX Features
657
659
660constexpr FeatureInfo FeatureInfos[X86::CPU_FEATURE_MAX] = {
661#define X86_FEATURE(ENUM, STR) {{"+" STR}, ImpliedFeatures##ENUM},
662#include "llvm/TargetParser/X86TargetParser.def"
663};
664
666 SmallVectorImpl<StringRef> &EnabledFeatures,
667 bool NeedPlus) {
669 [&](const ProcInfo &P) { return P.Name == CPU; });
670 assert(I != std::end(Processors) && "Processor not found!");
671
672 FeatureBitset Bits = I->Features;
673
674 // Remove the 64-bit feature which we only use to validate if a CPU can
675 // be used with 64-bit mode.
676 Bits &= ~Feature64BIT;
677
678 // Add the string version of all set bits.
679 for (unsigned i = 0; i != CPU_FEATURE_MAX; ++i)
680 if (Bits[i] && !FeatureInfos[i].getName(NeedPlus).empty())
681 EnabledFeatures.push_back(FeatureInfos[i].getName(NeedPlus));
682}
683
684// For each feature that is (transitively) implied by this feature, set it.
686 const FeatureBitset &Implies) {
687 // Fast path: Implies is often empty.
688 if (!Implies.any())
689 return;
690 FeatureBitset Prev;
691 Bits |= Implies;
692 do {
693 Prev = Bits;
694 for (unsigned i = CPU_FEATURE_MAX; i;)
695 if (Bits[--i])
696 Bits |= FeatureInfos[i].ImpliedFeatures;
697 } while (Prev != Bits);
698}
699
700/// Create bit vector of features that are implied disabled if the feature
701/// passed in Value is disabled.
702static void getImpliedDisabledFeatures(FeatureBitset &Bits, unsigned Value) {
703 // Check all features looking for any dependent on this feature. If we find
704 // one, mark it and recursively find any feature that depend on it.
705 FeatureBitset Prev;
706 Bits.set(Value);
707 do {
708 Prev = Bits;
709 for (unsigned i = 0; i != CPU_FEATURE_MAX; ++i)
710 if ((FeatureInfos[i].ImpliedFeatures & Bits).any())
711 Bits.set(i);
712 } while (Prev != Bits);
713}
714
716 StringRef Feature, bool Enabled,
717 StringMap<bool> &Features) {
718 auto I = llvm::find_if(FeatureInfos, [&](const FeatureInfo &FI) {
719 return FI.getName() == Feature;
720 });
721 if (I == std::end(FeatureInfos)) {
722 // FIXME: This shouldn't happen, but may not have all features in the table
723 // yet.
724 return;
725 }
726
727 FeatureBitset ImpliedBits;
728 if (Enabled)
729 getImpliedEnabledFeatures(ImpliedBits, I->ImpliedFeatures);
730 else
731 getImpliedDisabledFeatures(ImpliedBits,
732 std::distance(std::begin(FeatureInfos), I));
733
734 // Update the map entry for all implied features.
735 for (unsigned i = 0; i != CPU_FEATURE_MAX; ++i)
736 if (ImpliedBits[i] && !FeatureInfos[i].getName().empty())
737 Features[FeatureInfos[i].getName()] = Enabled;
738}
739
742 [&](const ProcInfo &P) { return P.Name == CPU; });
743 assert(I != std::end(Processors) && "Processor not found!");
744 assert(I->Mangling != '\0' && "Processor dooesn't support function multiversion!");
745 return I->Mangling;
746}
747
750 [&](const ProcInfo &P) { return P.Name == Name; });
751 return I != std::end(Processors);
752}
753
754std::array<uint32_t, 4>
756 // Processor features and mapping to processor feature value.
757 std::array<uint32_t, 4> FeatureMask{};
758 for (StringRef FeatureStr : FeatureStrs) {
759 unsigned Feature = StringSwitch<unsigned>(FeatureStr)
760#define X86_FEATURE_COMPAT(ENUM, STR, PRIORITY) \
761 .Case(STR, llvm::X86::FEATURE_##ENUM)
762#define X86_MICROARCH_LEVEL(ENUM, STR, PRIORITY) \
763 .Case(STR, llvm::X86::FEATURE_##ENUM)
764#include "llvm/TargetParser/X86TargetParser.def"
765 ;
766 assert(Feature / 32 < FeatureMask.size());
767 FeatureMask[Feature / 32] |= 1U << (Feature % 32);
768 }
769 return FeatureMask;
770}
771
773#ifndef NDEBUG
774 // Check that priorities are set properly in the .def file. We expect that
775 // "compat" features are assigned non-duplicate consecutive priorities
776 // starting from one (1, ..., 37) and multiple zeros.
777#define X86_FEATURE_COMPAT(ENUM, STR, PRIORITY) PRIORITY,
778 unsigned Priorities[] = {
779#include "llvm/TargetParser/X86TargetParser.def"
780 };
781 std::array<unsigned, std::size(Priorities)> HelperList;
782 const size_t MaxPriority = 37;
783 std::iota(HelperList.begin(), HelperList.begin() + MaxPriority + 1, 0);
784 for (size_t i = MaxPriority + 1; i != std::size(Priorities); ++i)
785 HelperList[i] = 0;
786 assert(std::is_permutation(HelperList.begin(), HelperList.end(),
787 std::begin(Priorities), std::end(Priorities)) &&
788 "Priorities don't form consecutive range!");
789#endif
790
791 switch (Feat) {
792#define X86_FEATURE_COMPAT(ENUM, STR, PRIORITY) \
793 case X86::FEATURE_##ENUM: \
794 return PRIORITY;
795#include "llvm/TargetParser/X86TargetParser.def"
796 default:
797 llvm_unreachable("No Feature Priority for non-CPUSupports Features");
798 }
799}
std::string Name
#define I(x, y, z)
Definition: MD5.cpp:58
#define P(N)
static StringRef getName(Value *V)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static bool Enabled
Definition: Statistic.cpp:46
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
constexpr FeatureBitset FeaturesClearwaterforest
constexpr FeatureBitset FeaturesX86_64
constexpr FeatureBitset ImpliedFeaturesLVI_LOAD_HARDENING
constexpr FeatureBitset FeaturesWestmere
constexpr FeatureBitset ImpliedFeaturesNDD
constexpr FeatureBitset ImpliedFeaturesXSAVEOPT
constexpr FeatureBitset FeaturesAthlon
constexpr FeatureBitset ImpliedFeaturesAMX_COMPLEX
constexpr FeatureBitset ImpliedFeaturesAVX5124VNNIW
constexpr FeatureBitset ImpliedFeaturesPOPCNT
constexpr FeatureBitset ImpliedFeaturesAVX512CD
constexpr FeatureBitset ImpliedFeaturesSSE4_1
constexpr FeatureBitset FeaturesZNVER2
constexpr FeatureBitset FeaturesBDVER3
constexpr FeatureBitset ImpliedFeaturesBMI2
constexpr FeatureBitset FeaturesGeode
constexpr FeatureBitset ImpliedFeaturesLWP
constexpr FeatureBitset ImpliedFeaturesPREFETCHI
constexpr FeatureBitset ImpliedFeaturesAVX512FP16
constexpr FeatureBitset FeaturesCascadeLake
constexpr FeatureBitset ImpliedFeaturesCLDEMOTE
constexpr FeatureBitset FeaturesK8SSE3
constexpr FeatureBitset FeaturesZNVER1
constexpr FeatureBitset FeaturesNocona
constexpr FeatureBitset ImpliedFeaturesEVEX512
constexpr FeatureBitset ImpliedFeaturesSSE4_A
constexpr FeatureBitset FeaturesPrescott
constexpr FeatureBitset FeaturesCooperLake
constexpr FeatureBitset ImpliedFeaturesEGPR
constexpr FeatureBitset ImpliedFeaturesFXSR
constexpr FeatureBitset FeaturesSapphireRapids
constexpr FeatureBitset ImpliedFeaturesAVX512DQ
constexpr FeatureBitset ImpliedFeaturesSERIALIZE
constexpr FeatureBitset ImpliedFeaturesVPCLMULQDQ
constexpr FeatureBitset ImpliedFeaturesWBNOINVD
constexpr FeatureBitset ImpliedFeaturesAES
constexpr FeatureBitset FeaturesTremont
constexpr FeatureBitset ImpliedFeaturesPush2Pop2
constexpr FeatureBitset FeaturesBDVER1
constexpr FeatureBitset ImpliedFeaturesWAITPKG
constexpr FeatureBitset ImpliedFeaturesCRC32
static constexpr FeatureBitset FeaturesZNVER3
constexpr FeatureBitset FeaturesGoldmontPlus
constexpr FeatureBitset ImpliedFeaturesRDPID
constexpr FeatureBitset ImpliedFeaturesPRFCHW
constexpr FeatureBitset FeaturesCannonlake
constexpr FeatureBitset ImpliedFeaturesX87
constexpr FeatureBitset ImpliedFeaturesAVX512VPOPCNTDQ
constexpr FeatureBitset ImpliedFeaturesVAES
constexpr FeatureBitset FeaturesSandyBridge
constexpr FeatureBitset ImpliedFeaturesAMX_INT8
constexpr FeatureBitset ImpliedFeaturesAVX512BF16
constexpr FeatureBitset ImpliedFeaturesRDPRU
constexpr FeatureBitset FeaturesAMDFAM10
constexpr FeatureBitset ImpliedFeaturesAMX_TILE
constexpr FeatureBitset FeaturesSkylakeServer
constexpr FeatureBitset FeaturesPentiumMMX
constexpr FeatureBitset ImpliedFeaturesCLWB
constexpr FeatureBitset ImpliedFeaturesAVX512IFMA
constexpr FeatureBitset FeaturesKNL
constexpr FeatureBitset FeaturesNehalem
constexpr FeatureBitset FeaturesBTVER1
constexpr FeatureBitset FeaturesPentium3
constexpr FeatureBitset ImpliedFeaturesTBM
constexpr FeatureBitset ImpliedFeaturesAVXNECONVERT
constexpr FeatureBitset FeaturesAthlonXP
constexpr FeatureBitset FeaturesGraniteRapids
constexpr FeatureBitset ImpliedFeaturesFSGSBASE
constexpr FeatureBitset FeaturesPantherlake
constexpr FeatureBitset ImpliedFeaturesPCONFIG
constexpr FeatureBitset ImpliedFeaturesAVX
constexpr FeatureBitset FeaturesX86_64_V3
constexpr FeatureBitset ImpliedFeaturesRETPOLINE_INDIRECT_BRANCHES
constexpr FeatureBitset ImpliedFeaturesAVX512VBMI2
constexpr FeatureBitset ImpliedFeaturesCMPCCXADD
constexpr FeatureBitset ImpliedFeaturesCLFLUSHOPT
constexpr FeatureBitset ImpliedFeaturesAVX5124FMAPS
constexpr FeatureBitset FeaturesDiamondRapids
constexpr FeatureBitset ImpliedFeaturesF16C
constexpr FeatureBitset ImpliedFeaturesAVX10_2
constexpr FeatureBitset ImpliedFeaturesXSAVE
constexpr FeatureBitset FeaturesX86_64_V2
constexpr FeatureBitset FeaturesArrowlakeS
constexpr FeatureBitset ImpliedFeaturesMOVBE
constexpr FeatureBitset FeaturesIvyBridge
constexpr FeatureBitset FeaturesHaswell
static constexpr FeatureBitset FeaturesZNVER5
constexpr FeatureBitset ImpliedFeaturesRETPOLINE_INDIRECT_CALLS
constexpr FeatureBitset ImpliedFeaturesSSSE3
constexpr FeatureBitset ImpliedFeaturesAVXVNNIINT8
constexpr FeatureBitset ImpliedFeaturesCCMP
constexpr FeatureBitset FeaturesICLClient
constexpr FeatureBitset ImpliedFeaturesCF
static void getImpliedDisabledFeatures(FeatureBitset &Bits, unsigned Value)
Create bit vector of features that are implied disabled if the feature passed in Value is disabled.
constexpr FeatureBitset ImpliedFeaturesHRESET
constexpr const char * NoTuneList[]
constexpr FeatureBitset ImpliedFeaturesUINTR
constexpr FeatureBitset ImpliedFeaturesCMOV
constexpr FeatureBitset ImpliedFeaturesAVX512BITALG
constexpr FeatureBitset ImpliedFeaturesRTM
constexpr FeatureBitset FeaturesRocketlake
constexpr FeatureBitset ImpliedFeaturesMOVDIRI
constexpr FeatureBitset ImpliedFeaturesMWAITX
constexpr FeatureBitset ImpliedFeaturesSSE3
constexpr FeatureBitset ImpliedFeaturesVZEROUPPER
constexpr FeatureBitset FeaturesBTVER2
constexpr FeatureBitset FeaturesSkylakeClient
constexpr FeatureBitset ImpliedFeaturesPPX
static void getImpliedEnabledFeatures(FeatureBitset &Bits, const FeatureBitset &Implies)
constexpr FeatureBitset FeaturesPentium2
constexpr FeatureBitset ImpliedFeaturesSHSTK
constexpr FeatureBitset ImpliedFeaturesDUMMYFEATURE2
constexpr FeatureBitset ImpliedFeaturesAMX_FP16
constexpr FeatureBitset ImpliedFeaturesMMX
constexpr FeatureBitset FeaturesICLServer
constexpr FeatureBitset ImpliedFeaturesRETPOLINE_EXTERNAL_THUNK
constexpr FeatureBitset ImpliedFeaturesAMX_BF16
constexpr FeatureBitset FeaturesBroadwell
constexpr ProcInfo Processors[]
constexpr FeatureBitset ImpliedFeaturesAMX_AVX512
constexpr FeatureBitset ImpliedFeaturesCLZERO
constexpr FeatureBitset ImpliedFeaturesAVXVNNIINT16
constexpr FeatureBitset ImpliedFeaturesMOVRS
constexpr FeatureBitset ImpliedFeaturesFMA4
constexpr FeatureBitset ImpliedFeaturesFMA
constexpr FeatureBitset FeaturesSierraforest
constexpr FeatureBitset FeaturesK6
constexpr FeatureBitset ImpliedFeaturesRAOINT
constexpr FeatureBitset FeaturesX86_64_V4
constexpr FeatureBitset ImpliedFeaturesLVI_CFI
constexpr FeatureBitset ImpliedFeaturesCMPXCHG16B
constexpr FeatureBitset ImpliedFeaturesSSE2
constexpr FeatureBitset FeaturesBonnell
constexpr FeatureBitset FeaturesPenryn
constexpr FeatureBitset ImpliedFeaturesKL
constexpr FeatureBitset ImpliedFeaturesBMI
constexpr FeatureBitset ImpliedFeaturesGFNI
constexpr FeatureBitset ImpliedFeaturesAVX10_2_512
constexpr FeatureBitset ImpliedFeatures64BIT
constexpr FeatureBitset FeaturesK8
constexpr FeatureBitset ImpliedFeaturesAVX512VP2INTERSECT
constexpr FeatureBitset ImpliedFeaturesSM4
constexpr FeatureBitset ImpliedFeaturesENQCMD
constexpr FeatureBitset ImpliedFeaturesAVXVNNI
constexpr FeatureBitset ImpliedFeaturesPKU
constexpr FeatureBitset ImpliedFeaturesTSXLDTRK
constexpr FeatureBitset ImpliedFeaturesPTWRITE
constexpr FeatureBitset FeaturesPentium4
constexpr FeatureBitset ImpliedFeaturesXSAVES
constexpr FeatureBitset ImpliedFeaturesAVX512VNNI
constexpr FeatureBitset ImpliedFeaturesAVX512BW
constexpr FeatureBitset ImpliedFeaturesSGX
constexpr FeatureBitset ImpliedFeaturesSSE4_2
constexpr FeatureBitset ImpliedFeaturesAVX512VBMI
constexpr FeatureBitset FeaturesAlderlake
constexpr FeatureBitset ImpliedFeaturesSHA512
constexpr FeatureBitset ImpliedFeaturesAMX_MOVRS
constexpr FeatureBitset ImpliedFeaturesAVXIFMA
constexpr FeatureBitset ImpliedFeaturesAMX_TF32
constexpr FeatureBitset ImpliedFeaturesPCLMUL
constexpr FeatureBitset ImpliedFeaturesXSAVEC
constexpr FeatureBitset FeaturesBDVER2
constexpr FeatureBitset ImpliedFeaturesAMX_TRANSPOSE
constexpr FeatureBitset ImpliedFeaturesSSE
constexpr FeatureBitset ImpliedFeaturesNF
constexpr FeatureBitset FeaturesKNM
constexpr FeatureBitset ImpliedFeaturesSAHF
constexpr FeatureBitset ImpliedFeaturesLZCNT
constexpr FeatureBitset ImpliedFeaturesAVX10_1_512
constexpr FeatureBitset ImpliedFeaturesMOVDIR64B
constexpr FeatureBitset ImpliedFeaturesCMPXCHG8B
constexpr FeatureBitset FeaturesGoldmont
constexpr FeatureBitset ImpliedFeaturesAVX2
constexpr FeatureBitset FeaturesBDVER4
constexpr FeatureBitset ImpliedFeaturesAVX512VL
constexpr FeatureBitset FeaturesSilvermont
constexpr FeatureBitset ImpliedFeaturesAMX_FP8
constexpr FeatureBitset FeaturesCore2
constexpr FeatureBitset ImpliedFeaturesXOP
constexpr FeatureBitset ImpliedFeaturesINVPCID
constexpr FeatureBitset ImpliedFeaturesRDSEED
constexpr FeatureInfo FeatureInfos[X86::CPU_FEATURE_MAX]
constexpr FeatureBitset ImpliedFeaturesAVX512F
constexpr FeatureBitset ImpliedFeaturesSM3
constexpr FeatureBitset ImpliedFeaturesWIDEKL
constexpr FeatureBitset ImpliedFeaturesADX
static constexpr FeatureBitset FeaturesZNVER4
constexpr FeatureBitset ImpliedFeaturesSHA
constexpr FeatureBitset ImpliedFeaturesDUMMYFEATURE1
constexpr FeatureBitset ImpliedFeaturesUSERMSR
constexpr FeatureBitset FeaturesTigerlake
constexpr FeatureBitset ImpliedFeaturesAVX10_1
constexpr FeatureBitset ImpliedFeaturesRDRND
constexpr FeatureBitset ImpliedFeaturesZU
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
This is a constexpr reimplementation of a subset of std::bitset.
Definition: Bitset.h:30
Container class for subtarget features.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: SmallVector.h:573
reference emplace_back(ArgTypes &&... Args)
Definition: SmallVector.h:937
void push_back(const T &Elt)
Definition: SmallVector.h:413
A wrapper around a string literal that serves as a proxy for constructing global tables of StringRefs...
Definition: StringRef.h:853
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition: StringMap.h:128
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:51
StringRef drop_front(size_t N=1) const
Return a StringRef equal to 'this' but with the first N elements dropped.
Definition: StringRef.h:609
A switch()-like statement whose cases are string literals.
Definition: StringSwitch.h:44
LLVM Value Representation.
Definition: Value.h:74
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Define some predicates that are used for node matching.
std::array< uint32_t, 4 > getCpuSupportsMask(ArrayRef< StringRef > FeatureStrs)
char getCPUDispatchMangling(StringRef Name)
CPUKind parseTuneCPU(StringRef CPU, bool Only64Bit=false)
void updateImpliedFeatures(StringRef Feature, bool Enabled, StringMap< bool > &Features)
Set or clear entries in Features that are implied to be enabled/disabled by the provided Feature.
CPUKind parseArchX86(StringRef CPU, bool Only64Bit=false)
Parse CPU string into a CPUKind.
void fillValidTuneCPUList(SmallVectorImpl< StringRef > &Values, bool Only64Bit=false)
Provide a list of valid -mtune names.
void getFeaturesForCPU(StringRef CPU, SmallVectorImpl< StringRef > &Features, bool NeedPlus=false)
Fill in the features that CPU supports into Features.
unsigned getFeaturePriority(ProcessorFeatures Feat)
void fillValidCPUArchList(SmallVectorImpl< StringRef > &Values, bool Only64Bit=false)
Provide a list of valid CPU names.
bool validateCPUSpecificCPUDispatch(StringRef Name)
ProcessorFeatures getKeyFeature(CPUKind Kind)
Get the key feature prioritizing target multiversioning.
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
auto find_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1766
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
Definition: STLExtras.h:1903