[compiler-rt] [llvm] [Clang][NFC] - Use Hex Encoding for Intel CPU CPUID family (PR #153004)

Pawan Nirpal via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 11 06:38:18 PDT 2025


https://github.com/pawan-nirpal-031 updated https://github.com/llvm/llvm-project/pull/153004

>From 3f63c46e8f9bc6bc58f5fc6278d51a8e482eb035 Mon Sep 17 00:00:00 2001
From: Pawan Nirpal <pawan.anil.nirpal at intel.com>
Date: Mon, 11 Aug 2025 15:16:16 +0200
Subject: [PATCH] [Clang][NFC] - Use Hex Encoding for Intel CPU CPUID family

---
 compiler-rt/lib/builtins/cpu_model/x86.c |  4 ++--
 llvm/lib/TargetParser/Host.cpp           | 12 ++++++------
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/compiler-rt/lib/builtins/cpu_model/x86.c b/compiler-rt/lib/builtins/cpu_model/x86.c
index 606571d527501..79705ca0886f8 100644
--- a/compiler-rt/lib/builtins/cpu_model/x86.c
+++ b/compiler-rt/lib/builtins/cpu_model/x86.c
@@ -328,7 +328,7 @@ static const char *getIntelProcessorTypeAndSubtype(unsigned Family,
   const char *CPU = 0;
 
   switch (Family) {
-  case 6:
+  case 0x6:
     switch (Model) {
     case 0x0f: // Intel Core 2 Duo processor, Intel Core 2 Duo mobile
                // processor, Intel Core 2 Quad processor, Intel Core 2 Quad
@@ -626,7 +626,7 @@ static const char *getIntelProcessorTypeAndSubtype(unsigned Family,
       break;
     }
     break;
-  case 19:
+  case 0x13:
     switch (Model) {
     // Diamond Rapids:
     case 0x01:
diff --git a/llvm/lib/TargetParser/Host.cpp b/llvm/lib/TargetParser/Host.cpp
index 5957e1befe2da..1364f7b58db5d 100644
--- a/llvm/lib/TargetParser/Host.cpp
+++ b/llvm/lib/TargetParser/Host.cpp
@@ -694,20 +694,20 @@ static StringRef getIntelProcessorTypeAndSubtype(unsigned Family,
   StringRef CPU;
 
   switch (Family) {
-  case 3:
+  case 0x3:
     CPU = "i386";
     break;
-  case 4:
+  case 0x4:
     CPU = "i486";
     break;
-  case 5:
+  case 0x5:
     if (testFeature(X86::FEATURE_MMX)) {
       CPU = "pentium-mmx";
       break;
     }
     CPU = "pentium";
     break;
-  case 6:
+  case 0x6:
     switch (Model) {
     case 0x0f: // Intel Core 2 Duo processor, Intel Core 2 Duo mobile
                // processor, Intel Core 2 Quad processor, Intel Core 2 Quad
@@ -1055,7 +1055,7 @@ static StringRef getIntelProcessorTypeAndSubtype(unsigned Family,
       break;
     }
     break;
-  case 15: {
+  case 0xf: {
     if (testFeature(X86::FEATURE_64BIT)) {
       CPU = "nocona";
       break;
@@ -1067,7 +1067,7 @@ static StringRef getIntelProcessorTypeAndSubtype(unsigned Family,
     CPU = "pentium4";
     break;
   }
-  case 19:
+  case 0x13:
     switch (Model) {
     // Diamond Rapids:
     case 0x01:



More information about the llvm-commits mailing list