Ok, this is a routine start:
#if defined(L_muldi3) && defined(MSP430_HAS_HW_MUL)
#define r_reshh r11 /* res = arg1 * arg2 */
#define r_reshl r10
#define r_reslh r9
#define r_resll r8
#define r_arg1hh r15 /* arg1 */
#define r_arg1hl r14
#define r_arg1lh r13
#define r_arg1ll r12
#define r_arg2hh r7 /* arg2 */
#define r_arg2hl r6
#define r_arg2lh r5
#define r_arg2ll r4
.global __muldi3
.func __muldi3
__muldi3:
push r4
push r5
push r6
push r7
push r8
push r9
push r10
push r11
mov 18+0(r1), r_arg2ll ; 18 is a stack offset
mov 18+2(r1), r_arg2lh ; so move arg 2 in.
mov 18+4(r1), r_arg2hl
mov 18+6(r1), r_arg2hh
clr r_reshh
clr r_reshl
clr r_reslh
clr r_resll
;; r15:r14:r13:r12 * r7:r6:r5:r4 -> r11:r10:r9:r8
;; actual code follows....
;; reload result
mov r_resll, r12
mov r_reslh, r13
mov r_reshl, r14
mov r_reshh, r15
pop r11
pop r10
pop r9
pop r8
pop r7
pop r6
pop r5
pop r4
ret
.endfunc
Please use _signed_ HW registers.
cheers,
~d
On Friday 31 January 2003 12:08, Oleg Skydan wrote:
> Ok, Dmitry !
> I will write one, but I need to know how parameters are passed to the
> __muldi3,
> and what registers can I clobber ?
>
> Regards,
> Oleg.
>
> ----- Original Message -----
> From: "Dmitry" <[email protected]>
> To: <[email protected]>
> Sent: Friday, January 31, 2003 9:18 AM
> Subject: Re: [Mspgcc-users] Missing "__muldi3" ...
>
> > Ok then
> > Can anybody write an assembly code for hardware multiplication for 64
> > bits integers?
> >
> > cheers,
> > ~d
> >
> > On Thursday 30 January 2003 18:49, Oleg Skydan wrote:
> > > Hello All,
> > >
> > > I am in a BIG trouble. The following program works only for MCU's
>
> without
>
> > > HW multiplyer.
> > >
> > > long long a,b,c;
> > >
> > > int main(void)
> > > {
> > > a=b*c;
> > > }
> > >
> > >
> > > And here is the GCC output:
> > >
> > > C:\DOCUME~2\Oleg\LOCALS~1\Temp/ccYlbaaa.o: In function `main':
> > > C:\DOCUME~2\Oleg\LOCALS~1\Temp/ccYlbaaa.o(.text+0x26): undefined
>
> reference
>
> > > to `__muldi3'
> > >
> > > I use the latest win32 available (with update).
> > >
> > > Also, I (and I think many other MSPGCC users) will be thankful for
>
> someone
>
> > > to compile new
> > > win32 MSPGCC build.
> > >
> > > All the best !
> > > Oleg.
> > >
> > >
> > >
> > > -------------------------------------------------------
> > > This SF.NET email is sponsored by:
> > > SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
> > > http://www.vasoftware.com
> > > _______________________________________________
> > > Mspgcc-users mailing list
> > > [email protected]
> > > https://lists.sourceforge.net/lists/listinfo/mspgcc-users
> >
> > --
> > /********************************************************************
> > ("`-''-/").___..--''"`-._ (\ Dimmy the Wild UA1ACZ
> > `6_ 6 ) `-. ( ).`-.__.`) Enterprise Information Sys
> > (_Y_.)' ._ ) `._ `. ``-..-' Nevsky prospekt, 20 / 44
> > _..`--'_..-_/ /--'_.' ,' Saint Petersburg, Russia
> > (il),-'' (li),' ((!.-' +7 (812) 3468202, 5585314
> > ********************************************************************/
> >
> >
> >
> > -------------------------------------------------------
> > This SF.NET email is sponsored by:
> > SourceForge Enterprise Edition + IBM + LinuxWorld
>
> http://www.vasoftware.com
>
> > _______________________________________________
> > Mspgcc-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/mspgcc-users
>
> -------------------------------------------------------
> This SF.NET email is sponsored by:
> SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
> http://www.vasoftware.com
> _______________________________________________
> Mspgcc-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users
--
/********************************************************************
("`-''-/").___..--''"`-._ (\ Dimmy the Wild UA1ACZ
`6_ 6 ) `-. ( ).`-.__.`) Enterprise Information Sys
(_Y_.)' ._ ) `._ `. ``-..-' Nevsky prospekt, 20 / 44
_..`--'_..-_/ /--'_.' ,' Saint Petersburg, Russia
(il),-'' (li),' ((!.-' +7 (812) 3468202, 5585314
********************************************************************/