[PATCH] D53315: [ARM] Do not fuse VADD and VMUL, continued (2/2)

Sjoerd Meijer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 16 06:49:14 PDT 2018


SjoerdMeijer updated this revision to Diff 169819.
SjoerdMeijer added a comment.

> should the f64 version not also be tested?

Both the M4 and M33 have only Single-Precision VFP support. Thus f64 operations result in EABI calls and so I don't think there's much to test here. I have cleaned up the RUN line in the test case though as we only need the -mcpu=cortex-m33 part and not the other attributes.


https://reviews.llvm.org/D53315

Files:
  lib/Target/ARM/ARMInstrInfo.td
  test/CodeGen/ARM/fusedMAC.ll


Index: test/CodeGen/ARM/fusedMAC.ll
===================================================================
--- test/CodeGen/ARM/fusedMAC.ll
+++ test/CodeGen/ARM/fusedMAC.ll
@@ -1,4 +1,5 @@
 ; RUN: llc < %s -mtriple=armv7-eabi -mattr=+neon,+vfp4 -fp-contract=fast | FileCheck %s
+; RUN: llc < %s -mtriple=armv7-eabi -fp-contract=fast -mcpu=cortex-m33 | FileCheck %s -check-prefix=DONT-FUSE
 ; Check generated fused MAC and MLS.
 
 define double @fusedMACTest1(double %d1, double %d2, double %d3) {
@@ -12,6 +13,11 @@
 define float @fusedMACTest2(float %f1, float %f2, float %f3) {
 ;CHECK-LABEL: fusedMACTest2:
 ;CHECK: vfma.f32
+
+;DONT-FUSE-LABEL: fusedMACTest2:
+;DONT-FUSE:       vmul.f32
+;DONT-FUSE-NEXT:  vadd.f32
+
   %1 = fmul float %f1, %f2
   %2 = fadd float %1, %f3
   ret float %2
Index: lib/Target/ARM/ARMInstrInfo.td
===================================================================
--- lib/Target/ARM/ARMInstrInfo.td
+++ lib/Target/ARM/ARMInstrInfo.td
@@ -365,12 +365,14 @@
 def UseMulOps        : Predicate<"Subtarget->useMulOps()">;
 
 // Prefer fused MAC for fp mul + add over fp VMLA / VMLS if they are available.
-// But only select them if more precision in FP computation is allowed.
+// But only select them if more precision in FP computation is allowed, and when
+// they are not slower than a mul + add sequence.
 // Do not use them for Darwin platforms.
 def UseFusedMAC      : Predicate<"(TM.Options.AllowFPOpFusion =="
                                  " FPOpFusion::Fast && "
                                  " Subtarget->hasVFP4()) && "
-                                 "!Subtarget->isTargetDarwin()">;
+                                 "!Subtarget->isTargetDarwin() &&"
+                                 "Subtarget->useFPVMLx()">;
 
 def HasFastVGETLNi32 : Predicate<"!Subtarget->hasSlowVGETLNi32()">;
 def HasSlowVGETLNi32 : Predicate<"Subtarget->hasSlowVGETLNi32()">;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53315.169819.patch
Type: text/x-patch
Size: 1903 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181016/6e44d11f/attachment.bin>


More information about the llvm-commits mailing list