[PATCH] D100372: [Clang][ARM] Define __VFP_FP__ macro unconditionally
This revision was automatically updated to reflect the committed changes. Closed by commit rGee3e01627ff8: [Clang][ARM] Define __VFP_FP__ macro unconditionally (authored by vhscampos). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D100372/new/ 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,12 @@ // Note, this is always on in gcc, even though it doesn't make sense. Builder.defineMacro("__APCS_32__"); + // __VFP_FP__ means that the floating-point format is VFP, not that a hardware + // FPU is present. Moreover, the VFP format is the only one supported by + // clang. For these reasons, this macro is always defined. + Builder.defineMacro("__VFP_FP__"); + if (FPUModeIsVFP((FPUMode)FPU)) { -Builder.defineMacro("__VFP_FP__"); if (FPU & VFP2FPU) Builder.defineMacro("__ARM_VFPV2__"); if (FPU & VFP3FPU) 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,12 @@ // Note, this is always on in gcc, even though it doesn't make sense. Builder.defineMacro("__APCS_32__"); + // __VFP_FP__ means that the floating-point format is VFP, not that a hardware + // FPU is present. Moreover, the VFP format is the only one supported by + // clang. For these reasons, this macro is always defined. + Builder.defineMacro("__VFP_FP__"); + if (FPUModeIsVFP((FPUMode)FPU)) { -Builder.defineMacro("__VFP_FP__"); if (FPU & VFP2FPU) Builder.defineMacro("__ARM_VFPV2__"); if (FPU & VFP3FPU) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D100372: [Clang][ARM] Define __VFP_FP__ macro unconditionally
rengolin accepted this revision. rengolin added a comment. It's a weird flag, for sure, but if that's the semantics of it, than this change LGTM. Thanks! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D100372/new/ https://reviews.llvm.org/D100372 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D100372: [Clang][ARM] Define __VFP_FP__ macro unconditionally
vhscampos added a comment. Thanks Peter. Since one week has passed, I plan to commit these changes by the end of the day if nothing surfaces. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D100372/new/ https://reviews.llvm.org/D100372 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D100372: [Clang][ARM] Define __VFP_FP__ macro unconditionally
vhscampos updated this revision to Diff 337723. vhscampos added a comment. Add a clarifying comment. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D100372/new/ 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,12 @@ // Note, this is always on in gcc, even though it doesn't make sense. Builder.defineMacro("__APCS_32__"); + // __VFP_FP__ means that the floating-point format is VFP, not that a hardware + // FPU is present. Moreover, the VFP format is the only one supported by + // clang. For these reasons, this macro is always defined. + Builder.defineMacro("__VFP_FP__"); + if (FPUModeIsVFP((FPUMode)FPU)) { -Builder.defineMacro("__VFP_FP__"); if (FPU & VFP2FPU) Builder.defineMacro("__ARM_VFPV2__"); if (FPU & VFP3FPU) 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,12 @@ // Note, this is always on in gcc, even though it doesn't make sense. Builder.defineMacro("__APCS_32__"); + // __VFP_FP__ means that the floating-point format is VFP, not that a hardware + // FPU is present. Moreover, the VFP format is the only one supported by + // clang. For these reasons, this macro is always defined. + Builder.defineMacro("__VFP_FP__"); + if (FPUModeIsVFP((FPUMode)FPU)) { -Builder.defineMacro("__VFP_FP__"); if (FPU & VFP2FPU) Builder.defineMacro("__ARM_VFPV2__"); if (FPU & VFP3FPU) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D100372: [Clang][ARM] Define __VFP_FP__ macro unconditionally
peter.smith accepted this revision. peter.smith added reviewers: compnerd, rengolin. peter.smith added a comment. This revision is now accepted and ready to land. I think this is the right thing to do. GCC changed to unconditionally set the macro with https://gcc.gnu.org/legacy-ml/gcc-patches/2016-10/msg01025.html my understanding is that the macro means that floating point representation uses the VFP format and not the FPA format (predecessor to VFP, not supported by clang, found in very old systems), it does not mean that there is a VFP unit present. see https://wiki.debian.org/ArmEabiPort for the mutually exclusive `__MAVERICK__` whcih refers to https://wiki.debian.org/ArmEabiMaverickCrunch the processor that had the FPA FPU. I've set LGTM, and added a few more non-Arm people involved in the area for visibility, will be good to give them a chance to comment before committing. Comment at: clang/lib/Basic/Targets/ARM.cpp:758 + Builder.defineMacro("__VFP_FP__"); + Worth a comment like "__VFP_FP__ means that the floating point format is VFP, not that a hardware FPU is present. The VFP format is the only one supported by clang." Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D100372/new/ https://reviews.llvm.org/D100372 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D100372: [Clang][ARM] Define __VFP_FP__ macro unconditionally
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) 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) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits