This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCC floating point usage


Richard Earnshaw <rearnsha at arm dot com> writes:

> I missed the start of the *BSD discussion, but if it's anything like the 
> one that Mike is referring to that occurred on this list, then the issue 
> is to discourage (severly) the first use of the floating point registers 
> when there are no floating point operations in a function; otherwise we 
> might pay a very large penalty in the kernel for the very first use and 
> fairly large penalties after each context switch if the kernel switches 
> the FP context on a lazy basis.

I'd like to remind everyone that the patch Mike refers to deals with a
slightly different situation, viz. where use of floating point in an
unanticipated context causes a correctness failure, not just a
performance penalty.  Which means...

> It seems to me that the best solution to this would be to have a new cost 
> metric that expressed this discouragement directly, maybe 
> CLASS_FIRST_USE_COST(class) which could then be set to a large value to 
> express what really happens.  Once the threshold has been crossed the 
> register allocator would then be free to use the registers as it would 
> normally.

... that, while this is an interesting idea, I'm not convinced it
would provide a sufficiently ironclad guarantee that floating point
instructions will _never_ be emitted unless floating point operations
appear in the same function.  Discouragement is not good enough.

(Maybe there's a notion of "infinite cost" or something that could be
applied -- I don't know a whole lot about register classes and costs.)

zw


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]