From 8396043f304bb2a752130230055605c5c966e89f Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Tue, 21 Aug 2018 09:46:46 -0700 Subject: Replace uses of _mesa_bitcount with util_bitcount and _mesa_bitcount_64 with util_bitcount_64. This fixes a build problem in nir for platforms that don't have popcount or popcountll, such as 32bit msvc. v2: - Fix additional uses of _mesa_bitcount added after this was originally written Acked-by: Eric Engestrom (v1) Acked-by: Eric Anholt Reviewed-by: Ian Romanick --- src/compiler/nir/nir.c | 6 +++--- src/compiler/nir/nir_split_vars.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/compiler/nir') diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c index a6240c11f2d..402fd2c7725 100644 --- a/src/compiler/nir/nir.c +++ b/src/compiler/nir/nir.c @@ -31,8 +31,8 @@ #include #include #include +#include "util/u_math.h" -#include "main/imports.h" /* _mesa_bitcount_64 */ #include "main/menums.h" /* BITFIELD64_MASK */ nir_shader * @@ -1862,7 +1862,7 @@ nir_system_value_from_intrinsic(nir_intrinsic_op intrin) * the original OpenGL single-slot input numbering. The mapping from old * locations to new locations is as follows: * - * new_loc = loc + _mesa_bitcount(dual_slot & BITFIELD64_MASK(loc)) + * new_loc = loc + util_bitcount(dual_slot & BITFIELD64_MASK(loc)) */ void nir_remap_dual_slot_attributes(nir_shader *shader, uint64_t *dual_slot) @@ -1879,7 +1879,7 @@ nir_remap_dual_slot_attributes(nir_shader *shader, uint64_t *dual_slot) nir_foreach_variable(var, &shader->inputs) { var->data.location += - _mesa_bitcount_64(*dual_slot & BITFIELD64_MASK(var->data.location)); + util_bitcount64(*dual_slot & BITFIELD64_MASK(var->data.location)); } } diff --git a/src/compiler/nir/nir_split_vars.c b/src/compiler/nir/nir_split_vars.c index 6cd835cb013..02aef2a9b47 100644 --- a/src/compiler/nir/nir_split_vars.c +++ b/src/compiler/nir/nir_split_vars.c @@ -26,8 +26,8 @@ #include "nir_deref.h" #include "nir_vla.h" -/* Needed for _mesa_bitcount() */ -#include "main/macros.h" +#include "util/u_math.h" + struct split_var_state { void *mem_ctx; @@ -1277,7 +1277,7 @@ shrink_vec_var_list(struct exec_list *vars, } /* Build the new var type */ - unsigned new_num_comps = _mesa_bitcount(usage->comps_kept); + unsigned new_num_comps = util_bitcount(usage->comps_kept); const struct glsl_type *new_type = glsl_vector_type(glsl_get_base_type(vec_type), new_num_comps); for (int i = usage->num_levels - 1; i >= 0; i--) { -- cgit v1.2.3