From: David Mosberger-Tang <davidm@cs.arizona.edu>
Subject: Re: More on f2c...
Date: Wed, 10 Apr 1996 20:42:46 -0700 [thread overview]
Message-ID: <199604110342.UAA10003@koppel.cs.arizona.edu> (raw)
> Well, that didn't do it. After rebuilding f2c with the -ieee flag, I
> still got "floating exception during constant evaluation" when I
> tried to build scilab-2.2
> One thing to note: the "constant evaluation" bit is a red herring; f2c
> prints the same message regardless of what caused the floating exception.
> I'm looking into it...
There was a problem with gcc -mieee when doing float (as opposed to
double) arithmetic. It's fixed in the latest gcc snapshot, but it
will require an updated gas as well (the fixed gcc generates the cvtst
instruction which the old gas didn't know about). I don't remember
exactly what the problem was, but it basically boiled down to gcc not
being able to convert non-finite float constants into doubles.
Some more caveats:
- The quality of the code generated by gcc -mieee is abysmal;
I can say it because it's my fault. I'm not really a gcc
hacker (nor a floating point guy, for that matter), so I just put
the minimal support into gcc to get non-finite arithmetic going. If
you want to turn a great day into a really bad one, just do
gcc -mieee -O2 -S somefpcode.c and look at its output---but don't
blame me if you end up with stomach cramps and a sleepless night...
The fundamental problem is that the current gcc's register allocator
knows nothing about the special constraints when generating code
for -mieee. This has the effect that many more trap barriers are
generated than is strictly necessary. To make matters worse, gcc
ends up moving fp values needlessly back and forth between registers.
I think the situation could be improved a lot by adding a strategy
to the register allocator that would minimize reuse of source
operands within a basic block when -mieee is in effect.
- Rounding of denormalized single-precision numbers is known
to be incorrect. It's not all that bad, but it's not according
to IEEE specs, I'm being told. The only grace is that DEC Unix
doesn't seem get it right either.
- The kernel emulation code is there and as far as I tested it,
appears to work quite well. I believe to have tested the
generation and handling of QNaN, NaN, +Inf, and -Inf values
exhaustively, but not being an fp guy, I haven't really done
anything heavy duty otherwise. I did run Stephen Monnier's
fp torture test and from what I saw, there wasn't anything
obvious wrong (except for the single prec denormal rounding
problem mentioned above). But then, I don't really claim I
understand all it tried to do...
- The math libraries and even some of the libc code would have
to be recompiled with -mieee as well. In essence, anything
that uses double or float arithmetic operations would need
to be recompiled. The easiest thing would probably be to
provide two versions of each library, one with and one without
-mieee support. For a better (and more complicated solution),
see DEC Unix's use of the .eflag directive in assembly files.
If I understand it correctly, DEC Unix marks object files that
are compiled with -mieee and if such an object file has an
undefined reference to a function for which there is a -mieee
version available, it'll link it against that one. The current
gas simply ignores the .eflag directive. I don't know how difficult
it would be to add the DEC Unix linker's clever linking strategy into
the GNU linker.
So now that you all know what's wrong with the current ieee support, I
hope some of you may tackle one or two of the existing
limitations... :-)
--david
next reply other threads:[~1996-04-11 3:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-04-11 3:42 David Mosberger-Tang [this message]
-- strict thread matches above, loose matches on Subject: below --
1996-04-11 0:49 More on f2c Jim Paradis
1996-04-11 1:13 ` Erik Troan
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox