Page MenuHomePhabricator

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

Authored by matejam on Mar 5 2021, 7:47 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 negated, and
from that the third argument is subtracted. This combiner will transform
that into two negations and one fma/fmad instruction.

Diff Detail

Event Timeline

matejam created this revision.Mar 5 2021, 7:47 AM
matejam requested review of this revision.Mar 5 2021, 7:47 AM
matejam updated this revision to Diff 329338.Mar 9 2021, 7:18 AM

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

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

Minor changes in CombinerHelper.cpp and in the tests.

matejam updated this revision to Diff 346786.May 20 2021, 10:27 AM

Use mi_match for comparing instructions instead of comparing the opcodes.