From 46da666205db26248cb2a9cac12d3ae664ef2c7b Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Wed, 13 Aug 2025 14:11:15 +0100 Subject: [PATCH] nir/algebraic: allow non-const for iand(iadd()) -> iadd(iand()) fossil-db (gfx1201): Totals from 596 (0.75% of 79839) affected shaders: Instrs: 691926 -> 691819 (-0.02%); split: -0.11%, +0.09% CodeSize: 3675216 -> 3675180 (-0.00%); split: -0.08%, +0.08% VGPRs: 37464 -> 37452 (-0.03%) Latency: 8566849 -> 8563162 (-0.04%); split: -0.09%, +0.05% InvThroughput: 1068038 -> 1063279 (-0.45%); split: -0.46%, +0.01% VClause: 17859 -> 17897 (+0.21%); split: -0.01%, +0.22% SClause: 16704 -> 16735 (+0.19%); split: -0.07%, +0.26% Copies: 45422 -> 45395 (-0.06%); split: -0.15%, +0.09% PreSGPRs: 24345 -> 24351 (+0.02%) PreVGPRs: 29121 -> 29128 (+0.02%) VALU: 349959 -> 348117 (-0.53%); split: -0.54%, +0.01% SALU: 105926 -> 107576 (+1.56%); split: -0.02%, +1.58% VOPD: 252 -> 234 (-7.14%) Signed-off-by: Rhys Perry Reviewed-by: Georg Lehmann Part-of: --- src/compiler/nir/nir_opt_algebraic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index e1933c42a80..de71167024a 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -612,7 +612,7 @@ optimizations.extend([ for log2 in range(1, 7): # powers of two from 2 to 64 v = 1 << log2 mask = 0xffffffff & ~(v - 1) - b_is_multiple = '#b(is_unsigned_multiple_of_{})'.format(v) + b_is_multiple = 'b(is_unsigned_multiple_of_{})'.format(v) optimizations.extend([ # Reassociate for improved CSE