nir: reuse nir_component_mask() where it makes sense

Avoiding local bit field manipulations.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21853>
This commit is contained in:
Lionel Landwerlin 2023-03-07 13:09:43 +02:00 committed by Marge Bot
parent 275ad509c1
commit 2259e1e932
2 changed files with 3 additions and 3 deletions

View file

@ -117,7 +117,7 @@ nir_builder_alu_instr_finish_and_insert(nir_builder *build, nir_alu_instr *instr
nir_ssa_dest_init(&instr->instr, &instr->dest.dest, num_components,
bit_size, NULL);
instr->dest.write_mask = (1 << num_components) - 1;
instr->dest.write_mask = nir_component_mask(num_components);
nir_builder_instr_insert(build, &instr->instr);
@ -338,7 +338,7 @@ nir_vec_scalars(nir_builder *build, nir_ssa_scalar *comp, unsigned num_component
*/
nir_ssa_dest_init(&instr->instr, &instr->dest.dest, num_components,
comp[0].def->bit_size, NULL);
instr->dest.write_mask = (1 << num_components) - 1;
instr->dest.write_mask = nir_component_mask(num_components);
nir_builder_instr_insert(build, &instr->instr);

View file

@ -349,7 +349,7 @@ validate_alu_dest(nir_alu_instr *instr, validate_state *state)
* validate that the instruction doesn't write to components not in the
* register/SSA value
*/
validate_assert(state, !(dest->write_mask & ~((1 << dest_size) - 1)));
validate_assert(state, !(dest->write_mask & ~nir_component_mask(dest_size)));
/* validate that saturate is only ever used on instructions with
* destinations of type float