remove empty dir
[ghc-hetmet.git] / ghc / rts / gmp / mpn / hppa / hppa1_1 / addmul_1.s
1 ; HP-PA-1.1 __gmpn_addmul_1 -- Multiply a limb vector with a limb and
2 ; add the result to a second limb vector.
3
4 ; Copyright (C) 1992, 1993, 1994, 2000 Free Software Foundation, Inc.
5
6 ; This file is part of the GNU MP Library.
7
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.
12
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.
17
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,
21 ; MA 02111-1307, USA.
22
23
24 ; INPUT PARAMETERS
25 ; res_ptr       r26
26 ; s1_ptr        r25
27 ; size          r24
28 ; s2_limb       r23
29
30 ; This runs at 11 cycles/limb on a PA7000.  With the used instructions, it
31 ; can not become faster due to data cache contention after a store.  On the
32 ; PA7100 it runs at 10 cycles/limb, and that can not be improved either,
33 ; since only the xmpyu does not need the integer pipeline, so the only
34 ; dual-issue we will get are addc+xmpyu.  Unrolling could gain a cycle/limb
35 ; on the PA7100.
36
37 ; There are some ideas described in mul_1.s that applies to this code too.
38
39         .code
40         .export         __gmpn_addmul_1
41 __gmpn_addmul_1
42         .proc
43         .callinfo       frame=64,no_calls
44         .entry
45
46         ldo             64(%r30),%r30
47         fldws,ma        4(%r25),%fr5
48         stw             %r23,-16(%r30)          ; move s2_limb ...
49         addib,=         -1,%r24,L$just_one_limb
50          fldws          -16(%r30),%fr4          ; ... into fr4
51         add             %r0,%r0,%r0             ; clear carry
52         xmpyu           %fr4,%fr5,%fr6
53         fldws,ma        4(%r25),%fr7
54         fstds           %fr6,-16(%r30)
55         xmpyu           %fr4,%fr7,%fr8
56         ldw             -12(%r30),%r19          ; least significant limb in product
57         ldw             -16(%r30),%r28
58
59         fstds           %fr8,-16(%r30)
60         addib,=         -1,%r24,L$end
61          ldw            -12(%r30),%r1
62
63 ; Main loop
64 L$loop  ldws            0(%r26),%r29
65         fldws,ma        4(%r25),%fr5
66         add             %r29,%r19,%r19
67         stws,ma         %r19,4(%r26)
68         addc            %r28,%r1,%r19
69         xmpyu           %fr4,%fr5,%fr6
70         ldw             -16(%r30),%r28
71         fstds           %fr6,-16(%r30)
72         addc            %r0,%r28,%r28
73         addib,<>        -1,%r24,L$loop
74          ldw            -12(%r30),%r1
75
76 L$end   ldw             0(%r26),%r29
77         add             %r29,%r19,%r19
78         stws,ma         %r19,4(%r26)
79         addc            %r28,%r1,%r19
80         ldw             -16(%r30),%r28
81         ldws            0(%r26),%r29
82         addc            %r0,%r28,%r28
83         add             %r29,%r19,%r19
84         stws,ma         %r19,4(%r26)
85         addc            %r0,%r28,%r28
86         bv              0(%r2)
87          ldo            -64(%r30),%r30
88
89 L$just_one_limb
90         xmpyu           %fr4,%fr5,%fr6
91         ldw             0(%r26),%r29
92         fstds           %fr6,-16(%r30)
93         ldw             -12(%r30),%r1
94         ldw             -16(%r30),%r28
95         add             %r29,%r1,%r19
96         stw             %r19,0(%r26)
97         addc            %r0,%r28,%r28
98         bv              0(%r2)
99          ldo            -64(%r30),%r30
100
101         .exit
102         .procend