Module: Mesa
Branch: main
Commit: 7b348086498a314bffaf37aa522c764e43fbeea1
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7b348086498a314bffaf37aa522c764e43fbeea1

Author: Ian Romanick <[email protected]>
Date:   Tue May 23 21:03:30 2023 -0700

nir/algebraic: Fixup iadd3 related patterns

There should not be any isub at this point due to lowerings that happened
ages before getting to late algebraic.

shader-db:

DG2
total instructions in shared programs: 23103769 -> 23103767 (<.01%)
instructions in affected programs: 65 -> 63 (-3.08%)
helped: 1 / HURT: 0

total cycles in shared programs: 842348074 -> 842347714 (<.01%)
cycles in affected programs: 28572 -> 28212 (-1.26%)
helped: 3 / HURT: 0

One compute shader in Assassin's Creed Odyssey was affected.

fossil-db:

DG2
Instructions in all programs: 196400668 -> 196400676 (+0.0%)
helped: 8 / HURT: 5

Cycles in all programs: 13931740724 -> 13931758003 (+0.0%)
helped: 8 / HURT: 7

Reviewed-by: Matt Turner <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23262>

---

 src/compiler/nir/nir_opt_algebraic.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/compiler/nir/nir_opt_algebraic.py 
b/src/compiler/nir/nir_opt_algebraic.py
index 3056ee1f374..afb0fd0895b 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -2863,8 +2863,7 @@ late_optimizations.extend([
    (('iabs', a), ('imax', a, ('ineg', a)), 'options->lower_iabs'),
 
    (('iadd', ('iadd(is_used_once)', 'a(is_not_const)', 'b(is_not_const)'), 
'c(is_not_const)'), ('iadd3', a, b, c), 'options->has_iadd3'),
-   (('iadd', ('isub(is_used_once)', 'a(is_not_const)', 'b(is_not_const)'), 
'c(is_not_const)'), ('iadd3', a, ('ineg', b), c), 'options->has_iadd3'),
-   (('isub', ('isub(is_used_once)', 'a(is_not_const)', 'b(is_not_const)'), 
'c(is_not_const)'), ('iadd3', a, ('ineg', b), ('ineg', c)), 
'options->has_iadd3'),
+   (('iadd', ('ineg', ('iadd(is_used_once)', 'a(is_not_const)', 
'b(is_not_const)')), 'c(is_not_const)'), ('iadd3', ('ineg', a), ('ineg', b), 
c), 'options->has_iadd3'),
 
     # fneg_lo / fneg_hi
    (('vec2(is_only_used_as_float)', ('fneg@16', a), b), ('fmul', ('vec2', a, 
b), ('vec2', -1.0, 1.0)), 'options->vectorize_vec2_16bit'),

Reply via email to