Hi,

I haven't figured out the signed multiply yet (maybe I'll get a chance to
think about it at home tonight), but this *should* work for unsigned.  It's
untested as yet.  Using MAC saves a couple of instructions compared to bare
MPY.

r5:r4 *  r8:r9, result in r15:r14:r13:r12

  r15: r14: r13: r12 = r5:r4 * r8:r9

 =  0 : 0 : r4  * r9
 + 0 : r5  * r9 : 0
 + 0 : r4  * r8 : 0
 + r5  * r8 : 0 : 0


mov r4, &__MPY
mov r9, &__OP2
mov &__RESLO, r12
mov &__RESHI, r13
mov r8, &__OP2
mov r5, &__MAC
mov r9, &__OP2
add &__RESLO, r13
addc &__RESHI, r14
mov &__SUMEXT, r15
adc r15
mov r5, &__MPY
mov r8, &__OP2
add &__RESLO, r14
addc &__RESHI, r15


mvh.,

David



> Fellows,
> can anybody send me a code which does multiplication of two longs (32bits)
> with result of 64 bits for both signed and unsigned. The HW multiplier
must
> be used.
>
> Source arguments are in r5:r4, r8:r9, result in r15:r14:r13:r12
>
>
> Thanks in advance,
> ~d
>
>
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle
Practices
> Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> _______________________________________________
> Mspgcc-users mailing list
> Mspgcc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users
>
>
>



Reply via email to