Skip to content

Conversation

ahmedbougacha
Copy link
Member

We previously bumped the defaults for 26.0 Apple OS targets to conservative CPU targets in 69d1417.

We can further bump it for watchOS arm64 (which lets us be a little bit more aggressive than arm64e/arm64_32), as well as for the iOS predecessor, iOS 18.

We previously bumped the defaults to conservative CPU targets,
for 26.0 Apple OS targets, in 69d1417.

We can further bump it for the iOS predecessor, iOS 18, as well
as for watchOS arm64, which lets us be a little bit more aggressive
than arm64e/arm64_32.
@ahmedbougacha ahmedbougacha requested a review from jroelofs October 7, 2025 17:15
@llvmbot llvmbot added clang Clang issues not falling into any other category backend:AArch64 clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' labels Oct 7, 2025
@llvmbot
Copy link
Member

llvmbot commented Oct 7, 2025

@llvm/pr-subscribers-clang
@llvm/pr-subscribers-backend-aarch64

@llvm/pr-subscribers-clang-driver

Author: Ahmed Bougacha (ahmedbougacha)

Changes

We previously bumped the defaults for 26.0 Apple OS targets to conservative CPU targets in 69d1417.

We can further bump it for watchOS arm64 (which lets us be a little bit more aggressive than arm64e/arm64_32), as well as for the iOS predecessor, iOS 18.


Full diff: https://github.com/llvm/llvm-project/pull/162325.diff

2 Files Affected:

  • (modified) clang/lib/Driver/ToolChains/Arch/AArch64.cpp (+5-2)
  • (modified) clang/test/Driver/aarch64-cpu-defaults-appleos26.c (+8-2)
diff --git a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
index 98f5efbe5652f..eb5d542f55605 100644
--- a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
@@ -57,6 +57,9 @@ std::string aarch64::getAArch64TargetCPU(const ArgList &Args,
     // iOS 26 only runs on apple-a12 and later CPUs.
     if (!Triple.isOSVersionLT(26))
       return "apple-a12";
+    // arm64 (non-e) iOS 18 only runs on apple-a10 and later CPUs.
+    if (!Triple.isOSVersionLT(18) && !Triple.isArm64e())
+      return "apple-a10";
   }
 
   if (Triple.isWatchOS()) {
@@ -64,8 +67,8 @@ std::string aarch64::getAArch64TargetCPU(const ArgList &Args,
     // arm64_32/arm64e watchOS requires S4 before watchOS 26, S6 after.
     if (Triple.getArch() == llvm::Triple::aarch64_32 || Triple.isArm64e())
       return Triple.isOSVersionLT(26) ? "apple-s4" : "apple-s6";
-    // arm64 (non-e, non-32) watchOS comes later, and requires S6 anyway.
-    return "apple-s6";
+    // arm64 (non-e, non-32) watchOS comes later, and requires S9 anyway.
+    return "apple-s9";
   }
 
   if (Triple.isXROS()) {
diff --git a/clang/test/Driver/aarch64-cpu-defaults-appleos26.c b/clang/test/Driver/aarch64-cpu-defaults-appleos26.c
index 99176050bf5ae..fe468a57c6763 100644
--- a/clang/test/Driver/aarch64-cpu-defaults-appleos26.c
+++ b/clang/test/Driver/aarch64-cpu-defaults-appleos26.c
@@ -4,12 +4,16 @@
 // RUN: %clang -target arm64-apple-ios26  -### -c %s 2>&1 | FileCheck %s --check-prefix=A12
 // RUN: %clang -target arm64e-apple-ios26 -### -c %s 2>&1 | FileCheck %s --check-prefix=A12
 
+/// iOS 18 came before iOS 26, compare its defaults.
+// RUN: %clang -target arm64-apple-ios18  -### -c %s 2>&1 | FileCheck %s --check-prefix=A10
+// RUN: %clang -target arm64e-apple-ios18 -### -c %s 2>&1 | FileCheck %s --check-prefix=A12
+
 /// arm64e/arm64_32 watchOS 26 default to apple-s6.
 // RUN: %clang -target arm64e-apple-watchos26   -### -c %s 2>&1 | FileCheck %s --check-prefix=S6
 // RUN: %clang -target arm64_32-apple-watchos26 -### -c %s 2>&1 | FileCheck %s --check-prefix=S6
 
-/// arm64 is new in watchOS 26, and defaults to apple-s6.
-// RUN: %clang -target arm64-apple-watchos26  -### -c %s 2>&1 | FileCheck %s --check-prefix=S6
+/// arm64 is new in watchOS 26, and defaults to apple-s9.
+// RUN: %clang -target arm64-apple-watchos26  -### -c %s 2>&1 | FileCheck %s --check-prefix=S9
 
 /// llvm usually treats tvOS like iOS, but it runs on different hardware.
 // RUN: %clang -target arm64-apple-tvos26  -### -c %s 2>&1 | FileCheck %s --check-prefix=A7
@@ -18,5 +22,7 @@
 /// Simulators are tested with other Mac-like targets in aarch64-mac-cpus.c.
 
 // A12: "-target-cpu" "apple-a12"
+// A10: "-target-cpu" "apple-a10"
 // S6:  "-target-cpu" "apple-s6"
+// S9:  "-target-cpu" "apple-s9"
 // A7:  "-target-cpu" "apple-a7"

@ahmedbougacha ahmedbougacha merged commit b54f01e into llvm:main Oct 7, 2025
13 checks passed
@ahmedbougacha ahmedbougacha deleted the users/ahmedbougacha/aarch64-appleos-cpu-default-bump branch October 7, 2025 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:AArch64 clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants