[all-commits] [llvm/llvm-project] 1d511e: [ARM][Driver] Warn if -mhard-float is incompatible

Michael Platings via All-commits all-commits at lists.llvm.org
Tue Jun 6 01:10:13 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1d511e1864f142d08a491a89940d70c516a6c6a2
      https://github.com/llvm/llvm-project/commit/1d511e1864f142d08a491a89940d70c516a6c6a2
  Author: Michael Platings <michael.platings at arm.com>
  Date:   2023-06-06 (Tue, 06 Jun 2023)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticDriverKinds.td
    M clang/lib/Driver/ToolChains/Arch/ARM.cpp
    A clang/test/Driver/arm-no-float-regs.c

  Log Message:
  -----------
  [ARM][Driver] Warn if -mhard-float is incompatible

Mixing -mfloat-abi=hard with a CPU that doesn't have floating point
registers is an error in GCC:
  cc1: error: '-mfloat-abi=hard': selected processor lacks an FPU

Since there is code in the wild (including in clang tests) that relies
on Clang's current behaviour, emit a warning instead of an error.

Unlike the GCC error, the new warning refers to floating point
registers instead of an FPU. This is because -mfloat-abi=hard and
-march=armv8.1-m.main+mve+nofp are compatible - in that case floating
point registers are required, but an FPU is not required.

My initial thought was to use the floating point ABI calculated by
arm::getARMFloatABI() but in invalid cases which error for other
reasons the ABI is miscalculated and the warning would cause confusion.
Therefore only warn if the user specifies the float ABI explicitly.

Fixes part of https://github.com/llvm/llvm-project/issues/55755

Differential Revision: https://reviews.llvm.org/D150902




More information about the All-commits mailing list