[Mesa-dev] [PATCH 4/5] i965/fs: Allow saturate propagation to propagate negations into MADs.

Matt Turner mattst88 at gmail.com
Tue Feb 23 00:58:24 UTC 2016


On Mon, Feb 22, 2016 at 4:39 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> On Mon, Feb 22, 2016 at 7:13 PM, Matt Turner <mattst88 at gmail.com> wrote:
>
> Unless there's something unexpected going on, let's say
>
> src0 = 0, src1 = 0, src2 = -0.5
>
>> Allows us to transform
>>
>>    mad      res  src0   src1   src2
>
> res = -0.5

I think you're assuming that MAD is src0 * src1 + src2, but it's
actually src0 + src1 * src2.

Does that clear things up?

Generally, the thinking is to negate a MUL you negate one of its
arguments, and to negate an ADD you negate both of its arguments, so
to negate a MAD you negate one of the multiplicands and the additive
argument.


More information about the mesa-dev mailing list