diff --git a/src/asahi/compiler/agx_nir_algebraic.py b/src/asahi/compiler/agx_nir_algebraic.py index 9e2c5aa7e5f..1deac433578 100644 --- a/src/asahi/compiler/agx_nir_algebraic.py +++ b/src/asahi/compiler/agx_nir_algebraic.py @@ -189,6 +189,12 @@ for s in range(1, 5): (('ishl', a, s), iaddshl(0, a, s)), ] +# If the above rules failed, we have a large constant shift on the IC unit. +# Might as well fuse an add to form an imad, if we're on the IC anyway. +fuse_imad += [ + (('iadd', a, ('ishl(is_used_once)', b, '#c')), imad(b, ('ishl', 1, c), a)), +] + # Discard lowering generates this pattern, clean it up ixor_bcsel = [ (('ixor', ('bcsel', a, '#b', '#c'), '#d'),