Re: floating-point abuse in 2.1.113

Andi Kleen (ak@muc.de)
06 Aug 1998 02:32:58 +0200


hpa@transmeta.com (H. Peter Anvin) writes:

> Followup to: <199808042250.SAA24173@jupiter.cs.uml.edu>
> By author: "Albert D. Cahalan" <acahalan@cs.uml.edu>
> In newsgroup: linux.dev.kernel
> >
> > Yes, of course. You have a literal float multiplied by a literal int.
> > The compiler should promote the int and multiply. After that, the compiler
> > should convert the result to an int, eliminating the cast. Then the compiler
> > should store that int value in the object file. Why not?
> >
> > If this has anything to do with IEEE rounding modes, gross!
> > In that case, gcc needs a -flinux-kernel option. Maybe one of the
> > existing flags will make gcc optimize away the floating point math.
> > How about -ffast-math?
> >
>
> Very few compilers will do *ANY* arithmetic on floating-point
> constants, mostly because it is so incredibly painful to do when
> cross-compiling. Since gcc is designed that it can be run as a
> cross-compilier if desired...

I don't think this is a big problem anymore with mostly all CPUs supporting
standard IEEE floating point arithmetic. Is there any Linux target that has
non-IEEE FP? I doubt it.

Gcc combines floating point constants in constant expressions, even when
cross compiling.

-Andi

-
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