mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 15:20:17 +01:00
nir/algebraic: Eliminate unary op on src of integer comparison w/ zero
This helps because it enables cmod propagation to do more. The removed patterns involving b2i will be handled by other existing patterns after the unary operations are removed. All Intel platforms had similar results. (Ice Lake shown) total instructions in shared programs: 19914458 -> 19914441 (<.01%) instructions in affected programs: 5456 -> 5439 (-0.31%) helped: 17 / HURT: 0 total cycles in shared programs: 855302118 -> 853869766 (-0.17%) cycles in affected programs: 327354347 -> 325921995 (-0.44%) helped: 291 / HURT: 81 All Intel platforms had similar results. (Ice Lake shown) Instructions in all programs: 141205979 -> 141205961 (-0.0%) Instructions helped: 4 Instructions hurt: 3 SENDs in all programs: 7466919 -> 7466913 (-0.0%) SENDs helped: 1 Cycles in all programs: 9133387327 -> 9133384475 (-0.0%) Cycles helped: 3 Cycles hurt: 12 In the shader that was helped for sends, it appears that a NIR pass that moves code out of loops was able to move 3 send operations outside a loop after this change. I did not investigate further. Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com> Acked-by: Jesse Natalie <jenatali@microsoft.com> Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Tested-by: Daniel Schürmann <daniel@schuermann.dev> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15121>
This commit is contained in:
parent
ee15d89322
commit
ba0b248ac2
1 changed files with 5 additions and 2 deletions
|
|
@ -552,6 +552,11 @@ optimizations.extend([
|
|||
(('fneu', ('fneg', a), -1.0), ('fneu', 1.0, a)),
|
||||
(('feq', -1.0, ('fneg', a)), ('feq', a, 1.0)),
|
||||
|
||||
(('ieq', ('ineg', a), 0), ('ieq', a, 0)),
|
||||
(('ine', ('ineg', a), 0), ('ine', a, 0)),
|
||||
(('ieq', ('iabs', a), 0), ('ieq', a, 0)),
|
||||
(('ine', ('iabs', a), 0), ('ine', a, 0)),
|
||||
|
||||
# b < fsat(NaN) -> b < 0 -> false, and b < Nan -> false.
|
||||
(('flt', '#b(is_gt_0_and_lt_1)', ('fsat(is_used_once)', a)), ('flt', b, a)),
|
||||
|
||||
|
|
@ -1410,9 +1415,7 @@ optimizations.extend([
|
|||
('ineg', ('b2i', ('iand', a, b)))),
|
||||
(('ior', ('ineg', ('b2i','a@1')), ('ineg', ('b2i', 'b@1'))),
|
||||
('ineg', ('b2i', ('ior', a, b)))),
|
||||
(('ieq', ('ineg', ('b2i', 'a@1')), 0), ('inot', a)),
|
||||
(('ieq', ('ineg', ('b2i', 'a@1')), -1), a),
|
||||
(('ine', ('ineg', ('b2i', 'a@1')), 0), a),
|
||||
(('ine', ('ineg', ('b2i', 'a@1')), -1), ('inot', a)),
|
||||
(('ige', ('ineg', ('b2i', 'a@1')), 0), ('inot', a)),
|
||||
(('ilt', ('ineg', ('b2i', 'a@1')), 0), a),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue