Skip to content

Commit

Permalink
Revert "[ARM][Driver] Warn if -mhard-float is incompatible"
Browse files Browse the repository at this point in the history
An associated -W flag is needed.

This reverts commit 1d511e1.
  • Loading branch information
mplatings committed Jun 6, 2023
1 parent cc7f524 commit fcd2fad
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 50 deletions.
2 changes: 0 additions & 2 deletions clang/include/clang/Basic/DiagnosticDriverKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,6 @@ def warn_drv_assuming_mfloat_abi_is : Warning<
def warn_drv_unsupported_float_abi_by_lib : Warning<
"float ABI '%0' is not supported by current library">,
InGroup<DiagGroup<"unsupported-abi">>;
def warn_drv_no_floating_point_registers: Warning<
"'%0': selected processor lacks floating point registers">;
def warn_ignoring_ftabstop_value : Warning<
"ignoring invalid -ftabstop value '%0', using default value %1">;
def warn_drv_overriding_flag_option : Warning<
Expand Down
29 changes: 4 additions & 25 deletions clang/lib/Driver/ToolChains/Arch/ARM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,22 +144,6 @@ static void checkARMCPUName(const Driver &D, const Arg *A, const ArgList &Args,
<< A->getSpelling() << A->getValue();
}

// If -mfloat-abi=hard or -mhard-float are specified explicitly then check that
// floating point registers are available on the target CPU.
static void checkARMFloatABI(const Driver &D, const ArgList &Args,
bool HasFPRegs) {
if (HasFPRegs)
return;
const Arg *A =
Args.getLastArg(options::OPT_msoft_float, options::OPT_mhard_float,
options::OPT_mfloat_abi_EQ);
if (A && (A->getOption().matches(options::OPT_mhard_float) ||
(A->getOption().matches(options::OPT_mfloat_abi_EQ) &&
A->getValue() == StringRef("hard"))))
D.Diag(clang::diag::warn_drv_no_floating_point_registers)
<< A->getAsString(Args);
}

bool arm::useAAPCSForMachO(const llvm::Triple &T) {
// The backend is hardwired to assume AAPCS for M-class processors, ensure
// the frontend matches that.
Expand Down Expand Up @@ -652,15 +636,13 @@ void arm::getARMTargetFeatures(const Driver &D, const llvm::Triple &Triple,
// -march/-mcpu effectively disables the FPU (GCC ignores the -mfpu options in
// this case). Note that the ABI can also be set implicitly by the target
// selected.
bool HasFPRegs = true;
if (ABI == arm::FloatABI::Soft) {
llvm::ARM::getFPUFeatures(llvm::ARM::FK_NONE, Features);

// Disable all features relating to hardware FP, not already disabled by the
// above call.
Features.insert(Features.end(),
{"-dotprod", "-fp16fml", "-bf16", "-mve", "-mve.fp"});
HasFPRegs = false;
Features.insert(Features.end(), {"-dotprod", "-fp16fml", "-bf16", "-mve",
"-mve.fp", "-fpregs"});
} else if (FPUKind == llvm::ARM::FK_NONE ||
ArchArgFPUKind == llvm::ARM::FK_NONE ||
CPUArgFPUKind == llvm::ARM::FK_NONE) {
Expand All @@ -670,10 +652,9 @@ void arm::getARMTargetFeatures(const Driver &D, const llvm::Triple &Triple,
// latter, is still supported.
Features.insert(Features.end(),
{"-dotprod", "-fp16fml", "-bf16", "-mve.fp"});
HasFPRegs = hasIntegerMVE(Features);
if (!hasIntegerMVE(Features))
Features.emplace_back("-fpregs");
}
if (!HasFPRegs)
Features.emplace_back("-fpregs");

// En/disable crc code generation.
if (Arg *A = Args.getLastArg(options::OPT_mcrc, options::OPT_mnocrc)) {
Expand Down Expand Up @@ -929,8 +910,6 @@ void arm::getARMTargetFeatures(const Driver &D, const llvm::Triple &Triple,

if (Args.getLastArg(options::OPT_mno_bti_at_return_twice))
Features.push_back("+no-bti-at-return-twice");

checkARMFloatABI(D, Args, HasFPRegs);
}

std::string arm::getARMArch(StringRef Arch, const llvm::Triple &Triple) {
Expand Down
23 changes: 0 additions & 23 deletions clang/test/Driver/arm-no-float-regs.c

This file was deleted.

0 comments on commit fcd2fad

Please sign in to comment.