sub_n.asm revision 1.1.1.3
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-2002, 2011 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
32include(`../config.m4')
33
34C INPUT PARAMETERS
35C res_ptr	$4
36C s1_ptr	$5
37C s2_ptr	$6
38C size		$7
39
40ASM_START()
41PROLOGUE(mpn_sub_nc)
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,$8
49	b	.Loop0
50	 dsubu	$7,$7,$9
51EPILOGUE()
52PROLOGUE(mpn_sub_n)
53	ld	$10,0($5)
54	ld	$11,0($6)
55
56	daddiu	$7,$7,-1
57	and	$9,$7,4-1	C number of limbs in first loop
58	beq	$9,$0,.L0	C if multiple of 4 limbs, skip first loop
59	 move	$2,$0
60
61	dsubu	$7,$7,$9
62
63.Loop0:	daddiu	$9,$9,-1
64	ld	$12,8($5)
65	daddu	$11,$11,$2
66	ld	$13,8($6)
67	sltu	$8,$11,$2
68	dsubu	$11,$10,$11
69	sltu	$2,$10,$11
70	sd	$11,0($4)
71	or	$2,$2,$8
72
73	daddiu	$5,$5,8
74	daddiu	$6,$6,8
75	move	$10,$12
76	move	$11,$13
77	bne	$9,$0,.Loop0
78	 daddiu	$4,$4,8
79
80.L0:	beq	$7,$0,.Lend
81	 nop
82
83.Loop:	daddiu	$7,$7,-4
84
85	ld	$12,8($5)
86	dsubu	$11,$10,$11
87	ld	$13,8($6)
88	sltu	$8,$10,$11
89	dsubu	$14,$11,$2
90	sltu	$2,$11,$14
91	sd	$14,0($4)
92	or	$2,$2,$8
93
94	ld	$10,16($5)
95	dsubu	$13,$12,$13
96	ld	$11,16($6)
97	sltu	$8,$12,$13
98	dsubu	$14,$13,$2
99	sltu	$2,$13,$14
100	sd	$14,8($4)
101	or	$2,$2,$8
102
103	ld	$12,24($5)
104	dsubu	$11,$10,$11
105	ld	$13,24($6)
106	sltu	$8,$10,$11
107	dsubu	$14,$11,$2
108	sltu	$2,$11,$14
109	sd	$14,16($4)
110	or	$2,$2,$8
111
112	ld	$10,32($5)
113	dsubu	$13,$12,$13
114	ld	$11,32($6)
115	sltu	$8,$12,$13
116	dsubu	$14,$13,$2
117	sltu	$2,$13,$14
118	sd	$14,24($4)
119	or	$2,$2,$8
120
121	daddiu	$5,$5,32
122	daddiu	$6,$6,32
123
124	bne	$7,$0,.Loop
125	 daddiu	$4,$4,32
126
127.Lend:	daddu	$11,$11,$2
128	sltu	$8,$11,$2
129	dsubu	$11,$10,$11
130	sltu	$2,$10,$11
131	sd	$11,0($4)
132	j	$31
133	or	$2,$2,$8
134EPILOGUE()
135