From ece3bd74dbd3f757505931290b52ead24e3356aa Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Mon, 4 Nov 2024 14:03:10 -0400 Subject: [PATCH] agx: make imad+ishl rules actually work total instructions in shared programs: 2750211 -> 2750184 (<.01%) instructions in affected programs: 50499 -> 50472 (-0.05%) helped: 27 HURT: 0 Instructions are helped. total alu in shared programs: 2273669 -> 2273642 (<.01%) alu in affected programs: 29874 -> 29847 (-0.09%) helped: 27 HURT: 0 Alu are helped. total fscib in shared programs: 2271986 -> 2271959 (<.01%) fscib in affected programs: 29874 -> 29847 (-0.09%) helped: 27 HURT: 0 Fscib are helped. total bytes in shared programs: 21475184 -> 21474968 (<.01%) bytes in affected programs: 371574 -> 371358 (-0.06%) helped: 27 HURT: 0 Bytes are helped. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/compiler/agx_nir_algebraic.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/asahi/compiler/agx_nir_algebraic.py b/src/asahi/compiler/agx_nir_algebraic.py index 1deac433578..25e079a3f88 100644 --- a/src/asahi/compiler/agx_nir_algebraic.py +++ b/src/asahi/compiler/agx_nir_algebraic.py @@ -176,6 +176,10 @@ for s in range(1, 5): (imad(a, b, ('ishl(is_used_once)', c, s)), ('imadshl_agx', a, b, c, s)), (imsub(a, b, ('ishl(is_used_once)', c, s)), ('imsubshl_agx', a, b, c, s)), + # The above but after the below shift lowering + (imad(a, b, ('imadshl_agx(is_used_once)', 0, 1, c, s)), ('imadshl_agx', a, b, c, s)), + (imsub(a, b, ('imadshl_agx(is_used_once)', 0, 1, c, s)), ('imsubshl_agx', a, b, c, s)), + # a + (a << s) = a + a * (1 << s) = a * (1 + (1 << s)) (('imul', a, 1 + (1 << s)), iaddshl(a, a, s)),