11.1Sjoerg// This file is dual licensed under the MIT and the University of Illinois Open
21.1Sjoerg// Source Licenses. See LICENSE.TXT for details.
31.1Sjoerg
41.1Sjoerg#include "../assembly.h"
51.1Sjoerg
61.1Sjoerg// di_int __muldi3(di_int a, di_int b);
71.1Sjoerg
81.1Sjoerg#ifdef __i386__
91.1Sjoerg
101.1Sjoerg.text
111.1.1.2Sjoerg.balign 4
121.1SjoergDEFINE_COMPILERRT_FUNCTION(__muldi3)
131.1Sjoerg	pushl	%ebx
141.1Sjoerg	movl  16(%esp),		%eax	// b.lo
151.1Sjoerg	movl  12(%esp),		%ecx	// a.hi
161.1Sjoerg	imull	%eax,		%ecx	// b.lo * a.hi
171.1Sjoerg
181.1Sjoerg	movl   8(%esp),		%edx	// a.lo
191.1Sjoerg	movl  20(%esp),		%ebx	// b.hi
201.1Sjoerg	imull	%edx,		%ebx	// a.lo * b.hi
211.1Sjoerg
221.1Sjoerg	mull	%edx				// EDX:EAX = a.lo * b.lo
231.1Sjoerg	addl	%ecx,		%ebx	// EBX = (a.lo*b.hi + a.hi*b.lo)
241.1Sjoerg	addl	%ebx,		%edx
251.1Sjoerg
261.1Sjoerg	popl	%ebx
271.1Sjoerg	retl
281.1SjoergEND_COMPILERRT_FUNCTION(__muldi3)
291.1Sjoerg
301.1Sjoerg#endif // __i386__
31