https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65862
--- Comment #6 from Matthew Fortune <matthew.fortune at imgtec dot com> --- (In reply to Robert Suchanek from comment #5) > > I am not sure, that the result code is better as we access memory 3 > > times instead of access to $f20. > > On one hand, yes, it seems good but it's not always desirable to use FP regs > until absolutely necessary. For instance, compiling the dynamic linker that > uses FP regs does not seem to be right. On the costs front then while it is true that moves between FPR and GPR are usually cheaper than moving to memory and back there is a secondary cost which is that simply turning on the FPU is costly. So, the reason for using FPRs needs to be that the floating point instructions are used rather than registers. Ideally we would not spill to FPRs unless there has been actual floating point code used, this suggests it would be good to set the cost of GPR->FPR higher than memory if no floating point code is present in the function. Otherwise if the FPU is in use anyway then using FPRs as scratch/spill for integer mode data is fine and the costs can be lower than memory. Matthew