diff options
author | Dylan Baker <[email protected]> | 2018-08-21 09:46:46 -0700 |
---|---|---|
committer | Dylan Baker <[email protected]> | 2018-09-07 10:21:26 -0700 |
commit | 8396043f304bb2a752130230055605c5c966e89f (patch) | |
tree | ee2e8a5494b88bff3b5e67ece8ffdba70d12c087 /src/intel/compiler | |
parent | 80825abb5d1a7491035880253ffd531c55acae6b (diff) |
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 <[email protected]> (v1)
Acked-by: Eric Anholt <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/intel/compiler')
-rw-r--r-- | src/intel/compiler/brw_fs.cpp | 3 | ||||
-rw-r--r-- | src/intel/compiler/brw_fs_nir.cpp | 3 | ||||
-rw-r--r-- | src/intel/compiler/brw_nir.c | 5 | ||||
-rw-r--r-- | src/intel/compiler/brw_vec4.cpp | 3 | ||||
-rw-r--r-- | src/intel/compiler/brw_vec4_visitor.cpp | 3 |
5 files changed, 11 insertions, 6 deletions
diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp index 02a7a33c4d7..3f7f2b4c984 100644 --- a/src/intel/compiler/brw_fs.cpp +++ b/src/intel/compiler/brw_fs.cpp @@ -39,6 +39,7 @@ #include "compiler/glsl_types.h" #include "compiler/nir/nir_builder.h" #include "program/prog_parameter.h" +#include "util/u_math.h" using namespace brw; @@ -1534,7 +1535,7 @@ fs_visitor::calculate_urb_setup() int urb_next = 0; /* Figure out where each of the incoming setup attributes lands. */ if (devinfo->gen >= 6) { - if (_mesa_bitcount_64(nir->info.inputs_read & + if (util_bitcount64(nir->info.inputs_read & BRW_FS_VARYING_INPUT_MASK) <= 16) { /* The SF/SBE pipeline stage can do arbitrary rearrangement of the * first 16 varying inputs, so we can put them wherever we want. diff --git a/src/intel/compiler/brw_fs_nir.cpp b/src/intel/compiler/brw_fs_nir.cpp index ab915ee0a2d..7f453d75b64 100644 --- a/src/intel/compiler/brw_fs_nir.cpp +++ b/src/intel/compiler/brw_fs_nir.cpp @@ -25,6 +25,7 @@ #include "brw_fs.h" #include "brw_fs_surface_builder.h" #include "brw_nir.h" +#include "util/u_math.h" using namespace brw; using namespace brw::surface_access; @@ -751,7 +752,7 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr) /* Since NIR is doing the scalarizing for us, we should only ever see * vectorized operations with a single channel. */ - assert(_mesa_bitcount(instr->dest.write_mask) == 1); + assert(util_bitcount(instr->dest.write_mask) == 1); channel = ffs(instr->dest.write_mask) - 1; result = offset(result, bld, channel); diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c index ce865e2ce71..b38c3ba383d 100644 --- a/src/intel/compiler/brw_nir.c +++ b/src/intel/compiler/brw_nir.c @@ -26,6 +26,7 @@ #include "common/gen_debug.h" #include "compiler/glsl_types.h" #include "compiler/nir/nir_builder.h" +#include "util/u_math.h" static bool is_input(nir_intrinsic_instr *intrin) @@ -243,7 +244,7 @@ brw_nir_lower_vs_inputs(nir_shader *nir, BITFIELD64_BIT(SYSTEM_VALUE_VERTEX_ID_ZERO_BASE) | BITFIELD64_BIT(SYSTEM_VALUE_INSTANCE_ID)); - const unsigned num_inputs = _mesa_bitcount_64(nir->info.inputs_read); + const unsigned num_inputs = util_bitcount64(nir->info.inputs_read); nir_foreach_function(function, nir) { if (!function->impl) @@ -322,7 +323,7 @@ brw_nir_lower_vs_inputs(nir_shader *nir, * before it and counting the bits. */ int attr = nir_intrinsic_base(intrin); - int slot = _mesa_bitcount_64(nir->info.inputs_read & + int slot = util_bitcount64(nir->info.inputs_read & BITFIELD64_MASK(attr)); nir_intrinsic_set_base(intrin, slot); break; diff --git a/src/intel/compiler/brw_vec4.cpp b/src/intel/compiler/brw_vec4.cpp index 4e242e03032..5a86f30634a 100644 --- a/src/intel/compiler/brw_vec4.cpp +++ b/src/intel/compiler/brw_vec4.cpp @@ -31,6 +31,7 @@ #include "brw_dead_control_flow.h" #include "common/gen_debug.h" #include "program/prog_parameter.h" +#include "util/u_math.h" #define MAX_INSTRUCTION (1 << 30) @@ -2845,7 +2846,7 @@ brw_compile_vs(const struct brw_compiler *compiler, void *log_data, ((1 << shader->info.cull_distance_array_size) - 1) << shader->info.clip_distance_array_size; - unsigned nr_attribute_slots = _mesa_bitcount_64(prog_data->inputs_read); + unsigned nr_attribute_slots = util_bitcount64(prog_data->inputs_read); /* gl_VertexID and gl_InstanceID are system values, but arrive via an * incoming vertex attribute. So, add an extra slot. diff --git a/src/intel/compiler/brw_vec4_visitor.cpp b/src/intel/compiler/brw_vec4_visitor.cpp index 65e1c6d88e1..b2bb2c6b82a 100644 --- a/src/intel/compiler/brw_vec4_visitor.cpp +++ b/src/intel/compiler/brw_vec4_visitor.cpp @@ -24,6 +24,7 @@ #include "brw_vec4.h" #include "brw_cfg.h" #include "brw_eu.h" +#include "util/u_math.h" namespace brw { @@ -1317,7 +1318,7 @@ vec4_visitor::emit_urb_slot(dst_reg reg, int varying) * determine which edges should be drawn as wireframe. */ current_annotation = "edge flag"; - int edge_attr = _mesa_bitcount_64(nir->info.inputs_read & + int edge_attr = util_bitcount64(nir->info.inputs_read & BITFIELD64_MASK(VERT_ATTRIB_EDGEFLAG)); emit(MOV(reg, src_reg(dst_reg(ATTR, edge_attr, glsl_type::float_type, WRITEMASK_XYZW)))); |