Module: Mesa Branch: main Commit: bf9c1699cd7fa57f869dff59e2b816df2e8e4f75 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=bf9c1699cd7fa57f869dff59e2b816df2e8e4f75
Author: Qiang Yu <[email protected]> Date: Sat Feb 25 21:13:50 2023 +0800 nir: add nir_fisnan helper function Reviewed-by: Marek Olšák <[email protected]> Signed-off-by: Qiang Yu <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21552> --- src/compiler/nir/nir_builtin_builder.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_builtin_builder.h b/src/compiler/nir/nir_builtin_builder.h index acbf0c68819..ed9d5298025 100644 --- a/src/compiler/nir/nir_builtin_builder.h +++ b/src/compiler/nir/nir_builtin_builder.h @@ -53,10 +53,16 @@ nir_get_texture_lod(nir_builder *b, nir_tex_instr *tex); nir_ssa_def * 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 * 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 *
