nir/algebraic: add optimizations for imul(a, INT_MIN)
authorRhys Perry <pendingchaos02@gmail.com>
Wed, 21 Jul 2021 16:03:01 +0000 (17:03 +0100)
committerMarge Bot <eric+marge@anholt.net>
Mon, 9 Aug 2021 11:00:39 +0000 (11:00 +0000)
commitb009467b810ce42a97f80c15cbb5647781a5f807
treebabf0b5a37cd8e806a1fc5704bc8c7a0f350195c
parent65cd5a0f22ed1ca2cae4d2f274101ba6b0753771
nir/algebraic: add optimizations for imul(a, INT_MIN)

is_pos_power_of_two would catch this, but nir_op_imul has signed sources,
so is_neg_power_of_two catches it instead, which creates a useless
nir_op_ineg.

fossil-db (Sienna Cichlid):
Totals from 1014 (0.68% of 150170) affected shaders:
CodeSize: 3592296 -> 3592288 (-0.00%); split: -0.00%, +0.00%
Instrs: 671211 -> 670426 (-0.12%)
Latency: 5268917 -> 5268479 (-0.01%); split: -0.01%, +0.00%
InvThroughput: 2187349 -> 2187343 (-0.00%); split: -0.00%, +0.00%
VClause: 8634 -> 8636 (+0.02%)
Copies: 97585 -> 97604 (+0.02%)

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12039>
src/compiler/nir/nir_opt_algebraic.py