1; 29000 __gmpn_submul_1 -- Multiply a limb vector with a single limb and
2; subtract the product from a second limb vector.
3
4; Copyright 1992, 1994, 2000 Free Software Foundation, Inc.
5
6; This file is part of the GNU MP Library.
7
8; The GNU MP Library is free software; you can redistribute it and/or modify
9; it under the terms of the GNU Lesser General Public License as published by
10; the Free Software Foundation; either version 3 of the License, or (at your
11; option) any later version.
12
13; The GNU MP Library is distributed in the hope that it will be useful, but
14; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
16; License for more details.
17
18; You should have received a copy of the GNU Lesser General Public License
19; along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
20
21
22; INPUT PARAMETERS
23; res_ptr	lr2
24; s1_ptr	lr3
25; size		lr4
26; s2_limb	lr5
27
28	.cputype 29050
29	.sect .lit,lit
30	.text
31	.align	4
32	.global	___gmpn_submul_1
33	.word	0x60000
34___gmpn_submul_1:
35	sub	lr4,lr4,8
36	jmpt	lr4,Ltail
37	 const	gr120,0			; init cylimb reg
38
39	srl	gr117,lr4,3		; divide by 8
40	sub	gr117,gr117,1		; count for jmpfdec
41
42Loop:	mtsrim	cr,(8-1)
43	loadm	0,0,gr96,lr3
44	add	lr3,lr3,32
45
46	multiplu gr104,gr96,lr5
47	multmu	 gr96,gr96,lr5
48	multiplu gr105,gr97,lr5
49	multmu	 gr97,gr97,lr5
50	multiplu gr106,gr98,lr5
51	multmu	 gr98,gr98,lr5
52	multiplu gr107,gr99,lr5
53	multmu	 gr99,gr99,lr5
54	multiplu gr108,gr100,lr5
55	multmu	 gr100,gr100,lr5
56	multiplu gr109,gr101,lr5
57	multmu	 gr101,gr101,lr5
58	multiplu gr110,gr102,lr5
59	multmu	 gr102,gr102,lr5
60	multiplu gr111,gr103,lr5
61	multmu	 gr103,gr103,lr5
62
63	add	gr104,gr104,gr120
64	addc	gr105,gr105,gr96
65	addc	gr106,gr106,gr97
66	addc	gr107,gr107,gr98
67	addc	gr108,gr108,gr99
68	addc	gr109,gr109,gr100
69	addc	gr110,gr110,gr101
70	addc	gr111,gr111,gr102
71	addc	gr120,gr103,0
72
73	mtsrim	cr,(8-1)
74	loadm	0,0,gr96,lr2
75
76	sub	gr96,gr96,gr104
77	subc	gr97,gr97,gr105
78	subc	gr98,gr98,gr106
79	subc	gr99,gr99,gr107
80	subc	gr100,gr100,gr108
81	subc	gr101,gr101,gr109
82	subc	gr102,gr102,gr110
83	subc	gr103,gr103,gr111
84
85	add	gr104,gr103,gr111	; invert carry from previous sub
86	addc	gr120,gr120,0
87
88	mtsrim	cr,(8-1)
89	storem	0,0,gr96,lr2
90	jmpfdec	gr117,Loop
91	 add	lr2,lr2,32
92
93Ltail:	and	lr4,lr4,(8-1)
94	sub	gr118,lr4,1		; count for CR
95	jmpt	gr118,Lend
96	 sub	lr4,lr4,2
97	sub	lr2,lr2,4		; offset res_ptr by one limb
98
99Loop2:	load	0,0,gr116,lr3
100	add	lr3,lr3,4
101	multiplu gr117,gr116,lr5
102	multmu	gr118,gr116,lr5
103	add	lr2,lr2,4
104	load	0,0,gr119,lr2
105	add	gr117,gr117,gr120
106	addc	gr118,gr118,0
107	sub	gr119,gr119,gr117
108	add	gr104,gr119,gr117	; invert carry from previous sub
109	store	0,0,gr119,lr2
110	jmpfdec	lr4,Loop2
111	 addc	gr120,gr118,0
112
113Lend:	jmpi	lr0
114	 or	gr96,gr120,0		; copy
115