[Mesa-dev] [PATCH 07/10] nir: Add algebraic optimizations for pointless shifts.
Matt Turner
mattst88 at gmail.com
Thu Jan 22 09:09:39 PST 2015
On Thu, Jan 22, 2015 at 3:41 AM, Kenneth Graunke <kenneth at whitecape.org> wrote:
> The GLSL IR optimization pass contained these; we may as well include
> them too.
>
> No change in the number of NIR instructions on a shader-db run.
>
> total i965 instructions in shared programs: 6035397 -> 6035393 (-0.00%)
> i965 instructions in affected programs: 772 -> 768 (-0.52%)
> helped: 3 (all in glamor)
>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
> src/glsl/nir/nir_opt_algebraic.py | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/src/glsl/nir/nir_opt_algebraic.py b/src/glsl/nir/nir_opt_algebraic.py
> index cf16b19..58e71e0 100644
> --- a/src/glsl/nir/nir_opt_algebraic.py
> +++ b/src/glsl/nir/nir_opt_algebraic.py
> @@ -83,6 +83,13 @@ optimizations = [
> # DeMorgan's Laws
> (('iand', ('inot', a), ('inot', b)), ('inot', ('ior', a, b))),
> (('ior', ('inot', a), ('inot', b)), ('inot', ('iand', a, b))),
> + # Shift optimizations
> + (('ishl', 0, a), 0),
Shift zero by an unknown -> zero. Yes.
> + (('ishl', a, 0), 0),
Shift an unknown by zero -> zero?!
With those fixed and shader-db results confirmed,
Reviewed-by: Matt Turner <mattst88 at gmail.com>
More information about the mesa-dev
mailing list