nir/algebraic: Undistribute b2i from logic-ops
shader-db: All Intel platforms had similar results. (Lunar Lake shown) total instructions in shared programs: 16973309 -> 16973173 (<.01%) instructions in affected programs: 13780 -> 13644 (-0.99%) helped: 31 / HURT: 0 total cycles in shared programs: 915620550 -> 915618604 (<.01%) cycles in affected programs: 185962 -> 184016 (-1.05%) helped: 30 / HURT: 1 fossil-db: All Intel platforms had similar results. (Lunar Lake shown) Totals: Instrs: 209748003 -> 209745278 (-0.00%) Cycle count: 30514920400 -> 30514716506 (-0.00%); split: -0.00%, +0.00% Max live registers: 65477183 -> 65477584 (+0.00%) Non SSA regs after NIR: 237334710 -> 237333632 (-0.00%) Totals from 1257 (0.18% of 706651) affected shaders: Instrs: 693039 -> 690314 (-0.39%) Cycle count: 39792504 -> 39588610 (-0.51%); split: -0.97%, +0.46% Max live registers: 194170 -> 194571 (+0.21%) Non SSA regs after NIR: 821978 -> 820900 (-0.13%) Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Georg Lehmann <dadschoorse@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33648>
This commit is contained in:
@@ -1451,10 +1451,6 @@ for s in [8, 16, 32, 64]:
|
||||
])
|
||||
|
||||
optimizations.extend([
|
||||
(('iand', ('ineg', ('b2i', 'a@1')), ('ineg', ('b2i', 'b@1'))),
|
||||
('ineg', ('b2i', ('iand', a, b)))),
|
||||
(('ior', ('ineg', ('b2i','a@1')), ('ineg', ('b2i', 'b@1'))),
|
||||
('ineg', ('b2i', ('ior', a, b)))),
|
||||
(('ieq', ('ineg', ('b2i', 'a@1')), -1), a),
|
||||
(('ine', ('ineg', ('b2i', 'a@1')), -1), ('inot', a)),
|
||||
(('ige', ('ineg', ('b2i', 'a@1')), 0), ('inot', a)),
|
||||
@@ -1464,6 +1460,22 @@ optimizations.extend([
|
||||
(('iand', ('ineg', ('b2i', a)), 1), ('b2i', a)),
|
||||
])
|
||||
|
||||
for op in ('ior', 'iand', 'ixor'):
|
||||
optimizations.extend([
|
||||
((op, ('b2i', 'a@1') , ('b2i', 'b@1') ), ('b2i', (op, a, b)) ),
|
||||
((op, ('ineg', ('b2i', 'a@1')), ('ineg', ('b2i', 'b@1'))), ('ineg', ('b2i', (op, a, b)))),
|
||||
|
||||
# This pattern can result when D3D-style Booleans are combined with some
|
||||
# algebraic optimizations of masking.
|
||||
(('iand', (op, ('b2i', 'a@1'), ('ineg', ('b2i', 'b@1'))), 1), ('b2i', (op, a, b)) ),
|
||||
])
|
||||
|
||||
# One extra rule for iand. Since one of the sources is missing ineg, the
|
||||
# final result can only be 0 or 1. Omit the final ineg.
|
||||
optimizations.extend([
|
||||
(('iand', ('ineg', ('b2i', 'a@1')), ('b2i', 'b@1')), ('b2i', ('iand', a, b)))
|
||||
])
|
||||
|
||||
optimizations.extend([
|
||||
(('feq', ('seq', a, b), 1.0), ('feq', a, b)),
|
||||
(('feq', ('sne', a, b), 1.0), ('fneu', a, b)),
|
||||
|
||||
Reference in New Issue
Block a user