[Mesa-dev] [PATCH 5/7] nir/int64: Call nir_lower_int64() in a loop

Ian Romanick idr at freedesktop.org
Mon Oct 15 18:48:24 UTC 2018


On 10/14/2018 03:11 PM, Matt Turner wrote:
> Unfortunately some int64 lowerings generate more int64 operations, so we
> need to call this function a few times. Also call
> nir_lower_alu_to_scalar() beforehand to make more int64 operations
> available for lowering.
> ---
>  src/intel/compiler/brw_nir.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c
> index f61baee230a..066724c58a6 100644
> --- a/src/intel/compiler/brw_nir.c
> +++ b/src/intel/compiler/brw_nir.c
> @@ -670,12 +670,16 @@ brw_preprocess_nir(const struct brw_compiler *compiler, nir_shader *nir)
>      */
>     OPT(nir_opt_algebraic);
>  
> +   if (is_scalar) {
> +      OPT(nir_lower_alu_to_scalar);
> +   }
> +
>     /* Lower int64 instructions before nir_optimize so that loop unrolling
>      * sees their actual cost.
>      */
> -   nir_lower_int64(nir, nir_lower_imul64 |
> -                        nir_lower_isign64 |
> -                        nir_lower_divmod64);
> +   while (nir_lower_int64(nir, nir_lower_imul64 |
> +                               nir_lower_isign64 |
> +                               nir_lower_divmod64));

I don't know that we have a specific coding standard about this, but I
always like

	while (foo)
		/* empty */ ;

just to make it obvious.

>  
>     nir = brw_nir_optimize(nir, compiler, is_scalar, true);
>  


More information about the mesa-dev mailing list