[comp.sys.m88k] floating point exceptions

sean@Neon.Stanford.EDU (Sean Quinlan) (11/29/90)

I am trying to code a simple exception handler for the two floating
point exceptions.  The 88100 manual states that there are routines from
Motorola that do the default IEEE processing.  Has anyone used these?
Are they public domain?  If not, does anyone have any code they can give
me?  I probably do not need full IEEE conformance, just enough so that
resonable results are produced when I start running out of precision instead
of taking the exception and crashing.  Having code to do the right thing
with infitity, NaN etc would be nice but not essential.
Many thanks
sean quinlan

robertb@cs.washington.edu (Robert Bedichek) (11/29/90)

In article <1990Nov29.084840.5410@Neon.Stanford.EDU> sean@Neon.Stanford.EDU (Sean Quinlan) writes:
>I am trying to code a simple exception handler for the two floating
>point exceptions.  The 88100 manual states that there are routines from
>Motorola that do the default IEEE processing.  Has anyone used these?

Yes, they are in the Tektronix and Motorola kernels, as well as at
least one Mach port that I know of.  My guess is that they are in
everyone's 88k kernel.

>Are they public domain?  If not, does anyone have any code they can give

I doubt that they are in the public domain.  I suggest that you ask
Moto's MCD (Microcomputer Division) in Tempe Az. for them.  Maybe
they'll just give them to you.  They were originally developed by the
chip folks in Austin Texas, but my guess is that it is no maintained
in Tempe.

>me?  I probably do not need full IEEE conformance, just enough so that
>resonable results are produced when I start running out of precision instead
>of taking the exception and crashing.  Having code to do the right thing
>with infitity, NaN etc would be nice but not essential.

They do all sorts of things besides obscure IEEE conformance.  Like,
they fix up floating to integer conversions that sometimes trap even
when the operand is not out of range.

This code is all in assembly and very tricky.  I highly recommend that
you get it from Motorola.

>Many thanks
>sean quinlan

	Rob Bedichek   robertb@cs.washington.edu

jkenton@pinocchio.encore.com (Jeff Kenton) (11/29/90)

From article <13899@june.cs.washington.edu>, by robertb@cs.washington.edu (Robert Bedichek):
> In article <1990Nov29.084840.5410@Neon.Stanford.EDU> sean@Neon.Stanford.EDU (Sean Quinlan) writes:
>>I am trying to code a simple exception handler for the two floating
>>point exceptions.  The 88100 manual states that there are routines from
>>Motorola that do the default IEEE processing.  Has anyone used these?
> 
> Yes, they are in the Tektronix and Motorola kernels, as well as at
> least one Mach port that I know of.  My guess is that they are in
> everyone's 88k kernel.
> 

Many people have written their own.  The original sample FP exception code
from Motorola did not handle denorms properly; it may be more complete now.

For the simple stuff the sample code will give you the general idea although
it may not just "drop right in" your particular implementation.  It's surely
the first place to start -- give Motorola a call.













----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -----
-----  jeff kenton:    	consulting at jkenton@pinocchio.encore.com  -----
-----		        until 11/30/90 -- always at (617) 894-4508  -----
----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -----

meissner@osf.org (Michael Meissner) (11/30/90)

In article <13899@june.cs.washington.edu> robertb@cs.washington.edu
(Robert Bedichek) writes:

| I doubt that they are in the public domain.  I suggest that you ask
| Moto's MCD (Microcomputer Division) in Tempe Az. for them.  Maybe
| they'll just give them to you.  They were originally developed by the
| chip folks in Austin Texas, but my guess is that it is no maintained
| in Tempe.

I remember when I was at Data General, the Motorola software was
inadequate, and the software written at DG, migrated back to Motorola
(and probably munged some more).

| They do all sorts of things besides obscure IEEE conformance.  Like,
| they fix up floating to integer conversions that sometimes trap even
| when the operand is not out of range.

I had forgotten about this gem when I sent mail to somebody comparing
MIPS and 88k from a compiler writer's viewpoint.  If the number is >=
2**30 and <= 2**31 it traps.
--
Michael Meissner	email: meissner@osf.org		phone: 617-621-8861
Open Software Foundation, 11 Cambridge Center, Cambridge, MA, 02142

Considering the flames and intolerance, shouldn't USENET be spelled ABUSENET?

jkenton@pinocchio.encore.com (Jeff Kenton) (11/30/90)

From article <MEISSNER.90Nov29172619@curley.osf.org>, by meissner@osf.org (Michael Meissner):
> 
> I had forgotten about this gem when I sent mail to somebody comparing
> MIPS and 88k from a compiler writer's viewpoint.  If the number is >=
> 2**30 and <= 2**31 it traps.

It traps if the exponent is anything >= 30.  This *could* cause an overflow
of the range of 32-bit integers when the exponent is exactly 30 or 31, and
always if the exponent is >= 32.  It's up to the exception software in the
kernel to decide.

If the number is positive and the exponent is == 30, you can have overflow
if the number is 0x7fffffff and rounding adds 1 to it.  If the exponent is
31, you always have overflow unless the number is negative and equal to
0x80000000 after rounding.

There -- I'm sure that makes everyone feel better.  What would you have
done if you didn't know that.

----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -----
-----  jeff kenton:    	consulting at jkenton@pinocchio.encore.com  -----
-----		        until 11/30/90 -- always at (617) 894-4508  -----
----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -----

phil@hansen.Berkeley.EDU (Phil Graham) (12/01/90)

I read this... Do we care?
Phil

In article <13899@june.cs.washington.edu>, robertb@cs.washington.edu
(Robert Bedichek) writes:
|> In article <1990Nov29.084840.5410@Neon.Stanford.EDU>
sean@Neon.Stanford.EDU (Sean Quinlan) writes:
|> >I am trying to code a simple exception handler for the two floating
|> >point exceptions.  The 88100 manual states that there are routines from
|> >Motorola that do the default IEEE processing.  Has anyone used these?
|> 
|> Yes, they are in the Tektronix and Motorola kernels, as well as at
|> least one Mach port that I know of.  My guess is that they are in
|> everyone's 88k kernel.
|> 
|> >Are they public domain?  If not, does anyone have any code they can give
|> 
|> I doubt that they are in the public domain.  I suggest that you ask
|> Moto's MCD (Microcomputer Division) in Tempe Az. for them.  Maybe
|> they'll just give them to you.  They were originally developed by the
|> chip folks in Austin Texas, but my guess is that it is no maintained
|> in Tempe.
|> 
|> >me?  I probably do not need full IEEE conformance, just enough so that
|> >resonable results are produced when I start running out of precision
instead
|> >of taking the exception and crashing.  Having code to do the right thing
|> >with infitity, NaN etc would be nice but not essential.
|> 
|> They do all sorts of things besides obscure IEEE conformance.  Like,
|> they fix up floating to integer conversions that sometimes trap even
|> when the operand is not out of range.
|> 
|> This code is all in assembly and very tricky.  I highly recommend that
|> you get it from Motorola.
|> 
|> >Many thanks
|> >sean quinlan
|> 
|> 	Rob Bedichek   robertb@cs.washington.edu