Subject: umull emulation
To: None <port-arm32@netbsd.org>
From: None <kim@pvv.ntnu.no>
List: port-arm32
Date: 11/19/2001 16:08:52
Here is the code that I currently use for umull emulation, since the
ARM710 do not have the ARM7TDMI umull instruction. I don't know if
this will be of interest, but here it is anyway.
Kim0
# umull r4,r3, r5,r6
# The point here is to emulate the above instruction on an ARM710 without it.
# By carefully designing the emulation, I need only 3 extra registers,
# which I have chosen to be r7,r8,r9, which are saved on the stack.
# umull a,A, b+B,c+C a=b+c, (a+A)=(b+B)*(c+C) der a:64 b:c:32
# r5=b+B, r6=c+C, r4=a, r3=A
stmfd sp!, {r7,r8,r9}
mov r7, #65536
sub r7, r7, #1
and r4, r6, r7 @ r4=c
and r8, r5, r7 @ r8=b
mov r7, r6, lsr #16 @ r7=C
mov r9, r5, lsr #16 @ r9=B
mul r3, r7,r9 @ r3=BC
mul r9, r4, r9 @ r9=Bc
mul r4, r8,r4 @ r4=bc
mul r8, r7, r8 @ r8=bC
adds r8, r8, r9 @ r8=bC+Bc
addcs r3, r3, #65536
add r3, r3, r8, lsr #16
adds r4, r4, r8, lsl #16
adc r3, r3, #0
ldmfd sp!, {r7,r8,r9}