Skip to content

Commit 5730163

Browse files
committed
[ClangImporter] Update clang invocation to use the marketing names of CPUs
Update the clang invocation to use the marketing name of Apple CPUs. rdar://problem/64918604
1 parent 7573a64 commit 5730163

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

lib/ClangImporter/ClangImporter.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -730,22 +730,22 @@ importer::addCommonInvocationArguments(
730730

731731
} else if (triple.isOSDarwin()) {
732732
// Special case CPU based on known deployments:
733-
// - arm64 deploys to cyclone
733+
// - arm64 deploys to apple-a7
734734
// - arm64 on macOS
735735
// - arm64 for iOS/tvOS/watchOS simulators
736-
// - arm64e deploys to vortex
737-
// and arm64e (everywhere) and arm64e macOS defaults to the "vortex" CPU
736+
// - arm64e deploys to apple-a12
737+
// and arm64e (everywhere) and arm64e macOS defaults to the "apple-a12" CPU
738738
// for Darwin, but Clang only detects this if we use -arch.
739739
if (triple.getArchName() == "arm64e")
740-
invocationArgStrs.push_back("-mcpu=vortex");
740+
invocationArgStrs.push_back("-mcpu=apple-a12");
741741
else if (triple.isAArch64() && triple.isMacOSX())
742-
invocationArgStrs.push_back("-mcpu=vortex");
742+
invocationArgStrs.push_back("-mcpu=apple-a12");
743743
else if (triple.isAArch64() && triple.isSimulatorEnvironment() &&
744744
(triple.isiOS() || triple.isWatchOS()))
745-
invocationArgStrs.push_back("-mcpu=vortex");
745+
invocationArgStrs.push_back("-mcpu=apple-a12");
746746
else if (triple.getArch() == llvm::Triple::aarch64 ||
747747
triple.getArch() == llvm::Triple::aarch64_be) {
748-
invocationArgStrs.push_back("-mcpu=cyclone");
748+
invocationArgStrs.push_back("-mcpu=apple-a7");
749749
}
750750
} else if (triple.getArch() == llvm::Triple::systemz) {
751751
invocationArgStrs.push_back("-march=z13");
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// RUN: %swift %s -typecheck -parse-stdlib -dump-clang-diagnostics -target arm64e-apple-ios13.0 2>&1 | %FileCheck -check-prefix=CHECK-APPLE-A12 %s
2+
// RUN: %swift %s -typecheck -parse-stdlib -dump-clang-diagnostics -target arm64e-apple-macos11.0 2>&1 | %FileCheck -check-prefix=CHECK-APPLE-A12 %s
3+
// RUN: %swift %s -typecheck -parse-stdlib -dump-clang-diagnostics -target arm64e-apple-ios13.0-simulator 2>&1 | %FileCheck -check-prefix=CHECK-APPLE-A12 %s
4+
// CHECK-APPLE-A12: '-mcpu=apple-a12'
5+
6+
// RUN: %swift %s -typecheck -parse-stdlib -dump-clang-diagnostics -target arm64-apple-ios13.0 2>&1 | %FileCheck -check-prefix=CHECK-APPLE-A7 %s
7+
// CHECK-APPLE-A7: '-mcpu=apple-a7'

test/Misc/target-cpu.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// RUN: not %swift -typecheck -target arm64-apple-ios7 -Xcc -### %s 2>&1 | %FileCheck -check-prefix=TARGETCPU1 %s
2-
// TARGETCPU1: "-target-cpu" "cyclone"
2+
// TARGETCPU1: "-target-cpu" "apple-a7"
33

44
// RUN: not %swift -typecheck -target arm64-apple-tvos9 -Xcc -### %s 2>&1 | %FileCheck -check-prefix=APPLETVTARGETCPU1 %s
5-
// APPLETVTARGETCPU1: "-target-cpu" "cyclone"
5+
// APPLETVTARGETCPU1: "-target-cpu" "apple-a7"
66

77
// RUN: not %swift -typecheck -target armv7s-apple-tvos9 -Xcc -### %s 2>&1 | %FileCheck -check-prefix=APPLETVTARGETCPU2 %s
88
// APPLETVTARGETCPU2: "-target-cpu" "swift"
@@ -14,7 +14,7 @@
1414
// WATCHTARGETCPU1: "-target-cpu" "cortex-a7"
1515

1616
// RUN: not %swift -typecheck -target arm64-apple-watchos2 -Xcc -### %s 2>&1 | %FileCheck -check-prefix=WATCHTARGETCPU2 %s
17-
// WATCHTARGETCPU2: "-target-cpu" "cyclone"
17+
// WATCHTARGETCPU2: "-target-cpu" "apple-a7"
1818

1919
// RUN: not %swift -typecheck -target armv7s-apple-ios7 -Xcc -### %s 2>&1 | %FileCheck -check-prefix=TARGETCPU2 %s
2020
// TARGETCPU2: "-target-cpu" "swift"

0 commit comments

Comments
 (0)