From 674d970861cdf2c9a0dc0a6292df3475c21d60b3 Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Mon, 10 Feb 2025 18:21:49 +0100 Subject: [PATCH] nir/opt_algebraic: 0 >= a -> 0 == a MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Foz-DB Navi21: Totals from 2179 (2.75% of 79377) affected shaders: MaxWaves: 40987 -> 40917 (-0.17%); split: +0.00%, -0.18% Instrs: 5950981 -> 5949310 (-0.03%); split: -0.04%, +0.01% CodeSize: 32120808 -> 32110328 (-0.03%); split: -0.04%, +0.00% VGPRs: 141704 -> 141768 (+0.05%); split: -0.01%, +0.05% SpillSGPRs: 1750 -> 1746 (-0.23%) Latency: 56667295 -> 56562916 (-0.18%); split: -0.19%, +0.00% InvThroughput: 13292128 -> 13288691 (-0.03%); split: -0.03%, +0.00% VClause: 151845 -> 151755 (-0.06%); split: -0.06%, +0.00% SClause: 172316 -> 172443 (+0.07%); split: -0.02%, +0.09% Copies: 458724 -> 458951 (+0.05%); split: -0.08%, +0.13% Branches: 195239 -> 195351 (+0.06%); split: -0.00%, +0.06% PreSGPRs: 135304 -> 135317 (+0.01%); split: -0.01%, +0.02% PreVGPRs: 122430 -> 122428 (-0.00%); split: -0.01%, +0.01% VALU: 3924585 -> 3924062 (-0.01%); split: -0.02%, +0.01% SALU: 820666 -> 819414 (-0.15%); split: -0.17%, +0.02% SMEM: 247036 -> 247142 (+0.04%); split: -0.00%, +0.04% v2 (idr): Remove a pattern that is now redundant. This was originaly removed in a commit later in the MR. Reviewed-by: Ian Romanick Reviewed-by: Alyssa Rosenzweig Reviewed-by: Timur Kristóf Part-of: --- src/compiler/nir/nir_opt_algebraic.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index 4c4b4d6e37a..d68e45aa6a1 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -798,9 +798,9 @@ optimizations.extend([ (('fneu', ('u2f', a), 0.0), ('ine', a, 0)), (('feq', ('u2f', a), 0.0), ('ieq', a, 0)), (('fge', ('u2f', a), 0.0), True), - (('fge', 0.0, ('u2f', a)), ('uge', 0, a)), # ieq instead? + (('fge', 0.0, ('u2f', a)), ('ieq', 0, a)), (('flt', ('u2f', a), 0.0), False), - (('flt', 0.0, ('u2f', a)), ('ult', 0, a)), # ine instead? + (('flt', 0.0, ('u2f', a)), ('ine', 0, a)), (('fneu', ('i2f', a), 0.0), ('ine', a, 0)), (('feq', ('i2f', a), 0.0), ('ieq', a, 0)), (('fge', ('i2f', a), 0.0), ('ige', a, 0)), @@ -1286,6 +1286,8 @@ optimizations.extend([ (('uge', a, 1), ('ine', a, 0)), (('ult', a, 1), ('ieq', a, 0)), + (('uge', 0, a), ('ieq', a, 0)), + (('ult', 0, a), ('ine', a, 0)), (('b2i', ('ine', 'a@1', 'b@1')), ('b2i', ('ixor', a, b))), @@ -1456,7 +1458,6 @@ for s in [8, 16, 32, 64]: optimizations.extend([ (('ige', ('ineg', ('b2i', 'a@1')), 0), ('inot', a)), (('ilt', ('ineg', ('b2i', 'a@1')), 0), a), - (('ult', 0, ('ineg', ('b2i', 'a@1'))), a), (('iand', ('ineg', ('b2i', a)), 1.0), ('b2f', a)), (('iand', ('ineg', ('b2i', a)), 1), ('b2i', a)), ])