How to instruct GCC to allocate FPU registers for some variable?
I'm optimizing some register-intensive code:
https:/
and found that the stack frame is too big(80 bytes) and the code seems to place lots of variables into the stack. Since memory access is much slower than registers, the interaction with stack becomes a bottleneck.
So I'm thinking that is there any way to tell GCC to allocate some variables into the FPU registers? I've declare some variables to be float to force GCC place them in the Sx registers instead of stack and obtained nearly 10% performance gain.
Is there a way to tell GCC automatically allocate the FPU register instead of the "hacks"?
Forgot to mention, my CPU is a Cortex-M4 and the CFLAGS is: -mcpu=cortex-m4 -mthumb -O2 -Ofast -mfloat-abi=hard -mfpu=fpv4-sp-d16
Question information
- Language:
- English Edit question
- Status:
- Answered
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask grissiom for more information if necessary.