nir/algebraic: optimize b<<a + c<<a

fossil-db (navi21):
Totals from 248 (0.18% of 135636) affected shaders:
Instrs: 85836 -> 85611 (-0.26%); split: -0.27%, +0.00%
CodeSize: 481304 -> 480332 (-0.20%); split: -0.21%, +0.00%
Latency: 9596559 -> 9596152 (-0.00%); split: -0.00%, +0.00%
InvThroughput: 1423707 -> 1423670 (-0.00%)
SClause: 3872 -> 3874 (+0.05%)
PreSGPRs: 5034 -> 5038 (+0.08%)

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19137>
This commit is contained in:
Rhys Perry
2022-10-17 20:24:23 +01:00
committed by Marge Bot
parent 26abdef5bc
commit 1ae73bc076

View File

@@ -161,6 +161,7 @@ optimizations = [
(('~fadd', ('fmulz(is_used_once)', a, b), ('ffmaz(is_used_once)', a, c, d)), ('ffmaz', a, ('fadd', b, c), d)),
(('~ffmaz', a, ('fmulz(is_used_once)', b, c), ('fmulz(is_used_once)', b, d)), ('fmulz', b, ('ffmaz', a, c, d))),
(('iadd', ('imul', a, b), ('imul', a, c)), ('imul', a, ('iadd', b, c))),
(('iadd', ('ishl', b, a), ('ishl', c, a)), ('ishl', ('iadd', b, c), a)),
(('iand', ('ior', a, b), ('ior', a, c)), ('ior', a, ('iand', b, c))),
(('ior', ('iand', a, b), ('iand', a, c)), ('iand', a, ('ior', b, c))),
(('ieq', ('iand', a, '#b(is_pos_power_of_two)'), b), ('ine', ('iand', a, b), 0)),