1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
|
$NetBSD: patch-aq,v 1.1 2004/01/13 23:40:25 jschauma Exp $
--- ./mzscheme/src/gmp/gmplonglong.h.orig 2001-06-26 12:46:25.000000000 -0400
+++ ./mzscheme/src/gmp/gmplonglong.h 2004-01-13 18:20:47.000000000 -0500
@@ -231,19 +231,19 @@
#define UMUL_TIME 5
#else
#define umul_ppmm(xh, xl, a, b) \
- __asm__ ("%@ Inlined umul_ppmm
- mov %|r0, %2, lsr #16
- mov %|r2, %3, lsr #16
- bic %|r1, %2, %|r0, lsl #16
- bic %|r2, %3, %|r2, lsl #16
- mul %1, %|r1, %|r2
- mul %|r2, %|r0, %|r2
- mul %|r1, %0, %|r1
- mul %0, %|r0, %0
- adds %|r1, %|r2, %|r1
- addcs %0, %0, #65536
- adds %1, %1, %|r1, lsl #16
- adc %0, %0, %|r1, lsr #16" \
+ __asm__ ("%@ Inlined umul_ppmm\n"
+" mov %|r0, %2, lsr #16\n"
+" mov %|r2, %3, lsr #16\n"
+" bic %|r1, %2, %|r0, lsl #16\n"
+" bic %|r2, %3, %|r2, lsl #16\n"
+" mul %1, %|r1, %|r2\n"
+" mul %|r2, %|r0, %|r2\n"
+" mul %|r1, %0, %|r1\n"
+" mul %0, %|r0, %0\n"
+" adds %|r1, %|r2, %|r1\n"
+" addcs %0, %0, #65536\n"
+" adds %1, %1, %|r1, lsl #16\n"
+" adc %0, %0, %|r1, lsr #16" \
: "=&r" (xh), "=r" (xl) \
: "r" (a), "r" (b) \
: "r0", "r1", "r2")
@@ -360,22 +360,22 @@
do { \
USItype __tmp; \
__asm__ ( \
- "ldi 1,%0
- extru,= %1,15,16,%%r0 ; Bits 31..16 zero?
- extru,tr %1,15,16,%1 ; No. Shift down, skip add.
- ldo 16(%0),%0 ; Yes. Perform add.
- extru,= %1,23,8,%%r0 ; Bits 15..8 zero?
- extru,tr %1,23,8,%1 ; No. Shift down, skip add.
- ldo 8(%0),%0 ; Yes. Perform add.
- extru,= %1,27,4,%%r0 ; Bits 7..4 zero?
- extru,tr %1,27,4,%1 ; No. Shift down, skip add.
- ldo 4(%0),%0 ; Yes. Perform add.
- extru,= %1,29,2,%%r0 ; Bits 3..2 zero?
- extru,tr %1,29,2,%1 ; No. Shift down, skip add.
- ldo 2(%0),%0 ; Yes. Perform add.
- extru %1,30,1,%1 ; Extract bit 1.
- sub %0,%1,%0 ; Subtract it.
- " : "=r" (count), "=r" (__tmp) : "1" (x)); \
+ "ldi 1,%0\n"
+" extru,= %1,15,16,%%r0 ; Bits 31..16 zero?\n"
+" extru,tr %1,15,16,%1 ; No. Shift down, skip add.\n"
+" ldo 16(%0),%0 ; Yes. Perform add.\n"
+" extru,= %1,23,8,%%r0 ; Bits 15..8 zero?\n"
+" extru,tr %1,23,8,%1 ; No. Shift down, skip add.\n"
+" ldo 8(%0),%0 ; Yes. Perform add.\n"
+" extru,= %1,27,4,%%r0 ; Bits 7..4 zero?\n"
+" extru,tr %1,27,4,%1 ; No. Shift down, skip add.\n"
+" ldo 4(%0),%0 ; Yes. Perform add.\n"
+" extru,= %1,29,2,%%r0 ; Bits 3..2 zero?\n"
+" extru,tr %1,29,2,%1 ; No. Shift down, skip add.\n"
+" ldo 2(%0),%0 ; Yes. Perform add.\n"
+" extru %1,30,1,%1 ; Extract bit 1.\n"
+" sub %0,%1,%0 ; Subtract it.\n"
+ : "=r" (count), "=r" (__tmp) : "1" (x)); \
} while (0)
#endif /* hppa */
@@ -529,28 +529,28 @@
#else /* for other 68k family members use 16x16->32 multiplication */
#define umul_ppmm(xh, xl, a, b) \
do { USItype __umul_tmp1, __umul_tmp2; \
- __asm__ ("| Inlined umul_ppmm
- move%.l %5,%3
- move%.l %2,%0
- move%.w %3,%1
- swap %3
- swap %0
- mulu%.w %2,%1
- mulu%.w %3,%0
- mulu%.w %2,%3
- swap %2
- mulu%.w %5,%2
- add%.l %3,%2
- jcc 1f
- add%.l %#0x10000,%0
-1: move%.l %2,%3
- clr%.w %2
- swap %2
- swap %3
- clr%.w %3
- add%.l %3,%1
- addx%.l %2,%0
- | End inlined umul_ppmm" \
+ __asm__ ("| Inlined umul_ppmm\n"
+" move%.l %5,%3\n"
+" move%.l %2,%0\n"
+" move%.w %3,%1\n"
+" swap %3\n"
+" swap %0\n"
+" mulu%.w %2,%1\n"
+" mulu%.w %3,%0\n"
+" mulu%.w %2,%3\n"
+" swap %2\n"
+" mulu%.w %5,%2\n"
+" add%.l %3,%2\n"
+" jcc 1f\n"
+" add%.l %#0x10000,%0\n"
+"1: move%.l %2,%3\n"
+" clr%.w %2\n"
+" swap %2\n"
+" swap %3\n"
+" clr%.w %3\n"
+" add%.l %3,%1\n"
+" addx%.l %2,%0\n"
+" | End inlined umul_ppmm" \
: "=&d" ((USItype)(xh)), "=&d" ((USItype)(xl)), \
"=d" (__umul_tmp1), "=&d" (__umul_tmp2) \
: "%2" ((USItype)(a)), "d" ((USItype)(b))); \
@@ -827,26 +827,26 @@
"1" ((USItype)(al)), "r" ((USItype)(bl)))
#define smul_ppmm(ph, pl, m0, m1) \
__asm__ ( \
- "s r2,r2
- mts r10,%2
- m r2,%3
- m r2,%3
- m r2,%3
- m r2,%3
- m r2,%3
- m r2,%3
- m r2,%3
- m r2,%3
- m r2,%3
- m r2,%3
- m r2,%3
- m r2,%3
- m r2,%3
- m r2,%3
- m r2,%3
- m r2,%3
- cas %0,r2,r0
- mfs r10,%1" \
+ "s r2,r2\n"
+" mts r10,%2\n"
+" m r2,%3\n"
+" m r2,%3\n"
+" m r2,%3\n"
+" m r2,%3\n"
+" m r2,%3\n"
+" m r2,%3\n"
+" m r2,%3\n"
+" m r2,%3\n"
+" m r2,%3\n"
+" m r2,%3\n"
+" m r2,%3\n"
+" m r2,%3\n"
+" m r2,%3\n"
+" m r2,%3\n"
+" m r2,%3\n"
+" m r2,%3\n"
+" cas %0,r2,r0\n"
+" mfs r10,%1" \
: "=r" ((USItype)(ph)), "=r" ((USItype)(pl)) \
: "%r" ((USItype)(m0)), "r" ((USItype)(m1)) \
: "r2"); \
@@ -936,45 +936,45 @@
__asm__ ("umul %2,%3,%1;rd %%y,%0" : "=r" (w1), "=r" (w0) : "r" (u), "r" (v))
#define UMUL_TIME 5
#define udiv_qrnnd(q, r, n1, n0, d) \
- __asm__ ("! Inlined udiv_qrnnd
- wr %%g0,%2,%%y ! Not a delayed write for sparclite
- tst %%g0
- divscc %3,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%0
- rd %%y,%1
- bl,a 1f
- add %1,%4,%1
-1: ! End of inline udiv_qrnnd" \
+ __asm__ ("! Inlined udiv_qrnnd\n"
+" wr %%g0,%2,%%y ! Not a delayed write for sparclite\n"
+" tst %%g0\n"
+" divscc %3,%4,%%g1\n"
+" divscc %%g1,%4,%%g1\n"
+" divscc %%g1,%4,%%g1\n"
+" divscc %%g1,%4,%%g1\n"
+" divscc %%g1,%4,%%g1\n"
+" divscc %%g1,%4,%%g1\n"
+" divscc %%g1,%4,%%g1\n"
+" divscc %%g1,%4,%%g1\n"
+" divscc %%g1,%4,%%g1\n"
+" divscc %%g1,%4,%%g1\n"
+" divscc %%g1,%4,%%g1\n"
+" divscc %%g1,%4,%%g1\n"
+" divscc %%g1,%4,%%g1\n"
+" divscc %%g1,%4,%%g1\n"
+" divscc %%g1,%4,%%g1\n"
+" divscc %%g1,%4,%%g1\n"
+" divscc %%g1,%4,%%g1\n"
+" divscc %%g1,%4,%%g1\n"
+" divscc %%g1,%4,%%g1\n"
+" divscc %%g1,%4,%%g1\n"
+" divscc %%g1,%4,%%g1\n"
+" divscc %%g1,%4,%%g1\n"
+" divscc %%g1,%4,%%g1\n"
+" divscc %%g1,%4,%%g1\n"
+" divscc %%g1,%4,%%g1\n"
+" divscc %%g1,%4,%%g1\n"
+" divscc %%g1,%4,%%g1\n"
+" divscc %%g1,%4,%%g1\n"
+" divscc %%g1,%4,%%g1\n"
+" divscc %%g1,%4,%%g1\n"
+" divscc %%g1,%4,%%g1\n"
+" divscc %%g1,%4,%0\n"
+" rd %%y,%1\n"
+" bl,a 1f\n"
+" add %1,%4,%1\n"
+"1: ! End of inline udiv_qrnnd" \
: "=r" (q), "=r" (r) : "r" (n1), "r" (n0), "rI" (d)
: "%g1" __AND_CLOBBER_CC)
#define UDIV_TIME 37
@@ -989,46 +989,46 @@
/* Default to sparc v7 versions of umul_ppmm and udiv_qrnnd. */
#ifndef umul_ppmm
#define umul_ppmm(w1, w0, u, v) \
- __asm__ ("! Inlined umul_ppmm
- wr %%g0,%2,%%y ! SPARC has 0-3 delay insn after a wr
- sra %3,31,%%g2 ! Don't move this insn
- and %2,%%g2,%%g2 ! Don't move this insn
- andcc %%g0,0,%%g1 ! Don't move this insn
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,0,%%g1
- add %%g1,%%g2,%0
- rd %%y,%1" \
+ __asm__ ("! Inlined umul_ppmm\n"
+" wr %%g0,%2,%%y ! SPARC has 0-3 delay insn after a wr\n"
+" sra %3,31,%%g2 ! Don't move this insn\n"
+" and %2,%%g2,%%g2 ! Don't move this insn\n"
+" andcc %%g0,0,%%g1 ! Don't move this insn\n"
+" mulscc %%g1,%3,%%g1\n"
+" mulscc %%g1,%3,%%g1\n"
+" mulscc %%g1,%3,%%g1\n"
+" mulscc %%g1,%3,%%g1\n"
+" mulscc %%g1,%3,%%g1\n"
+" mulscc %%g1,%3,%%g1\n"
+" mulscc %%g1,%3,%%g1\n"
+" mulscc %%g1,%3,%%g1\n"
+" mulscc %%g1,%3,%%g1\n"
+" mulscc %%g1,%3,%%g1\n"
+" mulscc %%g1,%3,%%g1\n"
+" mulscc %%g1,%3,%%g1\n"
+" mulscc %%g1,%3,%%g1\n"
+" mulscc %%g1,%3,%%g1\n"
+" mulscc %%g1,%3,%%g1\n"
+" mulscc %%g1,%3,%%g1\n"
+" mulscc %%g1,%3,%%g1\n"
+" mulscc %%g1,%3,%%g1\n"
+" mulscc %%g1,%3,%%g1\n"
+" mulscc %%g1,%3,%%g1\n"
+" mulscc %%g1,%3,%%g1\n"
+" mulscc %%g1,%3,%%g1\n"
+" mulscc %%g1,%3,%%g1\n"
+" mulscc %%g1,%3,%%g1\n"
+" mulscc %%g1,%3,%%g1\n"
+" mulscc %%g1,%3,%%g1\n"
+" mulscc %%g1,%3,%%g1\n"
+" mulscc %%g1,%3,%%g1\n"
+" mulscc %%g1,%3,%%g1\n"
+" mulscc %%g1,%3,%%g1\n"
+" mulscc %%g1,%3,%%g1\n"
+" mulscc %%g1,%3,%%g1\n"
+" mulscc %%g1,0,%%g1\n"
+" add %%g1,%%g2,%0\n"
+" rd %%y,%1" \
: "=r" (w1), "=r" (w0) : "%rI" (u), "r" (v) \
: "%g1", "%g2" __AND_CLOBBER_CC)
#define UMUL_TIME 39 /* 39 instructions */
|