Skip to content

nir/algebraic: Rearrange (x±1)*y to have multiply-add form and some ffma to be flrp

Ian Romanick requested to merge idr/mesa:review/optimize-dph-and-others into main

When I wrote these commits 5 years ago, they either didn't help much or cause many spill / fill regressions. Improvements to constant combining and other compiler changes have improved the situation.

The first commit rearranges (x±1)y to be (xy)+y so other optimizations can generate ffma.

The second commit converts ffma(2, x, -1) to be flrp(-1, 1, x). On Intel platforms that support flrp, 3-source instructions can't have immediate sources. The ffma has two immediate sources, but the flrp only has one. That potentially saves a register and a move.

There are additional commits that didn't help Intel platforms in https://gitlab.freedesktop.org/idr/mesa/-/commits/wip/optimize-dph-and-others.

Merge request reports