Annotation of OpenXM/src/kan96xx/gmp-2.0.2-ssh-2/mpn/power/addmul_1.s, Revision 1.1.1.1
1.1 takayama 1: # IBM POWER __mpn_addmul_1 -- Multiply a limb vector with a limb and add
2: # the result to a second limb vector.
3:
4: # Copyright (C) 1992, 1994 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 Library General Public License as published by
10: # the Free Software Foundation; either version 2 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 Library General Public
16: # License for more details.
17:
18: # You should have received a copy of the GNU Library 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 r3
26: # s1_ptr r4
27: # size r5
28: # s2_limb r6
29:
30: # The RS/6000 has no unsigned 32x32->64 bit multiplication instruction. To
31: # obtain that operation, we have to use the 32x32->64 signed multiplication
32: # instruction, and add the appropriate compensation to the high limb of the
33: # result. We add the multiplicand if the multiplier has its most significant
34: # bit set, and we add the multiplier if the multiplicand has its most
35: # significant bit set. We need to preserve the carry flag between each
36: # iteration, so we have to compute the compensation carefully (the natural,
37: # srai+and doesn't work). Since the POWER architecture has a branch unit
38: # we can branch in zero cycles, so that's how we perform the additions.
39:
40: .toc
41: .csect .__mpn_addmul_1[PR]
42: .align 2
43: .globl __mpn_addmul_1
44: .globl .__mpn_addmul_1
45: .csect __mpn_addmul_1[DS]
46: __mpn_addmul_1:
47: .long .__mpn_addmul_1[PR], TOC[tc0], 0
48: .csect .__mpn_addmul_1[PR]
49: .__mpn_addmul_1:
50:
51: cal 3,-4(3)
52: l 0,0(4)
53: cmpi 0,6,0
54: mtctr 5
55: mul 9,0,6
56: srai 7,0,31
57: and 7,7,6
58: mfmq 8
59: cax 9,9,7
60: l 7,4(3)
61: a 8,8,7 # add res_limb
62: blt Lneg
63: Lpos: bdz Lend
64:
65: Lploop: lu 0,4(4)
66: stu 8,4(3)
67: cmpi 0,0,0
68: mul 10,0,6
69: mfmq 0
70: ae 8,0,9 # low limb + old_cy_limb + old cy
71: l 7,4(3)
72: aze 10,10 # propagate cy to new cy_limb
73: a 8,8,7 # add res_limb
74: bge Lp0
75: cax 10,10,6 # adjust high limb for negative limb from s1
76: Lp0: bdz Lend0
77: lu 0,4(4)
78: stu 8,4(3)
79: cmpi 0,0,0
80: mul 9,0,6
81: mfmq 0
82: ae 8,0,10
83: l 7,4(3)
84: aze 9,9
85: a 8,8,7
86: bge Lp1
87: cax 9,9,6 # adjust high limb for negative limb from s1
88: Lp1: bdn Lploop
89:
90: b Lend
91:
92: Lneg: cax 9,9,0
93: bdz Lend
94: Lnloop: lu 0,4(4)
95: stu 8,4(3)
96: cmpi 0,0,0
97: mul 10,0,6
98: mfmq 7
99: ae 8,7,9
100: l 7,4(3)
101: ae 10,10,0 # propagate cy to new cy_limb
102: a 8,8,7 # add res_limb
103: bge Ln0
104: cax 10,10,6 # adjust high limb for negative limb from s1
105: Ln0: bdz Lend0
106: lu 0,4(4)
107: stu 8,4(3)
108: cmpi 0,0,0
109: mul 9,0,6
110: mfmq 7
111: ae 8,7,10
112: l 7,4(3)
113: ae 9,9,0 # propagate cy to new cy_limb
114: a 8,8,7 # add res_limb
115: bge Ln1
116: cax 9,9,6 # adjust high limb for negative limb from s1
117: Ln1: bdn Lnloop
118: b Lend
119:
120: Lend0: cal 9,0(10)
121: Lend: st 8,4(3)
122: aze 3,9
123: br
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>