HBO043%DJUKFA11.BITNET@cunyvm.cuny.edu (Christoph van Wuellen) (05/21/91)
I often get mail that I should implement IEEE floats/doubles in c68. Since I discussed this a minute ago, here is a copy for the Net. I would like to hear votes which strategy to follow. P.S. A third strategy would be the implementation of a software stack machine for doubles like in c386..... C.v.W. original message follows... Your point is the real trouble spot in implementing doubles for the 68000 processor: It has no register that can hold a 64-bit value. Management of register pairs can be very messy, normally the only thing you can do with a double in a register pair is to store them in memory. In this case, it might be better to pass a pointer for the result value using the mechanism which I take for returning structs. The latest version of c68/c386 is able to allocate dummy registers in the stack frame at random, so it looks elegant to use that. BUT, doing this will cause many flames. If I use the d0/d1 convention, I could easily adopt the IEEE routines available for the 68000 implementation of GCC (so I wonder why you re-invented the wheel) which work as follows: - push doubles on stack - call function - accept result in d0/d1 My variant would look like push pointers to the arguments on stack allocate space for result push pointer to result on stack call function This applies to compiler support functions, other functions require explicit pushing of the values anyway. Perhaps this should be discussed on the NET. C.v.W.