[PATCH] D84930: [AArch64] Consider instruction-level contract FMFs in combiner patterns.

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 30 07:22:35 PDT 2020


dmgreen added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AArch64InstrInfo.cpp:3914
 
+  // If we can only fuse if both instructions have the contract fast-math flag,
+  // bail out if it is missing.
----------------
-> We can only fuse ...


================
Comment at: llvm/lib/Target/AArch64/AArch64InstrInfo.cpp:4123
+  // We can fuse FMUL & FADD, if fusion is either allowed globally by the target
+  // options or if both instructions have the contract fast-math flag.
+  TargetOptions Options = Root.getParent()->getParent()->getTarget().Options;
----------------
Do both instructions need the fast-math flag, or just the add? I guess it's safer to check both, but the code would end up being simpler if it was just the add.

Reading DAGCombiner::visitFADDForFMACombine it's a bit messy, but seems like it only really considers the add:
https://godbolt.org/z/3ejrhE
Reading the code though, I'm not sure that's really what it is intending to do.


================
Comment at: llvm/test/CodeGen/AArch64/machine-combiner-instr-fmf.mir:82
 
 # Do not create FMADD, because we don't have the contract flag on moth instructions.
 
----------------
-> both


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84930/new/

https://reviews.llvm.org/D84930



More information about the llvm-commits mailing list