From: Tim Northover Date: Tue, 2 Feb 2016 18:02:10 +0000 (+0000) Subject: ARM: allow both vfma and vfms intrinsics on v7. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9eac6ef71a2c4f008f9dcf3241cc194a1d5cb6ff;p=clang ARM: allow both vfma and vfms intrinsics on v7. The main purpose here is that vfma/vfms should be symmetric, and they are supported on most v7 cores. The new ArchGuard is suggested by ACLE but prophylactic for us. Almost all CPUs with NEON *will* have vfma, and the few exceptions I know of (e.g. Cortex-A8) are incorrectly modelled by Clang so can't trigger a test. Fortunately, they're getting rarer. But if we ever do support them properly arm_neon.h should now do the right thing. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@259537 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/arm_neon.td b/include/clang/Basic/arm_neon.td index 6d95c1ec15..4863566653 100644 --- a/include/clang/Basic/arm_neon.td +++ b/include/clang/Basic/arm_neon.td @@ -824,7 +824,10 @@ def VREINTERPRET //////////////////////////////////////////////////////////////////////////////// // Vector fused multiply-add operations -def VFMA : SInst<"vfma", "dddd", "fQf">; +let ArchGuard = "defined(__ARM_FEATURE_FMA)" in { + def VFMA : SInst<"vfma", "dddd", "fQf">; + def VFMS : SInst<"vfms", "dddd", "fQf">; +} //////////////////////////////////////////////////////////////////////////////// // fp16 vector operations @@ -908,7 +911,7 @@ def FDIV : IOpInst<"vdiv", "ddd", "fdQfQd", OP_DIV>; //////////////////////////////////////////////////////////////////////////////// // Vector fused multiply-add operations def FMLA : SInst<"vfma", "dddd", "dQd">; -def FMLS : SInst<"vfms", "dddd", "fdQfQd">; +def FMLS : SInst<"vfms", "dddd", "dQd">; //////////////////////////////////////////////////////////////////////////////// // MUL, MLA, MLS, FMA, FMS definitions with scalar argument diff --git a/test/Sema/arm_vfma.c b/test/Sema/arm_vfma.c new file mode 100644 index 0000000000..c50a4147b3 --- /dev/null +++ b/test/Sema/arm_vfma.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -triple thumbv7s-apple-ios7.0 -target-feature +neon -fsyntax-only -verify %s +#include + +// expected-no-diagnostics + +void func(float32x2_t v2f32, float32x4_t v4f32) { + vfma_f32(v2f32, v2f32, v2f32); + vfmaq_f32(v4f32, v4f32, v4f32); + + vfms_f32(v2f32, v2f32, v2f32); + vfmsq_f32(v4f32, v4f32, v4f32); +}