Subject: Re: broken KA690?
To: Hugh Graham <>
From: Lord Isildur <>
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)
        subd3   r0,4(ap),*12(ap)

/* 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
        movd    4(ap),-8(fp)            #copy original value
        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

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

happy hacking,

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