nir/opt_algebraic: optimize -0.0 + a

Foz-DB Navi21:
Totals from 428 (0.54% of 79395) affected shaders:
MaxWaves: 8510 -> 8512 (+0.02%)
Instrs: 731062 -> 729665 (-0.19%); split: -0.19%, +0.00%
CodeSize: 3735788 -> 3728324 (-0.20%); split: -0.20%, +0.00%
VGPRs: 27328 -> 27336 (+0.03%); split: -0.03%, +0.06%
SpillSGPRs: 315 -> 314 (-0.32%)
Latency: 3872986 -> 3873236 (+0.01%); split: -0.08%, +0.09%
InvThroughput: 971001 -> 970056 (-0.10%); split: -0.17%, +0.08%
VClause: 11954 -> 11956 (+0.02%); split: -0.02%, +0.03%
SClause: 17361 -> 17358 (-0.02%)
Copies: 59038 -> 59045 (+0.01%); split: -0.22%, +0.24%
Branches: 17685 -> 17656 (-0.16%)
PreSGPRs: 26103 -> 26102 (-0.00%)
PreVGPRs: 23220 -> 23206 (-0.06%)
VALU: 515293 -> 513963 (-0.26%); split: -0.26%, +0.00%
SALU: 91591 -> 91544 (-0.05%)

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31770>
This commit is contained in:
Georg Lehmann 2024-10-21 19:50:32 +02:00 committed by Marge Bot
parent 7dccaf6c3e
commit 1f9b82bb2a

View file

@ -202,6 +202,8 @@ optimizations = [
# floating point instruction, they should flush any input denormals and we
# can replace -0.0 with 0.0 if the float execution mode allows it.
(('fadd(is_only_used_as_float,nsz)', 'a', 0.0), a),
(('fadd(is_only_used_as_float)', a, '#b(is_negative_zero)'), a),
(('fadd', ('fneg', a), '#b(is_negative_zero)'), ('fneg', a)),
(('iadd', a, 0), a),
(('iadd_sat', a, 0), a),
(('isub_sat', a, 0), a),