Saving fprs only

For a function that saves and restores m FPRs (m>2), the saving can be done using individual store and load instructions or by calling system-provided routines.

For a function that saves and restores m FPRs (m>2), the saving can be done using individual store and load instructions or by calling system-provided routines as shown in the following example:

#The following example shows the prolog/epilog of a function #which saves m FPRs and no GPRs:
mflr    r0                       #move LR into GPR 0
bla     _savefpr_<32-m>
stwu    r1,<-frame_size>(r1)     #update SP and save caller's SP
...
<save CR if necessary>
...
...                              #body of function
...
<reload save CR if necessary>
...
<reload caller's SP into r1>     #see note below
ba      _restfpr_<32-m>          #restore FPRs and return
Note:
  1. There are no entry points for saving and restoring GPR and FPR numbers higher than 29. It is more efficient to save a small number of registers in the prolog than to call the save and restore functions.
  2. The restoring of the calling function SP can be done by either adding the frame_size value to the current SP whenever frame_size is known, or by reloading it from offset 0 from the current SP. The first approach is more efficient, but not possible for functions that use the alloca subroutine to dynamically allocate stack space.