nir/lower_vec_to_movs: don't vectorize unsupports ops
If the instruction being coalesced would be vectorized but the target doesn't support vectorizing that op, skip coalescing. Reuse the callbacks from alu_to_scalar to describe which ops should not be vectorized. Signed-off-by: Erico Nunes <nunes.erico@gmail.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Eric Anholt <eric@anholt.net> Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6506>
This commit is contained in:
@@ -191,6 +191,17 @@ lima_alu_to_scalar_filter_cb(const nir_instr *instr, const void *data)
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool
|
||||
lima_vec_to_movs_filter_cb(const nir_instr *instr, unsigned writemask,
|
||||
const void *data)
|
||||
{
|
||||
assert(writemask > 0);
|
||||
if (util_bitcount(writemask) == 1)
|
||||
return true;
|
||||
|
||||
return !lima_alu_to_scalar_filter_cb(instr, data);
|
||||
}
|
||||
|
||||
void
|
||||
lima_program_optimize_fs_nir(struct nir_shader *s,
|
||||
struct nir_lower_tex_options *tex_options)
|
||||
@@ -252,7 +263,7 @@ lima_program_optimize_fs_nir(struct nir_shader *s,
|
||||
NIR_PASS_V(s, nir_remove_dead_variables, nir_var_function_temp, NULL);
|
||||
|
||||
NIR_PASS_V(s, nir_move_vec_src_uses_to_dest);
|
||||
NIR_PASS_V(s, nir_lower_vec_to_movs);
|
||||
NIR_PASS_V(s, nir_lower_vec_to_movs, lima_vec_to_movs_filter_cb, NULL);
|
||||
|
||||
NIR_PASS_V(s, lima_nir_duplicate_load_uniforms);
|
||||
NIR_PASS_V(s, lima_nir_duplicate_load_inputs);
|
||||
|
Reference in New Issue
Block a user