[Mesa-dev] [PATCH 01/10] nir: Convert ineg(b2i(a)) to a if it's a boolean.

Jason Ekstrand jason at jlekstrand.net
Sat Jan 7 15:28:59 UTC 2017


Rb (of you want another one)

On Jan 7, 2017 3:59 AM, "Timothy Arceri" <timothy.arceri at collabora.com>
wrote:

> From: Kenneth Graunke <kenneth at whitecape.org>
>
> On BDW:
>
> total instructions in shared programs: 13071119 -> 13070371 (-0.01%)
> instructions in affected programs: 83424 -> 82676 (-0.90%)
> helped: 505
> HURT: 45 (all TCS, all hurt by a single instruction)
>
> total cycles in shared programs: 256601322 -> 256588932 (-0.00%)
> cycles in affected programs: 819410 -> 807020 (-1.51%)
> helped: 450
> HURT: 57
>
> total loops in shared programs: 2950 -> 2942 (-0.27%)
> loops in affected programs: 8 -> 0
> helped: 7
> HURT: 0
>
> v2: Drop unnecessary 'a at bool' annotation (Connor, Eric).
>     Add a comment explaining the rule (Ian).
>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> Reviewed-by: Ian Romanick <ian.d.romanick at intel.com> [v1]
> Reviewed-by: Timothy Arceri <timothy.arceri at collabora.com>
> ---
>  src/compiler/nir/nir_opt_algebraic.py | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/src/compiler/nir/nir_opt_algebraic.py
> b/src/compiler/nir/nir_opt_algebraic.py
> index ff10d70..3b8836e 100644
> --- a/src/compiler/nir/nir_opt_algebraic.py
> +++ b/src/compiler/nir/nir_opt_algebraic.py
> @@ -197,6 +197,8 @@ optimizations = [
>     (('fmul', ('b2f', a), ('b2f', b)), ('b2f', ('iand', a, b))),
>     (('fsat', ('fadd', ('b2f', a), ('b2f', b))), ('b2f', ('ior', a, b))),
>     (('iand', 'a at bool', 1.0), ('b2f', a)),
> +   # True/False are ~0 and 0 in NIR.  b2i of True is 1, and -1 is ~0
> (True).
> +   (('ineg', ('b2i', a)), a),
>     (('flt', ('fneg', ('b2f', a)), 0), a), # Generated by TGSI KILL_IF.
>     (('flt', ('fsub', 0.0, ('b2f', a)), 0), a), # Generated by TGSI
> KILL_IF.
>     # Comparison with the same args.  Note that these are not done for
> --
> 2.9.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170107/d99bc5ed/attachment.html>


More information about the mesa-dev mailing list