diff options
author | tmm <tmm@FreeBSD.org> | 2002-03-11 03:10:55 +0000 |
---|---|---|
committer | tmm <tmm@FreeBSD.org> | 2002-03-11 03:10:55 +0000 |
commit | 30dcded43a98870518b983988ccb00182c8e59ce (patch) | |
tree | fb3c029cb118bfab66e8be189840b85eb5206408 /lib/libc/sparc64 | |
parent | 0b19b34b12f19deaea82cd29989feb30daf433c6 (diff) | |
download | FreeBSD-src-30dcded43a98870518b983988ccb00182c8e59ce.zip FreeBSD-src-30dcded43a98870518b983988ccb00182c8e59ce.tar.gz |
Fix __dtoul to work on sparc64 (it used a half-way v8 stack layout),
and make it PIC-aware.
Diffstat (limited to 'lib/libc/sparc64')
-rw-r--r-- | lib/libc/sparc64/gen/fixunsdfsi.S | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/libc/sparc64/gen/fixunsdfsi.S b/lib/libc/sparc64/gen/fixunsdfsi.S index a8c20da..fde0583 100644 --- a/lib/libc/sparc64/gen/fixunsdfsi.S +++ b/lib/libc/sparc64/gen/fixunsdfsi.S @@ -69,34 +69,34 @@ * Same as above but to unsigned long */ ENTRY(__dtoul) + PIC_PROLOGUE(%o4, %o5) sub %sp, 16, %sp - std %f2, [%sp + 64 + SPOFF + 8] - sethi %hi(.Lbig), %g1 - ldd [%g1 + %lo(.Lbig)], %f2 + std %f2, [%sp + CCFSZ + SPOFF + 8] + SET(.Lbig, %o5, %o3) + ldd [%o3], %f2 fcmped %f0, %f2 ! d < 2^63, or NaN, or -Inf? - nop ! (fpop2 delay) - fbul,a 1f ! if so, use fdtoi to convert to int + fbul,a 1f ! if so, use fdtox to convert to long fdtox %f0, %f0 ! (this includes negatives!) - ! d does not fit in an int, so subtract 2^63, convert, + ! d does not fit in a long, so subtract 2^63, convert, ! and add 2^63 again (sigh). Just hope the intermediate ! fits (if not, the result is undefined anyway). fsubd %f0, %f2, %f0 ! d -= 2^63 - fdtox %f0, %f0 ! convert to int - std %f0, [%sp + 64 + SPOFF] ! move into return reg - ldx [%sp + 64 + SPOFF], %o0 + fdtox %f0, %f0 ! convert to long + std %f0, [%sp + CCFSZ + SPOFF] ! move into return reg + ldx [%sp + CCFSZ + SPOFF], %o0 sethi %hi(0x80000000), %o1 sllx %o1, 32, %o1 add %o0, %o1, %o0 ! add 2^63 - ldd [%sp + 64 + SPOFF + 8], %f2 + ldd [%sp + CCFSZ + SPOFF + 8], %f2 retl add %sp, 16, %sp 1: - std %f0, [%sp + 64 + SPOFF] ! return result - ldx [%sp + 64 + SPOFF], %o0 - ldd [%sp + 64 + SPOFF + 8], %f2 + std %f0, [%sp + CCFSZ + SPOFF] ! return result + ldx [%sp + CCFSZ + SPOFF], %o0 + ldd [%sp + CCFSZ + SPOFF + 8], %f2 retl add %sp, 16, %sp END(__dtoul) |