[Mesa-dev] [PATCH 1/2] nir: Recognize a pattern for doing b2f without the opcode.

Connor Abbott cwabbott0 at gmail.com
Mon Mar 30 11:04:43 PDT 2015


Series is

Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>

On Mon, Mar 30, 2015 at 1:12 PM, Eric Anholt <eric at anholt.net> wrote:
> Since we have patterns based on b2f, generate them if we see the b2f
> equivalent using an iand.  This is common when generating NIR from TGSI.
> ---
>  src/glsl/nir/nir_opt_algebraic.py | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/src/glsl/nir/nir_opt_algebraic.py b/src/glsl/nir/nir_opt_algebraic.py
> index 66b456d..301d7a8 100644
> --- a/src/glsl/nir/nir_opt_algebraic.py
> +++ b/src/glsl/nir/nir_opt_algebraic.py
> @@ -99,6 +99,7 @@ optimizations = [
>     # Emulating booleans
>     (('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)),
>     # Comparison with the same args.  Note that these are not done for
>     # the float versions because NaN always returns false on float
>     # inequalities.
> --
> 2.1.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list