Re: [Mesa-dev] [PATCH 1/4] nir: Do basic constant reassociation.

2016-04-11 Thread Matt Turner
On Thu, Apr 7, 2016 at 4:35 PM, Kenneth Graunke wrote: > Many shaders contain expression trees of the form: > > const_1 * (value * const_2) > > Reorganizing these to > > (const_1 * const_2) * value > > will allow constant folding to combine the constants. Sometimes, these > constants are

Re: [Mesa-dev] [PATCH 1/4] nir: Do basic constant reassociation.

2016-04-08 Thread Jason Ekstrand
On Fri, Apr 8, 2016 at 8:21 AM, Eduardo Lima Mitev wrote: > On 04/08/2016 01:35 AM, Kenneth Graunke wrote: > >> Many shaders contain expression trees of the form: >> >> const_1 * (value * const_2) >> >> Reorganizing these to >> >> (const_1 * const_2) * value >> >> will allow constant fo

Re: [Mesa-dev] [PATCH 1/4] nir: Do basic constant reassociation.

2016-04-08 Thread Eduardo Lima Mitev
On 04/08/2016 01:35 AM, Kenneth Graunke wrote: Many shaders contain expression trees of the form: const_1 * (value * const_2) Reorganizing these to (const_1 * const_2) * value will allow constant folding to combine the constants. Sometimes, these constants are 2 and 0.5, so we can

[Mesa-dev] [PATCH 1/4] nir: Do basic constant reassociation.

2016-04-07 Thread Kenneth Graunke
Many shaders contain expression trees of the form: const_1 * (value * const_2) Reorganizing these to (const_1 * const_2) * value will allow constant folding to combine the constants. Sometimes, these constants are 2 and 0.5, so we can remove a multiply altogether. Other times, it can