Help with reload bug, please

Andrew Stubbs ams@codesourcery.com
Fri Jan 23 13:46:00 GMT 2015


How does reload ensure that an SImode value (re)loaded into an FP 
register has a valid stack index?

The FP load instruction allows a smaller index range than the integer 
equivalent, but nothing checks the destination register, only the source 
mode.

I'm trying to solve a problem in which GCC 4.1 gets this wrong, but 
AFAICT this code works exactly the same now as then (although I don't 
have a testcase). IOW, unless I'm missing something, the only reason 
this doesn't fail all the time is that it's quite rare for the register 
pressure to cause just this value to spill in a function that has a 
stack frame >1KB and the index happens to be beyond the limit.

My target is ARMv7a with VFP. The code is trying to cast an int to a 
float. The machine description is such that the preferred route is to 
load the value first into a general register, transfer it to the VFP 
register, and then convert. It's only possible to get it to load 
directly to the VFP register if all the general registers are in use. 
This makes it very hard to write a synthetic testcase.

I can "fix" the problem by rewriting arm_legitimate_index_p such that it 
assumes all SImode access might be VFP loads, but that seems suboptimal.

Any suggestions would be appreciated!

Thanks

Andrew



More information about the Gcc mailing list