summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRhys Perry <[email protected]>2019-06-28 16:13:04 +0100
committerRhys Perry <[email protected]>2019-07-19 16:33:01 +0000
commit79801b9d7ddad141d8c0e474d6d10aac11604635 (patch)
tree65ac71f554526c512478effcab06bf0bb12182c3
parent32ced14badc14f6b7d3c4c0738c83074ea68ea7d (diff)
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 <[email protected]> Reveiewed-by: Alyssa Rosenzweig [email protected] Reviewed-by: Connor Abbott <[email protected]>
-rw-r--r--src/compiler/nir/nir_opt_algebraic.py6
1 files changed, 6 insertions, 0 deletions
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.