r266211 - ARM: make Darwin's "-arch armv7em" default to hard-float.

Tim Northover via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 13 10:08:51 PDT 2016


Author: tnorthover
Date: Wed Apr 13 12:08:51 2016
New Revision: 266211

URL: http://llvm.org/viewvc/llvm-project?rev=266211&view=rev
Log:
ARM: make Darwin's "-arch armv7em" default to hard-float.

We've already paid the price for separate "armv7m" and "armv7em" slices
(support in other tools), it's silly to make them identical other than the
default CPU.

rdar://23055688

Modified:
    cfe/trunk/lib/Driver/Tools.cpp
    cfe/trunk/test/Driver/darwin-embedded.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=266211&r1=266210&r2=266211&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Apr 13 12:08:51 2016
@@ -803,7 +803,12 @@ arm::FloatABI arm::getARMFloatABI(const
         break;
       default:
         // Assume "soft", but warn the user we are guessing.
-        ABI = FloatABI::Soft;
+        if (Triple.isOSBinFormatMachO() &&
+            Triple.getSubArch() == llvm::Triple::ARMSubArch_v7em)
+          ABI = FloatABI::Hard;
+        else
+          ABI = FloatABI::Soft;
+
         if (Triple.getOS() != llvm::Triple::UnknownOS ||
             !Triple.isOSBinFormatMachO())
           D.Diag(diag::warn_drv_assuming_mfloat_abi_is) << "soft";

Modified: cfe/trunk/test/Driver/darwin-embedded.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/darwin-embedded.c?rev=266211&r1=266210&r2=266211&view=diff
==============================================================================
--- cfe/trunk/test/Driver/darwin-embedded.c (original)
+++ cfe/trunk/test/Driver/darwin-embedded.c Wed Apr 13 12:08:51 2016
@@ -1,6 +1,6 @@
 // RUN: %clang -target x86_64-apple-darwin -arch armv6m -resource-dir=%S/Inputs/resource_dir %s -### 2> %t
 // RUN: %clang -target x86_64-apple-darwin -arch armv7em -resource-dir=%S/Inputs/resource_dir %s -### 2>> %t
-// RUN: %clang -target x86_64-apple-darwin -arch armv7em -mhard-float -resource-dir=%S/Inputs/resource_dir %s -### 2>> %t
+// RUN: %clang -target x86_64-apple-darwin -arch armv7em -mfloat-abi=soft -resource-dir=%S/Inputs/resource_dir %s -### 2>> %t
 
 // RUN: %clang -target x86_64-apple-darwin -arch armv7m -fPIC -resource-dir=%S/Inputs/resource_dir %s -### 2>> %t
 // RUN: %clang -target x86_64-apple-darwin -arch armv7em -fPIC -mfloat-abi=hard -resource-dir=%S/Inputs/resource_dir %s -### 2>> %t
@@ -17,17 +17,18 @@
 // CHECK: "-mfloat-abi" "soft"
 // CHECK: libclang_rt.soft_static.a
 
-// ARMv7em does, but defaults to soft
+// ARMv7em does
 // CHECK-LABEL: Target:
 // CHECK-NOT: warning: unknown platform
-// CHECK: "-mfloat-abi" "soft"
-// CHECK: libclang_rt.soft_static.a
+// CHECK: "-mfloat-abi" "hard"
+// CHECK: libclang_rt.hard_static.a
 
-// Which can be overridden
+// but the ABI can be overridden
 // CHECK-LABEL: Target:
 // CHECK-NOT: warning: unknown platform
-// CHECK: "-mfloat-abi" "hard"
-// CHECK: libclang_rt.hard_static.a
+// CHECK: "-target-feature" "+soft-float"
+// CHECK: "-mfloat-abi" "soft"
+// CHECK: libclang_rt.soft_static.a
 
 // ARMv7m has no float either
 // CHECK-LABEL: Target:




More information about the cfe-commits mailing list