2020-06-09 21:18:08 +02:00
|
|
|
//===-- X86TargetParser - Parser for X86 features ---------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file implements a target parser to recognise X86 hardware features.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2021-02-06 06:02:06 +01:00
|
|
|
#ifndef LLVM_SUPPORT_X86TARGETPARSER_H
|
|
|
|
#define LLVM_SUPPORT_X86TARGETPARSER_H
|
2020-06-09 21:18:08 +02:00
|
|
|
|
|
|
|
#include "llvm/ADT/SmallVector.h"
|
2020-08-06 09:13:40 +02:00
|
|
|
#include "llvm/ADT/StringMap.h"
|
2020-06-09 21:18:08 +02:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
class StringRef;
|
|
|
|
|
|
|
|
namespace X86 {
|
|
|
|
|
2020-06-11 06:25:15 +02:00
|
|
|
// This should be kept in sync with libcc/compiler-rt as its included by clang
|
|
|
|
// as a proxy for what's in libgcc/compiler-rt.
|
|
|
|
enum ProcessorVendors : unsigned {
|
|
|
|
VENDOR_DUMMY,
|
|
|
|
#define X86_VENDOR(ENUM, STRING) \
|
|
|
|
ENUM,
|
|
|
|
#include "llvm/Support/X86TargetParser.def"
|
|
|
|
VENDOR_OTHER
|
|
|
|
};
|
|
|
|
|
|
|
|
// This should be kept in sync with libcc/compiler-rt as its included by clang
|
|
|
|
// as a proxy for what's in libgcc/compiler-rt.
|
|
|
|
enum ProcessorTypes : unsigned {
|
|
|
|
CPU_TYPE_DUMMY,
|
2020-07-13 01:58:27 +02:00
|
|
|
#define X86_CPU_TYPE(ENUM, STRING) \
|
2020-06-11 06:25:15 +02:00
|
|
|
ENUM,
|
|
|
|
#include "llvm/Support/X86TargetParser.def"
|
|
|
|
CPU_TYPE_MAX
|
|
|
|
};
|
|
|
|
|
|
|
|
// This should be kept in sync with libcc/compiler-rt as its included by clang
|
|
|
|
// as a proxy for what's in libgcc/compiler-rt.
|
|
|
|
enum ProcessorSubtypes : unsigned {
|
|
|
|
CPU_SUBTYPE_DUMMY,
|
2020-07-13 01:58:27 +02:00
|
|
|
#define X86_CPU_SUBTYPE(ENUM, STRING) \
|
2020-06-11 06:25:15 +02:00
|
|
|
ENUM,
|
|
|
|
#include "llvm/Support/X86TargetParser.def"
|
|
|
|
CPU_SUBTYPE_MAX
|
|
|
|
};
|
|
|
|
|
|
|
|
// This should be kept in sync with libcc/compiler-rt as it should be used
|
|
|
|
// by clang as a proxy for what's in libgcc/compiler-rt.
|
|
|
|
enum ProcessorFeatures {
|
2020-06-30 20:59:03 +02:00
|
|
|
#define X86_FEATURE(ENUM, STRING) FEATURE_##ENUM,
|
2020-06-11 06:25:15 +02:00
|
|
|
#include "llvm/Support/X86TargetParser.def"
|
2020-06-22 22:29:43 +02:00
|
|
|
CPU_FEATURE_MAX
|
2020-06-11 06:25:15 +02:00
|
|
|
};
|
|
|
|
|
2020-06-09 21:18:08 +02:00
|
|
|
enum CPUKind {
|
|
|
|
CK_None,
|
2020-06-24 19:36:02 +02:00
|
|
|
CK_i386,
|
|
|
|
CK_i486,
|
|
|
|
CK_WinChipC6,
|
|
|
|
CK_WinChip2,
|
|
|
|
CK_C3,
|
|
|
|
CK_i586,
|
|
|
|
CK_Pentium,
|
|
|
|
CK_PentiumMMX,
|
|
|
|
CK_PentiumPro,
|
|
|
|
CK_i686,
|
|
|
|
CK_Pentium2,
|
|
|
|
CK_Pentium3,
|
|
|
|
CK_PentiumM,
|
|
|
|
CK_C3_2,
|
|
|
|
CK_Yonah,
|
|
|
|
CK_Pentium4,
|
|
|
|
CK_Prescott,
|
|
|
|
CK_Nocona,
|
|
|
|
CK_Core2,
|
|
|
|
CK_Penryn,
|
|
|
|
CK_Bonnell,
|
|
|
|
CK_Silvermont,
|
|
|
|
CK_Goldmont,
|
|
|
|
CK_GoldmontPlus,
|
|
|
|
CK_Tremont,
|
|
|
|
CK_Nehalem,
|
|
|
|
CK_Westmere,
|
|
|
|
CK_SandyBridge,
|
|
|
|
CK_IvyBridge,
|
|
|
|
CK_Haswell,
|
|
|
|
CK_Broadwell,
|
|
|
|
CK_SkylakeClient,
|
|
|
|
CK_SkylakeServer,
|
|
|
|
CK_Cascadelake,
|
|
|
|
CK_Cooperlake,
|
|
|
|
CK_Cannonlake,
|
|
|
|
CK_IcelakeClient,
|
2021-04-13 03:24:34 +02:00
|
|
|
CK_Rocketlake,
|
2020-06-24 19:36:02 +02:00
|
|
|
CK_IcelakeServer,
|
|
|
|
CK_Tigerlake,
|
[X86] Support -march=sapphirerapids
Support -march=sapphirerapids for x86.
Compare with Icelake Server, it includes 14 more new features. They are
amxtile, amxint8, amxbf16, avx512bf16, avx512vp2intersect, cldemote,
enqcmd, movdir64b, movdiri, ptwrite, serialize, shstk, tsxldtrk, waitpkg.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D86503
2020-08-25 06:27:02 +02:00
|
|
|
CK_SapphireRapids,
|
2020-10-24 18:00:33 +02:00
|
|
|
CK_Alderlake,
|
2020-06-24 19:36:02 +02:00
|
|
|
CK_KNL,
|
|
|
|
CK_KNM,
|
|
|
|
CK_Lakemont,
|
|
|
|
CK_K6,
|
|
|
|
CK_K6_2,
|
|
|
|
CK_K6_3,
|
|
|
|
CK_Athlon,
|
|
|
|
CK_AthlonXP,
|
|
|
|
CK_K8,
|
|
|
|
CK_K8SSE3,
|
|
|
|
CK_AMDFAM10,
|
|
|
|
CK_BTVER1,
|
|
|
|
CK_BTVER2,
|
|
|
|
CK_BDVER1,
|
|
|
|
CK_BDVER2,
|
|
|
|
CK_BDVER3,
|
|
|
|
CK_BDVER4,
|
|
|
|
CK_ZNVER1,
|
|
|
|
CK_ZNVER2,
|
2020-10-24 18:00:20 +02:00
|
|
|
CK_ZNVER3,
|
2020-06-24 19:36:02 +02:00
|
|
|
CK_x86_64,
|
2020-10-12 18:35:22 +02:00
|
|
|
CK_x86_64_v2,
|
|
|
|
CK_x86_64_v3,
|
|
|
|
CK_x86_64_v4,
|
2020-06-24 19:36:02 +02:00
|
|
|
CK_Geode,
|
2020-06-09 21:18:08 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/// Parse \p CPU string into a CPUKind. Will only accept 64-bit capable CPUs if
|
|
|
|
/// \p Only64Bit is true.
|
|
|
|
CPUKind parseArchX86(StringRef CPU, bool Only64Bit = false);
|
2020-10-12 18:35:22 +02:00
|
|
|
CPUKind parseTuneCPU(StringRef CPU, bool Only64Bit = false);
|
2020-06-09 21:18:08 +02:00
|
|
|
|
|
|
|
/// Provide a list of valid CPU names. If \p Only64Bit is true, the list will
|
|
|
|
/// only contain 64-bit capable CPUs.
|
|
|
|
void fillValidCPUArchList(SmallVectorImpl<StringRef> &Values,
|
2020-08-23 01:05:01 +02:00
|
|
|
bool Only64Bit = false);
|
2020-10-12 18:35:22 +02:00
|
|
|
/// Provide a list of valid -mtune names.
|
|
|
|
void fillValidTuneCPUList(SmallVectorImpl<StringRef> &Values,
|
|
|
|
bool Only64Bit = false);
|
2020-06-09 21:18:08 +02:00
|
|
|
|
2020-06-30 20:59:03 +02:00
|
|
|
/// Get the key feature prioritizing target multiversioning.
|
2020-06-24 19:36:02 +02:00
|
|
|
ProcessorFeatures getKeyFeature(CPUKind Kind);
|
|
|
|
|
2020-06-30 20:59:03 +02:00
|
|
|
/// Fill in the features that \p CPU supports into \p Features.
|
|
|
|
void getFeaturesForCPU(StringRef CPU, SmallVectorImpl<StringRef> &Features);
|
|
|
|
|
2020-08-06 09:13:40 +02:00
|
|
|
/// Set or clear entries in \p Features that are implied to be enabled/disabled
|
2020-07-07 07:47:54 +02:00
|
|
|
/// by the provided \p Feature.
|
2020-08-06 09:13:40 +02:00
|
|
|
void updateImpliedFeatures(StringRef Feature, bool Enabled,
|
|
|
|
StringMap<bool> &Features);
|
2020-07-07 07:47:54 +02:00
|
|
|
|
2020-06-09 21:18:08 +02:00
|
|
|
} // namespace X86
|
|
|
|
} // namespace llvm
|
|
|
|
|
|
|
|
#endif
|