From 6b464785b9eefdcb7597942f0fd56bcdbdcff5c2 Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Wed, 25 Feb 2026 22:11:15 +0100 Subject: [PATCH] nir/opt_algebraic: optimize d3d9 iand(a, inot(b)) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Foz-DB GFX1201: Totals from 24 (0.02% of 112525) affected shaders: Instrs: 15598 -> 15426 (-1.10%); split: -1.17%, +0.06% CodeSize: 88716 -> 88260 (-0.51%); split: -0.98%, +0.46% Latency: 54419 -> 53965 (-0.83%); split: -0.91%, +0.08% InvThroughput: 10294 -> 10166 (-1.24%); split: -1.28%, +0.04% VClause: 302 -> 300 (-0.66%) SClause: 367 -> 363 (-1.09%); split: -1.63%, +0.54% Copies: 712 -> 705 (-0.98%); split: -3.09%, +2.11% PreSGPRs: 1402 -> 1424 (+1.57%); split: -0.14%, +1.71% PreVGPRs: 850 -> 848 (-0.24%) VALU: 9730 -> 9591 (-1.43%) SALU: 1579 -> 1649 (+4.43%) Reviewed-by: Marek Olšák Part-of: --- src/compiler/nir/nir_opt_algebraic.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index 508f67af10b..e0b71452cc5 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -1648,6 +1648,8 @@ optimizations.extend([ (('fmul', ('b2f', ('fneu', a, 0)), a), ('fmul', 1.0, a)), (('ffma', ('b2f', ('fneu', a, 0)), a, b), ('fadd', a, b)), (('fsat', ('fadd', ('b2f', 'a@1'), ('b2f', 'b@1'))), ('b2f', ('ior', a, b))), + (('fsat', ('fadd', ('b2f', 'a@1'), ('fneg', ('b2f', 'b@1')))), ('b2f', ('iand', a, ('inot', b)))), + (('fmax', ('fadd', ('b2f', 'a@1'), ('fneg', ('b2f', 'b@1'))), 0.0), ('b2f', ('iand', a, ('inot', b)))), (('iand', 'a@bool16', 1.0), ('b2f', a)), (('iand', 'a@bool32', 1.0), ('b2f', a)), (('flt', ('fneg', ('b2f', 'a@1')), 0), a), # Generated by TGSI KILL_IF.