The Texas Instruments (TI) Signal Processing Resource Application Report SPRAN9a, entitled TMS320C28x FPU Primer, includes the following sentence in section "4.1 High-Priority Interrupt Context Save and Restore":
"SAVE and RESTORE should only be used in high-priority interrupts."
Note the use of the word "only".
QUESTION:
If a C callable assembly function is never interrupted by ISRs that use floating point registers, is it true that SAVE and RESTORE may be used to simply and swiftly save and restore the floating point registers instead of having to save and restore them using the following?
MOV32 *SP++, R4H
MOV32 *SP++, R5H
MOV32 *SP++, R6H
MOV32 *SP++, R7H
and:
MOV32 R7H, *--SP, UNCF
MOV32 R6H, *--SP, UNCF
MOV32 R5H, *--SP, UNCF
MOV32 R4H, *--SP, UNCF
Note that it is not necessary to save and restore R0H, R1H, R2H, and R3H in a called function based on the following given in SPRU514g, entitled TMS320C28x Optimizing C/C++ Compiler v6.2.4:
“7.3.2 How a Called Function Responds
A called function (child function) must perform the following tasks:
1. If the called function modifies XAR1, XAR2, or XAR3, it must save them, since the calling function
assumes that the values of these registers are preserved upon return. If the target is FPU, then in
addition to the C28x registers, the called function must save registers R4H, R5H, R6H or R7H, if it
modifies any of them. Any other registers may be modified without preserving them.”
Thank you,
Tim Ball
TDB Consulting