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