diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
commit | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (patch) | |
tree | 64175d5cadab313b3e7039ebaa06c5bc3295e274 /contrib/libs/llvm12/lib/Support/TargetParser.cpp | |
parent | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (diff) | |
download | ydb-e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/llvm12/lib/Support/TargetParser.cpp')
-rw-r--r-- | contrib/libs/llvm12/lib/Support/TargetParser.cpp | 166 |
1 files changed, 83 insertions, 83 deletions
diff --git a/contrib/libs/llvm12/lib/Support/TargetParser.cpp b/contrib/libs/llvm12/lib/Support/TargetParser.cpp index 9cf604de34..3ccdc55b30 100644 --- a/contrib/libs/llvm12/lib/Support/TargetParser.cpp +++ b/contrib/libs/llvm12/lib/Support/TargetParser.cpp @@ -30,7 +30,7 @@ struct GPUInfo { unsigned Features; }; -constexpr GPUInfo R600GPUs[] = { +constexpr GPUInfo R600GPUs[] = { // Name Canonical Kind Features // Name {{"r600"}, {"r600"}, GK_R600, FEATURE_NONE }, @@ -63,7 +63,7 @@ constexpr GPUInfo R600GPUs[] = { // This table should be sorted by the value of GPUKind // Don't bother listing the implicitly true features -constexpr GPUInfo AMDGCNGPUs[] = { +constexpr GPUInfo AMDGCNGPUs[] = { // Name Canonical Kind Features // Name {{"gfx600"}, {"gfx600"}, GK_GFX600, FEATURE_FAST_FMA_F32}, @@ -71,9 +71,9 @@ constexpr GPUInfo AMDGCNGPUs[] = { {{"gfx601"}, {"gfx601"}, GK_GFX601, FEATURE_NONE}, {{"pitcairn"}, {"gfx601"}, GK_GFX601, FEATURE_NONE}, {{"verde"}, {"gfx601"}, GK_GFX601, FEATURE_NONE}, - {{"gfx602"}, {"gfx602"}, GK_GFX602, FEATURE_NONE}, - {{"hainan"}, {"gfx602"}, GK_GFX602, FEATURE_NONE}, - {{"oland"}, {"gfx602"}, GK_GFX602, FEATURE_NONE}, + {{"gfx602"}, {"gfx602"}, GK_GFX602, FEATURE_NONE}, + {{"hainan"}, {"gfx602"}, GK_GFX602, FEATURE_NONE}, + {{"oland"}, {"gfx602"}, GK_GFX602, FEATURE_NONE}, {{"gfx700"}, {"gfx700"}, GK_GFX700, FEATURE_NONE}, {{"kaveri"}, {"gfx700"}, GK_GFX700, FEATURE_NONE}, {{"gfx701"}, {"gfx701"}, GK_GFX701, FEATURE_FAST_FMA_F32}, @@ -84,43 +84,43 @@ constexpr GPUInfo AMDGCNGPUs[] = { {{"mullins"}, {"gfx703"}, GK_GFX703, FEATURE_NONE}, {{"gfx704"}, {"gfx704"}, GK_GFX704, FEATURE_NONE}, {{"bonaire"}, {"gfx704"}, GK_GFX704, FEATURE_NONE}, - {{"gfx705"}, {"gfx705"}, GK_GFX705, FEATURE_NONE}, - {{"gfx801"}, {"gfx801"}, GK_GFX801, FEATURE_FAST_FMA_F32|FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK}, - {{"carrizo"}, {"gfx801"}, GK_GFX801, FEATURE_FAST_FMA_F32|FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK}, - {{"gfx802"}, {"gfx802"}, GK_GFX802, FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK}, - {{"iceland"}, {"gfx802"}, GK_GFX802, FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK}, - {{"tonga"}, {"gfx802"}, GK_GFX802, FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK}, - {{"gfx803"}, {"gfx803"}, GK_GFX803, FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK}, - {{"fiji"}, {"gfx803"}, GK_GFX803, FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK}, - {{"polaris10"}, {"gfx803"}, GK_GFX803, FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK}, - {{"polaris11"}, {"gfx803"}, GK_GFX803, FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK}, - {{"gfx805"}, {"gfx805"}, GK_GFX805, FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK}, - {{"tongapro"}, {"gfx805"}, GK_GFX805, FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK}, - {{"gfx810"}, {"gfx810"}, GK_GFX810, FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK}, - {{"stoney"}, {"gfx810"}, GK_GFX810, FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK}, - {{"gfx900"}, {"gfx900"}, GK_GFX900, FEATURE_FAST_FMA_F32|FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK}, - {{"gfx902"}, {"gfx902"}, GK_GFX902, FEATURE_FAST_FMA_F32|FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK}, - {{"gfx904"}, {"gfx904"}, GK_GFX904, FEATURE_FAST_FMA_F32|FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK}, - {{"gfx906"}, {"gfx906"}, GK_GFX906, FEATURE_FAST_FMA_F32|FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK|FEATURE_SRAMECC}, - {{"gfx908"}, {"gfx908"}, GK_GFX908, FEATURE_FAST_FMA_F32|FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK|FEATURE_SRAMECC}, - {{"gfx909"}, {"gfx909"}, GK_GFX909, FEATURE_FAST_FMA_F32|FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK}, - {{"gfx90c"}, {"gfx90c"}, GK_GFX90C, FEATURE_FAST_FMA_F32|FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK}, - {{"gfx1010"}, {"gfx1010"}, GK_GFX1010, FEATURE_FAST_FMA_F32|FEATURE_FAST_DENORMAL_F32|FEATURE_WAVE32|FEATURE_XNACK}, - {{"gfx1011"}, {"gfx1011"}, GK_GFX1011, FEATURE_FAST_FMA_F32|FEATURE_FAST_DENORMAL_F32|FEATURE_WAVE32|FEATURE_XNACK}, - {{"gfx1012"}, {"gfx1012"}, GK_GFX1012, FEATURE_FAST_FMA_F32|FEATURE_FAST_DENORMAL_F32|FEATURE_WAVE32|FEATURE_XNACK}, + {{"gfx705"}, {"gfx705"}, GK_GFX705, FEATURE_NONE}, + {{"gfx801"}, {"gfx801"}, GK_GFX801, FEATURE_FAST_FMA_F32|FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK}, + {{"carrizo"}, {"gfx801"}, GK_GFX801, FEATURE_FAST_FMA_F32|FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK}, + {{"gfx802"}, {"gfx802"}, GK_GFX802, FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK}, + {{"iceland"}, {"gfx802"}, GK_GFX802, FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK}, + {{"tonga"}, {"gfx802"}, GK_GFX802, FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK}, + {{"gfx803"}, {"gfx803"}, GK_GFX803, FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK}, + {{"fiji"}, {"gfx803"}, GK_GFX803, FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK}, + {{"polaris10"}, {"gfx803"}, GK_GFX803, FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK}, + {{"polaris11"}, {"gfx803"}, GK_GFX803, FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK}, + {{"gfx805"}, {"gfx805"}, GK_GFX805, FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK}, + {{"tongapro"}, {"gfx805"}, GK_GFX805, FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK}, + {{"gfx810"}, {"gfx810"}, GK_GFX810, FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK}, + {{"stoney"}, {"gfx810"}, GK_GFX810, FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK}, + {{"gfx900"}, {"gfx900"}, GK_GFX900, FEATURE_FAST_FMA_F32|FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK}, + {{"gfx902"}, {"gfx902"}, GK_GFX902, FEATURE_FAST_FMA_F32|FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK}, + {{"gfx904"}, {"gfx904"}, GK_GFX904, FEATURE_FAST_FMA_F32|FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK}, + {{"gfx906"}, {"gfx906"}, GK_GFX906, FEATURE_FAST_FMA_F32|FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK|FEATURE_SRAMECC}, + {{"gfx908"}, {"gfx908"}, GK_GFX908, FEATURE_FAST_FMA_F32|FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK|FEATURE_SRAMECC}, + {{"gfx909"}, {"gfx909"}, GK_GFX909, FEATURE_FAST_FMA_F32|FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK}, + {{"gfx90c"}, {"gfx90c"}, GK_GFX90C, FEATURE_FAST_FMA_F32|FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK}, + {{"gfx1010"}, {"gfx1010"}, GK_GFX1010, FEATURE_FAST_FMA_F32|FEATURE_FAST_DENORMAL_F32|FEATURE_WAVE32|FEATURE_XNACK}, + {{"gfx1011"}, {"gfx1011"}, GK_GFX1011, FEATURE_FAST_FMA_F32|FEATURE_FAST_DENORMAL_F32|FEATURE_WAVE32|FEATURE_XNACK}, + {{"gfx1012"}, {"gfx1012"}, GK_GFX1012, FEATURE_FAST_FMA_F32|FEATURE_FAST_DENORMAL_F32|FEATURE_WAVE32|FEATURE_XNACK}, {{"gfx1030"}, {"gfx1030"}, GK_GFX1030, FEATURE_FAST_FMA_F32|FEATURE_FAST_DENORMAL_F32|FEATURE_WAVE32}, - {{"gfx1031"}, {"gfx1031"}, GK_GFX1031, FEATURE_FAST_FMA_F32|FEATURE_FAST_DENORMAL_F32|FEATURE_WAVE32}, - {{"gfx1032"}, {"gfx1032"}, GK_GFX1032, FEATURE_FAST_FMA_F32|FEATURE_FAST_DENORMAL_F32|FEATURE_WAVE32}, - {{"gfx1033"}, {"gfx1033"}, GK_GFX1033, FEATURE_FAST_FMA_F32|FEATURE_FAST_DENORMAL_F32|FEATURE_WAVE32}, + {{"gfx1031"}, {"gfx1031"}, GK_GFX1031, FEATURE_FAST_FMA_F32|FEATURE_FAST_DENORMAL_F32|FEATURE_WAVE32}, + {{"gfx1032"}, {"gfx1032"}, GK_GFX1032, FEATURE_FAST_FMA_F32|FEATURE_FAST_DENORMAL_F32|FEATURE_WAVE32}, + {{"gfx1033"}, {"gfx1033"}, GK_GFX1033, FEATURE_FAST_FMA_F32|FEATURE_FAST_DENORMAL_F32|FEATURE_WAVE32}, }; const GPUInfo *getArchEntry(AMDGPU::GPUKind AK, ArrayRef<GPUInfo> Table) { GPUInfo Search = { {""}, {""}, AK, AMDGPU::FEATURE_NONE }; - auto I = - llvm::lower_bound(Table, Search, [](const GPUInfo &A, const GPUInfo &B) { - return A.Kind < B.Kind; - }); + auto I = + llvm::lower_bound(Table, Search, [](const GPUInfo &A, const GPUInfo &B) { + return A.Kind < B.Kind; + }); if (I == Table.end()) return nullptr; @@ -195,17 +195,17 @@ AMDGPU::IsaVersion AMDGPU::getIsaVersion(StringRef GPU) { switch (AK) { case GK_GFX600: return {6, 0, 0}; case GK_GFX601: return {6, 0, 1}; - case GK_GFX602: return {6, 0, 2}; + case GK_GFX602: return {6, 0, 2}; case GK_GFX700: return {7, 0, 0}; case GK_GFX701: return {7, 0, 1}; case GK_GFX702: return {7, 0, 2}; case GK_GFX703: return {7, 0, 3}; case GK_GFX704: return {7, 0, 4}; - case GK_GFX705: return {7, 0, 5}; + case GK_GFX705: return {7, 0, 5}; case GK_GFX801: return {8, 0, 1}; case GK_GFX802: return {8, 0, 2}; case GK_GFX803: return {8, 0, 3}; - case GK_GFX805: return {8, 0, 5}; + case GK_GFX805: return {8, 0, 5}; case GK_GFX810: return {8, 1, 0}; case GK_GFX900: return {9, 0, 0}; case GK_GFX902: return {9, 0, 2}; @@ -213,27 +213,27 @@ AMDGPU::IsaVersion AMDGPU::getIsaVersion(StringRef GPU) { case GK_GFX906: return {9, 0, 6}; case GK_GFX908: return {9, 0, 8}; case GK_GFX909: return {9, 0, 9}; - case GK_GFX90C: return {9, 0, 12}; + case GK_GFX90C: return {9, 0, 12}; case GK_GFX1010: return {10, 1, 0}; case GK_GFX1011: return {10, 1, 1}; case GK_GFX1012: return {10, 1, 2}; case GK_GFX1030: return {10, 3, 0}; - case GK_GFX1031: return {10, 3, 1}; - case GK_GFX1032: return {10, 3, 2}; - case GK_GFX1033: return {10, 3, 3}; + case GK_GFX1031: return {10, 3, 1}; + case GK_GFX1032: return {10, 3, 2}; + case GK_GFX1033: return {10, 3, 3}; default: return {0, 0, 0}; } } -StringRef AMDGPU::getCanonicalArchName(const Triple &T, StringRef Arch) { - assert(T.isAMDGPU()); - auto ProcKind = T.isAMDGCN() ? parseArchAMDGCN(Arch) : parseArchR600(Arch); - if (ProcKind == GK_NONE) - return StringRef(); - - return T.isAMDGCN() ? getArchNameAMDGCN(ProcKind) : getArchNameR600(ProcKind); -} - +StringRef AMDGPU::getCanonicalArchName(const Triple &T, StringRef Arch) { + assert(T.isAMDGPU()); + auto ProcKind = T.isAMDGCN() ? parseArchAMDGCN(Arch) : parseArchR600(Arch); + if (ProcKind == GK_NONE) + return StringRef(); + + return T.isAMDGCN() ? getArchNameAMDGCN(ProcKind) : getArchNameR600(ProcKind); +} + namespace llvm { namespace RISCV { @@ -257,12 +257,12 @@ bool checkCPUKind(CPUKind Kind, bool IsRV64) { return RISCVCPUInfo[static_cast<unsigned>(Kind)].is64Bit() == IsRV64; } -bool checkTuneCPUKind(CPUKind Kind, bool IsRV64) { - if (Kind == CK_INVALID) - return false; - return RISCVCPUInfo[static_cast<unsigned>(Kind)].is64Bit() == IsRV64; -} - +bool checkTuneCPUKind(CPUKind Kind, bool IsRV64) { + if (Kind == CK_INVALID) + return false; + return RISCVCPUInfo[static_cast<unsigned>(Kind)].is64Bit() == IsRV64; +} + CPUKind parseCPUKind(StringRef CPU) { return llvm::StringSwitch<CPUKind>(CPU) #define PROC(ENUM, NAME, FEATURES, DEFAULT_MARCH) .Case(NAME, CK_##ENUM) @@ -270,22 +270,22 @@ CPUKind parseCPUKind(StringRef CPU) { .Default(CK_INVALID); } -StringRef resolveTuneCPUAlias(StringRef TuneCPU, bool IsRV64) { - return llvm::StringSwitch<StringRef>(TuneCPU) -#define PROC_ALIAS(NAME, RV32, RV64) .Case(NAME, IsRV64 ? StringRef(RV64) : StringRef(RV32)) -#include "llvm/Support/RISCVTargetParser.def" - .Default(TuneCPU); -} - -CPUKind parseTuneCPUKind(StringRef TuneCPU, bool IsRV64) { - TuneCPU = resolveTuneCPUAlias(TuneCPU, IsRV64); - - return llvm::StringSwitch<CPUKind>(TuneCPU) -#define PROC(ENUM, NAME, FEATURES, DEFAULT_MARCH) .Case(NAME, CK_##ENUM) -#include "llvm/Support/RISCVTargetParser.def" - .Default(CK_INVALID); -} - +StringRef resolveTuneCPUAlias(StringRef TuneCPU, bool IsRV64) { + return llvm::StringSwitch<StringRef>(TuneCPU) +#define PROC_ALIAS(NAME, RV32, RV64) .Case(NAME, IsRV64 ? StringRef(RV64) : StringRef(RV32)) +#include "llvm/Support/RISCVTargetParser.def" + .Default(TuneCPU); +} + +CPUKind parseTuneCPUKind(StringRef TuneCPU, bool IsRV64) { + TuneCPU = resolveTuneCPUAlias(TuneCPU, IsRV64); + + return llvm::StringSwitch<CPUKind>(TuneCPU) +#define PROC(ENUM, NAME, FEATURES, DEFAULT_MARCH) .Case(NAME, CK_##ENUM) +#include "llvm/Support/RISCVTargetParser.def" + .Default(CK_INVALID); +} + StringRef getMArchFromMcpu(StringRef CPU) { CPUKind Kind = parseCPUKind(CPU); return RISCVCPUInfo[static_cast<unsigned>(Kind)].DefaultMarch; @@ -298,15 +298,15 @@ void fillValidCPUArchList(SmallVectorImpl<StringRef> &Values, bool IsRV64) { } } -void fillValidTuneCPUArchList(SmallVectorImpl<StringRef> &Values, bool IsRV64) { - for (const auto &C : RISCVCPUInfo) { - if (C.Kind != CK_INVALID && IsRV64 == C.is64Bit()) - Values.emplace_back(C.Name); - } -#define PROC_ALIAS(NAME, RV32, RV64) Values.emplace_back(StringRef(NAME)); -#include "llvm/Support/RISCVTargetParser.def" -} - +void fillValidTuneCPUArchList(SmallVectorImpl<StringRef> &Values, bool IsRV64) { + for (const auto &C : RISCVCPUInfo) { + if (C.Kind != CK_INVALID && IsRV64 == C.is64Bit()) + Values.emplace_back(C.Name); + } +#define PROC_ALIAS(NAME, RV32, RV64) Values.emplace_back(StringRef(NAME)); +#include "llvm/Support/RISCVTargetParser.def" +} + // Get all features except standard extension feature bool getCPUFeaturesExceptStdExt(CPUKind Kind, std::vector<StringRef> &Features) { |