diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/intel/compiler/brw_nir_lower_mem_access_bit_sizes.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/intel/compiler/brw_nir_lower_mem_access_bit_sizes.c b/src/intel/compiler/brw_nir_lower_mem_access_bit_sizes.c index 2ec47b38999..342cf9ede87 100644 --- a/src/intel/compiler/brw_nir_lower_mem_access_bit_sizes.c +++ b/src/intel/compiler/brw_nir_lower_mem_access_bit_sizes.c @@ -180,20 +180,23 @@ lower_mem_store_bit_size(nir_builder *b, nir_intrinsic_instr *intrin) offset_is_const ? nir_src_as_uint(*offset_src) : 0; const unsigned byte_size = bit_size / 8; - assert(num_components * byte_size <= 32); - uint32_t byte_mask = 0; + assert(byte_size <= sizeof(uint64_t)); + + BITSET_DECLARE(mask, NIR_MAX_VEC_COMPONENTS * sizeof(uint64_t)); + BITSET_ZERO(mask); + for (unsigned i = 0; i < num_components; i++) { if (writemask & (1u << i)) - byte_mask |= ((1 << byte_size) - 1) << i * byte_size; + BITSET_SET_RANGE(mask, i * byte_size, ((i + 1) * byte_size) - 1); } - while (byte_mask) { - const int start = ffs(byte_mask) - 1; + while (BITSET_FFS(mask) != 0) { + const int start = BITSET_FFS(mask) - 1; assert(start % byte_size == 0); int end; for (end = start + 1; end < bytes_written; end++) { - if (!(byte_mask & (1 << end))) + if (!(BITSET_TEST(mask, end))) break; } /* The size of the current contiguous chunk in bytes */ @@ -233,7 +236,7 @@ lower_mem_store_bit_size(nir_builder *b, nir_intrinsic_instr *intrin) dup_mem_intrinsic(b, intrin, packed, start, store_comps, store_bit_size, store_align); - byte_mask &= ~(((1u << store_bytes) - 1) << start); + BITSET_CLEAR_RANGE(mask, start, (start + store_bytes - 1)); } nir_instr_remove(&intrin->instr); |