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
This whole patch hinges on the unspoken assumption that this is a correct way to test for the absence of FP registers, i.e. that "-fpregs" will always appear in Features if there are no FP registers.
Could you add a comment stating that assumption explicitly and explaining why it's valid? In particular, why you're confident that the absence of FP registers might not sometimes be signalled by the lack of either "-fpregs" or "+fpregs" in that list.
(In a quick look at the code I think you're right, but I'm not 100% confident, and if you show your working then people will be able to work out what went wrong later if things change.)