Upload Tizen:Base source
[external/gmp.git] / mpn / pa32 / hppa2_0 / sub_n.asm
1 dnl  HP-PA 2.0 32-bit mpn_sub_n -- Subtract two limb vectors of the same
2 dnl  length > 0 and store difference in a third limb vector.
3
4 dnl  Copyright 1997, 1998, 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 This runs at 2 cycles/limb on PA8000.
30
31 ASM_START()
32 PROLOGUE(mpn_sub_n)
33         sub             %r0,%r23,%r22
34         zdep            %r22,30,3,%r28          C r28 = 2 * (-n & 7)
35         zdep            %r22,29,3,%r22          C r22 = 4 * (-n & 7)
36         sub             %r25,%r22,%r25          C offset s1_ptr
37         sub             %r24,%r22,%r24          C offset s2_ptr
38         blr             %r28,%r0                C branch into loop
39         sub             %r26,%r22,%r26          C offset res_ptr and set carry
40
41 LDEF(loop)
42         ldw             0(%r25),%r20
43         ldw             0(%r24),%r31
44         subb            %r20,%r31,%r20
45         stw             %r20,0(%r26)
46
47 LDEF(7)
48         ldw             4(%r25),%r21
49         ldw             4(%r24),%r19
50         subb            %r21,%r19,%r21
51         stw             %r21,4(%r26)
52
53 LDEF(6)
54         ldw             8(%r25),%r20
55         ldw             8(%r24),%r31
56         subb            %r20,%r31,%r20
57         stw             %r20,8(%r26)
58
59 LDEF(5)
60         ldw             12(%r25),%r21
61         ldw             12(%r24),%r19
62         subb            %r21,%r19,%r21
63         stw             %r21,12(%r26)
64
65 LDEF(4)
66         ldw             16(%r25),%r20
67         ldw             16(%r24),%r31
68         subb            %r20,%r31,%r20
69         stw             %r20,16(%r26)
70
71 LDEF(3)
72         ldw             20(%r25),%r21
73         ldw             20(%r24),%r19
74         subb            %r21,%r19,%r21
75         stw             %r21,20(%r26)
76
77 LDEF(2)
78         ldw             24(%r25),%r20
79         ldw             24(%r24),%r31
80         subb            %r20,%r31,%r20
81         stw             %r20,24(%r26)
82
83 LDEF(1)
84         ldw             28(%r25),%r21
85         ldo             32(%r25),%r25
86         ldw             28(%r24),%r19
87         subb            %r21,%r19,%r21
88         stw             %r21,28(%r26)
89         ldo             32(%r24),%r24
90         addib,>         -8,%r23,L(loop)
91         ldo             32(%r26),%r26
92
93         addc            %r0,%r0,%r28
94         bv              (%r2)
95         subi            1,%r28,%r28
96 EPILOGUE()