Home | History | Annotate | Download | only in i386
      1 // This file is dual licensed under the MIT and the University of Illinois Open
      2 // Source Licenses. See LICENSE.TXT for details.
      3 
      4 #include "../assembly.h"
      5 
      6 // di_int __muldi3(di_int a, di_int b);
      7 
      8 #ifdef __i386__
      9 
     10 .text
     11 .align 4
     12 DEFINE_COMPILERRT_FUNCTION(__muldi3)
     13 	pushl	%ebx
     14 	movl  16(%esp),		%eax	// b.lo
     15 	movl  12(%esp),		%ecx	// a.hi
     16 	imull	%eax,		%ecx	// b.lo * a.hi
     17 
     18 	movl   8(%esp),		%edx	// a.lo
     19 	movl  20(%esp),		%ebx	// b.hi
     20 	imull	%edx,		%ebx	// a.lo * b.hi
     21 
     22 	mull	%edx				// EDX:EAX = a.lo * b.lo
     23 	addl	%ecx,		%ebx	// EBX = (a.lo*b.hi + a.hi*b.lo)
     24 	addl	%ebx,		%edx
     25 
     26 	popl	%ebx
     27 	retl
     28 
     29 #endif // __i386__
     30