aboutsummaryrefslogtreecommitdiffstats
path: root/lib/mpi/longlong.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mpi/longlong.h')
-rw-r--r--lib/mpi/longlong.h44
1 files changed, 33 insertions, 11 deletions
diff --git a/lib/mpi/longlong.h b/lib/mpi/longlong.h
index b87487b40a8..29f98624ef9 100644
--- a/lib/mpi/longlong.h
+++ b/lib/mpi/longlong.h
@@ -1200,18 +1200,40 @@ do { \
1200 "r" ((USItype)(v)) \ 1200 "r" ((USItype)(v)) \
1201 : "%g1", "%g2" __AND_CLOBBER_CC) 1201 : "%g1", "%g2" __AND_CLOBBER_CC)
1202#define UMUL_TIME 39 /* 39 instructions */ 1202#define UMUL_TIME 39 /* 39 instructions */
1203#endif 1203/* It's quite necessary to add this much assembler for the sparc.
1204#ifndef udiv_qrnnd 1204 The default udiv_qrnnd (in C) is more than 10 times slower! */
1205#ifndef LONGLONG_STANDALONE
1206#define udiv_qrnnd(q, r, n1, n0, d) \ 1205#define udiv_qrnnd(q, r, n1, n0, d) \
1207do { USItype __r; \ 1206 __asm__ ("! Inlined udiv_qrnnd\n\t" \
1208 (q) = __udiv_qrnnd(&__r, (n1), (n0), (d)); \ 1207 "mov 32,%%g1\n\t" \
1209 (r) = __r; \ 1208 "subcc %1,%2,%%g0\n\t" \
1210} while (0) 1209 "1: bcs 5f\n\t" \
1211 extern USItype __udiv_qrnnd(); 1210 "addxcc %0,%0,%0 ! shift n1n0 and a q-bit in lsb\n\t" \
1212#define UDIV_TIME 140 1211 "sub %1,%2,%1 ! this kills msb of n\n\t" \
1213#endif /* LONGLONG_STANDALONE */ 1212 "addx %1,%1,%1 ! so this can't give carry\n\t" \
1214#endif /* udiv_qrnnd */ 1213 "subcc %%g1,1,%%g1\n\t" \
1214 "2: bne 1b\n\t" \
1215 "subcc %1,%2,%%g0\n\t" \
1216 "bcs 3f\n\t" \
1217 "addxcc %0,%0,%0 ! shift n1n0 and a q-bit in lsb\n\t" \
1218 "b 3f\n\t" \
1219 "sub %1,%2,%1 ! this kills msb of n\n\t" \
1220 "4: sub %1,%2,%1\n\t" \
1221 "5: addxcc %1,%1,%1\n\t" \
1222 "bcc 2b\n\t" \
1223 "subcc %%g1,1,%%g1\n\t" \
1224 "! Got carry from n. Subtract next step to cancel this carry.\n\t" \
1225 "bne 4b\n\t" \
1226 "addcc %0,%0,%0 ! shift n1n0 and a 0-bit in lsb\n\t" \
1227 "sub %1,%2,%1\n\t" \
1228 "3: xnor %0,0,%0\n\t" \
1229 "! End of inline udiv_qrnnd\n" \
1230 : "=&r" ((USItype)(q)), \
1231 "=&r" ((USItype)(r)) \
1232 : "r" ((USItype)(d)), \
1233 "1" ((USItype)(n1)), \
1234 "0" ((USItype)(n0)) : "%g1", "cc")
1235#define UDIV_TIME (3+7*32) /* 7 instructions/iteration. 32 iterations. */
1236#endif
1215#endif /* __sparc__ */ 1237#endif /* __sparc__ */
1216 1238
1217/*************************************** 1239/***************************************