nir: add nir_fisnan helper function

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21552>
This commit is contained in:
Qiang Yu 2023-02-25 21:13:50 +08:00 committed by Marge Bot
parent c9d60547ef
commit bf9c1699cd

View file

@ -53,10 +53,16 @@ nir_get_texture_lod(nir_builder *b, nir_tex_instr *tex);
nir_ssa_def * nir_ssa_def *
nir_get_texture_size(nir_builder *b, nir_tex_instr *tex); nir_get_texture_size(nir_builder *b, nir_tex_instr *tex);
static inline nir_ssa_def *
nir_fisnan(nir_builder *b, nir_ssa_def *x)
{
return nir_fneu(b, x, x);
}
static inline nir_ssa_def * static inline nir_ssa_def *
nir_nan_check2(nir_builder *b, nir_ssa_def *x, nir_ssa_def *y, nir_ssa_def *res) nir_nan_check2(nir_builder *b, nir_ssa_def *x, nir_ssa_def *y, nir_ssa_def *res)
{ {
return nir_bcsel(b, nir_fneu(b, x, x), x, nir_bcsel(b, nir_fneu(b, y, y), y, res)); return nir_bcsel(b, nir_fisnan(b, x), x, nir_bcsel(b, nir_fisnan(b, y), y, res));
} }
static inline nir_ssa_def * static inline nir_ssa_def *