r267869 - PR27216: Only define __ARM_FEATURE_FMA when the target has VFPv4
Silviu Baranga via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 28 04:29:11 PDT 2016
Author: sbaranga
Date: Thu Apr 28 06:29:08 2016
New Revision: 267869
URL: http://llvm.org/viewvc/llvm-project?rev=267869&view=rev
Log:
PR27216: Only define __ARM_FEATURE_FMA when the target has VFPv4
Summary:
According to the ACLE spec, "__ARM_FEATURE_FMA is defined to 1 if
the hardware floating-point architecture supports fused floating-point
multiply-accumulate".
This changes clang's behaviour from emitting this macro for v7-A and v7-R
cores to only emitting it when the target has VFPv4 (and therefore support
for the floating point multiply-accumulate instruction).
Fixes PR27216
Reviewers: t.p.northover, rengolin
Subscribers: aemerson, rengolin, cfe-commits
Differential Revision: http://reviews.llvm.org/D18963
Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/CodeGen/arm-neon-fma.c
cfe/trunk/test/Preprocessor/arm-acle-6.5.c
cfe/trunk/test/Sema/arm_vfma.c
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=267869&r1=267868&r2=267869&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Thu Apr 28 06:29:08 2016
@@ -4931,7 +4931,7 @@ public:
Builder.defineMacro("__ARM_FP16_ARGS", "1");
// ACLE 6.5.3 Fused multiply-accumulate (FMA)
- if (ArchVersion >= 7 && (CPUProfile != "M" || CPUAttr == "7EM"))
+ if (ArchVersion >= 7 && (FPU & VFP4FPU))
Builder.defineMacro("__ARM_FEATURE_FMA", "1");
// Subtarget options.
Modified: cfe/trunk/test/CodeGen/arm-neon-fma.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/arm-neon-fma.c?rev=267869&r1=267868&r2=267869&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/arm-neon-fma.c (original)
+++ cfe/trunk/test/CodeGen/arm-neon-fma.c Thu Apr 28 06:29:08 2016
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -triple thumbv7-none-linux-gnueabihf \
// RUN: -target-abi aapcs \
-// RUN: -target-cpu cortex-a8 \
+// RUN: -target-cpu cortex-a7 \
// RUN: -mfloat-abi hard \
// RUN: -ffreestanding \
// RUN: -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s
Modified: cfe/trunk/test/Preprocessor/arm-acle-6.5.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/arm-acle-6.5.c?rev=267869&r1=267868&r2=267869&view=diff
==============================================================================
--- cfe/trunk/test/Preprocessor/arm-acle-6.5.c (original)
+++ cfe/trunk/test/Preprocessor/arm-acle-6.5.c Thu Apr 28 06:29:08 2016
@@ -49,10 +49,13 @@
// CHECK-NO-FMA-NOT: __ARM_FEATURE_FMA
-// RUN: %clang -target armv7a-eabi -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-FMA
-// RUN: %clang -target armv7r-eabi -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-FMA
+// RUN: %clang -target armv7a-eabi -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-NO-FMA
+// RUN: %clang -target armv7a-eabi -mfpu=vfpv4 -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-FMA
+// RUN: %clang -target armv7r-eabi -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-NO-FMA
+// RUN: %clang -target armv7r-eabi -mfpu=vfpv4 -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-FMA
// RUN: %clang -target armv7em-eabi -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-FMA
-// RUN: %clang -target armv8-eabi -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-FMA
+// RUN: %clang -target armv8-eabi -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-NO-FMA
+// RUN: %clang -target armv8-eabi -mfpu=vfpv4 -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-FMA
// CHECK-FMA: __ARM_FEATURE_FMA 1
Modified: cfe/trunk/test/Sema/arm_vfma.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/arm_vfma.c?rev=267869&r1=267868&r2=267869&view=diff
==============================================================================
--- cfe/trunk/test/Sema/arm_vfma.c (original)
+++ cfe/trunk/test/Sema/arm_vfma.c Thu Apr 28 06:29:08 2016
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple thumbv7s-apple-ios7.0 -target-feature +neon -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple thumbv7-none-eabi -target-feature +neon -target-feature +vfp4 -fsyntax-only -verify %s
#include <arm_neon.h>
// expected-no-diagnostics
More information about the cfe-commits
mailing list