forked from OSchip/llvm-project
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
This commit is contained in:
parent
3a45fab72b
commit
632fdc5919
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue