File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -799,8 +799,19 @@ importer::addCommonInvocationArguments(
799799 }
800800
801801 if (!importerOpts.TargetCPU .empty ()) {
802- invocationArgStrs.push_back (" -mcpu=" + importerOpts.TargetCPU );
803-
802+ switch (triple.getArch ()) {
803+ case llvm::Triple::x86:
804+ case llvm::Triple::x86_64:
805+ // `-mcpu` is deprecated and an alias for `-mtune`. We need to pass
806+ // `-march` and `-mtune` to behave identically to the `apple-a\d+` cases
807+ // below.
808+ invocationArgStrs.push_back (" -march=" + importerOpts.TargetCPU );
809+ invocationArgStrs.push_back (" -mtune=" + importerOpts.TargetCPU );
810+ break ;
811+ default :
812+ invocationArgStrs.push_back (" -mcpu=" + importerOpts.TargetCPU );
813+ break ;
814+ }
804815 } else if (triple.isOSDarwin ()) {
805816 // Special case CPU based on known deployments:
806817 // - arm64 deploys to apple-a7
Original file line number Diff line number Diff line change 4040// RUN: not %swift -typecheck -target s390x-unknown-linux-gnu -Xcc -### %s 2>&1 | %FileCheck -check-prefix=S390X_CPU %s
4141// S390X_CPU: "-target-cpu" "z13"
4242
43+ // RUN: not %swiftc -typecheck -target x86_64-unknown-windows-msvc -target-cpu haswell -Xcc -### %s 2>&1 | %FileCheck -check-prefix X86_64 %s
44+ // X86_64: "-target-cpu" "haswell"
45+ // X86_64: "-tune-cpu" "haswell"
You can’t perform that action at this time.
0 commit comments