From ea87f1f9bce4f5cd05b277da723b35b98b3e4304 Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Sun, 1 Feb 2026 16:48:09 +0100 Subject: [PATCH] nir/opt_algebraic: add a - a with nnan Foz-DB Navi48: Totals from 576 (0.70% of 82405) affected shaders: MaxWaves: 16706 -> 16726 (+0.12%) Instrs: 618677 -> 580965 (-6.10%); split: -6.10%, +0.00% CodeSize: 3022552 -> 2861612 (-5.32%); split: -5.33%, +0.00% VGPRs: 28008 -> 28860 (+3.04%); split: -0.51%, +3.56% Latency: 2689318 -> 2655887 (-1.24%); split: -1.25%, +0.01% InvThroughput: 403512 -> 393404 (-2.51%); split: -2.51%, +0.00% VClause: 7584 -> 7577 (-0.09%); split: -0.17%, +0.08% SClause: 19974 -> 19086 (-4.45%); split: -4.48%, +0.03% Copies: 43862 -> 40888 (-6.78%); split: -6.87%, +0.09% Branches: 12457 -> 11407 (-8.43%) PreSGPRs: 28315 -> 27046 (-4.48%); split: -4.53%, +0.05% PreVGPRs: 20751 -> 19397 (-6.52%) VALU: 317224 -> 290151 (-8.53%); split: -8.53%, +0.00% SALU: 124297 -> 121347 (-2.37%); split: -2.39%, +0.02% VMEM: 11918 -> 11907 (-0.09%) SMEM: 27582 -> 26241 (-4.86%) Reviewed-by: Alyssa Rosenzweig Reviewed-by: Rhys Perry Part-of: --- src/compiler/nir/nir_opt_algebraic.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index b33fb6152a9..2eff041570f 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -264,6 +264,7 @@ optimizations += [ (('ieq', ('ushr(is_used_once)', a, '#b'), 0), ('ult', a, ('ishl', 1, b))), (('ine', ('ushr(is_used_once)', a, '#b'), 0), ('uge', a, ('ishl', 1, b))), (('~fadd', ('fneg', a), a), 0.0), + (('fadd(nnan)', ('fneg', a), a), 0.0), (('iadd', ('ineg', a), a), 0), (('iadd', ('ineg', a), ('iadd', a, b)), b), (('iadd', a, ('iadd', ('ineg', a), b)), b),