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 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 General Public License as published by
10 ; the Free Software Foundation; either version 2, or (at your option)
13 ; The GNU MP Library is distributed in the hope that it will be useful,
14 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ; GNU General Public License for more details.
18 ; You should have received a copy of the GNU General Public License
19 ; along with the GNU MP Library; see the file COPYING. If not, write to
20 ; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
29 ; This code has been optimized to run one instruction per clock, avoiding
30 ; load stalls and writeback contention. As a result, the instruction
31 ; order is not always natural.
33 ; The speed is approximately 4.3 clocks/limb + 18 clocks/limb-vector.
38 ld r6,r3,0 ; read first limb from s1_ptr
40 ld r7,r4,0 ; read first limb from s2_ptr
42 subu.co r5,r0,r5 ; (clear carry as side effect)
47 or.u r12,r12,hi16(Lbase)
48 addu r12,r12,r5 ; r12 is address for entering in loop
50 extu r5,r5,2 ; divide by 4
51 subu r2,r2,r5 ; adjust res_ptr
52 subu r3,r3,r5 ; adjust s1_ptr
53 subu r4,r4,r5 ; adjust s2_ptr
66 Lzero: subu r10,r10,1 ; subtract 0 + 16r limbs (adjust loop counter)
71 ld r6,r3,8 ; subtract 15 + 16r limbs
75 ld r8,r3,12 ; subtract 14 + 16r limbs
79 ld r6,r3,16 ; subtract 13 + 16r limbs
83 ld r8,r3,20 ; subtract 12 + 16r limbs
87 ld r6,r3,24 ; subtract 11 + 16r limbs
91 ld r8,r3,28 ; subtract 10 + 16r limbs
95 ld r6,r3,32 ; subtract 9 + 16r limbs
99 ld r8,r3,36 ; subtract 8 + 16r limbs
103 ld r6,r3,40 ; subtract 7 + 16r limbs
107 ld r8,r3,44 ; subtract 6 + 16r limbs
111 ld r6,r3,48 ; subtract 5 + 16r limbs
115 ld r8,r3,52 ; subtract 4 + 16r limbs
119 ld r6,r3,56 ; subtract 3 + 16r limbs
123 ld r8,r3,60 ; subtract 2 + 16r limbs
127 bcnd.n ne0,r10,Loop ; subtract 1 + 16r limbs
130 st r8,r2,60 ; store most significant limb
132 addu.ci r2,r0,r0 ; return carry-out from most sign. limb