[Mesa-dev] [PATCH 7/8] nir: Add lowering for nir_op_bit_count.

Matt Turner mattst88 at gmail.com
Thu May 31 17:10:44 UTC 2018


On Tue, May 8, 2018 at 1:13 PM, Eric Anholt <eric at anholt.net> wrote:
> This is basically the same as the GLSL lowering path.
> ---
>  src/compiler/nir/nir.h           |  2 ++
>  src/compiler/nir/nir_lower_alu.c | 36 ++++++++++++++++++++++++++++++++
>  2 files changed, 38 insertions(+)
>
> diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
> index 5b29645a6c48..e424a01c8225 100644
> --- a/src/compiler/nir/nir.h
> +++ b/src/compiler/nir/nir.h
> @@ -1889,6 +1889,8 @@ typedef struct nir_shader_compiler_options {
>     bool lower_bitfield_insert_to_shifts;
>     /** Lowers bitfield_reverse to shifts. */
>     bool lower_bitfield_reverse;
> +   /** Lowers bit_count to shifts. */
> +   bool lower_bit_count;
>     /** Lowers bfm to shifts and subtracts. */
>     bool lower_bfm;
>     /** Lowers ifind_msb to compare and ufind_msb */
> diff --git a/src/compiler/nir/nir_lower_alu.c b/src/compiler/nir/nir_lower_alu.c
> index ff977f016961..4b145db7c8c6 100644
> --- a/src/compiler/nir/nir_lower_alu.c
> +++ b/src/compiler/nir/nir_lower_alu.c
> @@ -94,6 +94,42 @@ lower_alu_instr(nir_alu_instr *instr, nir_builder *b)
>        }
>        break;
>
> +   case nir_op_bit_count:
> +      if (b->shader->options->lower_bit_count) {
> +         /* For more details, see:
> +          *
> +          * http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetPaallel

Looks like this is typo'd in lower_instructions.cpp as well. Might as
well fix here. s/Paallel/Parallel/


More information about the mesa-dev mailing list