powerpc-eabi-gcc no implicit FPU usage

Robert Grimm rfgrimm@gmail.com
Sat Jan 16 15:32:00 GMT 2010


Thanks to all who have responded so far.  Thanks to Martin for the -mfloat-abi=softfp option as that could be useful to us.

On Jan 16, 2010, at 6:23 AM, David Edelsohn wrote:

> On Fri, Jan 15, 2010 at 6:42 PM, Robert Grimm <rfgrimm@gmail.com> wrote:
>> Greetings all,
>> 
>> I'm working with the powerpc-eabi architecture (specifically, the MPC563 processor).  For some time we have been using GCC 3.4.3 and I noticed gcc generating code that makes use of the floating point registers for 64-bit integer loads and whatnot... which we don't want it to do as there are times when we disable the FPU.  I'm aware of the -msoft-float option but we didn't want to use that as we only wanted it to not use FP registers in certain functions and not entire files.  I was under the impression that a newer GCC wouldn't do this based on some old mailing posts I've read.  I've just tried out GCC 4.4.2 and notice that the FP registers are still being used even though there is no explicit FPU usage going on in this particular part of the code.
>> 
>> Is there a way to get GCC to only use the FPU when we explicitly want to use it (i.e. when we use doubles/floats)?  Is -msoft-float my only option here?  Is there any sort of #pragma that could do the same thing as -msoft-float (I didn't see one)?
> 
> Recent versions of GCC greatly decrease the use of FPRs for
> non-floating point code, but do not prevent it.
> 
> To absolutely prevent use of FPRs, one must use -msoft-float.  The
> hard-float and soft-float ABIs are incompatible and one cannot mix
> object files.
> 

I get why one cannot mix hard/soft object files if you have functions whose interfaces use floats/doubles/uint64_ts, but what about those that don't.  In other words, if I had one hard-float object file that depends on a soft-float object file but no floats, doubles or 64-bit values are passed in between, is that okay?  One thing we've tried is to compile only certain libraries as soft-float as long as those libraries don't contain any float/double/64-bit interfaces.  It seems to work but now I'm wondering if we're playing with fire and that we've just been lucky.

> GCC is a compiler, not an assembler.  It tries to optimize programs,
> not read programmers' minds.  If the person invoking the compiler does
> not deny the resource to the compiler, it will try to use it when
> profitable, which is what it should do.
> 
> David

I'm not asking it to read my mind.  I'm asking for a "-fonly-use-the-FPU-when-you-see-a-float-or-a-double-and-not-when-you-see-a-uint64_t" flag.  This would be very useful for those of us, as Joel Sherill pointed out, leave the FPU disabled at times and use uint64_t's inside interrupt service routines.

Actually, I saw some old posts that talked about a -fno-implicit-fp option which seemed to be just what I want.  Any reason why that was abandoned or not considered?

Thanks again to all for your help,
Rob



More information about the Gcc mailing list