From 1795e7dacebb2b7ebbca43aa5f6e2df188894138 Mon Sep 17 00:00:00 2001 From: "Matthias J. Kannwischer" Date: Fri, 20 Dec 2024 16:38:30 +0800 Subject: [PATCH] M7: Adjust MAC forwarding paths --- slothy/targets/arm_v7m/cortex_m7.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/slothy/targets/arm_v7m/cortex_m7.py b/slothy/targets/arm_v7m/cortex_m7.py index 7a9892bd..f56e3cc9 100644 --- a/slothy/targets/arm_v7m/cortex_m7.py +++ b/slothy/targets/arm_v7m/cortex_m7.py @@ -291,12 +291,16 @@ def get_latency(src, out_idx, dst): latency = lookup_multidict(default_latencies, src) # Forwarding path to MAC instructions - if instclass_dst in [mla, mls, smlabb, smlabt, smlatt, smlatb] and src.args_out[0] == dst.args_in[2]: + if instclass_dst in [mla, mls, smlabb, smlabt, smlatt, smlatb] and dst.args_in[2] in (src.args_out + src.args_in_out): latency = latency - 1 - if instclass_dst in [smlal] and \ - (src.args_out[0] == dst.args_in_out[0] or src.args_out[0] == dst.args_in_out[1]): - latency = latency - 1 + if instclass_dst in [smlal]: + if len(src.args_out) > 1: + if (src.args_out[0] == dst.args_in_out[0] or src.args_out[0] == dst.args_in_out[1]): + latency = latency - 1 + elif len(src.args_in_out) > 1: + if (src.args_in_out[0] == dst.args_in_out[0] or src.args_in_out[0] == dst.args_in_out[1]): + latency = latency - 1 # Multiply accumulate chain latency is 1 if instclass_src in [smlal] and instclass_dst in [smlal] and \