lib: Fix 32-bit sparc udiv_qrnnd() definition in mpilib's longlong.h

This copy of longlong.h is extremely dated and results in compile
errors on sparc32 when MPILIB is enabled, copy over the more uptodate
implementation from arch/sparc/math/sfp-util_32.h

Reported-by: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: James Morris <jmorris@namei.org>
This commit is contained in:
David Miller 2012-02-02 00:17:55 +02:00 committed by James Morris
parent c6df4b17c8
commit a99e7e5f36

View File

@ -1200,18 +1200,40 @@ do { \
"r" ((USItype)(v)) \ "r" ((USItype)(v)) \
: "%g1", "%g2" __AND_CLOBBER_CC) : "%g1", "%g2" __AND_CLOBBER_CC)
#define UMUL_TIME 39 /* 39 instructions */ #define UMUL_TIME 39 /* 39 instructions */
#endif /* It's quite necessary to add this much assembler for the sparc.
#ifndef udiv_qrnnd The default udiv_qrnnd (in C) is more than 10 times slower! */
#ifndef LONGLONG_STANDALONE
#define udiv_qrnnd(q, r, n1, n0, d) \ #define udiv_qrnnd(q, r, n1, n0, d) \
do { USItype __r; \ __asm__ ("! Inlined udiv_qrnnd\n\t" \
(q) = __udiv_qrnnd(&__r, (n1), (n0), (d)); \ "mov 32,%%g1\n\t" \
(r) = __r; \ "subcc %1,%2,%%g0\n\t" \
} while (0) "1: bcs 5f\n\t" \
extern USItype __udiv_qrnnd(); "addxcc %0,%0,%0 ! shift n1n0 and a q-bit in lsb\n\t" \
#define UDIV_TIME 140 "sub %1,%2,%1 ! this kills msb of n\n\t" \
#endif /* LONGLONG_STANDALONE */ "addx %1,%1,%1 ! so this can't give carry\n\t" \
#endif /* udiv_qrnnd */ "subcc %%g1,1,%%g1\n\t" \
"2: bne 1b\n\t" \
"subcc %1,%2,%%g0\n\t" \
"bcs 3f\n\t" \
"addxcc %0,%0,%0 ! shift n1n0 and a q-bit in lsb\n\t" \
"b 3f\n\t" \
"sub %1,%2,%1 ! this kills msb of n\n\t" \
"4: sub %1,%2,%1\n\t" \
"5: addxcc %1,%1,%1\n\t" \
"bcc 2b\n\t" \
"subcc %%g1,1,%%g1\n\t" \
"! Got carry from n. Subtract next step to cancel this carry.\n\t" \
"bne 4b\n\t" \
"addcc %0,%0,%0 ! shift n1n0 and a 0-bit in lsb\n\t" \
"sub %1,%2,%1\n\t" \
"3: xnor %0,0,%0\n\t" \
"! End of inline udiv_qrnnd\n" \
: "=&r" ((USItype)(q)), \
"=&r" ((USItype)(r)) \
: "r" ((USItype)(d)), \
"1" ((USItype)(n1)), \
"0" ((USItype)(n0)) : "%g1", "cc")
#define UDIV_TIME (3+7*32) /* 7 instructions/iteration. 32 iterations. */
#endif
#endif /* __sparc__ */ #endif /* __sparc__ */
/*************************************** /***************************************