Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2876,6 +2876,17 @@ static void CollectArgsForIntegratedAssembler(Compilation &C,
CmdArgs.push_back("-target-feature");
CmdArgs.push_back(MipsTargetFeature);
}

// Those OSes default to enabling VIS on 64-bit SPARC.
// See also the corresponding code for external assemblers in
// sparc::getSparcAsmModeForCPU().
bool IsSparcV9ATarget =
(C.getDefaultToolChain().getArch() == llvm::Triple::sparcv9) &&
(Triple.isOSLinux() || Triple.isOSFreeBSD() || Triple.isOSOpenBSD());
if (IsSparcV9ATarget && SparcTargetFeatures.empty()) {
CmdArgs.push_back("-target-feature");
CmdArgs.push_back("+vis");
}
for (const char *Feature : SparcTargetFeatures) {
CmdArgs.push_back("-target-feature");
CmdArgs.push_back(Feature);
Expand Down
9 changes: 9 additions & 0 deletions clang/test/Driver/sparc-ias-Wa.s
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,12 @@
// V9D: "-target-feature" "+vis"
// V9D: "-target-feature" "+vis2"
// V9D: "-target-feature" "+vis3"

// RUN: %clang --target=sparc64-linux-gnu -### -fintegrated-as -c %s 2>&1 | \
// RUN: FileCheck -check-prefix=VIS-DEFAULT %s
// RUN: %clang --target=sparc64-freebsd -### -fintegrated-as -c %s 2>&1 | \
// RUN: FileCheck -check-prefix=VIS-DEFAULT %s
// RUN: %clang --target=sparc64-openbsd -### -fintegrated-as -c %s 2>&1 | \
// RUN: FileCheck -check-prefix=VIS-DEFAULT %s
// VIS-DEFAULT: -cc1as
// VIS-DEFAULT: "-target-feature" "+vis"