2006-01-07 Carlos O'Donell <carlos@systemhalted.org>
[glibc-ports.git] / sysdeps / hppa / hppa1.1 / addmul_1.s
bloba1fb083a83251837ccd74628ca14d6951de42d19
1 ;! HP-PA-1.1 __mpn_addmul_1 -- Multiply a limb vector with a limb and
2 ;! add the result to a second limb vector.
4 ;! Copyright (C) 1992, 1993, 1994 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,
21 ;! MA 02111-1307, USA.
24 ;! INPUT PARAMETERS
25 ;! res_ptr r26
26 ;! s1_ptr r25
27 ;! size r24
28 ;! s2_limb r23
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.
37 ;! There are some ideas described in mul_1.s that applies to this code too.
39 .text
40 .export __mpn_addmul_1
41 __mpn_addmul_1:
42 .proc
43 .callinfo frame=64,no_calls
44 .entry
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),%r20 ;! least significant limb in product
57 ldw -16(%r30),%r28
59 fstds %fr8,-16(%r30)
60 addib,= -1,%r24,L$end
61 ldw -12(%r30),%r1
63 ;! Main loop
64 L$loop:
65 ldws 0(%r26),%r29
66 fldws,ma 4(%r25),%fr5
67 add %r29,%r20,%r20
68 stws,ma %r20,4(%r26)
69 addc %r28,%r1,%r20
70 xmpyu %fr4,%fr5,%fr6
71 ldw -16(%r30),%r28
72 fstds %fr6,-16(%r30)
73 addc %r0,%r28,%r28
74 addib,<> -1,%r24,L$loop
75 ldw -12(%r30),%r1
77 L$end:
78 ldw 0(%r26),%r29
79 add %r29,%r20,%r20
80 stws,ma %r20,4(%r26)
81 addc %r28,%r1,%r20
82 ldw -16(%r30),%r28
83 ldws 0(%r26),%r29
84 addc %r0,%r28,%r28
85 add %r29,%r20,%r20
86 stws,ma %r20,4(%r26)
87 addc %r0,%r28,%r28
88 bv 0(%r2)
89 ldo -64(%r30),%r30
91 L$just_one_limb:
92 xmpyu %fr4,%fr5,%fr6
93 ldw 0(%r26),%r29
94 fstds %fr6,-16(%r30)
95 ldw -12(%r30),%r1
96 ldw -16(%r30),%r28
97 add %r29,%r1,%r20
98 stw %r20,0(%r26)
99 addc %r0,%r28,%r28
100 bv 0(%r2)
101 ldo -64(%r30),%r30
103 .exit
104 .procend