nir/algebraic: optimize bcsel(a, 0, 1) to b2i
This avoids combination with other bcsel operations, and as b2i is often a no-op (when used for iadd and such), the resulting pattern is preferable. Totals from affected shaders: (VEGA) SGPRS: 598448 -> 598448 (0.00 %) VGPRS: 457940 -> 457352 (-0.13 %) Spilled SGPRs: 127154 -> 127154 (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: 64836352 -> 64802728 (-0.05 %) bytes LDS: 781 -> 781 (0.00 %) blocks Max Waves: 22931 -> 22931 (0.00 %) Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Reviewed-by: Rhys Perry <pendingchaos02@gmail.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4830>
This commit is contained in:

committed by
Marge Bot

parent
e764192f40
commit
de0ebaf09d
@@ -859,6 +859,8 @@ optimizations.extend([
|
||||
# D3D Boolean emulation
|
||||
(('bcsel', a, -1, 0), ('ineg', ('b2i', 'a@1'))),
|
||||
(('bcsel', a, 0, -1), ('ineg', ('b2i', ('inot', a)))),
|
||||
(('bcsel', a, 1, 0), ('b2i', 'a@1')),
|
||||
(('bcsel', a, 0, 1), ('b2i', ('inot', a))),
|
||||
(('iand', ('ineg', ('b2i', 'a@1')), ('ineg', ('b2i', 'b@1'))),
|
||||
('ineg', ('b2i', ('iand', a, b)))),
|
||||
(('ior', ('ineg', ('b2i','a@1')), ('ineg', ('b2i', 'b@1'))),
|
||||
|
Reference in New Issue
Block a user