mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-30 12:10:09 +01:00
agx: Handle ssa_undef as zero
Masked stores may result in undefs after optimization. Rather than call lower_undef_to_zero late (but get no benefit), we may as well handle ourselves to prepare for proper undef support down the line. Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21431>
This commit is contained in:
parent
eab4d6a96f
commit
5e031867fe
1 changed files with 14 additions and 0 deletions
|
|
@ -1533,6 +1533,16 @@ agx_emit_phis_deferred(agx_context *ctx)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
agx_emit_undef(agx_builder *b, nir_ssa_undef_instr *instr)
|
||||
{
|
||||
/* For now, just lower undefs to zero. This doesn't matter too much, since
|
||||
* the lowering happens in NIR and this just allows for late lowering passes
|
||||
* to result in undefs.
|
||||
*/
|
||||
agx_mov_imm_to(b, agx_nir_ssa_index(&instr->def), 0);
|
||||
}
|
||||
|
||||
static void
|
||||
agx_emit_instr(agx_builder *b, struct nir_instr *instr)
|
||||
{
|
||||
|
|
@ -1561,6 +1571,10 @@ agx_emit_instr(agx_builder *b, struct nir_instr *instr)
|
|||
agx_emit_phi(b, nir_instr_as_phi(instr));
|
||||
break;
|
||||
|
||||
case nir_instr_type_ssa_undef:
|
||||
agx_emit_undef(b, nir_instr_as_ssa_undef(instr));
|
||||
break;
|
||||
|
||||
default:
|
||||
unreachable("should've been lowered");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue