From e145425746f7d5004eb39b0aced63c8463b70462 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Mon, 11 Nov 2024 08:20:43 -0400 Subject: [PATCH] agx: fuse also 8-bit address math Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/compiler/agx_nir_algebraic.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/asahi/compiler/agx_nir_algebraic.py b/src/asahi/compiler/agx_nir_algebraic.py index 25e079a3f88..3af4fb903cf 100644 --- a/src/asahi/compiler/agx_nir_algebraic.py +++ b/src/asahi/compiler/agx_nir_algebraic.py @@ -288,6 +288,12 @@ for s_ in range(1, 5): ('amul', 'c@32', ('ishr', d, s))), s)), ] +# 8-bit rules are lowest precedence since we really like to fuse shifts +fuse_lea += [ + (('iadd', a, ('u2u64', 'b@32')), ('ulea_agx', a, b, 0)), + (('iadd', a, ('i2i64', 'b@32')), ('ilea_agx', a, b, 0)), +] + # After lowering address arithmetic, the various address arithmetic opcodes are # no longer useful. Lower them to regular arithmetic to let nir_opt_algebraic # take over.