Skip to content

Commit aa0aa5b

Browse files
committed
[ClangImporter] Pass -mcx16 to Clang invocation for x86_64 Linux targets
The Swift runtime and the concurrency module both use -mcx16, so there seems to be little point in not enabling it for Swift code in general. This allows packages like swift-atomics to rely on double wide atomics always being available. https://bugs.swift.org/browse/SR-13781
1 parent 3ad6d00 commit aa0aa5b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/ClangImporter/ClangImporter.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,11 @@ importer::addCommonInvocationArguments(
781781
invocationArgStrs.push_back("-march=z13");
782782
}
783783

784+
if (triple.isOSLinux() && triple.getArch() == llvm::Triple::x86_64) {
785+
// Enable double wide atomic intrinsics for x86_64 archs on Linux.
786+
invocationArgStrs.push_back("-mcx16");
787+
}
788+
784789
if (!importerOpts.Optimization.empty()) {
785790
invocationArgStrs.push_back(importerOpts.Optimization);
786791
}

0 commit comments

Comments
 (0)