sub_n.asm revision 1.1.1.2
1dnl  MIPS64 mpn_sub_n -- Subtract two limb vectors of the same length > 0 and
2dnl  store difference in a third limb vector.
3
4dnl  Copyright 1995, 2000, 2001, 2002, 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
21include(`../config.m4')
22
23C INPUT PARAMETERS
24C res_ptr	$4
25C s1_ptr	$5
26C s2_ptr	$6
27C size		$7
28
29ASM_START()
30PROLOGUE(mpn_sub_nc)
31	ld	$10,0($5)
32	ld	$11,0($6)
33
34	daddiu	$7,$7,-1
35	and	$9,$7,4-1	C number of limbs in first loop
36	beq	$9,$0,.L0	C if multiple of 4 limbs, skip first loop
37	 move	$2,$8
38	b	.Loop0
39	 dsubu	$7,$7,$9
40EPILOGUE()
41PROLOGUE(mpn_sub_n)
42	ld	$10,0($5)
43	ld	$11,0($6)
44
45	daddiu	$7,$7,-1
46	and	$9,$7,4-1	C number of limbs in first loop
47	beq	$9,$0,.L0	C if multiple of 4 limbs, skip first loop
48	 move	$2,$0
49
50	dsubu	$7,$7,$9
51
52.Loop0:	daddiu	$9,$9,-1
53	ld	$12,8($5)
54	daddu	$11,$11,$2
55	ld	$13,8($6)
56	sltu	$8,$11,$2
57	dsubu	$11,$10,$11
58	sltu	$2,$10,$11
59	sd	$11,0($4)
60	or	$2,$2,$8
61
62	daddiu	$5,$5,8
63	daddiu	$6,$6,8
64	move	$10,$12
65	move	$11,$13
66	bne	$9,$0,.Loop0
67	 daddiu	$4,$4,8
68
69.L0:	beq	$7,$0,.Lend
70	 nop
71
72.Loop:	daddiu	$7,$7,-4
73
74	ld	$12,8($5)
75	dsubu	$11,$10,$11
76	ld	$13,8($6)
77	sltu	$8,$10,$11
78	dsubu	$14,$11,$2
79	sltu	$2,$11,$14
80	sd	$14,0($4)
81	or	$2,$2,$8
82
83	ld	$10,16($5)
84	dsubu	$13,$12,$13
85	ld	$11,16($6)
86	sltu	$8,$12,$13
87	dsubu	$14,$13,$2
88	sltu	$2,$13,$14
89	sd	$14,8($4)
90	or	$2,$2,$8
91
92	ld	$12,24($5)
93	dsubu	$11,$10,$11
94	ld	$13,24($6)
95	sltu	$8,$10,$11
96	dsubu	$14,$11,$2
97	sltu	$2,$11,$14
98	sd	$14,16($4)
99	or	$2,$2,$8
100
101	ld	$10,32($5)
102	dsubu	$13,$12,$13
103	ld	$11,32($6)
104	sltu	$8,$12,$13
105	dsubu	$14,$13,$2
106	sltu	$2,$13,$14
107	sd	$14,24($4)
108	or	$2,$2,$8
109
110	daddiu	$5,$5,32
111	daddiu	$6,$6,32
112
113	bne	$7,$0,.Loop
114	 daddiu	$4,$4,32
115
116.Lend:	daddu	$11,$11,$2
117	sltu	$8,$11,$2
118	dsubu	$11,$10,$11
119	sltu	$2,$10,$11
120	sd	$11,0($4)
121	j	$31
122	or	$2,$2,$8
123EPILOGUE()
124