From 5f79e4e69af178f7fcff5a4397085261ac46ceaf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20Sch=C3=BCrmann?= Date: Wed, 15 Jul 2020 19:31:22 +0200 Subject: [PATCH] nir/algebraic: fold some nested bcsel MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Totals from 14266 (10.62% of 134368) affected shaders (Polaris): SGPRs: 761756 -> 762732 (+0.13%); split: -0.00%, +0.13% VGPRs: 430392 -> 430924 (+0.12%); split: -0.05%, +0.17% SpillSGPRs: 4652 -> 4628 (-0.52%); split: -0.60%, +0.09% CodeSize: 30133000 -> 29949780 (-0.61%); split: -0.66%, +0.05% MaxWaves: 102122 -> 102111 (-0.01%); split: +0.00%, -0.01% Instrs: 5845085 -> 5841668 (-0.06%); split: -0.08%, +0.03% Cycles: 69033140 -> 68889188 (-0.21%); split: -0.22%, +0.01% VMEM: 8479021 -> 8474978 (-0.05%); split: +0.03%, -0.08% SMEM: 831437 -> 830464 (-0.12%); split: +0.06%, -0.18% VClause: 105411 -> 105410 (-0.00%); split: -0.01%, +0.01% SClause: 327727 -> 327780 (+0.02%); split: -0.00%, +0.02% Copies: 372704 -> 373306 (+0.16%); split: -0.16%, +0.32% Branches: 112260 -> 112269 (+0.01%); split: -0.00%, +0.01% PreSGPRs: 433308 -> 433631 (+0.07%); split: -0.01%, +0.09% PreVGPRs: 397888 -> 397905 (+0.00%); split: -0.01%, +0.01% Reviewed-by: Rhys Perry Reviewed-by: Marek Olšák Part-of: --- src/compiler/nir/nir_opt_algebraic.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index c2e961d020c..423fd06b879 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -1142,6 +1142,9 @@ optimizations.extend([ (('~fmul', ('bcsel(is_used_once)', c, 1.0, -1.0), b), ('bcsel', c, b, ('fneg', b))), (('~bcsel', ('flt', a, 0.0), ('fneg', a), a), ('fabs', a)), + (('bcsel', a, ('bcsel', b, c, d), d), ('bcsel', ('iand', a, b), c, d)), + (('bcsel', a, b, ('bcsel', c, b, d)), ('bcsel', ('ior', a, c), b, d)), + (('fmin3@64', a, b, c), ('fmin@64', a, ('fmin@64', b, c))), (('fmax3@64', a, b, c), ('fmax@64', a, ('fmax@64', b, c))), (('fmed3@64', a, b, c), ('fmax@64', ('fmin@64', ('fmax@64', a, b), c), ('fmin@64', a, b))), -- 2.30.2