[PATCH] D76419: [DAGCombiner] Add nsz constraint to aggressive fma folding

Qiu Chaofan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 19 02:39:30 PDT 2020


qiucf created this revision.
qiucf added reviewers: PowerPC, RKSimon, arsenm, lebedev.ri, spatel, critson.
Herald added subscribers: llvm-commits, kerbowa, hiraditya, nhaehnle, wdng, jvesely, nemanjai.
Herald added a project: LLVM.

There's a folding pattern in DAGCombine:

  (fsub x, (fma y, z, (fmul u, v)))
  ->
  (fma (fneg y), z, (fma (fneg u), v, x))

However, since `-0-0=-0; -0+0=+0`, if `yz=1, uv=-1, x=-0`:

  x-(yz+uv) = -0
  -yz+(-uv+x) = +0

So this requires `nsz`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76419

Files:
  llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  llvm/test/CodeGen/AMDGPU/fma-combine.ll
  llvm/test/CodeGen/AMDGPU/mad-combine.ll
  llvm/test/CodeGen/PowerPC/fma-assoc.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76419.251305.patch
Type: text/x-patch
Size: 4437 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200319/d8d4f21c/attachment.bin>


More information about the llvm-commits mailing list