[llvm] [compiler-rt] [X86] Add znver2 detection for Renoir CPUs (PR #74955)

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 9 16:30:21 PST 2023


https://github.com/boomanaiden154 created https://github.com/llvm/llvm-project/pull/74955

This patch adds proper detection support for Renoir CPUs.

This was originally proposed in https://reviews.llvm.org/D96220 and got approved, but slipped through the cracks. However, there is still a demand for this feature.

Fixes https://github.com/llvm/llvm-project/issues/74934.

>From 1da4bbab8223cf0f24e881b529509a6f85b3eb0e Mon Sep 17 00:00:00 2001
From: Aiden Grossman <agrossman154 at yahoo.com>
Date: Sat, 9 Dec 2023 16:26:36 -0800
Subject: [PATCH] [X86] Add znver2 detection for Renoir CPUs

This patch adds proper detection support for Renoir CPUs.

This was originally proposed in https://reviews.llvm.org/D96220 and
got approved, but slipped through the cracks. However, there is still a
demand for this feature.

Fixes https://github.com/llvm/llvm-project/issues/74934.
---
 compiler-rt/lib/builtins/cpu_model.c | 4 ++--
 llvm/lib/TargetParser/Host.cpp       | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/compiler-rt/lib/builtins/cpu_model.c b/compiler-rt/lib/builtins/cpu_model.c
index b0ec5e51e96d49..ab9ba744f3716e 100644
--- a/compiler-rt/lib/builtins/cpu_model.c
+++ b/compiler-rt/lib/builtins/cpu_model.c
@@ -667,10 +667,10 @@ getAMDProcessorTypeAndSubtype(unsigned Family, unsigned Model,
   case 23:
     CPU = "znver1";
     *Type = AMDFAM17H;
-    if ((Model >= 0x30 && Model <= 0x3f) || Model == 0x71) {
+    if ((Model >= 0x30 && Model <= 0x3f) || Model == 0x60 || Model == 0x71) {
       CPU = "znver2";
       *Subtype = AMDFAM17H_ZNVER2;
-      break; // 30h-3fh, 71h: Zen2
+      break; // 30h-3fh, 60h, 71h: Zen2
     }
     if (Model <= 0x0f) {
       *Subtype = AMDFAM17H_ZNVER1;
diff --git a/llvm/lib/TargetParser/Host.cpp b/llvm/lib/TargetParser/Host.cpp
index 40f4ba0be5503a..a6143bf49cbc0e 100644
--- a/llvm/lib/TargetParser/Host.cpp
+++ b/llvm/lib/TargetParser/Host.cpp
@@ -1131,10 +1131,10 @@ getAMDProcessorTypeAndSubtype(unsigned Family, unsigned Model,
   case 23:
     CPU = "znver1";
     *Type = X86::AMDFAM17H;
-    if ((Model >= 0x30 && Model <= 0x3f) || Model == 0x71) {
+    if ((Model >= 0x30 && Model <= 0x3f) || Model == 0x60 || Model == 0x71) {
       CPU = "znver2";
       *Subtype = X86::AMDFAM17H_ZNVER2;
-      break; // 30h-3fh, 71h: Zen2
+      break; // 30h-3fh, 60h, 71h: Zen2
     }
     if (Model <= 0x0f) {
       *Subtype = X86::AMDFAM17H_ZNVER1;



More information about the llvm-commits mailing list