[Mesa-dev] [PATCH 027/133] Fix what I think are a few NIR typos

Connor Abbott cwabbott0 at gmail.com
Tue Dec 16 10:10:40 PST 2014


On Tue, Dec 16, 2014 at 1:04 AM, Jason Ekstrand <jason at jlekstrand.net> wrote:
> ---
>  src/glsl/nir/nir_opcodes.h            | 6 +++---
>  src/glsl/nir/nir_opt_copy_propagate.c | 2 +-
>  2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/src/glsl/nir/nir_opcodes.h b/src/glsl/nir/nir_opcodes.h
> index 36a50d7..bee4bd1 100644
> --- a/src/glsl/nir/nir_opcodes.h
> +++ b/src/glsl/nir/nir_opcodes.h
> @@ -186,7 +186,7 @@ BINOP(isub, nir_type_int)
>  BINOP(fmul, nir_type_float)
>  BINOP(imul, nir_type_int) /* low 32-bits of signed/unsigned integer multiply */
>  BINOP(imul_high, nir_type_int) /* high 32-bits of signed integer multiply */
> -BINOP(umul_high, nir_type_int) /* high 32-bits of unsigned integer multiply */
> +BINOP(umul_high, nir_type_unsigned) /* high 32-bits of unsigned integer multiply */
>
>  BINOP(fdiv, nir_type_float)
>  BINOP(idiv, nir_type_int)
> @@ -223,8 +223,8 @@ BINOP_COMPARE(ilt, nir_type_int)
>  BINOP_COMPARE(ige, nir_type_int)
>  BINOP_COMPARE(ieq, nir_type_int)
>  BINOP_COMPARE(ine, nir_type_int)
> -BINOP_COMPARE(ult, nir_type_int)
> -BINOP_COMPARE(uge, nir_type_int)
> +BINOP_COMPARE(ult, nir_type_unsigned)
> +BINOP_COMPARE(uge, nir_type_unsigned)
>
>  /** integer-aware GLSL-style comparisons that compare floats and ints */
>  BINOP_REDUCE(ball_fequal,  1, nir_type_bool, nir_type_float)
> diff --git a/src/glsl/nir/nir_opt_copy_propagate.c b/src/glsl/nir/nir_opt_copy_propagate.c
> index a2be047..b710181 100644
> --- a/src/glsl/nir/nir_opt_copy_propagate.c
> +++ b/src/glsl/nir/nir_opt_copy_propagate.c
> @@ -61,7 +61,7 @@ is_swizzleless_move(nir_alu_instr *instr)
>
>     for (unsigned i = 0; i < 4; i++) {
>        if (!((instr->dest.write_mask >> i) & 1))
> -         break;
> +         continue;


This one isn't a typo... we know the destination is SSA here, so if
the i'th bit of the writemask is false, then all higher bits must be
false too. That being said, we could just replace the whole loop with
something like:

for (unsigned i = 0; i < instr->dest.dest.ssa.num_components; i++) {
   if (instr->src[0].swizzle[i] != i)
      return false;
}

>        if (instr->src[0].swizzle[i] != i)
>           return false;
>     }
> --
> 2.2.0
>
> _______________________________________________
> 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