addmul_1.asm revision 1.1.1.1
1dnl  SH2 mpn_addmul_1 -- Multiply a limb vector with a limb and add the result
2dnl  to a second limb vector.
3
4dnl  Copyright 1995, 2000, 2011 Free Software Foundation, Inc.
5
6dnl  This file is part of the GNU MP Library.
7
8dnl  The GNU MP Library is free software; you can redistribute it and/or modify
9dnl  it under the terms of the GNU Lesser General Public License as published
10dnl  by the Free Software Foundation; either version 3 of the License, or (at
11dnl  your option) any later version.
12
13dnl  The GNU MP Library is distributed in the hope that it will be useful, but
14dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
16dnl  License for more details.
17
18dnl  You should have received a copy of the GNU Lesser General Public License
19dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
20
21
22include(`../config.m4')
23
24C INPUT PARAMETERS
25C res_ptr	r4
26C s1_ptr	r5
27C size		r6
28C s2_limb	r7
29
30changecom(blah)			C disable # to make all C comments below work
31
32ASM_START()
33PROLOGUE(mpn_addmul_1)
34	mov	#0,r2		C cy_limb = 0
35	mov	#0,r0		C Keep r0 = 0 for entire loop
36	clrt
37
38L(top):	mov.l	@r5+,r3
39	dmulu.l	r3,r7
40	sts	macl,r1
41	addc	r2,r1		C lo_prod += old cy_limb
42	sts	mach,r2		C new cy_limb = hi_prod
43	mov.l	@r4,r3
44	addc	r0,r2		C cy_limb += T, T = 0
45	addc	r3,r1
46	addc	r0,r2		C cy_limb += T, T = 0
47	dt	r6
48	mov.l	r1,@r4
49	bf.s	L(top)
50	add	#4,r4
51
52	rts
53	mov	r2,r0
54EPILOGUE()
55