Mesa (master): nir/algebraic: optimize iand/ior of (n)eq zero
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Jul 20 16:31:07 UTC 2020
Module: Mesa
Branch: master
Commit: 8e1b75b330954a2e40e8ed0c04871e43120d4f4a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8e1b75b330954a2e40e8ed0c04871e43120d4f4a
Author: Daniel Schürmann <daniel at schuermann.dev>
Date: Wed Apr 29 17:49:45 2020 +0100
nir/algebraic: optimize iand/ior of (n)eq zero
Found in some Detroit: Become Human shaders.
Totals from affected shaders:
SGPRS: 700256 -> 700256 (0.00 %)
VGPRS: 507208 -> 507212 (0.00 %)
Spilled SGPRs: 142531 -> 142531 (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: 76404616 -> 76301768 (-0.13 %) bytes
LDS: 43 -> 43 (0.00 %) blocks
Max Waves: 21438 -> 21438 (0.00 %)
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Reviewed-by: Rhys Perry <pendingchaos02 at gmail.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4830>
---
src/compiler/nir/nir_opt_algebraic.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index 507a4d397b7..3719d0cc8c6 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -646,8 +646,10 @@ optimizations.extend([
(('ine', ('ineg', ('b2i32', 'a at 1')), ('ineg', ('b2i32', 'b at 1'))), ('ine', a, b)),
(('b2i32', ('ine', 'a at 1', 'b at 1')), ('b2i32', ('ixor', a, b))),
- (('iand', ('ieq', 'a at 32', 0), ('ieq', 'b at 32', 0)), ('ieq', ('ior', a, b), 0), '!options->lower_bitops'),
- (('ior', ('ine', 'a at 32', 0), ('ine', 'b at 32', 0)), ('ine', ('ior', a, b), 0), '!options->lower_bitops'),
+ (('iand', ('ieq', 'a at 32', 0), ('ieq', 'b at 32', 0)), ('ieq', ('umax', a, b), 0)),
+ (('ior', ('ieq', 'a at 32', 0), ('ieq', 'b at 32', 0)), ('ieq', ('umin', a, b), 0)),
+ (('iand', ('ine', 'a at 32', 0), ('ine', 'b at 32', 0)), ('ine', ('umin', a, b), 0)),
+ (('ior', ('ine', 'a at 32', 0), ('ine', 'b at 32', 0)), ('ine', ('umax', a, b), 0)),
# This pattern occurs coutresy of __flt64_nonnan in the soft-fp64 code.
# The first part of the iand comes from the !__feq64_nonnan.
More information about the mesa-commit
mailing list