Skip to content

Commit 69d1417

Browse files
[AArch64] Bump default CPUs for iOS 26/watchOS 26 to A12/S6. (#152235)
iOS 26/watchOS 26 deprecate some devices, allowing the default CPU to be raised based on the deployment target. watchOS 26 also introduces arm64 (vs. arm64_32/arm64e). The defaults are now: - arm64-apple-ios26 apple-a12 - arm64-apple-watchos26 apple-s6 - arm64_32-apple-watchos26 apple-s6 - arm64e-apple-watchos26 apple-s6 Left unchanged are: - arm64-apple-tvos26 apple-a7 - arm64e-apple-tvos26 apple-a12 - arm64e-apple-ios26 apple-a12 - arm64_32-apple-watchos11 apple-s4 While there, rewrite an outdated comment in a related Mac test.
1 parent 53c41f1 commit 69d1417

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,22 @@ std::string aarch64::getAArch64TargetCPU(const ArgList &Args,
5252
return "apple-m1";
5353
}
5454

55+
if (Triple.getOS() == llvm::Triple::IOS) {
56+
assert(!Triple.isSimulatorEnvironment() && "iossim should be mac-like");
57+
// iOS 26 only runs on apple-a12 and later CPUs.
58+
if (!Triple.isOSVersionLT(26))
59+
return "apple-a12";
60+
}
61+
62+
if (Triple.isWatchOS()) {
63+
assert(!Triple.isSimulatorEnvironment() && "watchossim should be mac-like");
64+
// arm64_32/arm64e watchOS requires S4 before watchOS 26, S6 after.
65+
if (Triple.getArch() == llvm::Triple::aarch64_32 || Triple.isArm64e())
66+
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";
69+
}
70+
5571
if (Triple.isXROS()) {
5672
// The xrOS simulator runs on M1 as well, it should have been covered above.
5773
assert(!Triple.isSimulatorEnvironment() && "xrossim should be mac-like");
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/// iOS 26 and watchOS 26 bump the default arm64 CPU targets.
2+
3+
/// arm64 iOS 26 defaults to apple-a12. arm64e already did.
4+
// RUN: %clang -target arm64-apple-ios26 -### -c %s 2>&1 | FileCheck %s --check-prefix=A12
5+
// RUN: %clang -target arm64e-apple-ios26 -### -c %s 2>&1 | FileCheck %s --check-prefix=A12
6+
7+
/// arm64e/arm64_32 watchOS 26 default to apple-s6.
8+
// RUN: %clang -target arm64e-apple-watchos26 -### -c %s 2>&1 | FileCheck %s --check-prefix=S6
9+
// RUN: %clang -target arm64_32-apple-watchos26 -### -c %s 2>&1 | FileCheck %s --check-prefix=S6
10+
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
13+
14+
/// llvm usually treats tvOS like iOS, but it runs on different hardware.
15+
// RUN: %clang -target arm64-apple-tvos26 -### -c %s 2>&1 | FileCheck %s --check-prefix=A7
16+
// RUN: %clang -target arm64e-apple-tvos26 -### -c %s 2>&1 | FileCheck %s --check-prefix=A12
17+
18+
/// Simulators are tested with other Mac-like targets in aarch64-mac-cpus.c.
19+
20+
// A12: "-target-cpu" "apple-a12"
21+
// S6: "-target-cpu" "apple-s6"
22+
// A7: "-target-cpu" "apple-a7"

clang/test/Driver/aarch64-mac-cpus.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// arm64 Mac-based targets default to Apple A13.
1+
// arm64/arm64e Mac-based targets default to Apple M1.
22

33
// RUN: %clang --target=arm64-apple-macos -### -c %s 2>&1 | FileCheck %s
44
// RUN: %clang --target=arm64-apple-ios-macabi -### -c %s 2>&1 | FileCheck %s

0 commit comments

Comments
 (0)