Annotation of OpenXM_contrib/gmp/mpn/pa32/hppa1_1/submul_1.asm, Revision 1.1.1.1
1.1 ohara 1: dnl HP-PA 1.1 mpn_submul_1 -- Multiply a limb vector with a limb and subtract
2: dnl the result from a second limb vector.
3:
4: dnl Copyright 1992, 1993, 1994, 2000, 2001, 2002 Free Software Foundation,
5: dnl Inc.
6:
7: dnl This file is part of the GNU MP Library.
8:
9: dnl The GNU MP Library is free software; you can redistribute it and/or modify
10: dnl it under the terms of the GNU Lesser General Public License as published
11: dnl by the Free Software Foundation; either version 2.1 of the License, or (at
12: dnl your option) any later version.
13:
14: dnl The GNU MP Library is distributed in the hope that it will be useful, but
15: dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16: dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17: dnl License for more details.
18:
19: dnl You should have received a copy of the GNU Lesser General Public License
20: dnl along with the GNU MP Library; see the file COPYING.LIB. If not, write to
21: dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
22: dnl MA 02111-1307, USA.
23:
24: include(`../config.m4')
25:
26: C INPUT PARAMETERS
27: C res_ptr r26
28: C s1_ptr r25
29: C size r24
30: C s2_limb r23
31:
32: C This runs at 12 cycles/limb on a PA7000. With the used instructions, it can
33: C not become faster due to data cache contention after a store. On the PA7100
34: C it runs at 11 cycles/limb.
35:
36: C There are some ideas described in mul_1.asm that applies to this code too.
37:
38: C It seems possible to make this run as fast as mpn_addmul_1, if we use
39: C sub,>>= %r29,%r19,%r22
40: C addi 1,%r28,%r28
41: C but that requires reworking the hairy software pipeline...
42:
43: ASM_START()
44: PROLOGUE(mpn_submul_1)
45: C .callinfo frame=64,no_calls
46:
47: ldo 64(%r30),%r30
48: fldws,ma 4(%r25),%fr5
49: stw %r23,-16(%r30) C move s2_limb ...
50: addib,= -1,%r24,L(just_one_limb)
51: fldws -16(%r30),%fr4 C ... into fr4
52: add %r0,%r0,%r0 C clear carry
53: xmpyu %fr4,%fr5,%fr6
54: fldws,ma 4(%r25),%fr7
55: fstds %fr6,-16(%r30)
56: xmpyu %fr4,%fr7,%fr8
57: ldw -12(%r30),%r19 C least significant limb in product
58: ldw -16(%r30),%r28
59:
60: fstds %fr8,-16(%r30)
61: addib,= -1,%r24,L(end)
62: ldw -12(%r30),%r1
63:
64: C Main loop
65: .label L(loop)
66: ldws 0(%r26),%r29
67: fldws,ma 4(%r25),%fr5
68: sub %r29,%r19,%r22
69: add %r22,%r19,%r0
70: stws,ma %r22,4(%r26)
71: addc %r28,%r1,%r19
72: xmpyu %fr4,%fr5,%fr6
73: ldw -16(%r30),%r28
74: fstds %fr6,-16(%r30)
75: addc %r0,%r28,%r28
76: addib,<> -1,%r24,L(loop)
77: ldw -12(%r30),%r1
78:
79: .label L(end)
80: ldw 0(%r26),%r29
81: sub %r29,%r19,%r22
82: add %r22,%r19,%r0
83: stws,ma %r22,4(%r26)
84: addc %r28,%r1,%r19
85: ldw -16(%r30),%r28
86: ldws 0(%r26),%r29
87: addc %r0,%r28,%r28
88: sub %r29,%r19,%r22
89: add %r22,%r19,%r0
90: stws,ma %r22,4(%r26)
91: addc %r0,%r28,%r28
92: bv 0(%r2)
93: ldo -64(%r30),%r30
94:
95: .label L(just_one_limb)
96: xmpyu %fr4,%fr5,%fr6
97: ldw 0(%r26),%r29
98: fstds %fr6,-16(%r30)
99: ldw -12(%r30),%r1
100: ldw -16(%r30),%r28
101: sub %r29,%r1,%r22
102: add %r22,%r1,%r0
103: stw %r22,0(%r26)
104: addc %r0,%r28,%r28
105: bv 0(%r2)
106: ldo -64(%r30),%r30
107: EPILOGUE()
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>