diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 7af0f9998455..fb64722b4456 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -2194,6 +2194,10 @@ void Clang::AddRISCVTargetArgs(const ArgList &Args, SetRISCVSmallDataLimit(getToolChain(), Args, CmdArgs); + if (!Args.hasFlag(options::OPT_mimplicit_float, + options::OPT_mno_implicit_float, true)) + CmdArgs.push_back("-no-implicit-float"); + if (const Arg *A = Args.getLastArg(options::OPT_mtune_EQ)) { CmdArgs.push_back("-tune-cpu"); CmdArgs.push_back(A->getValue()); diff --git a/clang/test/Driver/flags.c b/clang/test/Driver/flags.c index 656ac41a944f..da25a5cd3335 100644 --- a/clang/test/Driver/flags.c +++ b/clang/test/Driver/flags.c @@ -27,3 +27,9 @@ // RUN: %clang -target x86_64-linux-gnu -### -c -fclang-abi-compat=3.2 %s 2>&1 | FileCheck -check-prefix=TEST9 %s // TEST9: "-fclang-abi-compat=3.2" +// +// RUN: %clang -target riscv32 -### -S -mno-implicit-float %s 2>&1 | FileCheck -check-prefix=TEST10 %s +// TEST10: "-no-implicit-float" +// +// RUN: %clang -target riscv64 -### -S -mno-implicit-float %s 2>&1 | FileCheck -check-prefix=TEST11 %s +// TEST11: "-no-implicit-float"