[Mesa-dev] [PATCH 7/9] nir/peephole_ffma: Be less agressive about fusing multiply-adds

Matt Turner mattst88 at gmail.com
Tue Mar 24 17:06:12 PDT 2015


On Tue, Mar 24, 2015 at 3:39 PM, Connor Abbott <cwabbott0 at gmail.com> wrote:
> I think this is being both too aggressive and not aggressive enough.
> First, the too aggressive part. Imagine if we have something like:
>
> a = mul b, c;
> d = add a, 1.0;
> e = add a, 2.0;
> f = add a, 3.0;
>
> In this case, we don't want to turn this into a series of 3 mad's
> since the 3 load immediate instructions are going to hurt us more than
> the elimination of the mul. When the only thing using the mul is a
> bunch of add's, it's only profitable when there's at most one distinct
> immediate that isn't used by other MAD's -- any more and we gain
> instructions.

I think most importantly, we want to match the current try_emit_mad()
behavior (and just do it better) and make incremental progress from
there.


More information about the mesa-dev mailing list