1 ; 29000 mpn_sub_n -- Subtract two limb vectors of the same length > 0 and
2 ; store difference in a third limb vector.
4 ; Copyright 1992, 1994, 2000 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 Lesser General Public License as published by
10 ; the Free Software Foundation; either version 3 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 Lesser General Public
16 ; License for more details.
18 ; You should have received a copy of the GNU Lesser General Public License
19 ; along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
28 ; We use the loadm/storem instructions and operate on chunks of 8
29 ; limbs/per iteration, until less than 8 limbs remain.
31 ; The 29k has no addition or subtraction instructions that doesn't
32 ; affect carry, so we need to save and restore that as soon as we
33 ; adjust the pointers. gr116 is used for this purpose. Note that
34 ; gr116==0 means that carry should be set.
45 constn gr116,-1 ; init cy reg
46 sub gr117,gr117,2 ; count for jmpfdec
48 ; Main loop working 8 limbs/iteration.
56 subr gr116,gr116,0 ; restore carry
61 subc gr100,gr100,gr108
62 subc gr101,gr101,gr109
63 subc gr102,gr102,gr110
64 subc gr103,gr103,gr111
65 subc gr116,gr116,gr116 ; gr116 = not(cy)
72 ; Code for the last up-to-7 limbs.
73 ; This code might look very strange, but it's hard to write it
74 ; differently without major slowdown.
77 Ltail: sub gr118,lr5,1 ; count for CR
79 sub gr117,lr5,2 ; count for jmpfdec
86 subr gr116,gr116,0 ; restore carry
105 subc gr100,gr100,gr108
109 subc gr101,gr101,gr109
112 L6: subc gr102,gr102,gr110
114 Lstore: storem 0,0,gr96,lr2
115 subc gr116,gr116,gr116 ; gr116 = not(cy)