sub_n.asm revision 1.1.1.1
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 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_n)
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,$0
38
39	dsubu	$7,$7,$9
40
41.Loop0:	daddiu	$9,$9,-1
42	ld	$12,8($5)
43	daddu	$11,$11,$2
44	ld	$13,8($6)
45	sltu	$8,$11,$2
46	dsubu	$11,$10,$11
47	sltu	$2,$10,$11
48	sd	$11,0($4)
49	or	$2,$2,$8
50
51	daddiu	$5,$5,8
52	daddiu	$6,$6,8
53	move	$10,$12
54	move	$11,$13
55	bne	$9,$0,.Loop0
56	 daddiu	$4,$4,8
57
58.L0:	beq	$7,$0,.Lend
59	 nop
60
61.Loop:	daddiu	$7,$7,-4
62
63	ld	$12,8($5)
64	dsubu	$11,$10,$11
65	ld	$13,8($6)
66	sltu	$8,$10,$11
67	dsubu	$14,$11,$2
68	sltu	$2,$11,$14
69	sd	$14,0($4)
70	or	$2,$2,$8
71
72	ld	$10,16($5)
73	dsubu	$13,$12,$13
74	ld	$11,16($6)
75	sltu	$8,$12,$13
76	dsubu	$14,$13,$2
77	sltu	$2,$13,$14
78	sd	$14,8($4)
79	or	$2,$2,$8
80
81	ld	$12,24($5)
82	dsubu	$11,$10,$11
83	ld	$13,24($6)
84	sltu	$8,$10,$11
85	dsubu	$14,$11,$2
86	sltu	$2,$11,$14
87	sd	$14,16($4)
88	or	$2,$2,$8
89
90	ld	$10,32($5)
91	dsubu	$13,$12,$13
92	ld	$11,32($6)
93	sltu	$8,$12,$13
94	dsubu	$14,$13,$2
95	sltu	$2,$13,$14
96	sd	$14,24($4)
97	or	$2,$2,$8
98
99	daddiu	$5,$5,32
100	daddiu	$6,$6,32
101
102	bne	$7,$0,.Loop
103	 daddiu	$4,$4,32
104
105.Lend:	daddu	$11,$11,$2
106	sltu	$8,$11,$2
107	dsubu	$11,$10,$11
108	sltu	$2,$10,$11
109	sd	$11,0($4)
110	j	$31
111	or	$2,$2,$8
112EPILOGUE(mpn_sub_n)
113