116
AT94KAL Series FPSLIC
Rev. 1138G–FPSLI–11/03
mulsu r23, r20
; (signed)ah * bl
sbc r19, r2
add r17, r0
adc r18, r1
adc r19, r2
mulsu r21, r22
; (signed)bh * al
sbc r19, r2
; Sign extend
add r17, r0
adc r18, r1
adc r19, r2
ret
mac16x16_32_method_B:
; uses two temporary registers (r4,r5), Speed / Size
Optimized
; but reduces cycles/words by 1
clr r2
muls r23, r21
; (signed)ah * (signed)bh
movw r5:r4,r1:r0
mul r22, r20
; al * bl
add r16, r0
adc r17, r1
adc r18, r4
adc r19, r5
mulsu r23, r20
; (signed)ah * bl
sbc r19, r2
; Sign extend
add r17, r0
adc r18, r1
adc r19, r2
mulsu r21, r22
; (signed)bh * al
sbc r19, r2
; Sign extend
add r17, r0
adc r18, r1
adc r19, r2
ret