Subject: Re: broken KA690?
To: Hugh Graham <hugh@openbsd.org>
From: Lord Isildur <mrfusion@umbar.vaxpower.org>
List: port-vax
Date: 07/15/2001 13:03:03
here's my workaround:
(in /usr/src/lib/libc/gen/gen.vax/modf.s, this is of course still in my
4.3BSD work :)
/* the old code */
ENTRY(modf, 0)
emodd 4(ap),$0,$0f1.0,r2,r0
jvs 1f # integer overflow
cvtld r2,*12(ap)
ret
1:
subd3 r0,4(ap),*12(ap)
ret
/* my new code */
ENTRY(modf, 0)
cvtdl 4(ap),r2 # get the integer part out
jvs 1f # integer overflow
cvtld r2,*12(ap) # put it in float format, in dest
subd3 *12(ap),4(ap),r0 # put fraction in r0
ret
1:
movd 4(ap),-8(fp) #copy original value
2:
subd2 $0f1073741824.0,-8(fp) #decrement it
cvtdl -8(fp),-24(fp) #convert to integer
jvs 2b #overflowed , keep decrementing
cvtld -24(fp),-16(fp) #get the remaining integer part
subd3 -16(fp),-8(fp),r0 #put fraction in r0
subd3 r0,4(ap),*12(ap) #put integer component back
ret
It's not perfect, but it does work. i should decrement by a larger
value.. but i should also test if it is negative first..
i'm doing the final recompile of the toolchain and libc (compiled it after
the mods, installed them, then recompiling with the modd'ed compiler.. i had
to copy over a few object files from another machine which the unmodified
compiler (which used emodd) barfed on, the first time.. :) before rebuilding
userland.
happy hacking,
Isildur
On Sun, 15 Jul 2001, Hugh Graham wrote:
> See if your quantity is small enough you can get away with a CVTDL,
> CVTLD, SUBD3 sequence instead of an EMODD.
>
> /Hugh
>
> > isildur
>