[RISCV] Support -mno-implicit-float.

This can be used to disable vectorization and memcpy/memset
expansion for things like OS kernels. It also disables implicit
uses of scalar FP, but I don't know if we have any of those for
RISC-V.

NOTE: Without this patch you can still do -Xclang -no-implicit-float

Reviewed By: rui.zhang

Differential Revision: https://reviews.llvm.org/D134077
This commit is contained in:
Craig Topper 2022-09-20 12:13:01 -07:00
parent a0c53524a5
commit 549231d38e
2 changed files with 10 additions and 0 deletions

View File

@ -2194,6 +2194,10 @@ void Clang::AddRISCVTargetArgs(const ArgList &Args,
SetRISCVSmallDataLimit(getToolChain(), Args, CmdArgs); 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)) { if (const Arg *A = Args.getLastArg(options::OPT_mtune_EQ)) {
CmdArgs.push_back("-tune-cpu"); CmdArgs.push_back("-tune-cpu");
CmdArgs.push_back(A->getValue()); CmdArgs.push_back(A->getValue());

View File

@ -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 // 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" // 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"