From 1e552b9c95a1fc8cbec5f6187bf8630b3c31cc25 Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Tue, 4 Oct 2022 14:32:50 +0200 Subject: [PATCH] nir/opt_algebraic: Mirror optimizations for find_msb_rev. Signed-off-by: Georg Lehmann Reviewed-by: Ian Romanick Reviewed-by: Rhys Perry Part-of: --- 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))),