broadcom: implement nir_op_uclz

This enables some algebraic optimizations.

No changes in shader-db, but it does cause some CTS tests to
produce less instructions.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30614>
This commit is contained in:
Iago Toral Quiroga
2024-08-08 12:18:02 +02:00
parent aaff191356
commit 35a10f5d5a
3 changed files with 6 additions and 0 deletions
+4
View File
@@ -1615,6 +1615,10 @@ ntq_emit_alu(struct v3d_compile *c, nir_alu_instr *instr)
result = vir_NOT(c, src[0]);
break;
case nir_op_uclz:
result = vir_CLZ(c, src[0]);
break;
case nir_op_ufind_msb:
result = vir_SUB(c, vir_uniform_ui(c, 31), vir_CLZ(c, src[0]));
break;
+1
View File
@@ -220,6 +220,7 @@ v3dv_pipeline_get_nir_options(const struct v3d_device_info *devinfo)
.lower_fquantize2f16 = true,
.has_fsub = true,
.has_isub = true,
.has_uclz = true,
.vertex_id_zero_based = false, /* FIXME: to set this to true, the intrinsic
* needs to be supported */
.lower_interpolate_at = true,