From 2e7f34af6b84cbbe045ec9326f0b76499d14ed79 Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Thu, 20 Feb 2025 14:52:30 +0100 Subject: [PATCH] nir/opt_algebraic: optimize more ine/ieq(umin(b2i, ), 0) Foz-DB Navi21: Totals from 76 (0.10% of 79789) affected shaders: MaxWaves: 1050 -> 1062 (+1.14%) Instrs: 113754 -> 113691 (-0.06%); split: -0.11%, +0.06% CodeSize: 605096 -> 605216 (+0.02%); split: -0.03%, +0.05% VGPRs: 6024 -> 5976 (-0.80%) Latency: 1776501 -> 1777519 (+0.06%); split: -0.06%, +0.12% InvThroughput: 379644 -> 376751 (-0.76%) SClause: 2132 -> 2134 (+0.09%) Copies: 4131 -> 4128 (-0.07%); split: -1.77%, +1.69% PreSGPRs: 4275 -> 4270 (-0.12%) PreVGPRs: 5568 -> 5526 (-0.75%) VALU: 86732 -> 86581 (-0.17%); split: -0.24%, +0.07% SALU: 7112 -> 7198 (+1.21%) Reviewed-by: Ian Romanick Reviewed-by: Alyssa Rosenzweig Part-of: --- src/compiler/nir/nir_opt_algebraic.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index 27a70209f16..8316ef6f482 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -1799,6 +1799,12 @@ optimizations.extend([ (('ine', ('umin', ('ineg', ('b2i', 'a@1')), b), 0), ('iand', a, ('ine', b, 0))), (('ine', ('umax', ('ineg', ('b2i', 'a@1')), b), 0), ('ior' , a, ('ine', b, 0))), + (('ine', ('umin', ('b2i', 'a@1'), b), 0), ('iand', a, ('ine', b, 0))), + (('ine', ('umax', ('b2i', 'a@1'), b), 0), ('ior' , a, ('ine', b, 0))), + (('ieq', ('umin', ('ineg', ('b2i', 'a@1')), b), 0), ('ior', ('inot', a), ('ieq', b, 0))), + (('ieq', ('umax', ('ineg', ('b2i', 'a@1')), b), 0), ('iand' , ('inot', a), ('ieq', b, 0))), + (('ieq', ('umin', ('b2i', 'a@1'), b), 0), ('ior', ('inot', a), ('ieq', b, 0))), + (('ieq', ('umax', ('b2i', 'a@1'), b), 0), ('iand' , ('inot', a), ('ieq', b, 0))), # Conversions (('f2i', ('ftrunc', a)), ('f2i', a)),