r259537 - ARM: allow both vfma and vfms intrinsics on v7.
Tim Northover via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 2 10:02:11 PST 2016
Author: tnorthover
Date: Tue Feb 2 12:02:10 2016
New Revision: 259537
URL: http://llvm.org/viewvc/llvm-project?rev=259537&view=rev
Log:
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.
Added:
cfe/trunk/test/Sema/arm_vfma.c
Modified:
cfe/trunk/include/clang/Basic/arm_neon.td
Modified: cfe/trunk/include/clang/Basic/arm_neon.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/arm_neon.td?rev=259537&r1=259536&r2=259537&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/arm_neon.td (original)
+++ cfe/trunk/include/clang/Basic/arm_neon.td Tue Feb 2 12:02:10 2016
@@ -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", "fdQf
////////////////////////////////////////////////////////////////////////////////
// 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
Added: cfe/trunk/test/Sema/arm_vfma.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/arm_vfma.c?rev=259537&view=auto
==============================================================================
--- cfe/trunk/test/Sema/arm_vfma.c (added)
+++ cfe/trunk/test/Sema/arm_vfma.c Tue Feb 2 12:02:10 2016
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -triple thumbv7s-apple-ios7.0 -target-feature +neon -fsyntax-only -verify %s
+#include <arm_neon.h>
+
+// 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);
+}
More information about the cfe-commits
mailing list