r319420 - [ARM] disable FPU features when using soft floating point.

Keith Walker via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 30 03:38:56 PST 2017


Author: kwalker
Date: Thu Nov 30 03:38:56 2017
New Revision: 319420

URL: http://llvm.org/viewvc/llvm-project?rev=319420&view=rev
Log:
[ARM] disable FPU features when using soft floating point.

To be compatible with GCC if soft floating point is in effect any FPU
specified is effectively ignored, eg,

  -mfloat-abi=soft -fpu=neon

If any floating point features which require FPU hardware are enabled
they must be disable.

There was some support for doing this for NEON, but it did not handle
VFP, nor did it prevent the backend from emitting the build attribute
Tag_FP_arch describing the generated code as using the floating point
hardware if a FPU was specified (even though soft float does not use
the FPU).

Disabling the hardware floating point features for targets which are
compiling for soft float has meant that some tests which were incorrectly
checking for hardware support also needed to be updated. In such cases,
where appropriate the tests have been updated to check compiling for
soft float and a non-soft float variant (usually softfp). This was
usually because the target specified in the test defaulted to soft float.

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

Modified:
    cfe/trunk/lib/Driver/ToolChains/Arch/ARM.cpp
    cfe/trunk/test/Driver/arm-cortex-cpus.c
    cfe/trunk/test/Driver/arm-dotprod.c
    cfe/trunk/test/Driver/arm-mfpu.c
    cfe/trunk/test/Preprocessor/arm-target-features.c

Modified: cfe/trunk/lib/Driver/ToolChains/Arch/ARM.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Arch/ARM.cpp?rev=319420&r1=319419&r2=319420&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/Arch/ARM.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Arch/ARM.cpp Thu Nov 30 03:38:56 2017
@@ -391,12 +391,22 @@ void arm::getARMTargetFeatures(const Too
   } else if (HDivArg)
     getARMHWDivFeatures(D, HDivArg, Args, HDivArg->getValue(), Features);
 
-  // Setting -msoft-float effectively disables NEON because of the GCC
-  // implementation, although the same isn't true of VFP or VFP3.
+  // Setting -msoft-float/-mfloat-abi=soft 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.
   if (ABI == arm::FloatABI::Soft) {
-    Features.push_back("-neon");
-    // Also need to explicitly disable features which imply NEON.
-    Features.push_back("-crypto");
+    llvm::ARM::getFPUFeatures(llvm::ARM::FK_NONE, Features);
+
+    // Disable hardware FP features which have been enabled.
+    // FIXME: Disabling vfp2 and neon should be enough as all the other
+    //        features are dependant on these 2 features in LLVM. However
+    //        there is currently no easy way to test this in clang, so for
+    //        now just be explicit and disable all known dependent features
+    //        as well.
+    for (std::string Feature : {"vfp2", "vfp3", "vfp4", "fp-armv8", "fullfp16",
+                                "neon", "crypto", "dotprod"})
+      if (std::find(std::begin(Features), std::end(Features), "+" + Feature) != std::end(Features))
+        Features.push_back("-" + Feature);
   }
 
   // En/disable crc code generation.

Modified: cfe/trunk/test/Driver/arm-cortex-cpus.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/arm-cortex-cpus.c?rev=319420&r1=319419&r2=319420&view=diff
==============================================================================
--- cfe/trunk/test/Driver/arm-cortex-cpus.c (original)
+++ cfe/trunk/test/Driver/arm-cortex-cpus.c Thu Nov 30 03:38:56 2017
@@ -284,13 +284,13 @@
 // RUN: %clang -target arm -march=armebv8.2-a -mbig-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V82A-THUMB %s
 // CHECK-BE-V82A-THUMB: "-cc1"{{.*}} "-triple" "thumbebv8.2a-{{.*}}" "-target-cpu" "generic"
 
-// RUN: %clang -target armv8a -march=armv8.2-a+fp16 -### -c %s 2>&1 | FileCheck --check-prefix CHECK-V82A-FP16 %s
+// RUN: %clang -target armv8a-linux-eabi -march=armv8.2-a+fp16 -### -c %s 2>&1 | FileCheck --check-prefix CHECK-V82A-FP16 %s
 // CHECK-V82A-FP16: "-cc1"{{.*}} "-triple" "armv8.2{{.*}}" "-target-cpu" "generic" {{.*}}"-target-feature" "+fullfp16"
 
 // Once we have CPUs with optional v8.2-A FP16, we will need a way to turn it
 // on and off. Cortex-A53 is a placeholder for now.
-// RUN: %clang -target armv8a -mcpu=cortex-a53+fp16 -### -c %s 2>&1 | FileCheck --check-prefix CHECK-CORTEX-A53-FP16 %s
-// RUN: %clang -target armv8a -mcpu=cortex-a53+nofp16 -### -c %s 2>&1 | FileCheck --check-prefix CHECK-CORTEX-A53-NOFP16 %s
+// RUN: %clang -target armv8a-linux-eabi -mcpu=cortex-a53+fp16 -### -c %s 2>&1 | FileCheck --check-prefix CHECK-CORTEX-A53-FP16 %s
+// RUN: %clang -target armv8a-linux-eabi -mcpu=cortex-a53+nofp16 -### -c %s 2>&1 | FileCheck --check-prefix CHECK-CORTEX-A53-NOFP16 %s
 // CHECK-CORTEX-A53-FP16: "-cc1" {{.*}}"-target-cpu" "cortex-a53" {{.*}}"-target-feature" "+fullfp16"
 // CHECK-CORTEX-A53-NOFP16: "-cc1" {{.*}}"-target-cpu" "cortex-a53" {{.*}}"-target-feature" "-fullfp16"
 

Modified: cfe/trunk/test/Driver/arm-dotprod.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/arm-dotprod.c?rev=319420&r1=319419&r2=319420&view=diff
==============================================================================
--- cfe/trunk/test/Driver/arm-dotprod.c (original)
+++ cfe/trunk/test/Driver/arm-dotprod.c Thu Nov 30 03:38:56 2017
@@ -4,8 +4,21 @@
 // RUN: %clang -### -target arm -march=armv8.3a %s 2>&1 | FileCheck %s --check-prefix=CHECK-NONE
 // CHECK-NONE-NOT: "-target-feature" "+dotprod"
 
-// RUN: %clang -### -target arm -march=armv8.2a+dotprod %s 2>&1 | FileCheck %s
-// RUN: %clang -### -target arm -march=armv8.3a+dotprod %s 2>&1 | FileCheck %s
-// RUN: %clang -### -target arm -mcpu=cortex-a75 %s 2>&1 | FileCheck %s
-// RUN: %clang -### -target arm -mcpu=cortex-a55 %s 2>&1 | FileCheck %s
+// RUN: %clang -### -target arm-linux-eabi -march=armv8.2a+dotprod %s 2>&1 | FileCheck %s
+// RUN: %clang -### -target arm-linux-eabi -march=armv8.3a+dotprod %s 2>&1 | FileCheck %s
+// RUN: %clang -### -target arm-linux-eabi -mcpu=cortex-a75 %s 2>&1 | FileCheck %s
+// RUN: %clang -### -target arm-linux-eabi -mcpu=cortex-a55 %s 2>&1 | FileCheck %s
 // CHECK: "+dotprod"
+
+// The following default to -msoft-float
+// RUN: %clang -### -target arm -march=armv8.2a+dotprod %s 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-NO-DOTPROD
+// RUN: %clang -### -target arm -march=armv8.3a+dotprod %s 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-NO-DOTPROD
+// RUN: %clang -### -target arm -mcpu=cortex-a75 %s 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-NO-DOTPROD
+// RUN: %clang -### -target arm -mcpu=cortex-a55 %s 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-NO-DOTPROD
+// We rely on the backend disabling dotprod as it depends on neon, so check that
+// neon is disabled after the dotprod was enabled.
+// CHECK-NO-DOTPROD-NOT: "+dotprod"

Modified: cfe/trunk/test/Driver/arm-mfpu.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/arm-mfpu.c?rev=319420&r1=319419&r2=319420&view=diff
==============================================================================
--- cfe/trunk/test/Driver/arm-mfpu.c (original)
+++ cfe/trunk/test/Driver/arm-mfpu.c Thu Nov 30 03:38:56 2017
@@ -2,6 +2,8 @@
 
 // RUN: %clang -target arm-linux-eabi %s -### -o %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-DEFAULT %s
+// CHECK-DEFAULT-NOT: "-target-feature" "+soft-float"
+// CHECK-DEFAULT: "-target-feature" "+soft-float-abi"
 // CHECK-DEFAULT-NOT: "-target-feature" "+vfp2"
 // CHECK-DEFAULT-NOT: "-target-feature" "+vfp3"
 // CHECK-DEFAULT-NOT: "-target-feature" "+d16"
@@ -19,6 +21,10 @@
 
 // RUN: %clang -target arm-linux-eabi -mfpu=vfp %s -### -o %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-VFP %s
+// RUN: %clang -target arm-linux-eabi -mfpu=vfp %s -mfloat-abi=soft -### -o %t.o 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-SOFT-ABI-FP %s
+// CHECK-VFP-NOT: "-target-feature" "+soft-float"
+// CHECK-VFP: "-target-feature" "+soft-float-abi"
 // CHECK-VFP: "-target-feature" "+vfp2"
 // CHECK-VFP: "-target-feature" "-vfp3"
 // CHECK-VFP: "-target-feature" "-vfp4"
@@ -29,6 +35,10 @@
 // RUN:   | FileCheck --check-prefix=CHECK-VFP3 %s
 // RUN: %clang -target arm-linux-eabi -mfpu=vfpv3 %s -### -o %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-VFP3 %s
+// RUN: %clang -target arm-linux-eabi -mfpu=vfpv3 -mfloat-abi=soft %s -### -o %t.o 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-SOFT-ABI-FP %s
+// CHECK-VFP3-NOT: "-target-feature" "+soft-float"
+// CHECK-VFP3: "-target-feature" "+soft-float-abi"
 // CHECK-VFP3: "-target-feature" "+vfp3"
 // CHECK-VFP3: "-target-feature" "-vfp4"
 // CHECK-VFP3: "-target-feature" "-fp-armv8"
@@ -36,6 +46,10 @@
 
 // RUN: %clang -target arm-linux-eabi -mfpu=vfpv3-fp16 %s -### -o %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-VFP3-FP16 %s
+// RUN: %clang -target arm-linux-eabi -mfpu=vfpv3-fp16 -mfloat-abi=soft %s -### -o %t.o 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-SOFT-ABI-FP %s
+// CHECK-VFP3-FP16-NOT: "-target-feature" "+soft-float"
+// CHECK-VFP3-FP16: "-target-feature" "+soft-float-abi"
 // CHECK-VFP3-FP16: "-target-feature" "-fp-only-sp"
 // CHECK-VFP3-FP16: "-target-feature" "-d16"
 // CHECK-VFP3-FP16: "-target-feature" "+vfp3"
@@ -49,6 +63,10 @@
 // RUN:   | FileCheck --check-prefix=CHECK-VFP3-D16 %s
 // RUN: %clang -target arm-linux-eabi -mfpu=vfpv3-d16 %s -### -o %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-VFP3-D16 %s
+// RUN: %clang -target arm-linux-eabi -mfpu=vfpv3-d16 -mfloat-abi=soft %s -### -o %t.o 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-SOFT-ABI-FP %s
+// CHECK-VFP3-D16-NOT: "-target-feature" "+soft-float"
+// CHECK-VFP3-D16: "-target-feature" "+soft-float-abi"
 // CHECK-VFP3-D16: "-target-feature" "-fp-only-sp"
 // CHECK-VFP3-D16: "-target-feature" "+d16"
 // CHECK-VFP3-D16: "-target-feature" "+vfp3"
@@ -58,6 +76,10 @@
 
 // RUN: %clang -target arm-linux-eabi -mfpu=vfpv3-d16-fp16 %s -### -o %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-VFP3-D16-FP16 %s
+// RUN: %clang -target arm-linux-eabi -mfpu=vfpv3-d16-fp16 -mfloat-abi=soft %s -### -o %t.o 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-SOFT-ABI-FP %s
+// CHECK-VFP3-D16-FP16-NOT: "-target-feature" "+soft-float"
+// CHECK-VFP3-D16-FP16: "-target-feature" "+soft-float-abi"
 // CHECK-VFP3-D16-FP16: "-target-feature" "-fp-only-sp"
 // CHECK-VFP3-D16-FP16: "-target-feature" "+d16"
 // CHECK-VFP3-D16-FP16: "-target-feature" "+vfp3"
@@ -69,6 +91,10 @@
 
 // RUN: %clang -target arm-linux-eabi -mfpu=vfpv3xd %s -### -o %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-VFP3XD %s
+// RUN: %clang -target arm-linux-eabi -mfpu=vfpv3xd -mfloat-abi=soft %s -### -o %t.o 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-SOFT-ABI-FP %s
+// CHECK-VFP3XD-NOT: "-target-feature" "+soft-float"
+// CHECK-VFP3XD: "-target-feature" "+soft-float-abi"
 // CHECK-VFP3XD: "-target-feature" "+fp-only-sp"
 // CHECK-VFP3XD: "-target-feature" "+d16"
 // CHECK-VFP3XD: "-target-feature" "+vfp3"
@@ -80,6 +106,10 @@
 
 // RUN: %clang -target arm-linux-eabi -mfpu=vfpv3xd-fp16 %s -### -o %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-VFP3XD-FP16 %s
+// RUN: %clang -target arm-linux-eabi -mfpu=vfpv3xd-fp16 -mfloat-abi=soft %s -### -o %t.o 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-SOFT-ABI-FP %s
+// CHECK-VFP3XD-FP16-NOT: "-target-feature" "+soft-float"
+// CHECK-VFP3XD-FP16: "-target-feature" "+soft-float-abi"
 // CHECK-VFP3XD-FP16: "-target-feature" "+fp-only-sp"
 // CHECK-VFP3XD-FP16: "-target-feature" "+d16"
 // CHECK-VFP3XD-FP16: "-target-feature" "+vfp3"
@@ -93,6 +123,10 @@
 // RUN:   | FileCheck --check-prefix=CHECK-VFP4 %s
 // RUN: %clang -target arm-linux-eabi -mfpu=vfpv4 %s -### -o %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-VFP4 %s
+// RUN: %clang -target arm-linux-eabi -mfpu=vfpv4 -mfloat-abi=soft %s -### -o %t.o 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-SOFT-ABI-FP %s
+// CHECK-VFP4-NOT: "-target-feature" "+soft-float"
+// CHECK-VFP4: "-target-feature" "+soft-float-abi"
 // CHECK-VFP4: "-target-feature" "+vfp4"
 // CHECK-VFP4: "-target-feature" "-fp-armv8"
 // CHECK-VFP4: "-target-feature" "-neon"
@@ -101,6 +135,10 @@
 // RUN:   | FileCheck --check-prefix=CHECK-VFP4-D16 %s
 // RUN: %clang -target arm-linux-eabi -mfpu=vfpv4-d16 %s -### -o %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-VFP4-D16 %s
+// RUN: %clang -target arm-linux-eabi -mfpu=vfpv4-d16 -mfloat-abi=soft %s -### -o %t.o 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-SOFT-ABI-FP %s
+// CHECK-VFP4-D16-NOT: "-target-feature" "+soft-float"
+// CHECK-VFP4-D16: "-target-feature" "+soft-float-abi"
 // CHECK-VFP4-D16: "-target-feature" "-fp-only-sp"
 // CHECK-VFP4-D16: "-target-feature" "+d16"
 // CHECK-VFP4-D16: "-target-feature" "+vfp4"
@@ -111,6 +149,10 @@
 // RUN:   | FileCheck --check-prefix=CHECK-FP4-SP-D16 %s
 // RUN: %clang -target arm-linux-eabi -mfpu=fpv4-sp-d16 %s -### -o %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-FP4-SP-D16 %s
+// RUN: %clang -target arm-linux-eabi -mfpu=fpv4-sp-d16 -mfloat-abi=soft %s -### -o %t.o 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-SOFT-ABI-FP %s
+// CHECK-FP4-SP-D16-NOT: "-target-feature" "+soft-float"
+// CHECK-FP4-SP-D16: "-target-feature" "+soft-float-abi"
 // CHECK-FP4-SP-D16: "-target-feature" "+fp-only-sp"
 // CHECK-FP4-SP-D16: "-target-feature" "+d16"
 // CHECK-FP4-SP-D16: "-target-feature" "+vfp4"
@@ -121,6 +163,10 @@
 // RUN:   | FileCheck --check-prefix=CHECK-FP5-SP-D16 %s
 // RUN: %clang -target arm-linux-eabi -mfpu=fpv5-sp-d16 %s -### -o %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-FP5-SP-D16 %s
+// RUN: %clang -target arm-linux-eabi -mfpu=fp-armv8-sp-d16 -mfloat-abi=soft %s -### -o %t.o \
+// RUN:   2>&1 | FileCheck --check-prefix=CHECK-SOFT-ABI-FP %s
+// CHECK-FP5-SP-D16-NOT: "-target-feature" "+soft-float"
+// CHECK-FP5-SP-D16: "-target-feature" "+soft-float-abi"
 // CHECK-FP5-SP-D16: "-target-feature" "+fp-only-sp"
 // CHECK-FP5-SP-D16: "-target-feature" "+d16"
 // CHECK-FP5-SP-D16: "-target-feature" "+fp-armv8"
@@ -131,6 +177,10 @@
 // RUN:   | FileCheck --check-prefix=CHECK-FP5-DP-D16 %s
 // RUN: %clang -target arm-linux-eabi -mfpu=fpv5-dp-d16 %s -### -o %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-FP5-DP-D16 %s
+// RUN: %clang -target arm-linux-eabi -mfpu=fpv5-dp-d16 %s -mfloat-abi=soft -### -o %t.o 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-SOFT-ABI-FP %s
+// CHECK-FP5-DP-D16-NOT: "-target-feature" "+soft-float"
+// CHECK-FP5-DP-D16: "-target-feature" "+soft-float-abi"
 // CHECK-FP5-DP-D16: "-target-feature" "-fp-only-sp"
 // CHECK-FP5-DP-D16: "-target-feature" "+d16"
 // CHECK-FP5-DP-D16: "-target-feature" "+fp-armv8"
@@ -139,10 +189,17 @@
 
 // RUN: %clang -target arm-linux-eabi -mfpu=neon %s -### -o %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NEON %s
+// RUN: %clang -target arm-linux-eabi -mfpu=neon -mfloat-abi=soft %s -### -o %t.o 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-SOFT-ABI-FP %s
+// CHECK-NEON-NOT: "-target-feature" "+soft-float"
 // CHECK-NEON: "-target-feature" "+neon"
 
 // RUN: %clang -target arm-linux-eabi -mfpu=neon-fp16 %s -### -o %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NEON-FP16 %s
+// RUN: %clang -target arm-linux-eabi -mfpu=neon-fp16 -mfloat-abi=soft %s -### -o %t.o 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-SOFT-ABI-FP %s
+// CHECK-NEON-FP16-NOT: "-target-feature" "+soft-float"
+// CHECK-NEON-FP16: "-target-feature" "+soft-float-abi"
 // CHECK-NEON-FP16: "-target-feature" "-fp-only-sp"
 // CHECK-NEON-FP16: "-target-feature" "-d16"
 // CHECK-NEON-FP16: "-target-feature" "+vfp3"
@@ -154,48 +211,64 @@
 
 // RUN: %clang -target arm-linux-eabi -mfpu=neon-vfpv3 %s -### -o %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NEON-VFPV3 %s
+// RUN: %clang -target arm-linux-eabi -mfpu=neon-vfpv3 -mfloat-abi=soft %s -### -o %t.o 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-SOFT-ABI-FP %s
+// CHECK-NEON-VFPV3-NOT: "-target-feature" "+soft-float"
+// CHECK-NEON-VFPV3: "-target-feature" "+soft-float-abi"
+// CHECK-NEON-VFPV3: "-target-feature" "+vfp3"
 // CHECK-NEON-VFPV3: "-target-feature" "+neon"
 
 // RUN: %clang -target arm-linux-eabi -mfpu=neon-vfpv4 %s -### -o %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NEON-VFPV4 %s
+// RUN: %clang -target arm-linux-eabi -mfpu=neon-vfpv4 -mfloat-abi=soft %s -### -o %t.o 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-SOFT-ABI-FP %s
+// CHECK-NEON-VFPV4-NOT: "-target-feature" "+soft-float"
+// CHECK-NEON-VFPV4: "-target-feature" "+soft-float-abi"
 // CHECK-NEON-VFPV4: "-target-feature" "+vfp4"
 // CHECK-NEON-VFPV4: "-target-feature" "+neon"
 
 // RUN: %clang -target arm-linux-eabi -msoft-float %s -### -o %t.o 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-SOFT-FLOAT %s
-// CHECK-SOFT-FLOAT: "-target-feature" "-neon"
-
+// RUN:   | FileCheck --check-prefix=CHECK-SOFT-ABI-FP %s
 // RUN: %clang -target armv8 %s -### 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-ARMV8-DEFAULT-SOFT-FP %s
-// CHECK-ARMV8-DEFAULT-SOFT-FP: "-target-feature" "-neon"
-// CHECK-ARMV8-DEFAULT-SOFT-FP: "-target-feature" "-crypto"
+// RUN:   | FileCheck --check-prefix=CHECK-SOFT-ABI-FP %s
+// RUN: %clang -target armv8a -mfpu=neon %s -### -c 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-SOFT-ABI-FP %s
 
 // RUN: %clang -target armv8 -mfpu=fp-armv8 %s -### 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-ARMV8-SOFT-FLOAT %s
-// CHECK-ARMV8-SOFT-FLOAT: "-target-feature" "+fp-armv8"
-// CHECK-ARMV8-SOFT-FLOAT: "-target-feature" "-neon"
+// CHECK-ARMV8-SOFT-FLOAT: "-target-feature" "+soft-float"
+// CHECK-ARMV8-SOFT-FLOAT: "-target-feature" "+soft-float-abi"
+// NOT-CHECK-ARMV8-SOFT-FLOAT: "-target-feature" "+fp-armv8"
+// CHECK-ARMV9-SOFT-FLOAT: "-target-feature" "-neon"
 // CHECK-ARMV8-SOFT-FLOAT: "-target-feature" "-crypto"
 
 // RUN: %clang -target armv8-linux-gnueabihf -mfpu=fp-armv8 %s -### 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-FP-ARMV8 %s
-// CHECK-FP-ARMV8-NOT: "-target-feature" "+neon"
+// CHECK-FP-ARMV8-NOT: "-target-feature" "+soft-float"
+// CHECK-FP-ARMV8-NOT: "-target-feature" "+soft-float-abi"
 // CHECK-FP-ARMV8: "-target-feature" "+fp-armv8"
 // CHECK-FP-ARMV8: "-target-feature" "-neon"
 // CHECK-FP-ARMV8: "-target-feature" "-crypto"
 
 // RUN: %clang -target armv8-linux-gnueabihf -mfpu=neon-fp-armv8 %s -### 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NEON-FP-ARMV8 %s
+// CHECK-NEON-FP-ARMV8-NOT: "-target-feature" "+soft-float"
+// CHECK-NEON-FP-ARMV8-NOT: "-target-feature" "+soft-float-abi"
 // CHECK-NEON-FP-ARMV8: "-target-feature" "+fp-armv8"
 // CHECK-NEON-FP-ARMV8: "-target-feature" "+neon"
 // CHECK-NEON-FP-ARMV8: "-target-feature" "-crypto"
 
 // RUN: %clang -target armv8-linux-gnueabihf -mfpu=crypto-neon-fp-armv8 %s -### 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-CRYPTO-NEON-FP-ARMV8 %s
+// CHECK-CRYPTO-NEON-FP-ARMV8-NOT: "-target-feature" "+soft-float"
+// CHECK-CRYPTO-NEON-FP-ARMV8-NOT: "-target-feature" "+soft-float-abi"
 // CHECK-CRYPTO-NEON-FP-ARMV8: "-target-feature" "+fp-armv8"
 // CHECK-CRYPTO-NEON-FP-ARMV8: "-target-feature" "+crypto"
 
 // RUN: %clang -target armv8-linux-gnueabi -mfpu=none %s -### 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NO-FP %s
+// CHECK-NO-FP-NOT: "-target-feature" "+soft-float"
+// CHECK-NO-FP: "-target-feature" "+soft-float-abi"
 // CHECK-NO-FP: "-target-feature" "-fp-only-sp"
 // CHECK-NO-FP: "-target-feature" "-d16"
 // CHECK-NO-FP: "-target-feature" "-vfp2"
@@ -209,8 +282,34 @@
 // RUN:   | FileCheck --check-prefix=CHECK-HF %s
 // RUN: %clang -target arm-linux-musleabihf %s -### 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-HF %s
+// CHECK-HF-NOT: "-target-feature" "+soft-float"
+// CHECK-HF-NOT: "-target-feature" "+soft-float-abi"
 // CHECK-HF: "-target-cpu" "arm1176jzf-s"
 
 // RUN: %clang -target armv7-apple-darwin -x assembler %s -### -c 2>&1 \
 // RUN:   | FileCheck --check-prefix=ASM %s
 // ASM-NOT: -target-feature
+
+// RUN: %clang -target armv8-linux-gnueabi -mfloat-abi=soft -mfpu=none %s -### -c 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-SOFT-ABI-FP %s
+// RUN: %clang -target armv7-linux-gnueabi -mfloat-abi=soft -mfpu=none %s -### -c 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-SOFT-ABI-FP %s
+// RUN: %clang -target armv6-linux-gnueabi -mfloat-abi=soft -mfpu=none %s -### -c 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-SOFT-ABI-FP %s
+// RUN: %clang -target armv5-linux-gnueabi -mfloat-abi=soft -mfpu=none %s -### -c 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-SOFT-ABI-FP %s
+// RUN: %clang -target armv4-linux-gnueabi -mfloat-abi=soft -mfpu=none %s -### -c 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-SOFT-ABI-FP %s
+// RUN: %clang -target armv8-linux-gnueabi -msoft-float -mfpu=none %s -### -c 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-SOFT-ABI-FP %s
+// RUN: %clang -target armv8-linux-gnueabi -mfloat-abi=soft %s -### -c 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-SOFT-ABI-FP %s
+// RUN: %clang -target armv8-linux-gnueabi -msoft-float %s -### -c 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-SOFT-ABI-FP %s
+// CHECK-SOFT-ABI-FP: "-target-feature" "+soft-float-abi"
+// CHECK-SOFT-ABI-FP: "-target-feature" "-vfp2"
+// CHECK-SOFT-ABI-FP: "-target-feature" "-vfp3"
+// CHECK-SOFT-ABI-FP: "-target-feature" "-vfp4"
+// CHECK-SOFT-ABI-FP: "-target-feature" "-fp-armv8"
+// CHECK-SOFT-ABI-FP: "-target-feature" "-neon"
+// CHECK-SOFT-ABI-FP: "-target-feature" "-crypto"

Modified: cfe/trunk/test/Preprocessor/arm-target-features.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/arm-target-features.c?rev=319420&r1=319419&r2=319420&view=diff
==============================================================================
--- cfe/trunk/test/Preprocessor/arm-target-features.c (original)
+++ cfe/trunk/test/Preprocessor/arm-target-features.c Thu Nov 30 03:38:56 2017
@@ -5,10 +5,22 @@
 // CHECK-V8A: #define __ARM_FEATURE_CRC32 1
 // CHECK-V8A: #define __ARM_FEATURE_DIRECTED_ROUNDING 1
 // CHECK-V8A: #define __ARM_FEATURE_NUMERIC_MAXMIN 1
-// CHECK-V8A: #define __ARM_FP 0xE
+// CHECK-V8A-NOT: #define __ARM_FP 0x
 // CHECK-V8A: #define __ARM_FP16_ARGS 1
 // CHECK-V8A: #define __ARM_FP16_FORMAT_IEEE 1
 
+// RUN: %clang -target armv8a-none-linux-gnueabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V8A-ALLOW-FP-INSTR %s
+// RUN: %clang -target armv8a-none-linux-gnueabihf -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V8A-ALLOW-FP-INSTR %s
+// CHECK-V8A-ALLOW-FP-INSTR: #define __ARMEL__ 1
+// CHECK-V8A-ALLOW-FP-INSTR: #define __ARM_ARCH 8
+// CHECK-V8A-ALLOW-FP-INSTR: #define __ARM_ARCH_8A__ 1
+// CHECK-V8A-ALLOW-FP-INSTR: #define __ARM_FEATURE_CRC32 1
+// CHECK-V8A-ALLOW-FP-INSTR: #define __ARM_FEATURE_DIRECTED_ROUNDING 1
+// CHECK-V8A-ALLOW-FP-INSTR: #define __ARM_FEATURE_NUMERIC_MAXMIN 1
+// CHECK-V8A-ALLOW-FP-INSTR: #define __ARM_FP 0xE
+// CHECK-V8A-ALLOW-FP-INSTR: #define __ARM_FP16_ARGS 1
+// CHECK-V8A-ALLOW-FP-INSTR: #define __ARM_FP16_FORMAT_IEEE 1
+
 // RUN: %clang -target armv8r-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V8R %s
 // CHECK-V8R: #define __ARMEL__ 1
 // CHECK-V8R: #define __ARM_ARCH 8
@@ -16,7 +28,17 @@
 // CHECK-V8R: #define __ARM_FEATURE_CRC32 1
 // CHECK-V8R: #define __ARM_FEATURE_DIRECTED_ROUNDING 1
 // CHECK-V8R: #define __ARM_FEATURE_NUMERIC_MAXMIN 1
-// CHECK-V8R: #define __ARM_FP 0xE
+// CHECK-V8R-NOT: #define __ARM_FP 0x
+
+// RUN: %clang -target armv8r-none-linux-gnueabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V8R-ALLOW-FP-INSTR %s
+// RUN: %clang -target armv8r-none-linux-gnueabihf -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V8R-ALLOW-FP-INSTR %s
+// CHECK-V8R-ALLOW-FP-INSTR: #define __ARMEL__ 1
+// CHECK-V8R-ALLOW-FP-INSTR: #define __ARM_ARCH 8
+// CHECK-V8R-ALLOW-FP-INSTR: #define __ARM_ARCH_8R__ 1
+// CHECK-V8R-ALLOW-FP-INSTR: #define __ARM_FEATURE_CRC32 1
+// CHECK-V8R-ALLOW-FP-INSTR: #define __ARM_FEATURE_DIRECTED_ROUNDING 1
+// CHECK-V8R-ALLOW-FP-INSTR: #define __ARM_FEATURE_NUMERIC_MAXMIN 1
+// CHECK-V8R-ALLOW-FP-INSTR: #define __ARM_FP 0xE
 
 // RUN: %clang -target armv7a-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V7 %s
 // CHECK-V7: #define __ARMEL__ 1
@@ -25,14 +47,32 @@
 // CHECK-V7-NOT: __ARM_FEATURE_CRC32
 // CHECK-V7-NOT: __ARM_FEATURE_NUMERIC_MAXMIN
 // CHECK-V7-NOT: __ARM_FEATURE_DIRECTED_ROUNDING
-// CHECK-V7: #define __ARM_FP 0xC
+// CHECK-V7-NOT: #define __ARM_FP 0x
+
+// RUN: %clang -target armv7a-none-linux-gnueabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V7-ALLOW-FP-INSTR %s
+// RUN: %clang -target armv7a-none-linux-gnueabihf -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V7-ALLOW-FP-INSTR %s
+// CHECK-V7-ALLOW-FP-INSTR: #define __ARMEL__ 1
+// CHECK-V7-ALLOW-FP-INSTR: #define __ARM_ARCH 7
+// CHECK-V7-ALLOW-FP-INSTR: #define __ARM_ARCH_7A__ 1
+// CHECK-V7-ALLOW-FP-INSTR-NOT: __ARM_FEATURE_CRC32
+// CHECK-V7-ALLOW-FP-INSTR-NOT: __ARM_FEATURE_NUMERIC_MAXMIN
+// CHECK-V7-ALLOW-FP-INSTR-NOT: __ARM_FEATURE_DIRECTED_ROUNDING
+// CHECK-V7-ALLOW-FP-INSTR: #define __ARM_FP 0xC
 
 // RUN: %clang -target armv7ve-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V7VE %s
 // CHECK-V7VE: #define __ARMEL__ 1
 // CHECK-V7VE: #define __ARM_ARCH 7
 // CHECK-V7VE: #define __ARM_ARCH_7VE__ 1
 // CHECK-V7VE: #define __ARM_ARCH_EXT_IDIV__ 1
-// CHECK-V7VE: #define __ARM_FP 0xC
+// CHECK-V7VE-NOT: #define __ARM_FP 0x
+
+// RUN: %clang -target armv7ve-none-linux-gnueabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V7VE-DEFAULT-ABI-SOFT %s
+// RUN: %clang -target armv7ve-none-linux-gnueabihf -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V7VE-DEFAULT-ABI-SOFT %s
+// CHECK-V7VE-DEFAULT-ABI-SOFT: #define __ARMEL__ 1
+// CHECK-V7VE-DEFAULT-ABI-SOFT: #define __ARM_ARCH 7
+// CHECK-V7VE-DEFAULT-ABI-SOFT: #define __ARM_ARCH_7VE__ 1
+// CHECK-V7VE-DEFAULT-ABI-SOFT: #define __ARM_ARCH_EXT_IDIV__ 1
+// CHECK-V7VE-DEFAULT-ABI-SOFT: #define __ARM_FP 0xC
 
 // RUN: %clang -target x86_64-apple-macosx10.10 -arch armv7s -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V7S %s
 // CHECK-V7S: #define __ARMEL__ 1
@@ -85,10 +125,15 @@
 
 // RUN: %clang -target armv8a -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8A %s
 // RUN: %clang -target armv8a -mthumb -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8A %s
-// RUN: %clang -target armv8a-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8A %s
-// RUN: %clang -target armv8a-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8A %s
 // V8A:#define __ARM_ARCH_EXT_IDIV__ 1
-// V8A:#define __ARM_FP 0xE
+// V8A-NOT:#define __ARM_FP 0x
+
+// RUN: %clang -target armv8a-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8A-ALLOW-FP-INSTR %s
+// RUN: %clang -target armv8a-eabi -mthumb -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8A-ALLOW-FP-INSTR %s
+// RUN: %clang -target armv8a-eabihf -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8A-ALLOW-FP-INSTR %s
+// RUN: %clang -target armv8a-eabihf -mthumb -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8A-ALLOW-FP-INSTR %s
+// V8A-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
+// V8A-ALLOW-FP-INSTR:#define __ARM_FP 0xE
 
 // RUN: %clang -target armv8m.base-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8M_BASELINE %s
 // V8M_BASELINE: #define __ARM_ARCH 8
@@ -111,9 +156,22 @@
 // V8M_MAINLINE: #define __ARM_ARCH_PROFILE 'M'
 // V8M_MAINLINE-NOT: __ARM_FEATURE_CRC32
 // V8M_MAINLINE-NOT: __ARM_FEATURE_DSP
-// V8M_MAINLINE: #define __ARM_FP 0xE
+// V8M_MAINLINE-NOT: #define __ARM_FP 0x
 // V8M_MAINLINE: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
 
+// RUN: %clang -target armv8m.main-none-linux-gnueabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8M-MAINLINE-ALLOW-FP-INSTR %s
+// RUN: %clang -target armv8m.main-none-linux-gnueabihf -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8M-MAINLINE-ALLOW-FP-INSTR %s
+// V8M-MAINLINE-ALLOW-FP-INSTR: #define __ARM_ARCH 8
+// V8M-MAINLINE-ALLOW-FP-INSTR: #define __ARM_ARCH_8M_MAIN__ 1
+// V8M-MAINLINE-ALLOW-FP-INSTR: #define __ARM_ARCH_EXT_IDIV__ 1
+// V8M-MAINLINE-ALLOW-FP-INSTR-NOT: __ARM_ARCH_ISA_ARM
+// V8M-MAINLINE-ALLOW-FP-INSTR: #define __ARM_ARCH_ISA_THUMB 2
+// V8M-MAINLINE-ALLOW-FP-INSTR: #define __ARM_ARCH_PROFILE 'M'
+// V8M-MAINLINE-ALLOW-FP-INSTR-NOT: __ARM_FEATURE_CRC32
+// V8M-MAINLINE-ALLOW-FP-INSTR-NOT: __ARM_FEATURE_DSP
+// V8M-MAINLINE-ALLOW-FP-INSTR: #define __ARM_FP 0xE
+// V8M-MAINLINE-ALLOW-FP-INSTR: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
+
 // RUN: %clang -target arm-none-linux-gnu -march=armv8-m.main+dsp -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8M_MAINLINE_DSP %s
 // V8M_MAINLINE_DSP: #define __ARM_ARCH 8
 // V8M_MAINLINE_DSP: #define __ARM_ARCH_8M_MAIN__ 1
@@ -123,9 +181,21 @@
 // V8M_MAINLINE_DSP: #define __ARM_ARCH_PROFILE 'M'
 // V8M_MAINLINE_DSP-NOT: __ARM_FEATURE_CRC32
 // V8M_MAINLINE_DSP: #define __ARM_FEATURE_DSP 1
-// V8M_MAINLINE_DSP: #define __ARM_FP 0xE
+// V8M_MAINLINE_DSP-NOT: #define __ARM_FP 0x
 // V8M_MAINLINE_DSP: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
 
+// RUN: %clang -target arm-none-linux-gnueabi -march=armv8-m.main+dsp -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8M-MAINLINE-DSP-ALLOW-FP-INSTR %s
+// V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __ARM_ARCH 8
+// V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __ARM_ARCH_8M_MAIN__ 1
+// V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __ARM_ARCH_EXT_IDIV__ 1
+// V8M-MAINLINE-DSP-ALLOW-FP-INSTR-NOT: __ARM_ARCH_ISA_ARM
+// V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __ARM_ARCH_ISA_THUMB 2
+// V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __ARM_ARCH_PROFILE 'M'
+// V8M-MAINLINE-DSP-ALLOW-FP-INSTR-NOT: __ARM_FEATURE_CRC32
+// V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __ARM_FEATURE_DSP 1
+// V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __ARM_FP 0xE
+// V8M-MAINLINE-DSP-ALLOW-FP-INSTR: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
+
 // RUN: %clang -target arm-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-DEFS %s
 // CHECK-DEFS:#define __ARM_PCS 1
 // CHECK-DEFS:#define __ARM_SIZEOF_MINIMAL_ENUM 4
@@ -161,6 +231,8 @@
 // Check that -mfpu works properly for Cortex-A7 (enabled by default).
 // RUN: %clang -target armv7-none-linux-gnueabi -mcpu=cortex-a7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=DEFAULTFPU-A7 %s
 // RUN: %clang -target armv7-none-linux-gnueabi -mthumb -mcpu=cortex-a7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=DEFAULTFPU-A7 %s
+// RUN: %clang -target armv7-none-linux-gnueabihf -mcpu=cortex-a7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=DEFAULTFPU-A7 %s
+// RUN: %clang -target armv7-none-linux-gnueabihf -mthumb -mcpu=cortex-a7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=DEFAULTFPU-A7 %s
 // DEFAULTFPU-A7:#define __ARM_FP 0xE
 // DEFAULTFPU-A7:#define __ARM_NEON__ 1
 // DEFAULTFPU-A7:#define __ARM_VFPV4__ 1
@@ -207,7 +279,7 @@
 // A5T-NOT:#define __ARM_FEATURE_DSP
 // A5T-NOT:#define __ARM_FP 0x{{.*}}
 
-// Test whether predefines are as expected when targeting cortex-a5.
+// Test whether predefines are as expected when targeting cortex-a5i (soft FP ABI as default).
 // RUN: %clang -target armv7 -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A5 %s
 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A5 %s
 // A5:#define __ARM_ARCH 7
@@ -218,9 +290,21 @@
 // A5-NOT: #define __ARM_FEATURE_DIRECTED_ROUNDING
 // A5:#define __ARM_FEATURE_DSP 1
 // A5-NOT: #define __ARM_FEATURE_NUMERIC_MAXMIN
-// A5:#define __ARM_FP 0xE
+// A5-NOT:#define __ARM_FP 0x
 
-// Test whether predefines are as expected when targeting cortex-a7.
+// Test whether predefines are as expected when targeting cortex-a5 (softfp FP ABI as default).
+// RUN: %clang -target armv7-eabi -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A5-ALLOW-FP-INSTR %s
+// RUN: %clang -target armv7-eabi -mthumb -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A5-ALLOW-FP-INSTR %s
+// A5-ALLOW-FP-INSTR:#define __ARM_ARCH 7
+// A5-ALLOW-FP-INSTR:#define __ARM_ARCH_7A__ 1
+// A5-ALLOW-FP-INSTR-NOT:#define __ARM_ARCH_EXT_IDIV__
+// A5-ALLOW-FP-INSTR:#define __ARM_ARCH_PROFILE 'A'
+// A5-ALLOW-FP-INSTR-NOT: #define __ARM_FEATURE_DIRECTED_ROUNDING
+// A5-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
+// A5-ALLOW-FP-INSTR-NOT: #define __ARM_FEATURE_NUMERIC_MAXMIN
+// A5-ALLOW-FP-INSTR:#define __ARM_FP 0xE
+
+// Test whether predefines are as expected when targeting cortex-a7 (soft FP ABI as default).
 // RUN: %clang -target armv7k -mcpu=cortex-a7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A7 %s
 // RUN: %clang -target armv7k -mthumb -mcpu=cortex-a7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A7 %s
 // A7:#define __ARM_ARCH 7
@@ -228,7 +312,16 @@
 // A7:#define __ARM_ARCH_PROFILE 'A'
 // A7-NOT:#define __ARM_DWARF_EH__ 1
 // A7:#define __ARM_FEATURE_DSP 1
-// A7:#define __ARM_FP 0xE
+// A7-NOT:#define __ARM_FP 0x
+
+// Test whether predefines are as expected when targeting cortex-a7 (softfp FP ABI as default).
+// RUN: %clang -target armv7k-eabi -mcpu=cortex-a7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A7-ALLOW-FP-INSTR %s
+// RUN: %clang -target armv7k-eabi -mthumb -mcpu=cortex-a7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A7-ALLOW-FP-INSTR %s
+// A7-ALLOW-FP-INSTR:#define __ARM_ARCH 7
+// A7-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
+// A7-ALLOW-FP-INSTR:#define __ARM_ARCH_PROFILE 'A'
+// A7-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
+// A7-ALLOW-FP-INSTR:#define __ARM_FP 0xE
 
 // Test whether predefines are as expected when targeting cortex-a7.
 // RUN: %clang -target x86_64-apple-darwin -arch armv7k -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV7K %s
@@ -241,19 +334,33 @@
 // ARMV7K:#define __ARM_PCS_VFP 1
 
 
-// Test whether predefines are as expected when targeting cortex-a8.
+// Test whether predefines are as expected when targeting cortex-a8 (soft FP ABI as default).
 // RUN: %clang -target armv7 -mcpu=cortex-a8 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A8 %s
 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a8 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A8 %s
 // A8-NOT:#define __ARM_ARCH_EXT_IDIV__
 // A8:#define __ARM_FEATURE_DSP 1
-// A8:#define __ARM_FP 0xC
+// A8-NOT:#define __ARM_FP 0x
 
-// Test whether predefines are as expected when targeting cortex-a9.
+// Test whether predefines are as expected when targeting cortex-a8 (softfp FP ABI as default).
+// RUN: %clang -target armv7-eabi -mcpu=cortex-a8 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A8-ALLOW-FP-INSTR %s
+// RUN: %clang -target armv7-eabi -mthumb -mcpu=cortex-a8 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A8-ALLOW-FP-INSTR %s
+// A8-ALLOW-FP-INSTR-NOT:#define __ARM_ARCH_EXT_IDIV__
+// A8-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
+// A8-ALLOW-FP-INSTR:#define __ARM_FP 0xC
+
+// Test whether predefines are as expected when targeting cortex-a9 (soft FP as default).
 // RUN: %clang -target armv7 -mcpu=cortex-a9 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A9 %s
 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a9 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A9 %s
 // A9-NOT:#define __ARM_ARCH_EXT_IDIV__
 // A9:#define __ARM_FEATURE_DSP 1
-// A9:#define __ARM_FP 0xE
+// A9-NOT:#define __ARM_FP 0x
+
+// Test whether predefines are as expected when targeting cortex-a9 (softfp FP as default).
+// RUN: %clang -target armv7-eabi -mcpu=cortex-a9 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A9-ALLOW-FP-INSTR %s
+// RUN: %clang -target armv7-eabi -mthumb -mcpu=cortex-a9 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A9-ALLOW-FP-INSTR %s
+// A9-ALLOW-FP-INSTR-NOT:#define __ARM_ARCH_EXT_IDIV__
+// A9-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
+// A9-ALLOW-FP-INSTR:#define __ARM_FP 0xE
 
 
 // Check that -mfpu works properly for Cortex-A12 (enabled by default).
@@ -269,7 +376,7 @@
 // FPUNONE-A12-NOT:#define __ARM_NEON__ 1
 // FPUNONE-A12-NOT:#define __ARM_VFPV4__ 1
 
-// Test whether predefines are as expected when targeting cortex-a12.
+// Test whether predefines are as expected when targeting cortex-a12 (soft FP ABI as default).
 // RUN: %clang -target armv7 -mcpu=cortex-a12 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A12 %s
 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a12 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A12 %s
 // A12:#define __ARM_ARCH 7
@@ -277,14 +384,31 @@
 // A12:#define __ARM_ARCH_EXT_IDIV__ 1
 // A12:#define __ARM_ARCH_PROFILE 'A'
 // A12:#define __ARM_FEATURE_DSP 1
-// A12:#define __ARM_FP 0xE
+// A12-NOT:#define __ARM_FP 0x
+
+// Test whether predefines are as expected when targeting cortex-a12 (soft FP ABI as default).
+// RUN: %clang -target armv7-eabi -mcpu=cortex-a12 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A12-ALLOW-FP-INSTR %s
+// RUN: %clang -target armv7-eabi -mthumb -mcpu=cortex-a12 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A12-ALLOW-FP-INSTR %s
+// A12-ALLOW-FP-INSTR:#define __ARM_ARCH 7
+// A12-ALLOW-FP-INSTR:#define __ARM_ARCH_7A__ 1
+// A12-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
+// A12-ALLOW-FP-INSTR:#define __ARM_ARCH_PROFILE 'A'
+// A12-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
+// A12-ALLOW-FP-INSTR:#define __ARM_FP 0xE
 
-// Test whether predefines are as expected when targeting cortex-a15.
+// Test whether predefines are as expected when targeting cortex-a15 (soft FP ABI as default).
 // RUN: %clang -target armv7 -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A15 %s
 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A15 %s
 // A15:#define __ARM_ARCH_EXT_IDIV__ 1
 // A15:#define __ARM_FEATURE_DSP 1
-// A15:#define __ARM_FP 0xE
+// A15-NOT:#define __ARM_FP 0x
+
+// Test whether predefines are as expected when targeting cortex-a15 (softfp ABI as default).
+// RUN: %clang -target armv7-eabi -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A15-ALLOW-FP-INSTR %s
+// RUN: %clang -target armv7-eabi -mthumb -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A15-ALLOW-FP-INSTR %s
+// A15-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
+// A15-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
+// A15-ALLOW-FP-INSTR:#define __ARM_FP 0xE
 
 // Check that -mfpu works properly for Cortex-A17 (enabled by default).
 // RUN: %clang -target armv7-none-linux-gnueabi -mcpu=cortex-a17 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=DEFAULTFPU-A17 %s
@@ -299,7 +423,7 @@
 // FPUNONE-A17-NOT:#define __ARM_NEON__ 1
 // FPUNONE-A17-NOT:#define __ARM_VFPV4__ 1
 
-// Test whether predefines are as expected when targeting cortex-a17.
+// Test whether predefines are as expected when targeting cortex-a17 (soft FP ABI as default).
 // RUN: %clang -target armv7 -mcpu=cortex-a17 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A17 %s
 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-a17 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A17 %s
 // A17:#define __ARM_ARCH 7
@@ -307,16 +431,33 @@
 // A17:#define __ARM_ARCH_EXT_IDIV__ 1
 // A17:#define __ARM_ARCH_PROFILE 'A'
 // A17:#define __ARM_FEATURE_DSP 1
-// A17:#define __ARM_FP 0xE
+// A17-NOT:#define __ARM_FP 0x
+
+// Test whether predefines are as expected when targeting cortex-a17 (softfp FP ABI as default).
+// RUN: %clang -target armv7-eabi -mcpu=cortex-a17 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A17-ALLOW-FP-INSTR %s
+// RUN: %clang -target armv7-eabi -mthumb -mcpu=cortex-a17 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=A17-ALLOW-FP-INSTR %s
+// A17-ALLOW-FP-INSTR:#define __ARM_ARCH 7
+// A17-ALLOW-FP-INSTR:#define __ARM_ARCH_7A__ 1
+// A17-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
+// A17-ALLOW-FP-INSTR:#define __ARM_ARCH_PROFILE 'A'
+// A17-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
+// A17-ALLOW-FP-INSTR:#define __ARM_FP 0xE
 
-// Test whether predefines are as expected when targeting swift.
+// Test whether predefines are as expected when targeting swift (soft FP ABI as default).
 // RUN: %clang -target armv7s -mcpu=swift -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=SWIFT %s
 // RUN: %clang -target armv7s -mthumb -mcpu=swift -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=SWIFT %s
 // SWIFT:#define __ARM_ARCH_EXT_IDIV__ 1
 // SWIFT:#define __ARM_FEATURE_DSP 1
-// SWIFT:#define __ARM_FP 0xE
+// SWIFTi-NOT:#define __ARM_FP 0xxE
+
+// Test whether predefines are as expected when targeting swift (softfp FP ABI as default).
+// RUN: %clang -target armv7s-eabi -mcpu=swift -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=SWIFT-ALLOW-FP-INSTR %s
+// RUN: %clang -target armv7s-eabi -mthumb -mcpu=swift -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=SWIFT-ALLOW-FP-INSTR %s
+// SWIFT-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
+// SWIFT-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
+// SWIFT-ALLOW-FP-INSTR:#define __ARM_FP 0xE
 
-// Test whether predefines are as expected when targeting ARMv8-A Cortex implementations
+// Test whether predefines are as expected when targeting ARMv8-A Cortex implementations (soft FP ABI as default)
 // RUN: %clang -target armv8 -mcpu=cortex-a32 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a32 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
 // RUN: %clang -target armv8 -mcpu=cortex-a35 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
@@ -331,7 +472,24 @@
 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a73 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
 // ARMV8:#define __ARM_ARCH_EXT_IDIV__ 1
 // ARMV8:#define __ARM_FEATURE_DSP 1
-// ARMV8:#define __ARM_FP 0xE
+// ARMV8-NOT:#define __ARM_FP 0x
+
+// Test whether predefines are as expected when targeting ARMv8-A Cortex implementations (softfp FP ABI as default)
+// RUN: %clang -target armv8-eabi -mcpu=cortex-a32 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8-ALLOW-FP-INSTR %s
+// RUN: %clang -target armv8-eabi -mthumb -mcpu=cortex-a32 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8-ALLOW-FP-INSTR %s
+// RUN: %clang -target armv8-eabi -mcpu=cortex-a35 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8-ALLOW-FP-INSTR %s
+// RUN: %clang -target armv8-eabi -mthumb -mcpu=cortex-a35 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8-ALLOW-FP-INSTR %s
+// RUN: %clang -target armv8-eabi -mcpu=cortex-a53 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8-ALLOW-FP-INSTR %s
+// RUN: %clang -target armv8-eabi -mthumb -mcpu=cortex-a53 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8-ALLOW-FP-INSTR %s
+// RUN: %clang -target armv8-eabi -mcpu=cortex-a57 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8-ALLOW-FP-INSTR %s
+// RUN: %clang -target armv8-eabi -mthumb -mcpu=cortex-a57 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8-ALLOW-FP-INSTR %s
+// RUN: %clang -target armv8-eabi -mcpu=cortex-a72 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8-ALLOW-FP-INSTR %s
+// RUN: %clang -target armv8-eabi -mthumb -mcpu=cortex-a72 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8-ALLOW-FP-INSTR %s
+// RUN: %clang -target armv8-eabi -mcpu=cortex-a73 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8-ALLOW-FP-INSTR %s
+// RUN: %clang -target armv8-eabi -mthumb -mcpu=cortex-a73 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8-ALLOW-FP-INSTR %s
+// ARMV8-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
+// ARMV8-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
+// ARMV8-ALLOW-FP-INSTR:#define __ARM_FP 0xE
 
 // Test whether predefines are as expected when targeting cortex-r4.
 // RUN: %clang -target armv7 -mcpu=cortex-r4 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R4-ARM %s
@@ -344,32 +502,59 @@
 // R4-THUMB:#define __ARM_FEATURE_DSP 1
 // R4-THUMB-NOT:#define __ARM_FP 0x{{.*}}
 
-// Test whether predefines are as expected when targeting cortex-r4f.
+// Test whether predefines are as expected when targeting cortex-r4f (soft FP ABI as default).
 // RUN: %clang -target armv7 -mcpu=cortex-r4f -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R4F-ARM %s
 // R4F-ARM-NOT:#define __ARM_ARCH_EXT_IDIV__
 // R4F-ARM:#define __ARM_FEATURE_DSP 1
-// R4F-ARM:#define __ARM_FP 0xC
+// R4F-ARM-NOT:#define __ARM_FP 0x
+
+// Test whether predefines are as expected when targeting cortex-r4f (softfp FP ABI as default).
+// RUN: %clang -target armv7-eabi -mcpu=cortex-r4f -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R4F-ARM-ALLOW-FP-INSTR %s
+// R4F-ARM-ALLOW-FP-INSTR-NOT:#define __ARM_ARCH_EXT_IDIV__
+// R4F-ARM-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
+// R4F-ARM-ALLOW-FP-INSTR:#define __ARM_FP 0xC
 
 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-r4f -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R4F-THUMB %s
 // R4F-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
 // R4F-THUMB:#define __ARM_FEATURE_DSP 1
-// R4F-THUMB:#define __ARM_FP 0xC
+// R4F-THUMB-NOT:#define __ARM_FP 0x
+
+// RUN: %clang -target armv7-eabi -mthumb -mcpu=cortex-r4f -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R4F-THUMB-ALLOW-FP-INSTR %s
+// R4F-THUMB-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
+// R4F-THUMB-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
+// R4F-THUMB-ALLOW-FP-INSTR:#define __ARM_FP 0xC
 
-// Test whether predefines are as expected when targeting cortex-r5.
+// Test whether predefines are as expected when targeting cortex-r5 (soft FP ABI as default).
 // RUN: %clang -target armv7 -mcpu=cortex-r5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R5 %s
 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-r5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R5 %s
 // R5:#define __ARM_ARCH_EXT_IDIV__ 1
 // R5:#define __ARM_FEATURE_DSP 1
-// R5:#define __ARM_FP 0xC
+// R5-NOT:#define __ARM_FP 0x
 
-// Test whether predefines are as expected when targeting cortex-r7 and cortex-r8.
+// Test whether predefines are as expected when targeting cortex-r5 (softfp FP ABI as default).
+// RUN: %clang -target armv7-eabi -mcpu=cortex-r5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R5-ALLOW-FP-INSTR %s
+// RUN: %clang -target armv7-eabi -mthumb -mcpu=cortex-r5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R5-ALLOW-FP-INSTR %s
+// R5-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
+// R5-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
+// R5-ALLOW-FP-INSTR:#define __ARM_FP 0xC
+
+// Test whether predefines are as expected when targeting cortex-r7 and cortex-r8 (soft FP ABI as default).
 // RUN: %clang -target armv7 -mcpu=cortex-r7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R7-R8 %s
 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-r7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R7-R8 %s
 // RUN: %clang -target armv7 -mcpu=cortex-r8 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R7-R8 %s
 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-r8 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R7-R8 %s
 // R7-R8:#define __ARM_ARCH_EXT_IDIV__ 1
 // R7-R8:#define __ARM_FEATURE_DSP 1
-// R7-R8:#define __ARM_FP 0xE
+// R7-R8-NOT:#define __ARM_FP 0x
+
+// Test whether predefines are as expected when targeting cortex-r7 and cortex-r8 (softfp FP ABI as default).
+// RUN: %clang -target armv7-eabi -mcpu=cortex-r7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R7-R8-ALLOW-FP-INSTR %s
+// RUN: %clang -target armv7-eabi -mthumb -mcpu=cortex-r7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R7-R8-ALLOW-FP-INSTR %s
+// RUN: %clang -target armv7-eabi -mcpu=cortex-r8 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R7-R8-ALLOW-FP-INSTR %s
+// RUN: %clang -target armv7-eabi -mthumb -mcpu=cortex-r8 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=R7-R8-ALLOW-FP-INSTR %s
+// R7-R8-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
+// R7-R8-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
+// R7-R8-ALLOW-FP-INSTR:#define __ARM_FP 0xE
 
 // Test whether predefines are as expected when targeting cortex-m0.
 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-m0 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M0-THUMB %s
@@ -387,18 +572,31 @@
 // M3-THUMB-NOT:#define __ARM_FEATURE_DSP
 // M3-THUMB-NOT:#define __ARM_FP 0x{{.*}}
 
-// Test whether predefines are as expected when targeting cortex-m4.
+// Test whether predefines are as expected when targeting cortex-m4 (soft FP ABI as default).
 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-m4 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M4-THUMB %s
 // M4-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
 // M4-THUMB:#define __ARM_FEATURE_DSP 1
-// M4-THUMB:#define __ARM_FP 0x6
+// M4-THUMB-NOT:#define __ARM_FP 0x
+
+// Test whether predefines are as expected when targeting cortex-m4 (softfp ABI as default).
+// RUN: %clang -target armv7-eabi -mthumb -mcpu=cortex-m4 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M4-THUMB-ALLOW-FP-INSTR %s
+// M4-THUMB-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
+// M4-THUMB-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
+// M4-THUMB-ALLOW-FP-INSTR:#define __ARM_FP 0x6
 
-// Test whether predefines are as expected when targeting cortex-m7.
+// Test whether predefines are as expected when targeting cortex-m7 (soft FP ABI as default).
 // RUN: %clang -target armv7 -mthumb -mcpu=cortex-m7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M7-THUMB %s
 // M7-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1
 // M7-THUMB:#define __ARM_FEATURE_DSP 1
-// M7-THUMB:#define __ARM_FP 0xE
-// M7-THUMB:#define __ARM_FPV5__ 1
+// M7-THUMB-NOT:#define __ARM_FP 0x
+// M7-THUMB-NOT:#define __ARM_FPV5__
+
+// Test whether predefines are as expected when targeting cortex-m7 (softfp FP ABI as default).
+// RUN: %clang -target armv7-eabi -mthumb -mcpu=cortex-m7 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M7-THUMB-ALLOW-FP-INSTR %s
+// M7-THUMB-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
+// M7-THUMB-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
+// M7-THUMB-ALLOW-FP-INSTR:#define __ARM_FP 0xE
+// M7-THUMB-ALLOW-FP-INSTR:#define __ARM_FPV5__ 1
 
 // Test whether predefines are as expected when targeting v8m cores
 // RUN: %clang -target arm -mcpu=cortex-m23 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M23 %s
@@ -413,6 +611,7 @@
 // M23-NOT: __ARM_FP 0x{{.*}}
 // M23-NOT: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
 
+// Test whether predefines are as expected when targeting m33 (soft FP ABI as default).
 // RUN: %clang -target arm -mcpu=cortex-m33 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M33 %s
 // M33: #define __ARM_ARCH 8
 // M33: #define __ARM_ARCH_8M_MAIN__ 1
@@ -422,15 +621,35 @@
 // M33: #define __ARM_ARCH_PROFILE 'M'
 // M33-NOT: __ARM_FEATURE_CRC32
 // M33: #define __ARM_FEATURE_DSP 1
-// M33: #define __ARM_FP 0x6
+// M33-NOT: #define __ARM_FP 0x
 // M33: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
 
-// Test whether predefines are as expected when targeting krait.
+// Test whether predefines are as expected when targeting m33 (softfp FP ABI as default).
+// RUN: %clang -target arm-eabi -mcpu=cortex-m33 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M33-ALLOW-FP-INSTR %s
+// M33-ALLOW-FP-INSTR: #define __ARM_ARCH 8
+// M33-ALLOW-FP-INSTR: #define __ARM_ARCH_8M_MAIN__ 1
+// M33-ALLOW-FP-INSTR: #define __ARM_ARCH_EXT_IDIV__ 1
+// M33-ALLOW-FP-INSTR-NOT: __ARM_ARCH_ISA_ARM
+// M33-ALLOW-FP-INSTR: #define __ARM_ARCH_ISA_THUMB 2
+// M33-ALLOW-FP-INSTR: #define __ARM_ARCH_PROFILE 'M'
+// M33-ALLOW-FP-INSTR-NOT: __ARM_FEATURE_CRC32
+// M33-ALLOW-FP-INSTR: #define __ARM_FEATURE_DSP 1
+// M33-ALLOW-FP-INSTR: #define __ARM_FP 0x6
+// M33-ALLOW-FP-INSTR: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
+
+// Test whether predefines are as expected when targeting krait (soft FP as default).
 // RUN: %clang -target armv7 -mcpu=krait -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=KRAIT %s
 // RUN: %clang -target armv7 -mthumb -mcpu=krait -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=KRAIT %s
 // KRAIT:#define __ARM_ARCH_EXT_IDIV__ 1
 // KRAIT:#define __ARM_FEATURE_DSP 1
-// KRAIT:#define  __ARM_VFPV4__ 1
+// KRAIT-NOT:#define  __ARM_VFPV4__
+
+// Test whether predefines are as expected when targeting krait (softfp FP as default).
+// RUN: %clang -target armv7-eabi -mcpu=krait -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=KRAIT-ALLOW-FP-INSTR %s
+// RUN: %clang -target armv7-eabi -mthumb -mcpu=krait -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=KRAIT-ALLOW-FP-INSTR %s
+// KRAIT-ALLOW-FP-INSTR:#define __ARM_ARCH_EXT_IDIV__ 1
+// KRAIT-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
+// KRAIT-ALLOW-FP-INSTR:#define  __ARM_VFPV4__ 1
 
 // RUN: %clang -target armv8.1a-none-none-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V81A %s
 // CHECK-V81A: #define __ARM_ARCH 8




More information about the cfe-commits mailing list