aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Driver/Tools.cpp14
-rw-r--r--lib/Driver/Tools.h1
-rw-r--r--test/Driver/target-as.s8
3 files changed, 23 insertions, 0 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 445ae5358b..12833a8422 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -3325,6 +3325,15 @@ void ClangAs::AddARMTargetArgs(const ArgList &Args,
addFPMathArgs(D, A, Args, CmdArgs, getARMTargetCPU(Args, Triple));
}
+void ClangAs::AddX86TargetArgs(const ArgList &Args,
+ ArgStringList &CmdArgs) const {
+ // Set the CPU based on -march=.
+ if (const char *CPUName = getX86TargetCPU(Args, getToolChain().getTriple())) {
+ CmdArgs.push_back("-target-cpu");
+ CmdArgs.push_back(CPUName);
+ }
+}
+
/// Add options related to the Objective-C runtime/ABI.
///
/// Returns true if the runtime is non-fragile.
@@ -3500,6 +3509,11 @@ void ClangAs::ConstructJob(Compilation &C, const JobAction &JA,
case llvm::Triple::thumb:
AddARMTargetArgs(Args, CmdArgs);
break;
+
+ case llvm::Triple::x86:
+ case llvm::Triple::x86_64:
+ AddX86TargetArgs(Args, CmdArgs);
+ break;
}
// Ignore explicit -force_cpusubtype_ALL option.
diff --git a/lib/Driver/Tools.h b/lib/Driver/Tools.h
index f4aebd8bd2..846c834034 100644
--- a/lib/Driver/Tools.h
+++ b/lib/Driver/Tools.h
@@ -77,6 +77,7 @@ namespace tools {
/// \brief Clang integrated assembler tool.
class LLVM_LIBRARY_VISIBILITY ClangAs : public Tool {
void AddARMTargetArgs(const ArgList &Args, ArgStringList &CmdArgs) const;
+ void AddX86TargetArgs(const ArgList &Args, ArgStringList &CmdArgs) const;
public:
ClangAs(const ToolChain &TC) : Tool("clang::as",
"clang integrated assembler", TC) {}
diff --git a/test/Driver/target-as.s b/test/Driver/target-as.s
new file mode 100644
index 0000000000..adb3d10f14
--- /dev/null
+++ b/test/Driver/target-as.s
@@ -0,0 +1,8 @@
+// REQUIRES: clang-driver
+
+// Make sure the -march is passed down to cc1as.
+// RUN: %clang -target i386-unknown-freebsd -### -c -integrated-as %s \
+// RUN: -march=geode 2>&1 | FileCheck -check-prefix=TARGET %s
+//
+// TARGET: "-cc1as"
+// TARGET: "-target-cpu" "geode"