From bf9c1699cd7fa57f869dff59e2b816df2e8e4f75 Mon Sep 17 00:00:00 2001 From: Qiang Yu Date: Sat, 25 Feb 2023 21:13:50 +0800 Subject: [PATCH] nir: add nir_fisnan helper function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Marek Olšák Signed-off-by: Qiang Yu Part-of: --- 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 *