From: Daniel Schürmann Date: Wed, 15 Jul 2020 17:30:34 +0000 (+0200) Subject: nir/algebraic: propagate b2i out of ior/iand X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=27244662f25e038844799d4784e429491c06fc0d;p=mesa.git nir/algebraic: propagate b2i out of ior/iand Totals from 761 (0.57% of 134368) affected shaders (Polaris): SGPRs: 29496 -> 29488 (-0.03%) SpillSGPRs: 41 -> 43 (+4.88%) CodeSize: 1922036 -> 1882408 (-2.06%); split: -2.08%, +0.02% Instrs: 366051 -> 360362 (-1.55%); split: -1.57%, +0.02% Cycles: 7692516 -> 7661216 (-0.41%); split: -0.41%, +0.01% VMEM: 365175 -> 365172 (-0.00%) VClause: 15324 -> 15322 (-0.01%) SClause: 9825 -> 9824 (-0.01%); split: -0.02%, +0.01% Copies: 41216 -> 41294 (+0.19%); split: -0.01%, +0.20% Branches: 7020 -> 7033 (+0.19%) PreSGPRs: 22103 -> 22106 (+0.01%) PreVGPRs: 26518 -> 26515 (-0.01%) Reviewed-by: Rhys Perry Reviewed-by: Marek Olšák Part-of: --- diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index 213bc843a68..c2e961d020c 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -753,6 +753,8 @@ optimizations.extend([ (('feq', ('fneg', a), a), ('feq', a, 0.0)), # Emulating booleans (('imul', ('b2i', 'a@1'), ('b2i', 'b@1')), ('b2i', ('iand', a, b))), + (('iand', ('b2i', 'a@1'), ('b2i', 'b@1')), ('b2i', ('iand', a, b))), + (('ior', ('b2i', 'a@1'), ('b2i', 'b@1')), ('b2i', ('ior', a, b))), (('fmul', ('b2f', 'a@1'), ('b2f', 'b@1')), ('b2f', ('iand', a, b))), (('fsat', ('fadd', ('b2f', 'a@1'), ('b2f', 'b@1'))), ('b2f', ('ior', a, b))), (('iand', 'a@bool32', 1.0), ('b2f', a)),