1/* i80386 __mpn_submul_1 -- Multiply a limb vector with a limb and subtract
2   the result from a second limb vector.
3   Copyright (C) 1992, 1994, 1997, 1998, 2000 Free Software Foundation, Inc.
4   This file is part of the GNU MP Library.
5
6   The GNU MP Library is free software; you can redistribute it and/or modify
7   it under the terms of the GNU Lesser General Public License as published by
8   the Free Software Foundation; either version 2.1 of the License, or (at your
9   option) any later version.
10
11   The GNU MP Library is distributed in the hope that it will be useful, but
12   WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
14   License for more details.
15
16   You should have received a copy of the GNU Lesser General Public License
17   along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
18   the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
19   MA 02111-1307, USA. */
20
21#if 0 /* vstr */
22#include "sysdep.h"
23#include "asm-syntax.h"
24#include "bp-sym.h"
25#include "bp-asm.h"
26#endif /* vstr */
27
28#define PARMS	LINKAGE+16	/* space for 4 saved regs */
29#define RES	PARMS
30#define S1	RES+PTR_SIZE
31#define SIZE	S1+PTR_SIZE
32#define S2LIMB	SIZE+4
33
34#define res_ptr edi
35#define s1_ptr esi
36#define sizeP ecx
37#define s2_limb ebx
38
39	.text
40ENTRY (BP_SYM (__mpn_submul_1))
41	ENTER
42
43	pushl	%edi
44	pushl	%esi
45	pushl	%ebp
46	pushl	%ebx
47
48	movl	RES(%esp), %res_ptr
49	movl	S1(%esp), %s1_ptr
50	movl	SIZE(%esp), %sizeP
51	movl	S2LIMB(%esp), %s2_limb
52#if __BOUNDED_POINTERS__
53	shll	$2, %sizeP	/* convert limbs to bytes */
54	CHECK_BOUNDS_BOTH_WIDE (%res_ptr, RES(%esp), %sizeP)
55	CHECK_BOUNDS_BOTH_WIDE (%s1_ptr, S1(%esp), %sizeP)
56	shrl	$2, %sizeP
57#endif
58	leal	(%res_ptr,%sizeP,4), %res_ptr
59	leal	(%s1_ptr,%sizeP,4), %s1_ptr
60	negl	%sizeP
61	xorl	%ebp, %ebp
62	ALIGN (3)
63L(oop):
64	movl	(%s1_ptr,%sizeP,4), %eax
65	mull	%s2_limb
66	addl	%ebp, %eax
67	adcl	$0, %edx
68	subl	%eax, (%res_ptr,%sizeP,4)
69	adcl	$0, %edx
70	movl	%edx, %ebp
71
72	incl	%sizeP
73	jnz	L(oop)
74	movl	%ebp, %eax
75
76	popl	%ebx
77	popl	%ebp
78	popl	%esi
79	popl	%edi
80
81	LEAVE
82	ret
83END (BP_SYM (__mpn_submul_1))
84