1 ; mc88100 __mpn_sub
-- Subtract two limb vectors of the same length
> 0 and
2 ; store difference in
a third limb vector.
4 ; Copyright
(C
) 1992, 1994, 1996 Free Software Foundation
, Inc.
6 ; This file is part of the GNU MP Library.
8 ; The GNU MP Library is free software; you can redistribute it
and/or modify
9 ; it under the terms of the GNU Library General Public License as published by
10 ; the Free Software Foundation; either version
2 of the License
, or (at your
11 ; option
) any later version.
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 Library General Public
16 ; License for more details.
18 ; You should have received
a copy of the GNU Library General Public License
19 ; along with the GNU MP Library; see the file COPYING.LIB. If
not, write to
20 ; the Free Software Foundation
, Inc.
, 59 Temple Place
- Suite
330, Boston
,
30 ; This code has been optimized to run one instruction per clock
, avoiding
31 ; load stalls
and writeback contention. As
a result
, the instruction
32 ; order is
not always natural.
34 ; The speed is about
4.6 clocks
/limb
+ 18 clocks
/limb-vector on an
88100,
35 ; but on the
88110, it seems to run much slower
, 6.6 clocks
/limb.
41 ld r6,r3,0 ; read first limb from s1_ptr
43 ld r7,r4,0 ; read first limb from s2_ptr
48 subu.co
r0,r0,r0 ; initialize carry
51 or.u
r12,r12,hi16
(Lbase
)
52 addu
r12,r12,r5 ;
r12 is address for entering in loop
54 extu
r5,r5,2 ; divide by
4
55 subu
r2,r2,r5 ; adjust res_ptr
56 subu
r3,r3,r5 ; adjust s1_ptr
57 subu
r4,r4,r5 ; adjust s2_ptr
70 Lzero
: subu
r10,r10,1 ; subtract
0 + 8r limbs
(adj loop cnt
)
75 ld r6,r3,8 ; subtract
7 + 8r limbs
79 ld r8,r3,12 ; subtract
6 + 8r limbs
83 ld r6,r3,16 ; subtract
5 + 8r limbs
87 ld r8,r3,20 ; subtract
4 + 8r limbs
91 ld r6,r3,24 ; subtract
3 + 8r limbs
95 ld r8,r3,28 ; subtract
2 + 8r limbs
99 bcnd.n ne0
,r10,Loop ; subtract
1 + 8r limbs
102 st r8,r2,28 ; store most significant limb
104 addu.ci
r2,r0,r0 ; return carry-out from most sign. limb