OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [config/] [sparc/] [lb1spl.asm] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
/* This is an assembly language implementation of mulsi3, divsi3, and modsi3
2
   for the sparclite processor.
3
 
4
   These routines are all from the SPARClite User's Guide, slightly edited
5
   to match the desired calling convention, and also to optimize them.  */
6
 
7
#ifdef L_udivsi3
8
.text
9
        .align 4
10
        .global .udiv
11
        .proc   04
12
.udiv:
13
        wr      %g0,%g0,%y      ! Not a delayed write for sparclite
14
        tst     %g0
15
        divscc  %o0,%o1,%g1
16
        divscc  %g1,%o1,%g1
17
        divscc  %g1,%o1,%g1
18
        divscc  %g1,%o1,%g1
19
        divscc  %g1,%o1,%g1
20
        divscc  %g1,%o1,%g1
21
        divscc  %g1,%o1,%g1
22
        divscc  %g1,%o1,%g1
23
        divscc  %g1,%o1,%g1
24
        divscc  %g1,%o1,%g1
25
        divscc  %g1,%o1,%g1
26
        divscc  %g1,%o1,%g1
27
        divscc  %g1,%o1,%g1
28
        divscc  %g1,%o1,%g1
29
        divscc  %g1,%o1,%g1
30
        divscc  %g1,%o1,%g1
31
        divscc  %g1,%o1,%g1
32
        divscc  %g1,%o1,%g1
33
        divscc  %g1,%o1,%g1
34
        divscc  %g1,%o1,%g1
35
        divscc  %g1,%o1,%g1
36
        divscc  %g1,%o1,%g1
37
        divscc  %g1,%o1,%g1
38
        divscc  %g1,%o1,%g1
39
        divscc  %g1,%o1,%g1
40
        divscc  %g1,%o1,%g1
41
        divscc  %g1,%o1,%g1
42
        divscc  %g1,%o1,%g1
43
        divscc  %g1,%o1,%g1
44
        divscc  %g1,%o1,%g1
45
        divscc  %g1,%o1,%g1
46
        retl
47
        divscc  %g1,%o1,%o0
48
#endif
49
 
50
#ifdef L_umodsi3
51
.text
52
        .align 4
53
        .global .urem
54
        .proc   04
55
.urem:
56
        wr      %g0,%g0,%y      ! Not a delayed write for sparclite
57
        tst     %g0
58
        divscc  %o0,%o1,%g1
59
        divscc  %g1,%o1,%g1
60
        divscc  %g1,%o1,%g1
61
        divscc  %g1,%o1,%g1
62
        divscc  %g1,%o1,%g1
63
        divscc  %g1,%o1,%g1
64
        divscc  %g1,%o1,%g1
65
        divscc  %g1,%o1,%g1
66
        divscc  %g1,%o1,%g1
67
        divscc  %g1,%o1,%g1
68
        divscc  %g1,%o1,%g1
69
        divscc  %g1,%o1,%g1
70
        divscc  %g1,%o1,%g1
71
        divscc  %g1,%o1,%g1
72
        divscc  %g1,%o1,%g1
73
        divscc  %g1,%o1,%g1
74
        divscc  %g1,%o1,%g1
75
        divscc  %g1,%o1,%g1
76
        divscc  %g1,%o1,%g1
77
        divscc  %g1,%o1,%g1
78
        divscc  %g1,%o1,%g1
79
        divscc  %g1,%o1,%g1
80
        divscc  %g1,%o1,%g1
81
        divscc  %g1,%o1,%g1
82
        divscc  %g1,%o1,%g1
83
        divscc  %g1,%o1,%g1
84
        divscc  %g1,%o1,%g1
85
        divscc  %g1,%o1,%g1
86
        divscc  %g1,%o1,%g1
87
        divscc  %g1,%o1,%g1
88
        divscc  %g1,%o1,%g1
89
        divscc  %g1,%o1,%g1
90
        bl 1f
91
        rd      %y,%o0
92
        retl
93
        nop
94
1:      retl
95
        add     %o0,%o1,%o0
96
#endif
97
 
98
#ifdef L_divsi3
99
.text
100
        .align 4
101
        .global .div
102
        .proc   04
103
! ??? This routine could be made faster if was optimized, and if it was
104
! rewritten to only calculate the quotient.
105
.div:
106
        wr      %g0,%g0,%y      ! Not a delayed write for sparclite
107
        mov     %o1,%o4
108
        tst     %o1
109
        bl,a    1f
110
        sub     %g0,%o4,%o4
111
1:      tst     %o0
112
        bl,a    2f
113
        mov     -1,%y
114
2:      divscc  %o0,%o4,%g1
115
        divscc  %g1,%o4,%g1
116
        divscc  %g1,%o4,%g1
117
        divscc  %g1,%o4,%g1
118
        divscc  %g1,%o4,%g1
119
        divscc  %g1,%o4,%g1
120
        divscc  %g1,%o4,%g1
121
        divscc  %g1,%o4,%g1
122
        divscc  %g1,%o4,%g1
123
        divscc  %g1,%o4,%g1
124
        divscc  %g1,%o4,%g1
125
        divscc  %g1,%o4,%g1
126
        divscc  %g1,%o4,%g1
127
        divscc  %g1,%o4,%g1
128
        divscc  %g1,%o4,%g1
129
        divscc  %g1,%o4,%g1
130
        divscc  %g1,%o4,%g1
131
        divscc  %g1,%o4,%g1
132
        divscc  %g1,%o4,%g1
133
        divscc  %g1,%o4,%g1
134
        divscc  %g1,%o4,%g1
135
        divscc  %g1,%o4,%g1
136
        divscc  %g1,%o4,%g1
137
        divscc  %g1,%o4,%g1
138
        divscc  %g1,%o4,%g1
139
        divscc  %g1,%o4,%g1
140
        divscc  %g1,%o4,%g1
141
        divscc  %g1,%o4,%g1
142
        divscc  %g1,%o4,%g1
143
        divscc  %g1,%o4,%g1
144
        divscc  %g1,%o4,%g1
145
        divscc  %g1,%o4,%g1
146
        be      6f
147
        mov     %y,%o3
148
        bg      4f
149
        addcc   %o3,%o4,%g0
150
        be,a    6f
151
        mov     %g0,%o3
152
        tst     %o0
153
        bl      5f
154
        tst     %g1
155
        ba      5f
156
        add     %o3,%o4,%o3
157
4:      subcc   %o3,%o4,%g0
158
        be,a    6f
159
        mov     %g0,%o3
160
        tst     %o0
161
        bge     5f
162
        tst     %g1
163
        sub     %o3,%o4,%o3
164
5:      bl,a    6f
165
        add     %g1,1,%g1
166
6:      tst     %o1
167
        bl,a    7f
168
        sub     %g0,%g1,%g1
169
7:      retl
170
        mov     %g1,%o0         ! Quotient is in %g1.
171
#endif
172
 
173
#ifdef L_modsi3
174
.text
175
        .align 4
176
        .global .rem
177
        .proc   04
178
! ??? This routine could be made faster if was optimized, and if it was
179
! rewritten to only calculate the remainder.
180
.rem:
181
        wr      %g0,%g0,%y      ! Not a delayed write for sparclite
182
        mov     %o1,%o4
183
        tst     %o1
184
        bl,a    1f
185
        sub     %g0,%o4,%o4
186
1:      tst     %o0
187
        bl,a    2f
188
        mov     -1,%y
189
2:      divscc  %o0,%o4,%g1
190
        divscc  %g1,%o4,%g1
191
        divscc  %g1,%o4,%g1
192
        divscc  %g1,%o4,%g1
193
        divscc  %g1,%o4,%g1
194
        divscc  %g1,%o4,%g1
195
        divscc  %g1,%o4,%g1
196
        divscc  %g1,%o4,%g1
197
        divscc  %g1,%o4,%g1
198
        divscc  %g1,%o4,%g1
199
        divscc  %g1,%o4,%g1
200
        divscc  %g1,%o4,%g1
201
        divscc  %g1,%o4,%g1
202
        divscc  %g1,%o4,%g1
203
        divscc  %g1,%o4,%g1
204
        divscc  %g1,%o4,%g1
205
        divscc  %g1,%o4,%g1
206
        divscc  %g1,%o4,%g1
207
        divscc  %g1,%o4,%g1
208
        divscc  %g1,%o4,%g1
209
        divscc  %g1,%o4,%g1
210
        divscc  %g1,%o4,%g1
211
        divscc  %g1,%o4,%g1
212
        divscc  %g1,%o4,%g1
213
        divscc  %g1,%o4,%g1
214
        divscc  %g1,%o4,%g1
215
        divscc  %g1,%o4,%g1
216
        divscc  %g1,%o4,%g1
217
        divscc  %g1,%o4,%g1
218
        divscc  %g1,%o4,%g1
219
        divscc  %g1,%o4,%g1
220
        divscc  %g1,%o4,%g1
221
        be      6f
222
        mov     %y,%o3
223
        bg      4f
224
        addcc   %o3,%o4,%g0
225
        be,a    6f
226
        mov     %g0,%o3
227
        tst     %o0
228
        bl      5f
229
        tst     %g1
230
        ba      5f
231
        add     %o3,%o4,%o3
232
4:      subcc   %o3,%o4,%g0
233
        be,a    6f
234
        mov     %g0,%o3
235
        tst     %o0
236
        bge     5f
237
        tst     %g1
238
        sub     %o3,%o4,%o3
239
5:      bl,a    6f
240
        add     %g1,1,%g1
241
6:      tst     %o1
242
        bl,a    7f
243
        sub     %g0,%g1,%g1
244
7:      retl
245
        mov     %o3,%o0         ! Remainder is in %o3.
246
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.