diff options
author | Dave Airlie <[email protected]> | 2019-05-03 10:15:07 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2019-05-15 07:10:30 +1000 |
commit | 3b2c4331671e04a964d7b47a9876bc46e8a276d6 (patch) | |
tree | 5ccea568d0c99a6f9f297b4123fba210c0041d4b /src | |
parent | 646924cfa1bb51c9091a8cf0079f00759cbea372 (diff) |
intel/compiler: remove repeated bit_size / 8 in brw mem lowering pass.
Just use a variable already.
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/intel/compiler/brw_nir_lower_mem_access_bit_sizes.c | 15 |
1 files changed, 8 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 0705c4efd82..2ec47b38999 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 @@ -179,16 +179,17 @@ lower_mem_store_bit_size(nir_builder *b, nir_intrinsic_instr *intrin) const unsigned const_offset = offset_is_const ? nir_src_as_uint(*offset_src) : 0; - assert(num_components * (bit_size / 8) <= 32); + const unsigned byte_size = bit_size / 8; + assert(num_components * byte_size <= 32); uint32_t byte_mask = 0; for (unsigned i = 0; i < num_components; i++) { - if (writemask & (1 << i)) - byte_mask |= ((1 << (bit_size / 8)) - 1) << i * (bit_size / 8); + if (writemask & (1u << i)) + byte_mask |= ((1 << byte_size) - 1) << i * byte_size; } while (byte_mask) { const int start = ffs(byte_mask) - 1; - assert(start % (bit_size / 8) == 0); + assert(start % byte_size == 0); int end; for (end = start + 1; end < bytes_written; end++) { @@ -217,9 +218,9 @@ lower_mem_store_bit_size(nir_builder *b, nir_intrinsic_instr *intrin) } const unsigned store_bytes = store_comps * (store_bit_size / 8); - assert(store_bytes % (bit_size / 8) == 0); - const unsigned store_first_src_comp = start / (bit_size / 8); - const unsigned store_src_comps = store_bytes / (bit_size / 8); + assert(store_bytes % byte_size == 0); + const unsigned store_first_src_comp = start / byte_size; + const unsigned store_src_comps = store_bytes / byte_size; assert(store_first_src_comp + store_src_comps <= num_components); unsigned src_swiz[4] = { 0, }; |