From: Rhys Perry Date: Fri, 28 Jun 2019 15:13:04 +0000 (+0100) Subject: nir/algebraic: optimize contradictory iand operands X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=79801b9d7ddad141d8c0e474d6d10aac11604635;p=mesa.git nir/algebraic: optimize contradictory iand operands Some of these were found in a few GTAV, Rise of the Tomb Raider and Shadow of the Tomb Raider shaders. Results from vkpipeline-db run with ACO: Totals from affected shaders: SGPRS: 376 -> 376 (0.00 %) VGPRS: 220 -> 220 (0.00 %) Spilled SGPRs: 0 -> 0 (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: 13492 -> 11560 (-14.32 %) bytes LDS: 6 -> 6 (0.00 %) blocks Max Waves: 69 -> 69 (0.00 %) Wait states: 0 -> 0 (0.00 %) v2: use False instead of 0 Signed-off-by: Rhys Perry Reveiewed-by: Alyssa Rosenzweig alyssa.rosenzweig@collabora.com Reviewed-by: Connor Abbott --- diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index abefbb54756..4c1d547d3a1 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -218,6 +218,12 @@ optimizations = [ (('inot', ('ieq', a, b)), ('ine', a, b)), (('inot', ('ine', a, b)), ('ieq', a, b)), + (('iand', ('feq', a, b), ('fne', a, b)), False), + (('iand', ('flt', a, b), ('flt', b, a)), False), + (('iand', ('ieq', a, b), ('ine', a, b)), False), + (('iand', ('ilt', a, b), ('ilt', b, a)), False), + (('iand', ('ult', a, b), ('ult', b, a)), False), + # This helps some shaders because, after some optimizations, they end up # with patterns like (-a < -b) || (b < a). In an ideal world, this sort of # matching would be handled by CSE.