[PATCH] D158840: Detect apple M2 processor targets

Tom Forbes via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 25 05:54:06 PDT 2023


orf created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
orf requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Currently on MacOS `getHostCPUName` only detects M1 <https://reviews.llvm.org/M1> processors and not M2 <https://reviews.llvm.org/M2> processors. The M2 <https://reviews.llvm.org/M2> CPU family is the following:

  ❯ sysctl hw.cpufamily
  hw.cpufamily: -634136515


https://reviews.llvm.org/D158840

Files:
  llvm/lib/TargetParser/Host.cpp


Index: llvm/lib/TargetParser/Host.cpp
===================================================================
--- llvm/lib/TargetParser/Host.cpp
+++ llvm/lib/TargetParser/Host.cpp
@@ -1415,6 +1415,7 @@
 #define CPUFAMILY_ARM_VORTEX_TEMPEST 0x07d34b9f
 #define CPUFAMILY_ARM_LIGHTNING_THUNDER 0x462504d2
 #define CPUFAMILY_ARM_FIRESTORM_ICESTORM 0x1b588bb3
+#define CPUFAMILY_ARM_BLIZZARD_AVALANCHE 0xda33d83d
 
 StringRef sys::getHostCPUName() {
   uint32_t Family;
@@ -1440,9 +1441,11 @@
     return "apple-a13";
   case CPUFAMILY_ARM_FIRESTORM_ICESTORM:
     return "apple-m1";
+  case CPUFAMILY_ARM_BLIZZARD_AVALANCHE:
+    return "apple-m2";
   default:
     // Default to the newest CPU we know about.
-    return "apple-m1";
+    return "apple-m2";
   }
 }
 #elif defined(_AIX)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158840.553446.patch
Type: text/x-patch
Size: 780 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230825/d7097e1c/attachment.bin>


More information about the llvm-commits mailing list