diff options
author | Silviu Baranga <silviu.baranga@arm.com> | 2016-04-28 11:29:08 +0000 |
---|---|---|
committer | Silviu Baranga <silviu.baranga@arm.com> | 2016-04-28 11:29:08 +0000 |
commit | 632fdc5919d9738a1174a347deef377dbe18f51b (patch) | |
tree | 9df9f69f173045b1fdf6eee4f2a1bde6df767b96 | |
parent | 3a45fab72b0ebc51fe1ce38392be29aaf29603e4 (diff) | |
download | bcm5719-llvm-632fdc5919d9738a1174a347deef377dbe18f51b.tar.gz bcm5719-llvm-632fdc5919d9738a1174a347deef377dbe18f51b.zip |
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
llvm-svn: 267869
-rw-r--r-- | clang/lib/Basic/Targets.cpp | 2 | ||||
-rw-r--r-- | clang/test/CodeGen/arm-neon-fma.c | 2 | ||||
-rw-r--r-- | clang/test/Preprocessor/arm-acle-6.5.c | 9 | ||||
-rw-r--r-- | clang/test/Sema/arm_vfma.c | 2 |
4 files changed, 9 insertions, 6 deletions
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index 98827b89a15..4e516513b34 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -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. diff --git a/clang/test/CodeGen/arm-neon-fma.c b/clang/test/CodeGen/arm-neon-fma.c index 1a2a20f2bde..ff6acbcc2e9 100644 --- a/clang/test/CodeGen/arm-neon-fma.c +++ b/clang/test/CodeGen/arm-neon-fma.c @@ -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 diff --git a/clang/test/Preprocessor/arm-acle-6.5.c b/clang/test/Preprocessor/arm-acle-6.5.c index 95adad9faa8..cc158c82cd8 100644 --- a/clang/test/Preprocessor/arm-acle-6.5.c +++ b/clang/test/Preprocessor/arm-acle-6.5.c @@ -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 diff --git a/clang/test/Sema/arm_vfma.c b/clang/test/Sema/arm_vfma.c index c50a4147b3f..8c08b4d8b9e 100644 --- a/clang/test/Sema/arm_vfma.c +++ b/clang/test/Sema/arm_vfma.c @@ -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 |