mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-01 14:38:06 +02:00
glsl: Add ir_unop_f2fmp
This is the same as ir_unop_f2f16 except that it comes with a promise that it is safe to optimise it out if the result is immediately converted back to float32 again. Normally this would be a lossy operation but it is safe to do if the conversion was generated as part of the precision lowering pass. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3929>
This commit is contained in:
parent
5d6b007da8
commit
1b8edffaa5
6 changed files with 10 additions and 0 deletions
|
|
@ -2079,6 +2079,11 @@ nir_visitor::visit(ir_expression *ir)
|
|||
break;
|
||||
}
|
||||
|
||||
case ir_unop_f2fmp: {
|
||||
result = nir_build_alu(&b, nir_op_f2fmp, srcs[0], NULL, NULL, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
case ir_unop_bitcast_i2f:
|
||||
case ir_unop_bitcast_f2i:
|
||||
case ir_unop_bitcast_u2f:
|
||||
|
|
|
|||
|
|
@ -293,6 +293,7 @@ ir_expression::ir_expression(int op, ir_rvalue *op0)
|
|||
break;
|
||||
|
||||
case ir_unop_f2f16:
|
||||
case ir_unop_f2fmp:
|
||||
case ir_unop_b2f16:
|
||||
this->type = glsl_type::get_instance(GLSL_TYPE_FLOAT16,
|
||||
op0->type->vector_elements, 1);
|
||||
|
|
|
|||
|
|
@ -459,6 +459,7 @@ ir_expression_operation = [
|
|||
# still have to handle them here so that we can constant propagate through
|
||||
# them, but they are no-ops.
|
||||
operation("f2f16", 1, source_types=(float_type,), dest_type=float_type, c_expression="{src0}"),
|
||||
operation("f2fmp", 1, source_types=(float_type,), dest_type=float_type, c_expression="{src0}"),
|
||||
operation("f162f", 1, source_types=(float_type,), dest_type=float_type, c_expression="{src0}"),
|
||||
# Double-to-integer conversion.
|
||||
operation("d2i", 1, source_types=(double_type,), dest_type=int_type, c_expression="{src0}"),
|
||||
|
|
|
|||
|
|
@ -593,6 +593,7 @@ ir_validate::visit_leave(ir_expression *ir)
|
|||
assert(ir->type->is_float());
|
||||
break;
|
||||
case ir_unop_f2f16:
|
||||
case ir_unop_f2fmp:
|
||||
assert(ir->operands[0]->type->is_float());
|
||||
assert(ir->type->base_type == GLSL_TYPE_FLOAT16);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -1349,6 +1349,7 @@ ir_to_mesa_visitor::visit(ir_expression *ir)
|
|||
case ir_unop_clz:
|
||||
case ir_unop_f162f:
|
||||
case ir_unop_f2f16:
|
||||
case ir_unop_f2fmp:
|
||||
case ir_unop_f162b:
|
||||
case ir_unop_b2f16:
|
||||
assert(!"not supported");
|
||||
|
|
|
|||
|
|
@ -2397,6 +2397,7 @@ glsl_to_tgsi_visitor::visit_expression(ir_expression* ir, st_src_reg *op)
|
|||
case ir_binop_mul_32x16:
|
||||
case ir_unop_f162f:
|
||||
case ir_unop_f2f16:
|
||||
case ir_unop_f2fmp:
|
||||
case ir_unop_f162b:
|
||||
case ir_unop_b2f16:
|
||||
/* This operation is not supported, or should have already been handled.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue