nir/algebraic: Optimize more comparisons with b2f

shader-db:

All Intel platforms had similar results. (Meteor Lake shown)
total instructions in shared programs: 19781108 -> 19772614 (-0.04%)
instructions in affected programs: 372638 -> 364144 (-2.28%)
helped: 2915 / HURT: 0

total cycles in shared programs: 905907644 -> 905822682 (<.01%)
cycles in affected programs: 5573453 -> 5488491 (-1.52%)
helped: 2363 / HURT: 234

LOST:   42
GAINED: 16

fossil-db:

All Intel platforms had similar results. (Meteor Lake shown)
Totals:
Instrs: 152519634 -> 152519610 (-0.00%)
Cycle count: 17122707642 -> 17122710974 (+0.00%); split: -0.00%, +0.00%

Totals from 5 (0.00% of 633222) affected shaders:
Instrs: 2827 -> 2803 (-0.85%)
Cycle count: 83089 -> 86421 (+4.01%); split: -0.12%, +4.13%

Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31068>
This commit is contained in:
Ian Romanick
2024-09-04 10:27:18 -07:00
committed by Marge Bot
parent c5c349a690
commit a780305818

View File

@@ -719,7 +719,9 @@ optimizations.extend([
(('ine', ('iadd', a, b), a), ('ine', b, 0)),
(('feq', ('b2f', 'a@1'), 0.0), ('inot', a)),
(('fge', 0.0, ('b2f', 'a@1')), ('inot', a)),
(('fneu', ('b2f', 'a@1'), 0.0), a),
(('flt', 0.0, ('b2f', 'a@1')), a),
(('ieq', ('b2i', 'a@1'), 0), ('inot', a)),
(('ine', ('b2i', 'a@1'), 0), a),
(('ieq', 'a@1', False), ('inot', a)),