1*0b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 2*0b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information. 3*0b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 4*0b57cec5SDimitry Andric 5*0b57cec5SDimitry Andric#include "../assembly.h" 6*0b57cec5SDimitry Andric 7*0b57cec5SDimitry Andric// di_int __muldi3(di_int a, di_int b); 8*0b57cec5SDimitry Andric 9*0b57cec5SDimitry Andric#ifdef __i386__ 10*0b57cec5SDimitry Andric 11*0b57cec5SDimitry Andric.text 12*0b57cec5SDimitry Andric.balign 4 13*0b57cec5SDimitry AndricDEFINE_COMPILERRT_FUNCTION(__muldi3) 14*0b57cec5SDimitry Andric pushl %ebx 15*0b57cec5SDimitry Andric movl 16(%esp), %eax // b.lo 16*0b57cec5SDimitry Andric movl 12(%esp), %ecx // a.hi 17*0b57cec5SDimitry Andric imull %eax, %ecx // b.lo * a.hi 18*0b57cec5SDimitry Andric 19*0b57cec5SDimitry Andric movl 8(%esp), %edx // a.lo 20*0b57cec5SDimitry Andric movl 20(%esp), %ebx // b.hi 21*0b57cec5SDimitry Andric imull %edx, %ebx // a.lo * b.hi 22*0b57cec5SDimitry Andric 23*0b57cec5SDimitry Andric mull %edx // EDX:EAX = a.lo * b.lo 24*0b57cec5SDimitry Andric addl %ecx, %ebx // EBX = (a.lo*b.hi + a.hi*b.lo) 25*0b57cec5SDimitry Andric addl %ebx, %edx 26*0b57cec5SDimitry Andric 27*0b57cec5SDimitry Andric popl %ebx 28*0b57cec5SDimitry Andric retl 29*0b57cec5SDimitry AndricEND_COMPILERRT_FUNCTION(__muldi3) 30*0b57cec5SDimitry Andric 31*0b57cec5SDimitry Andric#endif // __i386__ 32*0b57cec5SDimitry Andric 33*0b57cec5SDimitry AndricNO_EXEC_STACK_DIRECTIVE 34*0b57cec5SDimitry Andric 35