From 7992a8c10f74f205f000a5e9f8320c29e868d363 Mon Sep 17 00:00:00 2001 From: Brad Smith <brad@comstyle.com> Date: Fri, 11 Jul 2014 20:12:08 +0000 Subject: [PATCH] Handle SPARC float command line parameters for SPARCv9. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212838 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Driver/Tools.cpp | 3 ++- test/Driver/sparc-float.c | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 test/Driver/sparc-float.c diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 3846d471bbb..ebac93c6ec8 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -1247,7 +1247,7 @@ void Clang::AddSparcTargetArgs(const ArgList &Args, ArgStringList &CmdArgs) const { const Driver &D = getToolChain().getDriver(); - // Select the float ABI as determined by -msoft-float, -mhard-float, and + // Select the float ABI as determined by -msoft-float and -mhard-float. StringRef FloatABI; if (Arg *A = Args.getLastArg(options::OPT_msoft_float, options::OPT_mhard_float)) { @@ -2857,6 +2857,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, break; case llvm::Triple::sparc: + case llvm::Triple::sparcv9: AddSparcTargetArgs(Args, CmdArgs); break; diff --git a/test/Driver/sparc-float.c b/test/Driver/sparc-float.c new file mode 100644 index 00000000000..36f99041737 --- /dev/null +++ b/test/Driver/sparc-float.c @@ -0,0 +1,38 @@ +// Check handling -mhard-float / -msoft-float options +// when build for SPARC platforms. +// +// Default sparc +// RUN: %clang -c %s -### -o %t.o 2>&1 \ +// RUN: -target sparc-linux-gnu \ +// RUN: | FileCheck --check-prefix=CHECK-DEF %s +// CHECK-DEF: "-msoft-float" +// +// -mhard-float +// RUN: %clang -c %s -### -o %t.o 2>&1 \ +// RUN: -target sparc-linux-gnu -mhard-float \ +// RUN: | FileCheck --check-prefix=CHECK-HARD %s +// CHECK-HARD: "-mhard-float" +// +// -msoft-float +// RUN: %clang -c %s -### -o %t.o 2>&1 \ +// RUN: -target sparc-linux-gnu -msoft-float \ +// RUN: | FileCheck --check-prefix=CHECK-SOFT %s +// CHECK-SOFT: "-msoft-float" +// +// Default sparc64 +// RUN: %clang -c %s -### -o %t.o 2>&1 \ +// RUN: -target sparc64-linux-gnu \ +// RUN: | FileCheck --check-prefix=CHECK-DEF-SPARC64 %s +// CHECK-DEF-SPARC64: "-msoft-float" +// +// -mhard-float +// RUN: %clang -c %s -### -o %t.o 2>&1 \ +// RUN: -target sparc64-linux-gnu -mhard-float \ +// RUN: | FileCheck --check-prefix=CHECK-HARD-SPARC64 %s +// CHECK-HARD-SPARC64: "-mhard-float" +// +// -msoft-float +// RUN: %clang -c %s -### -o %t.o 2>&1 \ +// RUN: -target sparc64-linux-gnu -msoft-float \ +// RUN: | FileCheck --check-prefix=CHECK-SOFT-SPARC64 %s +// CHECK-SOFT-MIPS16: "-msoft-float" -- GitLab