Re: floating-point abuse in 2.1.113

Richard B. Johnson (root@chaos.analogic.com)
Thu, 6 Aug 1998 09:23:01 -0400 (EDT)


On Thu, 6 Aug 1998, Andi Kleen wrote:

> On Thu, Aug 06, 1998 at 02:49:39PM +0200, Richard B. Johnson wrote:
> > On Thu, 6 Aug 1998, Andi Kleen wrote:
> >
> > > On Thu, Aug 06, 1998 at 03:36:48AM +0200, H. Peter Anvin wrote:
> > > > > Gcc combines floating point constants in constant expressions, even when
> > > > > cross compiling.
> > > >
> > > > Are you sure? Or only if the source and target use the same formats?
> > >
> > > Yes. read gcc/fold-const.c in the gcc source. They go into great pains
> > > to do that.
> > >
> > > -Andi
> > >
> >
> > Hmmmm. But gcc didn't do it in the kernel when it encountered some
> > real number constants, cast to an int.
>
> tfp.c:
>
> int f()
> {
> return (int) (1.02 * 2.0 - 3.121232);
> }
>

[SNIPPED what we've been over before]
I did this Monday. I tried to emulate what was happening in the kernel
code with a simple program. I could not.

We have discovered that a simple program, using real-number constants,
cast to an integer, compiled by gcc doesn't result in FP code. However,
certain kernel functions, using the same code-snipets does. The FP
was showing up in the kernel binary so some considerable work has
been done by others, chasing it all down.

It seems that gcc does not treat a short procedure like a large one.
This may have something to do with resources available during a kernel
compile???

Cheers,
Dick Johnson
***** FILE SYSTEM MODIFIED *****
Penguin : Linux version 2.1.113 on an i586 machine (66.15 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html