[PATCH] D98048: [AMDGPU][GlobalISel] Transform (fsub (fneg (fmul, x, y)), z) -> (fma (fneg x), y, (fneg z))

Mateja Marjanovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 5 07:47:48 PST 2021


matejam created this revision.
matejam added reviewers: foad, arsen, mbrkusanin, Petar.Avramovic.
matejam added a project: LLVM.
Herald added subscribers: kerbowa, hiraditya, t-tye, tpr, dstuttard, rovka, yaxunl, nhaehnle, jvesely, kzhuravl.
matejam requested review of this revision.
Herald added a subscriber: wdng.

Instead of sub and mul instructions, use v_mad, v_mac or v_fma if fma
instructions are faster and are legal for the given architecture.
Combiner for a case that has one multiplication, which gets negated, and
from that the third argument is subtracted. This combiner will transform
that into two negations and one fma/fmad instruction.


https://reviews.llvm.org/D98048

Files:
  llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
  llvm/include/llvm/Target/GlobalISel/Combine.td
  llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
  llvm/test/CodeGen/AMDGPU/GlobalISel/combine-fma-sub-neg-mul.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98048.328531.patch
Type: text/x-patch
Size: 26781 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210305/0b51e7de/attachment-0001.bin>


More information about the llvm-commits mailing list