[Mesa-dev] [PATCH 4/4] nir: Rely on the fact that bcsel takes a well formed boolean.
Jason Ekstrand
jason at jlekstrand.net
Thu Aug 18 08:14:42 UTC 2016
On Wed, Aug 17, 2016 at 3:03 PM, Kenneth Graunke <kenneth at whitecape.org>
wrote:
> According to Connor, it's safe to assume that the first operand of
> bcsel, as well as the operand of b2f and b2i, must be well formed
> booleans.
>
Connor is *probably* right... I'm personally still a bit skeptical that
this won't bite us in practice since we have no way to validate it.
Patches 1-3 are definitely
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Go ahead and put my R-B on this patch if you want. We can revert it if it
causes trouble. :)
> https://lists.freedesktop.org/archives/mesa-dev/2016-August/125658.html
>
> With the previous improvements to a at bool handling, this now has no
> change in shader-db instruction counts on Broadwell.
>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
> src/compiler/nir/nir_opt_algebraic.py | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/compiler/nir/nir_opt_algebraic.py
> b/src/compiler/nir/nir_opt_algebraic.py
> index 0f0896b..ceb8730 100644
> --- a/src/compiler/nir/nir_opt_algebraic.py
> +++ b/src/compiler/nir/nir_opt_algebraic.py
> @@ -144,7 +144,7 @@ optimizations = [
> (('fge', ('fneg', ('fabs', a)), 0.0), ('feq', a, 0.0)),
> (('bcsel', ('flt', b, a), b, a), ('fmin', a, b)),
> (('bcsel', ('flt', a, b), b, a), ('fmax', a, b)),
> - (('bcsel', ('inot', 'a at bool'), b, c), ('bcsel', a, c, b)),
> + (('bcsel', ('inot', a), b, c), ('bcsel', a, c, b)),
> (('bcsel', a, ('bcsel', a, b, c), d), ('bcsel', a, b, d)),
> (('bcsel', a, True, 'b at bool'), ('ior', a, b)),
> (('fmin', a, a), a),
> @@ -248,8 +248,8 @@ optimizations = [
> (('ine', 'a at bool', True), ('inot', a)),
> (('ine', 'a at bool', False), a),
> (('ieq', 'a at bool', False), ('inot', 'a')),
> - (('bcsel', a, True, False), ('ine', a, 0)),
> - (('bcsel', a, False, True), ('ieq', a, 0)),
> + (('bcsel', a, True, False), a),
> + (('bcsel', a, False, True), ('inot', a)),
> (('bcsel', True, b, c), b),
> (('bcsel', False, b, c), c),
> # The result of this should be hit by constant propagation and, in the
> --
> 2.9.0
>
> _______________________________________________
> 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/20160818/5df17540/attachment-0001.html>
More information about the mesa-dev
mailing list