[Mesa-dev] [PATCH 06/24] glsl: Add lowering pass for ir_unop_bit_count
Matt Turner
mattst88 at gmail.com
Thu Jun 30 18:44:36 UTC 2016
On Wed, Jun 29, 2016 at 2:04 PM, Ian Romanick <idr at freedesktop.org> wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> ---
> src/compiler/glsl/ir_optimization.h | 1 +
> src/compiler/glsl/lower_instructions.cpp | 53 ++++++++++++++++++++++++++++++++
> 2 files changed, 54 insertions(+)
>
> diff --git a/src/compiler/glsl/ir_optimization.h b/src/compiler/glsl/ir_optimization.h
> index ba14e34..019909a 100644
> --- a/src/compiler/glsl/ir_optimization.h
> +++ b/src/compiler/glsl/ir_optimization.h
> @@ -42,6 +42,7 @@
> #define SAT_TO_CLAMP 0x400
> #define DOPS_TO_DFRAC 0x800
> #define DFREXP_DLDEXP_TO_ARITH 0x1000
> +#define BIT_COUNT_TO_MATH 0x02000
No preference, but there's a leading zero in this constant.
>
> /**
> * \see class lower_packing_builtins_visitor
> diff --git a/src/compiler/glsl/lower_instructions.cpp b/src/compiler/glsl/lower_instructions.cpp
> index 16d92d6..fc87605 100644
> --- a/src/compiler/glsl/lower_instructions.cpp
> +++ b/src/compiler/glsl/lower_instructions.cpp
> @@ -159,6 +159,7 @@ private:
> void dround_even_to_dfrac(ir_expression *);
> void dtrunc_to_dfrac(ir_expression *);
> void dsign_to_csel(ir_expression *);
> + void bit_count_to_math(ir_expression *);
> };
>
> } /* anonymous namespace */
> @@ -954,6 +955,52 @@ lower_instructions_visitor::dsign_to_csel(ir_expression *ir)
> this->progress = true;
> }
>
> +void
> +lower_instructions_visitor::bit_count_to_math(ir_expression *ir)
> +{
> + /* For more details, see:
> + *
> + * http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetPaallel
Lost the 'r' in Parallel in the link.
More information about the mesa-dev
mailing list