[llvm] r362380 - [ARM] Fix recent breakage of -mfpu=none.

Simon Tatham via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 3 04:02:54 PDT 2019


Author: statham
Date: Mon Jun  3 04:02:53 2019
New Revision: 362380

URL: http://llvm.org/viewvc/llvm-project?rev=362380&view=rev
Log:
[ARM] Fix recent breakage of -mfpu=none.

The recent change D60691 introduced a bug in clang when handling
option combinations such as `-mcpu=cortex-m4 -mfpu=none`. Those
options together should select Cortex-M4 but disable all use of
hardware FP, but in fact, now hardware FP instructions can still be
generated in that mode.

The reason is because the handling of FPUVersion::NONE disables all
the same feature names it used to, of which the base one is `vfp2`.
But now there are further features below that, like `vfp2d16fp` and
(following D60694) `fpregs`, which also need to be turned off to
disable hardware FP completely.

Added a tiny test which double-checks that compiling a simple FP
function doesn't access the FP registers.

Reviewers: SjoerdMeijer, dmgreen

Reviewed By: dmgreen

Subscribers: lebedev.ri, javed.absar, kristof.beyls, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

Modified:
    llvm/trunk/lib/Support/ARMTargetParser.cpp

Modified: llvm/trunk/lib/Support/ARMTargetParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/ARMTargetParser.cpp?rev=362380&r1=362379&r2=362380&view=diff
==============================================================================
--- llvm/trunk/lib/Support/ARMTargetParser.cpp (original)
+++ llvm/trunk/lib/Support/ARMTargetParser.cpp Mon Jun  3 04:02:53 2019
@@ -198,6 +198,7 @@ bool ARM::getFPUFeatures(unsigned FPUKin
     Features.push_back("-fp-armv8");
     break;
   case FPUVersion::NONE:
+    Features.push_back("-fpregs");
     Features.push_back("-vfp2");
     Features.push_back("-vfp3");
     Features.push_back("-fp16");




More information about the llvm-commits mailing list