[clang] fcd2fad - Revert "[ARM][Driver] Warn if -mhard-float is incompatible"
Michael Platings via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 6 03:06:02 PDT 2023
Author: Michael Platings
Date: 2023-06-06T11:05:46+01:00
New Revision: fcd2fadd0b8c2c2140615efaa9df0148f004f8dd
URL: https://github.com/llvm/llvm-project/commit/fcd2fadd0b8c2c2140615efaa9df0148f004f8dd
DIFF: https://github.com/llvm/llvm-project/commit/fcd2fadd0b8c2c2140615efaa9df0148f004f8dd.diff
LOG: Revert "[ARM][Driver] Warn if -mhard-float is incompatible"
An associated -W flag is needed.
This reverts commit 1d511e1864f142d08a491a89940d70c516a6c6a2.
Added:
Modified:
clang/include/clang/Basic/DiagnosticDriverKinds.td
clang/lib/Driver/ToolChains/Arch/ARM.cpp
Removed:
clang/test/Driver/arm-no-float-regs.c
################################################################################
diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td
index 0fce8d414336d..d7e59879cfa58 100644
--- a/clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -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<
diff --git a/clang/lib/Driver/ToolChains/Arch/ARM.cpp b/clang/lib/Driver/ToolChains/Arch/ARM.cpp
index 705457805ed64..d5d5ec6114a1d 100644
--- a/clang/lib/Driver/ToolChains/Arch/ARM.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/ARM.cpp
@@ -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.
@@ -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) {
@@ -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)) {
@@ -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) {
diff --git a/clang/test/Driver/arm-no-float-regs.c b/clang/test/Driver/arm-no-float-regs.c
deleted file mode 100644
index b542f7d2805fe..0000000000000
--- a/clang/test/Driver/arm-no-float-regs.c
+++ /dev/null
@@ -1,23 +0,0 @@
-// REQUIRES: arm-registered-target
-
-// Check that -mfloat-abi=hard gives a warning if FP registers aren't available.
-// RUN: %clang --target=arm-none-eabi -mcpu=cortex-m0 -mfloat-abi=hard -### -c %s 2>&1
-
-// RUN: %clang --target=arm-none-eabi -mcpu=cortex-m0 -mhard-float -### -c %s 2>&1 \
-// RUN: | FileCheck -check-prefix=HARDFLOAT %s
-
-// -mfloat-abi=hard and -march=...+nofp are incompatible in this instance:
-// RUN: %clang --target=arm-none-eabi -march=armv8.1-m.main+nofp -mfloat-abi=hard -### -c %s 2>&1
-// -mfloat-abi=hard and -march=...+nofp are compatible in this instance:
-// RUN: %clang --target=arm-none-eabi -march=armv8.1-m.main+mve+nofp -mfloat-abi=hard -### -c %s 2>&1 \
-// RUN: | FileCheck -check-prefix=NOWARN %s
-
-// Here the float ABI is calculated as "hard" and FP registers are
-// calculated to not be available. Since the float ABI wasn't specified
-// explicitly, the warning should not be emitted.
-// RUN: %clang -target thumbv5-windows -mcpu=arm10tdmi -### -c %s -o /dev/null 2>&1 \
-// RUN: | FileCheck -check-prefix=NOWARN %s
-
-// CHECK: warning: '-mfloat-abi=hard': selected processor lacks floating point registers
-// HARDFLOAT: warning: '-mhard-float': selected processor lacks floating point registers
-// NOWARN-NOT: selected processor lacks floating point registers
More information about the cfe-commits
mailing list