[PATCH] D22272: ARM: define __ARM_VFPV5__ when present.

Tim Northover via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 12 11:59:49 PDT 2016

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?




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 @@
       if (FPU & VFP4FPU)
+      if (FPU & FPARMV8)
+        Builder.defineMacro("__ARM_VFPV5__");
     // This only gets set when Neon instructions are actually available, unlike

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22272.63704.patch
Type: text/x-patch
Size: 1018 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160712/fb2e9ba9/attachment-0001.bin>

More information about the cfe-commits mailing list