[PATCH] D100372: [Clang][ARM] Define __VFP_FP__ macro unconditionally
Victor Campos via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 13 02:06:50 PDT 2021
vhscampos created this revision.
Herald added subscribers: danielkiss, kristof.beyls.
vhscampos requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Clang only defines __VFP_FP__ when the FPU is enabled. However, gcc
defines it unconditionally.
This patch aligns Clang with gcc.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D100372
Files:
clang/lib/Basic/Targets/ARM.cpp
clang/test/Preprocessor/arm-target-features.c
Index: clang/test/Preprocessor/arm-target-features.c
===================================================================
--- clang/test/Preprocessor/arm-target-features.c
+++ clang/test/Preprocessor/arm-target-features.c
@@ -141,6 +141,11 @@
// CHECK-V7S-NOT: __ARM_FEATURE_DIRECTED_ROUNDING
// CHECK-V7S: #define __ARM_FP 0xe
+// RUN: %clang -target arm-arm-none-eabi -march=armv7-m -mfloat-abi=soft -x c -E -dM %s | FileCheck -match-full-lines --check-prefix=CHECK-VFP-FP %s
+// RUN: %clang -target arm-arm-none-eabi -march=armv7-m -mfloat-abi=softfp -x c -E -dM %s | FileCheck -match-full-lines --check-prefix=CHECK-VFP-FP %s
+// RUN: %clang -target arm-arm-none-eabi -march=armv7-m -mfloat-abi=hard -x c -E -dM %s | FileCheck -match-full-lines --check-prefix=CHECK-VFP-FP %s
+// CHECK-VFP-FP: #define __VFP_FP__ 1
+
// RUN: %clang -target armv8a -mfloat-abi=hard -x c -E -dM %s | FileCheck -match-full-lines --check-prefix=CHECK-V8-BAREHF %s
// CHECK-V8-BAREHF: #define __ARMEL__ 1
// CHECK-V8-BAREHF: #define __ARM_ARCH 8
Index: clang/lib/Basic/Targets/ARM.cpp
===================================================================
--- clang/lib/Basic/Targets/ARM.cpp
+++ clang/lib/Basic/Targets/ARM.cpp
@@ -755,8 +755,9 @@
// Note, this is always on in gcc, even though it doesn't make sense.
Builder.defineMacro("__APCS_32__");
+ Builder.defineMacro("__VFP_FP__");
+
if (FPUModeIsVFP((FPUMode)FPU)) {
- Builder.defineMacro("__VFP_FP__");
if (FPU & VFP2FPU)
Builder.defineMacro("__ARM_VFPV2__");
if (FPU & VFP3FPU)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100372.337074.patch
Type: text/x-patch
Size: 1557 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210413/400242c3/attachment-0001.bin>
More information about the cfe-commits
mailing list