From 8f6c3dcc90a439b4d05a7ed94bf4a8926e2c5656 Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Tue, 24 Feb 2026 14:39:23 +0100 Subject: [PATCH] nir/opt_algebraic: fix frsq clamp pattern This is not NaN correct. And also make the pattern 32bit only because the constant is hard coded FLT_MAX. Fixes: 780b5c10374 ("nir/algebraic: Simplify some Inf and NaN avoidance code") Reviewed-by: Alyssa Rosenzweig (cherry picked from commit ab773fc5d480d367191385bbd364993e16989752) Part-of: --- .pick_status.json | 2 +- src/compiler/nir/nir_opt_algebraic.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index f8b0c8c1975..eb61a692e49 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1754,7 +1754,7 @@ "description": "nir/opt_algebraic: fix frsq clamp pattern", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "780b5c10374d9323a6f4933c4cdca3b3beb58f6a", "notes": null diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index af0b9318b0a..75a87a07569 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -3910,7 +3910,7 @@ late_optimizations.extend([ # Putting this in 'optimizations' interferes with the bcsel(a, op(b, c), # op(b, d)) => op(b, bcsel(a, c, d)) transformations. I do not know why. - (('bcsel', ('feq', ('fsqrt', 'a(is_not_negative)'), 0.0), intBitsToFloat(0x7f7fffff), ('frsq', a)), + (('bcsel@32', ('feq', ('fsqrt', 'a(is_a_number_not_negative)'), 0.0), intBitsToFloat(0x7f7fffff), ('frsq', a)), ('fmin', ('frsq', a), intBitsToFloat(0x7f7fffff))), # Things that look like DPH in the source shader may get expanded to