[Mesa-dev] [PATCH 07/10] nir: Simplify 0 >= b2f(a)

Matt Turner mattst88 at gmail.com
Thu Mar 10 18:51:50 UTC 2016


On Thu, Mar 10, 2016 at 10:25 AM, Ian Romanick <idr at freedesktop.org> wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> This also prevented some regressions with other patches in my local
> tree.
>
> Broadwell / Skylake
> total instructions in shared programs: 8980835 -> 8980833 (-0.00%)
> instructions in affected programs: 45 -> 43 (-4.44%)
> helped: 1
> HURT: 0
>
> total cycles in shared programs: 70077904 -> 70077900 (-0.00%)
> cycles in affected programs: 122 -> 118 (-3.28%)
> helped: 1
> HURT: 0
>
> No changes on earlier platforms.
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> ---
>  src/compiler/nir/nir_opt_algebraic.py | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
> index 5b3694e..4db8f84 100644
> --- a/src/compiler/nir/nir_opt_algebraic.py
> +++ b/src/compiler/nir/nir_opt_algebraic.py
> @@ -101,6 +101,13 @@ optimizations = [
>     (('inot', ('ige', a, b)), ('ilt', a, b)),
>     (('inot', ('ieq', a, b)), ('ine', a, b)),
>     (('inot', ('ine', a, b)), ('ieq', a, b)),
> +
> +   # 0.0 >= b2f(a)
> +   # 0.0 == b2f(a) because b2f(a) can only be 0 or 1
> +   # b2f(a) == 0.0
> +   # inot(a)
> +   (('fge', 0.0, ('b2f', a)), ('inot', a)),
> +

Reviewed-by: Matt Turner <mattst88 at gmail.com>


More information about the mesa-dev mailing list