https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65862
--- Comment #8 from Vladimir Makarov <vmakarov at gcc dot gnu.org> --- (In reply to Matthew Fortune from comment #6) > (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. Thanks, Matt. It is a good point. As I wrote in my previous comment, introducing target hook narrowing allocno class could help here. Hook implementation for MIPS could change ALL_REGS to general regs unless the pseudo is of a floating point mode.