Upload Tizen:Base source
[external/gmp.git] / mpn / pa32 / sub_n.asm
1 dnl  HP-PA mpn_sub_n -- Subtract two limb vectors of the same length > 0 and
2 dnl  store difference in a third limb vector.
3
4 dnl  Copyright 1992, 1994, 2000, 2001, 2002 Free Software Foundation, Inc.
5
6 dnl  This file is part of the GNU MP Library.
7
8 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
9 dnl  it under the terms of the GNU Lesser General Public License as published
10 dnl  by the Free Software Foundation; either version 3 of the License, or (at
11 dnl  your option) any later version.
12
13 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
14 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
16 dnl  License for more details.
17
18 dnl  You should have received a copy of the GNU Lesser General Public License
19 dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
20
21 include(`../config.m4')
22
23 C INPUT PARAMETERS
24 C res_ptr       gr26
25 C s1_ptr        gr25
26 C s2_ptr        gr24
27 C size          gr23
28
29 C One might want to unroll this as for other processors, but it turns out that
30 C the data cache contention after a store makes such unrolling useless.  We
31 C can't come under 5 cycles/limb anyway.
32
33 ASM_START()
34 PROLOGUE(mpn_sub_n)
35         ldws,ma         4(0,%r25),%r20
36         ldws,ma         4(0,%r24),%r19
37
38         addib,=         -1,%r23,L(end)  C check for (SIZE == 1)
39          sub            %r20,%r19,%r28  C subtract first limbs ignoring cy
40
41 LDEF(loop)
42         ldws,ma         4(0,%r25),%r20
43         ldws,ma         4(0,%r24),%r19
44         stws,ma         %r28,4(0,%r26)
45         addib,<>        -1,%r23,L(loop)
46          subb           %r20,%r19,%r28
47
48 LDEF(end)
49         stws            %r28,0(0,%r26)
50         addc            %r0,%r0,%r28
51         bv              0(%r2)
52          subi           1,%r28,%r28
53 EPILOGUE()