nir/opt_algebraic: reassociate constants in ior(iand) chains
Mostly affects one F1_23 shader that packs bitfields bit by bit. Totals from 3 (0.00% of 79395) affected shaders: Instrs: 5004 -> 4202 (-16.03%) CodeSize: 30992 -> 23952 (-22.72%) Latency: 28894 -> 28464 (-1.49%) InvThroughput: 4095 -> 3934 (-3.93%) Copies: 363 -> 376 (+3.58%) PreVGPRs: 110 -> 109 (-0.91%) VALU: 3035 -> 2504 (-17.50%) SALU: 463 -> 459 (-0.86%) Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31009>
This commit is contained in:
@@ -2003,6 +2003,7 @@ optimizations.extend([
|
||||
(('iand', '#a', ('iand', 'b(is_not_const)', '#c')), ('iand', ('iand', a, c), b)),
|
||||
(('ior', '#a', ('ior', 'b(is_not_const)', '#c')), ('ior', ('ior', a, c), b)),
|
||||
(('ixor', '#a', ('ixor', 'b(is_not_const)', '#c')), ('ixor', ('ixor', a, c), b)),
|
||||
(('ior', ('iand', a, '#c'), ('ior', b, ('iand', a, '#d'))), ('ior', b, ('iand', a, ('ior', c, d)))),
|
||||
|
||||
# Reassociate add chains for more MAD/FMA-friendly code
|
||||
(('~fadd', ('fadd(is_used_once)', 'a(is_fmul)', 'b(is_fmul)'), 'c(is_not_fmul)'), ('fadd', ('fadd', a, c), b)),
|
||||
|
Reference in New Issue
Block a user