From: Benjamin Kramer Date: Sat, 5 Dec 2020 18:07:09 +0000 (+0100) Subject: [X86] Autodetect znver3 X-Git-Tag: llvmorg-13-init~4272 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2a136a7a9c68e4818b28bea6051b78a8181ba78e;p=platform%2Fupstream%2Fllvm.git [X86] Autodetect znver3 --- diff --git a/clang/test/CodeGen/target-builtin-noerror.c b/clang/test/CodeGen/target-builtin-noerror.c index 50967c6..808f3a0 100644 --- a/clang/test/CodeGen/target-builtin-noerror.c +++ b/clang/test/CodeGen/target-builtin-noerror.c @@ -128,4 +128,5 @@ void verifycpustrings() { (void)__builtin_cpu_is("westmere"); (void)__builtin_cpu_is("znver1"); (void)__builtin_cpu_is("znver2"); + (void)__builtin_cpu_is("znver3"); } diff --git a/compiler-rt/lib/builtins/cpu_model.c b/compiler-rt/lib/builtins/cpu_model.c index 05ef849..51bedd98 100644 --- a/compiler-rt/lib/builtins/cpu_model.c +++ b/compiler-rt/lib/builtins/cpu_model.c @@ -68,6 +68,7 @@ enum ProcessorTypes { INTEL_GOLDMONT, INTEL_GOLDMONT_PLUS, INTEL_TREMONT, + AMDFAM19H, CPU_TYPE_MAX }; @@ -97,6 +98,7 @@ enum ProcessorSubtypes { INTEL_COREI7_COOPERLAKE, INTEL_COREI7_SAPPHIRERAPIDS, INTEL_COREI7_ALDERLAKE, + AMDFAM19H_ZNVER3, CPU_SUBTYPE_MAX }; @@ -550,6 +552,14 @@ getAMDProcessorTypeAndSubtype(unsigned Family, unsigned Model, break; // 00h-0Fh: Zen1 } break; + case 25: + CPU = "znver3"; + *Type = AMDFAM19H; + if (Model <= 0x0f) { + *Subtype = AMDFAM19H_ZNVER3; + break; // 00h-0Fh: Zen3 + } + break; default: break; // Unknown AMD CPU. } diff --git a/llvm/include/llvm/Support/X86TargetParser.def b/llvm/include/llvm/Support/X86TargetParser.def index c0fe76d..ec19ce4 100644 --- a/llvm/include/llvm/Support/X86TargetParser.def +++ b/llvm/include/llvm/Support/X86TargetParser.def @@ -44,6 +44,7 @@ X86_CPU_TYPE(INTEL_KNM, "knm") X86_CPU_TYPE(INTEL_GOLDMONT, "goldmont") X86_CPU_TYPE(INTEL_GOLDMONT_PLUS, "goldmont-plus") X86_CPU_TYPE(INTEL_TREMONT, "tremont") +X86_CPU_TYPE(AMDFAM19H, "amdfam19h") // Alternate names supported by __builtin_cpu_is and target multiversioning. X86_CPU_TYPE_ALIAS(INTEL_BONNELL, "atom") @@ -86,6 +87,7 @@ X86_CPU_SUBTYPE(INTEL_COREI7_TIGERLAKE, "tigerlake") X86_CPU_SUBTYPE(INTEL_COREI7_COOPERLAKE, "cooperlake") X86_CPU_SUBTYPE(INTEL_COREI7_SAPPHIRERAPIDS, "sapphirerapids") X86_CPU_SUBTYPE(INTEL_COREI7_ALDERLAKE, "alderlake") +X86_CPU_SUBTYPE(AMDFAM19H_ZNVER3, "znver3") #undef X86_CPU_SUBTYPE diff --git a/llvm/lib/Support/Host.cpp b/llvm/lib/Support/Host.cpp index 4fb9392..b179c83 100644 --- a/llvm/lib/Support/Host.cpp +++ b/llvm/lib/Support/Host.cpp @@ -964,6 +964,14 @@ getAMDProcessorTypeAndSubtype(unsigned Family, unsigned Model, break; // 00h-0Fh: Zen1 } break; + case 25: + CPU = "znver3"; + *Type = X86::AMDFAM19H; + if (Model <= 0x0f) { + *Subtype = X86::AMDFAM19H_ZNVER3; + break; // 00h-0Fh: Zen3 + } + break; default: break; // Unknown AMD CPU. }