This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU][GlobalISel] Transform (fsub (fpext (fmul x, y)), z) -> (fma (fpext x), (fpext y), (fneg z))
ClosedPublic

Authored by matejam on Mar 5 2021, 7:49 AM.

Details

Summary

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 extended, and
from that the third argument is subtracted. This combiner will transform
that into two extends and one negation within the fma/fmad instruction.

Diff Detail

Event Timeline

matejam created this revision.Mar 5 2021, 7:49 AM
matejam requested review of this revision.Mar 5 2021, 7:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 5 2021, 7:49 AM
matejam updated this revision to Diff 329339.Mar 9 2021, 7:19 AM

Put back the accidentally deleted combiner from the list of combiners (load_or_combine).

matejam updated this revision to Diff 343376.May 6 2021, 5:48 AM

Minor changes in CombinerHelper.cpp and in the tests.

matejam updated this revision to Diff 346785.May 20 2021, 10:25 AM

Use mi_match for comparing instructions instead of comparing the opcodes.

matejam updated this revision to Diff 375876.Sep 29 2021, 7:09 AM

Use m_MInstr instead of m_Reg in matching patterns (mi_match).
Instead of getting MachineInstr's, get only the Register values (no need for MachineInstr in this case).
A few minor bug fixes.
Formatting and refactoring.

matejam updated this revision to Diff 376207.Sep 30 2021, 7:10 AM

Use applyBuildFn instead of writing my own apply.

matejam updated this revision to Diff 376522.Oct 1 2021, 7:24 AM

Changes in tests.

This revision is now accepted and ready to land.Nov 17 2021, 9:59 AM
matejam updated this revision to Diff 390335.Nov 29 2021, 6:21 AM

Added missing comments and an FMA combiner group in table gen.

This revision was landed with ongoing or failed builds.Nov 29 2021, 7:28 AM
This revision was automatically updated to reflect the committed changes.