Module: Mesa Branch: main Commit: 1e552b9c95a1fc8cbec5f6187bf8630b3c31cc25 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1e552b9c95a1fc8cbec5f6187bf8630b3c31cc25
Author: Georg Lehmann <[email protected]> Date: Tue Oct 4 14:32:50 2022 +0200 nir/opt_algebraic: Mirror optimizations for find_msb_rev. Signed-off-by: Georg Lehmann <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Rhys Perry <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18951> --- src/compiler/nir/nir_opt_algebraic.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index 834565d6ce9..39ca3be927b 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -1674,12 +1674,17 @@ optimizations.extend([ (('bcsel', ('ige', ('find_lsb', a), 0), ('find_lsb', a), -1), ('find_lsb', a)), (('bcsel', ('ige', ('ifind_msb', a), 0), ('ifind_msb', a), -1), ('ifind_msb', a)), (('bcsel', ('ige', ('ufind_msb', a), 0), ('ufind_msb', a), -1), ('ufind_msb', a)), + (('bcsel', ('ige', ('ifind_msb_rev', a), 0), ('ifind_msb_rev', a), -1), ('ifind_msb_rev', a)), + (('bcsel', ('ige', ('ufind_msb_rev', a), 0), ('ufind_msb_rev', a), -1), ('ufind_msb_rev', a)), (('bcsel', ('ine', a, 0), ('find_lsb', a), -1), ('find_lsb', a)), (('bcsel', ('ine', a, 0), ('ifind_msb', a), -1), ('ifind_msb', a)), (('bcsel', ('ine', a, 0), ('ufind_msb', a), -1), ('ufind_msb', a)), + (('bcsel', ('ine', a, 0), ('ifind_msb_rev', a), -1), ('ifind_msb_rev', a)), + (('bcsel', ('ine', a, 0), ('ufind_msb_rev', a), -1), ('ufind_msb_rev', a)), (('bcsel', ('ine', a, -1), ('ifind_msb', a), -1), ('ifind_msb', a)), + (('bcsel', ('ine', a, -1), ('ifind_msb_rev', a), -1), ('ifind_msb_rev', a)), (('~fmul', ('bcsel(is_used_once)', c, -1.0, 1.0), b), ('bcsel', c, ('fneg', b), b)), (('~fmul', ('bcsel(is_used_once)', c, 1.0, -1.0), b), ('bcsel', c, b, ('fneg', b))),
