From 599a52174b407ac4ad377b4d6f0e95c62218cdff Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Mon, 27 Apr 2026 09:18:05 +0200 Subject: [PATCH] nir: disable fp class analysis for 64bit transcendentals Some backends have terrible precision for these fp64 opcodes, so don't try to do anything clever. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/work_items/15334 Fixes: 5a298f35606 ("nir: rewrite fp range analysis as a fp class analysis") Reviewed-by: Alyssa Rosenzweig Reviewed-by: Eric R. Smith Part-of: --- src/compiler/nir/nir_range_analysis.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/compiler/nir/nir_range_analysis.c b/src/compiler/nir/nir_range_analysis.c index ecfdcbc1ca6..5e4702861ca 100644 --- a/src/compiler/nir/nir_range_analysis.c +++ b/src/compiler/nir/nir_range_analysis.c @@ -1039,7 +1039,11 @@ process_fp_query(struct analysis_state *state, struct analysis_query *aq, uint32 } case nir_op_frcp: - r = frcp_fp_class(handle_sz(alu, src_res[0])); + /* Some backends have terrible precision for fp64, + * so don't try to do anything clever. + */ + if (alu->def.bit_size < 64) + r = frcp_fp_class(handle_sz(alu, src_res[0])); break; case nir_op_mov: @@ -1085,11 +1089,13 @@ process_fp_query(struct analysis_state *state, struct analysis_query *aq, uint32 break; case nir_op_fsqrt: - r = fsqrt_fp_class(src_res[0]); + if (alu->def.bit_size < 64) + r = fsqrt_fp_class(src_res[0]); break; case nir_op_frsq: - r = frcp_fp_class(fsqrt_fp_class(handle_sz(alu, src_res[0]))); + if (alu->def.bit_size < 64) + r = frcp_fp_class(fsqrt_fp_class(handle_sz(alu, src_res[0]))); break; case nir_op_ffloor: {