t.p.northover created this revision.
t.p.northover added reviewers: rengolin, jmolloy.
t.p.northover added a subscriber: cfe-commits.
Herald added subscribers: mcrosier, rengolin, aemerson.

We've had embedded developers requesting we extend the __ARM_VFPVn__ series to 
support Cortex-M7, which sounds reasonable apart from the name bikeshedding.

The features added are equivalent to a v8 FPU and the LLVM codebase is pretty 
split on whether it's fp-armv8 or vfpv5. Since this is user-facing, I thought 
I'd ask for opinions. The obvious choices are:

  * `__ARM_VFPV5__` everywhere (including Cortex-A57 for example). This matches 
Cortex-M7 naming from ARM, but probably not Cortex-A57. It also matches our 
historical #defines.
  * `__ARM_FPV8__` (or similar) everywhere. Reverse problem from above.
  * Both, depending on whether the CPU really is v8. No naming mismatch, but 
two #defines for what's essentially the same thing. It's difficult to imagine 
code actually wanting to distinguish the two.

I've got a mild preference for the first, hence this patch. Any objections or 
other suggestions?

Tim.

http://reviews.llvm.org/D22272

Files:
  lib/Basic/Targets.cpp
  test/Preprocessor/arm-target-features.c

Index: test/Preprocessor/arm-target-features.c
===================================================================
--- test/Preprocessor/arm-target-features.c
+++ test/Preprocessor/arm-target-features.c
@@ -380,6 +380,7 @@
 // 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_VFPV5__ 1
 
 // Test whether predefines are as expected when targeting krait.
 // RUN: %clang -target armv7 -mcpu=krait -x c -E -dM %s -o - | FileCheck 
-match-full-lines --check-prefix=KRAIT %s
Index: lib/Basic/Targets.cpp
===================================================================
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -5219,6 +5219,8 @@
         Builder.defineMacro("__ARM_VFPV3__");
       if (FPU & VFP4FPU)
         Builder.defineMacro("__ARM_VFPV4__");
+      if (FPU & FPARMV8)
+        Builder.defineMacro("__ARM_VFPV5__");
     }
 
     // This only gets set when Neon instructions are actually available, unlike


Index: test/Preprocessor/arm-target-features.c
===================================================================
--- test/Preprocessor/arm-target-features.c
+++ test/Preprocessor/arm-target-features.c
@@ -380,6 +380,7 @@
 // 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_VFPV5__ 1
 
 // Test whether predefines are as expected when targeting krait.
 // RUN: %clang -target armv7 -mcpu=krait -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=KRAIT %s
Index: lib/Basic/Targets.cpp
===================================================================
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -5219,6 +5219,8 @@
         Builder.defineMacro("__ARM_VFPV3__");
       if (FPU & VFP4FPU)
         Builder.defineMacro("__ARM_VFPV4__");
+      if (FPU & FPARMV8)
+        Builder.defineMacro("__ARM_VFPV5__");
     }
 
     // This only gets set when Neon instructions are actually available, unlike
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to