nir/opt_algebraic: Simple xor/ishr optimizations.

The first pattern here removes the xor-swap pattern.

Foz-DB GFX10_3:
Totals from 305 (0.23% of 134913) affected shaders:
CodeSize: 1589040 -> 1585164 (-0.24%)
Instrs: 284344 -> 283375 (-0.34%)
Latency: 4205148 -> 4198472 (-0.16%); split: -0.16%, +0.00%
InvThroughput: 708745 -> 708739 (-0.00%)

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16411>
This commit is contained in:
Georg Lehmann 2022-05-09 11:52:26 +02:00 committed by Marge Bot
parent 66e917fff6
commit 60c9a45562

View file

@ -1210,6 +1210,8 @@ optimizations.extend([
(('ior', a, True), True),
(('ixor', a, a), 0),
(('ixor', a, 0), a),
(('ixor', a, ('ixor', a, b)), b),
(('ixor', a, -1), ('inot', a)),
(('inot', ('inot', a)), a),
(('ior', ('iand', a, b), b), b),
(('ior', ('ior', a, b), b), ('ior', a, b)),
@ -1222,6 +1224,7 @@ optimizations.extend([
(('ishl', 0, a), 0),
(('ishl', a, 0), a),
(('ishr', 0, a), 0),
(('ishr', -1, a), -1),
(('ishr', a, 0), a),
(('ushr', 0, a), 0),
(('ushr', a, 0), a),