agx: Add agx_ushr helper

Syntax sugar for the underlying bitfield manipulation instruction.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12053>
This commit is contained in:
Alyssa Rosenzweig 2021-07-24 17:23:42 -04:00
parent 3c1f754a71
commit 50a4c993fd
2 changed files with 15 additions and 1 deletions

View File

@ -157,6 +157,20 @@ agx_push_exec(agx_builder *b, unsigned n)
return agx_if_fcmp(b, agx_zero(), agx_zero(), n, AGX_FCOND_EQ, false);
}
static inline agx_instr *
agx_ushr_to(agx_builder *b, agx_index dst, agx_index s0, agx_index s1)
{
return agx_bfeil_to(b, dst, agx_zero(), s0, s1, 0);
}
static inline agx_index
agx_ushr(agx_builder *b, agx_index s0, agx_index s1)
{
agx_index tmp = agx_temp(b->shader, s0.size);
agx_ushr_to(b, tmp, s0, s1);
return tmp;
}
#endif
"""

View File

@ -542,7 +542,7 @@ agx_emit_alu(agx_builder *b, nir_alu_instr *instr)
case nir_op_imul: return agx_imad_to(b, dst, s0, s1, agx_zero(), 0);
case nir_op_ishl: return agx_bfi_to(b, dst, agx_zero(), s0, s1, 0);
case nir_op_ushr: return agx_bfeil_to(b, dst, agx_zero(), s0, s1, 0);
case nir_op_ushr: return agx_ushr_to(b, dst, s0, s1);
case nir_op_ishr: return agx_asr_to(b, dst, s0, s1);
case nir_op_bcsel: