Skip to content

Commit b54f01e

Browse files
[AArch64] Bump default CPUs for iOS 18/watchOS 26 to A10/S9. (#162325)
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.
1 parent 30b9ef8 commit b54f01e

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

clang/lib/Driver/ToolChains/Arch/AArch64.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,18 @@ std::string aarch64::getAArch64TargetCPU(const ArgList &Args,
5757
// iOS 26 only runs on apple-a12 and later CPUs.
5858
if (!Triple.isOSVersionLT(26))
5959
return "apple-a12";
60+
// arm64 (non-e) iOS 18 only runs on apple-a10 and later CPUs.
61+
if (!Triple.isOSVersionLT(18) && !Triple.isArm64e())
62+
return "apple-a10";
6063
}
6164

6265
if (Triple.isWatchOS()) {
6366
assert(!Triple.isSimulatorEnvironment() && "watchossim should be mac-like");
6467
// arm64_32/arm64e watchOS requires S4 before watchOS 26, S6 after.
6568
if (Triple.getArch() == llvm::Triple::aarch64_32 || Triple.isArm64e())
6669
return Triple.isOSVersionLT(26) ? "apple-s4" : "apple-s6";
67-
// arm64 (non-e, non-32) watchOS comes later, and requires S6 anyway.
68-
return "apple-s6";
70+
// arm64 (non-e, non-32) watchOS comes later, and requires S9 anyway.
71+
return "apple-s9";
6972
}
7073

7174
if (Triple.isXROS()) {

clang/test/Driver/aarch64-cpu-defaults-appleos26.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,16 @@
44
// RUN: %clang -target arm64-apple-ios26 -### -c %s 2>&1 | FileCheck %s --check-prefix=A12
55
// RUN: %clang -target arm64e-apple-ios26 -### -c %s 2>&1 | FileCheck %s --check-prefix=A12
66

7+
/// iOS 18 came before iOS 26, compare its defaults.
8+
// RUN: %clang -target arm64-apple-ios18 -### -c %s 2>&1 | FileCheck %s --check-prefix=A10
9+
// RUN: %clang -target arm64e-apple-ios18 -### -c %s 2>&1 | FileCheck %s --check-prefix=A12
10+
711
/// arm64e/arm64_32 watchOS 26 default to apple-s6.
812
// RUN: %clang -target arm64e-apple-watchos26 -### -c %s 2>&1 | FileCheck %s --check-prefix=S6
913
// RUN: %clang -target arm64_32-apple-watchos26 -### -c %s 2>&1 | FileCheck %s --check-prefix=S6
1014

11-
/// arm64 is new in watchOS 26, and defaults to apple-s6.
12-
// RUN: %clang -target arm64-apple-watchos26 -### -c %s 2>&1 | FileCheck %s --check-prefix=S6
15+
/// arm64 is new in watchOS 26, and defaults to apple-s9.
16+
// RUN: %clang -target arm64-apple-watchos26 -### -c %s 2>&1 | FileCheck %s --check-prefix=S9
1317

1418
/// llvm usually treats tvOS like iOS, but it runs on different hardware.
1519
// RUN: %clang -target arm64-apple-tvos26 -### -c %s 2>&1 | FileCheck %s --check-prefix=A7
@@ -18,5 +22,7 @@
1822
/// Simulators are tested with other Mac-like targets in aarch64-mac-cpus.c.
1923

2024
// A12: "-target-cpu" "apple-a12"
25+
// A10: "-target-cpu" "apple-a10"
2126
// S6: "-target-cpu" "apple-s6"
27+
// S9: "-target-cpu" "apple-s9"
2228
// A7: "-target-cpu" "apple-a7"

0 commit comments

Comments
 (0)