[llvm] Add Apple M4 host detection (PR #117530)

via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 25 01:09:10 PST 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 73bebf96bc21dcc01a8eccfb4ece200c1c665931 7944594118f6a8861b02ecb2c17d0a138a1abe24 --extensions cpp -- llvm/lib/TargetParser/Host.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/TargetParser/Host.cpp b/llvm/lib/TargetParser/Host.cpp
index f529d9d32f..20601cbc42 100644
--- a/llvm/lib/TargetParser/Host.cpp
+++ b/llvm/lib/TargetParser/Host.cpp
@@ -1499,7 +1499,8 @@ StringRef sys::getHostCPUName() {
   // This is found by testing on actual hardware, and by looking at:
   // https://github.com/apple-oss-distributions/xnu/blob/xnu-11215.41.3/osfmk/arm/cpuid.c#L109-L231.
   //
-  // Another great resource is https://github.com/AsahiLinux/docs/wiki/Codenames.
+  // Another great resource is
+  // https://github.com/AsahiLinux/docs/wiki/Codenames.
   //
   // NOTE: We choose to return `apple-mX` instead of `apple-aX`, since the M1,
   // M2, M3 etc. aliases are more widely known to users than A14, A15, A16 etc.
@@ -1520,8 +1521,8 @@ StringRef sys::getHostCPUName() {
   case CPUFAMILY_ARM_14:
     return "cortex-a9";
   case CPUFAMILY_ARM_15:
-    return "cortex-a7";.
-  case CPUFAMILY_ARM_SWIFT:
+    return "cortex-a7";
+  .case CPUFAMILY_ARM_SWIFT:
     return "swift";
   case CPUFAMILY_ARM_CYCLONE:
     return "apple-a7";
@@ -1557,9 +1558,9 @@ StringRef sys::getHostCPUName() {
     return "apple-m4"; // A18 Pro
   case CPUFAMILY_ARM_TUPAI:
     return "apple-m4"; // A18
-  default:
-    // Default to the newest CPU we know about.
-    return "apple-m4";
+    default :
+        // Default to the newest CPU we know about.
+        return "apple-m4";
   }
 }
 #elif defined(_AIX)

``````````

</details>


https://github.com/llvm/llvm-project/pull/117530


More information about the llvm-commits mailing list