[Mesa-dev] [PATCH 1/6] nir: Convert ineg(b2i(a)) to a if it's a boolean.
Ian Romanick
idr at freedesktop.org
Wed Aug 10 17:53:17 UTC 2016
My most "recent" work in this area is in my appropriately named
assume-CMS-in-precompile branch. I should just rename all my branches
idr-got-distracted-#.
On 08/09/2016 07:30 PM, Kenneth Graunke wrote:
> On Haswell (GL 3.3):
>
> total instructions in shared programs: 6211678 -> 6211584 (-0.00%)
> instructions in affected programs: 18968 -> 18874 (-0.50%)
> helped: 62
> HURT: 0
> LOST: 0
> GAINED: 4
>
> On Broadwell (GL 4.4):
>
> total instructions in shared programs: 11638930 -> 11638181 (-0.01%)
> instructions in affected programs: 84768 -> 84019 (-0.88%)
> helped: 505
> HURT: 45
>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
> src/compiler/nir/nir_opt_algebraic.py | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
> index 0f0896b..1cf614c 100644
> --- a/src/compiler/nir/nir_opt_algebraic.py
> +++ b/src/compiler/nir/nir_opt_algebraic.py
> @@ -180,6 +180,7 @@ 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)),
> + (('ineg', ('b2i', 'a at bool')), a),
I think I might like a comment that this works because Boolean true and
false are always ~0 and 0 in NIR. With that,
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
> (('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
>
More information about the mesa-dev
mailing list