From bb653b0acbee945652a0581ca6b06f3341665114 Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Thu, 30 Mar 2023 13:38:06 +0100 Subject: [PATCH] nir: make nir_fisnan helper exact Floating point ALU assume no NaNs unless FLOAT_CONTROLS_SIGNED_ZERO_INF_NAN_PRESERVE_FPn or (for some opcodes) exact=true. Signed-off-by: Rhys Perry Reviewed-by: Alyssa Rosenzweig Fixes: bf9c1699cd7 ("nir: add nir_fisnan helper function") Part-of: --- src/compiler/nir/nir_builtin_builder.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_builtin_builder.h b/src/compiler/nir/nir_builtin_builder.h index ed9d529..1082fa8 100644 --- a/src/compiler/nir/nir_builtin_builder.h +++ b/src/compiler/nir/nir_builtin_builder.h @@ -56,7 +56,11 @@ 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); + bool old_exact = b->exact; + b->exact = true; + nir_ssa_def *res = nir_fneu(b, x, x); + b->exact = old_exact; + return res; } static inline nir_ssa_def * -- 2.7.4