1
; 29000 __gmpn_sub -- Subtract two limb vectors of the same length > 0 and
2
; store difference in a third limb vector.
4
; Copyright (C) 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 2.1 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; see the file COPYING.LIB. If not, write to
20
; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
30
; We use the loadm/storem instructions and operate on chunks of 8
31
; limbs/per iteration, until less than 8 limbs remain.
33
; The 29k has no addition or subtraction instructions that doesn't
34
; affect carry, so we need to save and restore that as soon as we
35
; adjust the pointers. gr116 is used for this purpose. Note that
36
; gr116==0 means that carry should be set.
47
constn gr116,-1 ; init cy reg
48
sub gr117,gr117,2 ; count for jmpfdec
50
; Main loop working 8 limbs/iteration.
58
subr gr116,gr116,0 ; restore carry
63
subc gr100,gr100,gr108
64
subc gr101,gr101,gr109
65
subc gr102,gr102,gr110
66
subc gr103,gr103,gr111
67
subc gr116,gr116,gr116 ; gr116 = not(cy)
74
; Code for the last up-to-7 limbs.
75
; This code might look very strange, but it's hard to write it
76
; differently without major slowdown.
79
Ltail: sub gr118,lr5,1 ; count for CR
81
sub gr117,lr5,2 ; count for jmpfdec
88
subr gr116,gr116,0 ; restore carry
107
subc gr100,gr100,gr108
111
subc gr101,gr101,gr109
114
L6: subc gr102,gr102,gr110
116
Lstore: storem 0,0,gr96,lr2
117
subc gr116,gr116,gr116 ; gr116 = not(cy)