[PATCH] D121714: [VP] fm flag transfer to SDNodes [VE] VVP_FMA fusion

Simon Moll via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 18 05:28:04 PDT 2022


simoll added inline comments.


================
Comment at: llvm/lib/Target/VE/VVPCombine.cpp:29
+  auto MulIdx = match_SomeOperand(Root, VEISD::VVP_FMUL, [](SDValue Op) {
+    return Op->hasOneUse() && Op->getFlags().hasAllowContract();
+  });
----------------
craig.topper wrote:
> Do you need to check that the FADD is contractable too? I think that's what DAGCombiner.cpp does but the different ways of specifiying fast math make it hard to be sure.
The specification isn't clear on this; from the LangRef:
```
contract

    Allow floating-point contraction (e.g. fusing a multiply followed by an addition into a fused multiply-and-add). This does not enable reassociating to form arbitrary contractions. For example, (a*b) + (c*d) + e can not be transformed into (a*b) + ((c*d) + e) to create two fma operations.
```

I agree with you. Intuitively, the `contract` only needs to be on the node that is contracted into another node. Since contraction (in the sense of FMA) means removing the implicit rounding step after the `fmul`. The rounding after the `fadd` is unaffacted by this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121714



More information about the llvm-commits mailing list