lshiftc.asm revision 1.1.1.1 1 1.1 mrg dnl SPARC v9 mpn_lshiftc
2 1.1 mrg
3 1.1 mrg dnl Copyright 1996, 2000, 2001, 2002, 2003, 2010 Free Software Foundation,
4 1.1 mrg dnl Inc.
5 1.1 mrg
6 1.1 mrg dnl This file is part of the GNU MP Library.
7 1.1 mrg
8 1.1 mrg dnl The GNU MP Library is free software; you can redistribute it and/or modify
9 1.1 mrg dnl it under the terms of the GNU Lesser General Public License as published
10 1.1 mrg dnl by the Free Software Foundation; either version 3 of the License, or (at
11 1.1 mrg dnl your option) any later version.
12 1.1 mrg
13 1.1 mrg dnl The GNU MP Library is distributed in the hope that it will be useful, but
14 1.1 mrg dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 1.1 mrg dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
16 1.1 mrg dnl License for more details.
17 1.1 mrg
18 1.1 mrg dnl You should have received a copy of the GNU Lesser General Public License
19 1.1 mrg dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
20 1.1 mrg
21 1.1 mrg
22 1.1 mrg include(`../config.m4')
23 1.1 mrg
24 1.1 mrg C cycles/limb
25 1.1 mrg C UltraSPARC 1&2: ?
26 1.1 mrg C UltraSPARC 3: 2.67
27 1.1 mrg
28 1.1 mrg C INPUT PARAMETERS
29 1.1 mrg define(`rp', `%i0')
30 1.1 mrg define(`up', `%i1')
31 1.1 mrg define(`n', `%i2')
32 1.1 mrg define(`cnt',`%i3')
33 1.1 mrg
34 1.1 mrg define(`u0', `%l0')
35 1.1 mrg define(`u1', `%l2')
36 1.1 mrg define(`u2', `%l4')
37 1.1 mrg define(`u3', `%l6')
38 1.1 mrg
39 1.1 mrg define(`tnc',`%i4')
40 1.1 mrg
41 1.1 mrg define(`fanop',`fitod %f0,%f2') dnl A quasi nop running in the FA pipe
42 1.1 mrg
43 1.1 mrg ASM_START()
44 1.1 mrg REGISTER(%g2,#scratch)
45 1.1 mrg REGISTER(%g3,#scratch)
46 1.1 mrg PROLOGUE(mpn_lshiftc)
47 1.1 mrg save %sp,-160,%sp
48 1.1 mrg
49 1.1 mrg sllx n,3,%g1
50 1.1 mrg sub %g0,cnt,tnc C negate shift count
51 1.1 mrg add up,%g1,up C make %o1 point at end of src
52 1.1 mrg add rp,%g1,rp C make %o0 point at end of res
53 1.1 mrg ldx [up-8],u3 C load first limb
54 1.1 mrg subcc n,5,n
55 1.1 mrg srlx u3,tnc,%i5 C compute function result
56 1.1 mrg bl,pn %xcc,.Lend1234
57 1.1 mrg sllx u3,cnt,%g3
58 1.1 mrg
59 1.1 mrg subcc n,4,n
60 1.1 mrg ldx [up-16],u0
61 1.1 mrg ldx [up-24],u1
62 1.1 mrg add up,-32,up
63 1.1 mrg ldx [up-0],u2
64 1.1 mrg ldx [up-8],u3
65 1.1 mrg srlx u0,tnc,%g2
66 1.1 mrg bl,pn %xcc,.Lend5678
67 1.1 mrg not %g3, %g3
68 1.1 mrg
69 1.1 mrg b,a .Loop
70 1.1 mrg ALIGN(16)
71 1.1 mrg .Loop:
72 1.1 mrg sllx u0,cnt,%g1
73 1.1 mrg andn %g3,%g2,%g3
74 1.1 mrg ldx [up-16],u0
75 1.1 mrg fanop
76 1.1 mrg C --
77 1.1 mrg srlx u1,tnc,%g2
78 1.1 mrg subcc n,4,n
79 1.1 mrg stx %g3,[rp-8]
80 1.1 mrg not %g1, %g1
81 1.1 mrg C --
82 1.1 mrg sllx u1,cnt,%g3
83 1.1 mrg andn %g1,%g2,%g1
84 1.1 mrg ldx [up-24],u1
85 1.1 mrg fanop
86 1.1 mrg C --
87 1.1 mrg srlx u2,tnc,%g2
88 1.1 mrg stx %g1,[rp-16]
89 1.1 mrg add up,-32,up
90 1.1 mrg not %g3, %g3
91 1.1 mrg C --
92 1.1 mrg sllx u2,cnt,%g1
93 1.1 mrg andn %g3,%g2,%g3
94 1.1 mrg ldx [up-0],u2
95 1.1 mrg fanop
96 1.1 mrg C --
97 1.1 mrg srlx u3,tnc,%g2
98 1.1 mrg stx %g3,[rp-24]
99 1.1 mrg add rp,-32,rp
100 1.1 mrg not %g1, %g1
101 1.1 mrg C --
102 1.1 mrg sllx u3,cnt,%g3
103 1.1 mrg andn %g1,%g2,%g1
104 1.1 mrg ldx [up-8],u3
105 1.1 mrg fanop
106 1.1 mrg C --
107 1.1 mrg srlx u0,tnc,%g2
108 1.1 mrg stx %g1,[rp-0]
109 1.1 mrg bge,pt %xcc,.Loop
110 1.1 mrg not %g3, %g3
111 1.1 mrg C --
112 1.1 mrg .Lend5678:
113 1.1 mrg sllx u0,cnt,%g1
114 1.1 mrg andn %g3,%g2,%g3
115 1.1 mrg srlx u1,tnc,%g2
116 1.1 mrg stx %g3,[rp-8]
117 1.1 mrg not %g1, %g1
118 1.1 mrg sllx u1,cnt,%g3
119 1.1 mrg andn %g1,%g2,%g1
120 1.1 mrg srlx u2,tnc,%g2
121 1.1 mrg stx %g1,[rp-16]
122 1.1 mrg not %g3, %g3
123 1.1 mrg sllx u2,cnt,%g1
124 1.1 mrg andn %g3,%g2,%g3
125 1.1 mrg srlx u3,tnc,%g2
126 1.1 mrg stx %g3,[rp-24]
127 1.1 mrg add rp,-32,rp
128 1.1 mrg not %g1, %g1
129 1.1 mrg sllx u3,cnt,%g3 C carry...
130 1.1 mrg andn %g1,%g2,%g1
131 1.1 mrg stx %g1,[rp-0]
132 1.1 mrg
133 1.1 mrg .Lend1234:
134 1.1 mrg addcc n,4,n
135 1.1 mrg bz,pn %xcc,.Lret
136 1.1 mrg fanop
137 1.1 mrg .Loop0:
138 1.1 mrg add rp,-8,rp
139 1.1 mrg subcc n,1,n
140 1.1 mrg ldx [up-16],u3
141 1.1 mrg add up,-8,up
142 1.1 mrg srlx u3,tnc,%g2
143 1.1 mrg not %g3, %g3
144 1.1 mrg andn %g3,%g2,%g3
145 1.1 mrg stx %g3,[rp]
146 1.1 mrg sllx u3,cnt,%g3
147 1.1 mrg bnz,pt %xcc,.Loop0
148 1.1 mrg fanop
149 1.1 mrg .Lret:
150 1.1 mrg not %g3, %g3
151 1.1 mrg stx %g3,[rp-8]
152 1.1 mrg mov %i5,%i0
153 1.1 mrg ret
154 1.1 mrg restore
155 1.1 mrg EPILOGUE()
156