From 2fca183910ddbd2f87ec713396172fcf2c4abae4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Wed, 29 Apr 2020 17:56:05 +0100 Subject: [PATCH] nir/algebraic: add optimizations for fsign/isign MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This just reverts fsign/isign lowering. Totals from affected shaders: SGPRS: 257496 -> 256672 (-0.32 %) VGPRS: 181800 -> 178864 (-1.61 %) Spilled SGPRs: 105 -> 105 (0.00 %) Spilled VGPRs: 0 -> 0 (0.00 %) Private memory VGPRs: 0 -> 0 (0.00 %) Scratch size: 0 -> 0 (0.00 %) dwords per thread Code Size: 11355852 -> 11141840 (-1.88 %) bytes LDS: 3789 -> 3789 (0.00 %) blocks Max Waves: 30453 -> 30951 (1.64 %) Reviewed-by: Alyssa Rosenzweig Reviewed-by: Rhys Perry Reviewed-by: Marek Olšák Part-of: --- src/compiler/nir/nir_opt_algebraic.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index 3719d0cc8c6..92c3a9901ca 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -1394,7 +1394,11 @@ optimizations.extend([ 'options->lower_pack_split'), (('isign', a), ('imin', ('imax', a, -1), 1), 'options->lower_isign'), + (('imin', ('imax', a, -1), 1), ('isign', a), '!options->lower_isign'), + (('imax', ('imin', a, 1), -1), ('isign', a), '!options->lower_isign'), (('fsign', a), ('fsub', ('b2f', ('flt', 0.0, a)), ('b2f', ('flt', a, 0.0))), 'options->lower_fsign'), + (('fadd', ('b2f32', ('flt', 0.0, 'a@32')), ('fneg', ('b2f32', ('flt', 'a@32', 0.0)))), ('fsign', a), '!options->lower_fsign'), + (('iadd', ('b2i32', ('flt', 0, 'a@32')), ('ineg', ('b2i32', ('flt', 'a@32', 0)))), ('f2i32', ('fsign', a)), '!options->lower_fsign'), # Address/offset calculations: # Drivers supporting imul24 should use the nir_lower_amul() pass, this