mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 17:20:10 +01:00
nir/algebraic: Add a couple optimizations for iabs and ishr
Shader-db results on Kaby Lake:
total instructions in shared programs: 15225213 -> 15222365 (-0.02%)
instructions in affected programs: 43524 -> 40676 (-6.54%)
helped: 203
HURT: 0
Lots of shaders in Shadow Warrior had this pattern along with Deus Ex,
Civ, Shadow of Mordor, and several others.
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
This commit is contained in:
parent
0803bef006
commit
2b76de9b5d
1 changed files with 6 additions and 0 deletions
|
|
@ -439,6 +439,12 @@ optimizations = [
|
|||
(('uge', '#a', ('umax', '#b', c)), ('iand', ('uge', a, b), ('uge', a, c))),
|
||||
(('uge', ('umin', '#a', b), '#c'), ('iand', ('uge', a, c), ('uge', b, c))),
|
||||
|
||||
# Thanks to sign extension, the ishr(a, b) is negative if and only if a is
|
||||
# negative.
|
||||
(('bcsel', ('ilt', a, 0), ('ineg', ('ishr', a, b)), ('ishr', a, b)),
|
||||
('iabs', ('ishr', a, b))),
|
||||
(('iabs', ('ishr', ('iabs', a), b)), ('ishr', ('iabs', a), b)),
|
||||
|
||||
(('fabs', ('slt', a, b)), ('slt', a, b)),
|
||||
(('fabs', ('sge', a, b)), ('sge', a, b)),
|
||||
(('fabs', ('seq', a, b)), ('seq', a, b)),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue