This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GCC floating point usage
- From: Zack Weinberg <zack at codesourcery dot com>
- To: Mark Mitchell <mark at codesourcery dot com>
- Cc: David Edelsohn <dje at watson dot ibm dot com>, Michael Matz <matz at suse dot de>,Geoff Keating <geoffk at geoffk dot org>, "mrs at apple dot com" <mrs at apple dot com>,"steby at enea dot se" <steby at enea dot se>,"gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Wed, 16 Oct 2002 15:16:05 -0700
- Subject: Re: GCC floating point usage
- References: <200210162134.RAA24036@makai.watson.ibm.com> <371060000.1034805269@warlock.codesourcery.com>
On Wed, Oct 16, 2002 at 02:54:29PM -0700, Mark Mitchell wrote:
> Since you think the semantics are unclear, I'll make an effort to state
> them again:
>
> If the user does not explicitly use floating point at the source
> level, the compiler will not generate reads to or writes from the
> floating point registers that can ever be executed by the program,
> unless that program calls "setjmp" or makes use of exception-handling.
I would prefer to phrase it thus:
The compiler will not generate floating point instructions that can
ever be executed by the program, unless either
(a) the source code of the program makes use of floating point, or
(b) the source code of the program contains constructs which -
although not explicitly using floating point - cannot be implemented
in an ABI-compatible manner without causing the compiled program to
execute floating point instructions.
Examples of such constructs are: exception handling, setjmp,
longjmp, and variadic functions. This list is not necessarily
exhaustive, nor do all of these constructs necessarily require
floating point.
[On the PowerPC, the SVR4 ABI allows variadic functions to be used
without executing floating point instructions, as long as no actual
argument has a floating point type. This is not true of other ABIs.
For instance, some ABIs for the SH with hardware floating point do
require any variadic function to execute floating point instructions
in its prologue.]
[As that comment might suggest, a version of this feature that's
architecture independent would be preferred by the people who
originally asked me to implement it. I don't presently see any way to
do it in an architecture-independent fashion, but I'm open to
suggestions.]
Your description of what "the source code of the program makes use of
floating point" means for C, works for me.
zw