xref: /netbsd-src/external/lgpl3/gmp/dist/mpn/sparc32/v8/submul_1.asm (revision a45db23f655e22f0c2354600d3b3c2cb98abf2dc)
1dnl  SPARC v8 mpn_submul_1 -- Multiply a limb vector with a limb and
2dnl  subtract the result from a second limb vector.
3
4dnl  Copyright 1992-1994, 2000 Free Software Foundation, Inc.
5
6dnl  This file is part of the GNU MP Library.
7dnl
8dnl  The GNU MP Library is free software; you can redistribute it and/or modify
9dnl  it under the terms of either:
10dnl
11dnl    * the GNU Lesser General Public License as published by the Free
12dnl      Software Foundation; either version 3 of the License, or (at your
13dnl      option) any later version.
14dnl
15dnl  or
16dnl
17dnl    * the GNU General Public License as published by the Free Software
18dnl      Foundation; either version 2 of the License, or (at your option) any
19dnl      later version.
20dnl
21dnl  or both in parallel, as here.
22dnl
23dnl  The GNU MP Library is distributed in the hope that it will be useful, but
24dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
25dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
26dnl  for more details.
27dnl
28dnl  You should have received copies of the GNU General Public License and the
29dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
30dnl  see https://www.gnu.org/licenses/.
31
32
33include(`../config.m4')
34
35C INPUT PARAMETERS
36C res_ptr	o0
37C s1_ptr	o1
38C size		o2
39C s2_limb	o3
40
41ASM_START()
42PROLOGUE(mpn_submul_1)
43	sub	%g0,%o2,%o2		C negate ...
44	sll	%o2,2,%o2		C ... and scale size
45	sub	%o1,%o2,%o1		C o1 is offset s1_ptr
46	sub	%o0,%o2,%g1		C g1 is offset res_ptr
47
48	mov	0,%o0			C clear cy_limb
49
50L(loop):
51	ld	[%o1+%o2],%o4
52	ld	[%g1+%o2],%g2
53	umul	%o4,%o3,%o5
54	rd	%y,%g3
55	addcc	%o5,%o0,%o5
56	addx	%g3,0,%o0
57	subcc	%g2,%o5,%g2
58	addx	%o0,0,%o0
59	st	%g2,[%g1+%o2]
60
61	addcc	%o2,4,%o2
62	bne	L(loop)
63	 nop
64
65	retl
66	 nop
67EPILOGUE(mpn_submul_1)
68