On Tue, Sep 30, 2014 at 2:10 PM, Ian Romanick <i...@freedesktop.org> wrote:
> On 09/27/2014 12:12 PM, Matt Turner wrote:
>> The next patch adds an algebraic optimization for the pattern
>>
>>    sqrt a, b
>>    rcp  c, a
>>
>> and turns it into
>>
>>    sqrt a, b
>>    rsq  c, b
>>
>> but many vertex shaders do
>>
>>    a = sqrt(b);
>>    var1 /= a;
>>    var2 /= a;
>>
>> which generates
>>
>>    sqrt a, b
>>    rcp  c, a
>>    rcp  d, a
>>
>> If we apply the algebraic optimization before CSE, we'll end up with
>>
>>    sqrt a, b
>>    rsq  c, b
>>    rcp  d, a
>
> Why doesn't a second pass through opt_algebraic turn this into

Because the addition in patch #2 just recognizes a consecutive sqrt+rcp pattern.

>    rsq  c, b
>    rsq  d, b
>
> Seems like this could cause us to miss other optimization opportunities...

This seems pretty sufficient for the collection of shaders in
shader-db -- no regressions, cuts vec4 instructions, and handles 410
sqrt+rcp pairs.
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to