nir: Add lowering from regular ALU conversions to the intrinsic
Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6945>
This commit is contained in:

committed by
Marge Bot

parent
bc7ed03ef8
commit
cb95065dd1
@@ -4388,6 +4388,7 @@ bool nir_opt_simplify_convert_alu_types(nir_shader *shader);
|
||||
bool nir_lower_convert_alu_types(nir_shader *shader,
|
||||
bool (*should_lower)(nir_intrinsic_instr *));
|
||||
bool nir_lower_constant_convert_alu_types(nir_shader *shader);
|
||||
bool nir_lower_alu_covnersion_to_intrinsic(nir_shader *shader);
|
||||
bool nir_lower_int_to_float(nir_shader *shader);
|
||||
bool nir_lower_load_const_to_scalar(nir_shader *shader);
|
||||
bool nir_lower_read_invocation_to_scalar(nir_shader *shader);
|
||||
|
@@ -180,3 +180,27 @@ nir_lower_constant_convert_alu_types(nir_shader *shader)
|
||||
{
|
||||
return nir_lower_convert_alu_types(shader, is_constant);
|
||||
}
|
||||
|
||||
static bool
|
||||
is_alu_conversion(const nir_instr *instr, UNUSED const void *_data)
|
||||
{
|
||||
return instr->type == nir_instr_type_alu &&
|
||||
nir_op_infos[nir_instr_as_alu(instr)->op].is_conversion;
|
||||
}
|
||||
|
||||
static nir_ssa_def *
|
||||
lower_alu_conversion(nir_builder *b, nir_instr *instr, UNUSED void *_data)
|
||||
{
|
||||
nir_alu_instr *alu = nir_instr_as_alu(instr);
|
||||
return nir_convert_alu_types(b, nir_ssa_for_alu_src(b, alu, 0),
|
||||
nir_op_infos[alu->op].input_types[0],
|
||||
nir_op_infos[alu->op].output_type,
|
||||
nir_rounding_mode_undef, false);
|
||||
}
|
||||
|
||||
bool
|
||||
nir_lower_alu_covnersion_to_intrinsic(nir_shader *shader)
|
||||
{
|
||||
return nir_shader_lower_instructions(shader, is_alu_conversion,
|
||||
lower_alu_conversion, NULL);
|
||||
}
|
||||
|
Reference in New Issue
Block a user