util/bitset: s/BITSET_SET_RANGE/BITSET_SET_RANGE_INSIDE_WORD
authorChristian Gmeiner <christian.gmeiner@gmail.com>
Fri, 20 Aug 2021 10:14:02 +0000 (12:14 +0200)
committerMarge Bot <eric+marge@anholt.net>
Tue, 21 Sep 2021 20:25:31 +0000 (20:25 +0000)
Prep work for the next commit.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11321>

src/amd/compiler/aco_insert_NOPs.cpp
src/compiler/glsl/gl_nir_lower_samplers_as_deref.c
src/freedreno/vulkan/tu_shader.c
src/gallium/frontends/clover/nir/invocation.cpp
src/intel/compiler/brw_nir_lower_mem_access_bit_sizes.c
src/util/bitset.h
src/util/bitset_test.cpp

index 0f08499..361411d 100644 (file)
@@ -287,7 +287,7 @@ set_bitset_range(BITSET_WORD* words, unsigned start, unsigned size)
    unsigned end = start + size - 1;
    unsigned start_mod = start % BITSET_WORDBITS;
    if (start_mod + size <= BITSET_WORDBITS) {
-      BITSET_SET_RANGE(words, start, end);
+      BITSET_SET_RANGE_INSIDE_WORD(words, start, end);
    } else {
       unsigned first_size = BITSET_WORDBITS - start_mod;
       set_bitset_range(words, start, BITSET_WORDBITS - start_mod);
index b56a887..ddd9697 100644 (file)
@@ -232,12 +232,12 @@ record_textures_used(struct shader_info *info,
    const unsigned size =
       glsl_type_is_array(var->type) ? glsl_get_aoa_size(var->type) : 1;
 
-   BITSET_SET_RANGE(info->textures_used, var->data.binding, var->data.binding + (MAX2(size, 1) - 1));
+   BITSET_SET_RANGE_INSIDE_WORD(info->textures_used, var->data.binding, var->data.binding + (MAX2(size, 1) - 1));
 
    if (op == nir_texop_txf ||
        op == nir_texop_txf_ms ||
        op == nir_texop_txf_ms_mcs_intel)
-      BITSET_SET_RANGE(info->textures_used_by_txf, var->data.binding, var->data.binding + (MAX2(size, 1) - 1));
+      BITSET_SET_RANGE_INSIDE_WORD(info->textures_used_by_txf, var->data.binding, var->data.binding + (MAX2(size, 1) - 1));
 }
 
 static bool
index 8060fd6..a1671e2 100644 (file)
@@ -342,7 +342,7 @@ build_bindless(nir_builder *b, nir_deref_instr *deref, bool is_sampler,
       const struct glsl_type *glsl_type = glsl_without_array(var->type);
       uint32_t idx = var->data.index * 2;
 
-      BITSET_SET_RANGE(b->shader->info.textures_used, idx * 2, ((idx * 2) + (bind_layout->array_size * 2)) - 1);
+      BITSET_SET_RANGE_INSIDE_WORD(b->shader->info.textures_used, idx * 2, ((idx * 2) + (bind_layout->array_size * 2)) - 1);
 
       /* D24S8 workaround: stencil of D24S8 will be sampled as uint */
       if (glsl_get_sampler_result_type(glsl_type) == GLSL_TYPE_UINT)
index 151b37d..cbc9def 100644 (file)
@@ -113,7 +113,7 @@ clover_nir_lower_images(nir_shader *shader)
    shader->info.num_textures = num_rd_images;
    BITSET_ZERO(shader->info.textures_used);
    if (num_rd_images)
-      BITSET_SET_RANGE(shader->info.textures_used, 0, num_rd_images - 1);
+      BITSET_SET_RANGE_INSIDE_WORD(shader->info.textures_used, 0, num_rd_images - 1);
    shader->info.num_images = num_wr_images;
 
    nir_builder b;
index fae63e5..0b0a088 100644 (file)
@@ -189,7 +189,7 @@ lower_mem_store_bit_size(nir_builder *b, nir_intrinsic_instr *intrin,
 
    for (unsigned i = 0; i < num_components; i++) {
       if (writemask & (1u << i))
-         BITSET_SET_RANGE(mask, i * byte_size, ((i + 1) * byte_size) - 1);
+         BITSET_SET_RANGE_INSIDE_WORD(mask, i * byte_size, ((i + 1) * byte_size) - 1);
    }
 
    while (BITSET_FFS(mask) != 0) {
index 88c3673..f0b16ea 100644 (file)
@@ -196,10 +196,10 @@ __bitset_shl(BITSET_WORD *x, unsigned amount, unsigned n)
    (BITSET_BITWORD(b) == BITSET_BITWORD(e) ? \
    (((x)[BITSET_BITWORD(b)] & BITSET_RANGE(b, e)) != 0) : \
    (assert (!"BITSET_TEST_RANGE: bit range crosses word boundary"), 0))
-#define BITSET_SET_RANGE(x, b, e) \
+#define BITSET_SET_RANGE_INSIDE_WORD(x, b, e) \
    (BITSET_BITWORD(b) == BITSET_BITWORD(e) ? \
    ((x)[BITSET_BITWORD(b)] |= BITSET_RANGE(b, e)) : \
-   (assert (!"BITSET_SET_RANGE: bit range crosses word boundary"), 0))
+   (assert (!"BITSET_SET_RANGE_INSIDE_WORD: bit range crosses word boundary"), 0))
 #define BITSET_CLEAR_RANGE(x, b, e) \
    (BITSET_BITWORD(b) == BITSET_BITWORD(e) ? \
    ((x)[BITSET_BITWORD(b)] &= ~BITSET_RANGE(b, e)) : \
index 34798f4..608251e 100644 (file)
@@ -73,7 +73,7 @@ TEST(bitset, test_basic_range)
    BITSET_ZERO(mask128);
 
    const int max_set = 15;
-   BITSET_SET_RANGE(mask128, 0, max_set);
+   BITSET_SET_RANGE_INSIDE_WORD(mask128, 0, max_set);
    EXPECT_EQ(BITSET_TEST_RANGE(mask128, 0, max_set), true);
    EXPECT_EQ(BITSET_TEST_RANGE(mask128, max_set + 1, max_set + 15), false);
    for (int i = 0; i < 128; i++) {
@@ -105,7 +105,7 @@ TEST(bitset, test_bitset_ffs)
    BITSET_CLEAR(mask128, 14);
    EXPECT_EQ(BITSET_FFS(mask128), 29);
 
-   BITSET_SET_RANGE(mask128, 14, 18);
+   BITSET_SET_RANGE_INSIDE_WORD(mask128, 14, 18);
    EXPECT_EQ(BITSET_FFS(mask128), 15);
 }
 
@@ -114,10 +114,10 @@ TEST(bitset, test_range_bits)
    BITSET_DECLARE(mask128, 128);
    BITSET_ZERO(mask128);
 
-   BITSET_SET_RANGE(mask128, 0, 31);
-   BITSET_SET_RANGE(mask128, 32, 63);
-   BITSET_SET_RANGE(mask128, 64, 95);
-   BITSET_SET_RANGE(mask128, 96, 127);
+   BITSET_SET_RANGE_INSIDE_WORD(mask128, 0, 31);
+   BITSET_SET_RANGE_INSIDE_WORD(mask128, 32, 63);
+   BITSET_SET_RANGE_INSIDE_WORD(mask128, 64, 95);
+   BITSET_SET_RANGE_INSIDE_WORD(mask128, 96, 127);
 
    EXPECT_EQ(BITSET_TEST_RANGE(mask128, 0, 31), true);
    EXPECT_EQ(BITSET_TEST_RANGE(mask128, 32, 63), true);
@@ -144,8 +144,8 @@ TEST(bitset, test_and)
    EXPECT_EQ(BITSET_TEST_RANGE(r, 96, 127), false);
 
 
-   BITSET_SET_RANGE(a, 32, 63);
-   BITSET_SET_RANGE(b, 96, 127);
+   BITSET_SET_RANGE_INSIDE_WORD(a, 32, 63);
+   BITSET_SET_RANGE_INSIDE_WORD(b, 96, 127);
    BITSET_AND(r, a, b);
 
    EXPECT_EQ(BITSET_TEST_RANGE(r, 0, 31), false);
@@ -182,8 +182,8 @@ TEST(bitset, test_or)
    EXPECT_EQ(BITSET_TEST_RANGE(r, 96, 127), false);
 
 
-   BITSET_SET_RANGE(a, 32, 63);
-   BITSET_SET_RANGE(b, 96, 127);
+   BITSET_SET_RANGE_INSIDE_WORD(a, 32, 63);
+   BITSET_SET_RANGE_INSIDE_WORD(b, 96, 127);
    BITSET_OR(r, a, b);
 
    EXPECT_EQ(BITSET_TEST_RANGE(r, 0, 31), false);