* except.c (expand_start_all_catch): One more do_pending_stack_adjust.
[official-gcc.git] / gcc / config / pa / ee_fp.asm
blobef040cf7dad04e95a1650eae77f96758ed68f998
1 ; Subroutines for out of line prologues and epilogues on for the HPPA
2 ; Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
4 ; This file is part of GNU CC.
6 ; GNU CC is free software; you can redistribute it and/or modify
7 ; it under the terms of the GNU General Public License as published by
8 ; the Free Software Foundation; either version 2, or (at your option)
9 ; any later version.
11 ; GNU CC is distributed in the hope that it will be useful,
12 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ; GNU General Public License for more details.
16 ; You should have received a copy of the GNU General Public License
17 ; along with GNU CC; see the file COPYING. If not, write to
18 ; the Free Software Foundation, 59 Temple Place - Suite 330,
19 ; Boston, MA 02111-1307, USA.
21 .SPACE $PRIVATE$
22 .SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
23 .SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
24 .SPACE $TEXT$
25 .SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
26 .SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
27 .SUBSPA $MILLICODE$,QUAD=0,ALIGN=8,ACCESS=44,SORT=8
30 ; This is an out-of-line prologue.
32 ; It performs the following operations:
34 ; * Saves the return pointer at sp - 20
36 ; * Creates a new stack frame (sp'), size of the frame is passed in %r21
38 ; * The old stack pointer is saved at sp (frame pointer version only).
40 ; * Saves grs (passed in low 16 bits of %r22 into the stack frame
41 ; at sp' + local_fsize (passed in %r19).
43 ; * Saves frs (passed in high 16 bits of %r22) into the stack
44 ; frame at sp' + local_fsize (passed in %r19).
46 ; * Sets up a frame pointer (in %r3) (frame pointer version only).
48 ; * Returns to the instruction _immediately_ after the call to
49 ; this function.
51 .SPACE $TEXT$
52 .SUBSPA $MILLICODE$
53 .EXPORT __outline_prologue_fp,MILLICODE
54 .align 32
55 __outline_prologue_fp
56 .PROC
57 .CALLINFO FRAME=0,NO_CALLS
58 .ENTRY
59 copy %r30,%r20
61 ; Subtract 4 from our return pointer so that we return to
62 ; the right location.
63 ldo -4(%r31),%r31
65 ; Save off %r2
66 stw %r2,-20(0,%r30)
68 ; Make our new frame.
69 add %r21,%r30,%r30
71 ; Save our old stack pointer.
72 stw %r20,0(0,%r20)
74 ; Add in local_fsize to our frame pointer so we do register
75 ; saves into the right place
76 add %r20,%r19,%r20
78 ; %r22 tells us what registers we need to save. The upper half
79 ; is for fp registers, the lower half for integer registers.
80 ; We put the lower half in %r1 and the upper half into %r22
81 ; for later use.
82 extru %r22,31,16,%r1
83 extrs %r22,15,16,%r22
85 ; %r1 now olds a value 0-18 which corresponds to the number
86 ; of grs we need to save. We need to reverse that value so
87 ; we can just into the table and straight-line execute to the
88 ; end of the gr saves.
89 comb,= %r0,%r1,L$0002
90 subi 18,%r1,%r1
91 blr,n %r1,%r0
92 b,n L$0002
93 stws,ma %r18,4(0,%r20)
94 nop
95 stws,ma %r17,4(0,%r20)
96 nop
97 stws,ma %r16,4(0,%r20)
98 nop
99 stws,ma %r15,4(0,%r20)
101 stws,ma %r14,4(0,%r20)
103 stws,ma %r13,4(0,%r20)
105 stws,ma %r12,4(0,%r20)
107 stws,ma %r11,4(0,%r20)
109 stws,ma %r10,4(0,%r20)
111 stws,ma %r9,4(0,%r20)
113 stws,ma %r8,4(0,%r20)
115 stws,ma %r7,4(0,%r20)
117 stws,ma %r6,4(0,%r20)
119 stws,ma %r5,4(0,%r20)
121 stws,ma %r4,4(0,%r20)
123 stws,ma %r3,4(0,%r20)
125 L$0002
126 ; All gr saves are done. Align the temporary frame pointer and
127 ; do the fr saves.
128 ldo 7(%r20),%r20
129 depi 0,31,3,%r20
131 comb,= %r0,%r22,L$0003
132 subi 21,%r22,%r22
133 blr,n %r22,%r0
134 b,n L$0003
135 fstws,ma %fr21,8(0,%r20)
137 fstws,ma %fr20,8(0,%r20)
139 fstws,ma %fr19,8(0,%r20)
141 fstws,ma %fr18,8(0,%r20)
143 fstws,ma %fr17,8(0,%r20)
145 fstws,ma %fr16,8(0,%r20)
147 fstws,ma %fr15,8(0,%r20)
149 fstws,ma %fr14,8(0,%r20)
151 fstws,ma %fr13,8(0,%r20)
153 fstws,ma %fr12,8(0,%r20)
155 L$0003
156 ; Return, setting up a frame pointer in the delay slot
157 bv 0(%r31)
158 sub %r30,%r21,%r3
159 .EXIT
160 .PROCEND
163 ; This is an out-of-line epilogue. It's operation is basically the reverse
164 ; of the out-of-line prologue.
166 .EXPORT __outline_epilogue_fp,MILLICODE
167 .align 32
168 __outline_epilogue_fp
169 .PROC
170 .CALLINFO FRAME=0,NO_CALLS
171 .ENTRY
172 ; Make a copy of our frame pointer into %r20
173 copy %r3,%r20
175 ; Subtract 4 from our return pointer so that we return to
176 ; the right location.
177 ldo -4(%r31),%r31
179 ; Reload %r2
180 ; First save off %r2
181 ldw -20(0,%r20),%r2
183 ; Load our old stack pointer, save it in %r21.
184 ldw 0(0,%r20),%r21
186 ; Add in local_fsize (%r19) to the frame pointer to find
187 ; the saved registers.
188 add %r20,%r19,%r20
190 ; %r22 tells us what registers we need to restore. The upper half
191 ; is for fp registers, the lower half for integer registers.
192 ; We put the lower half in %r1 and the upper half into %r22
193 ; for later use.
194 extru %r22,31,16,%r1
195 extrs %r22,15,16,%r22
197 ; %r1 now olds a value 0-18 which corresponds to the number
198 ; of grs we need to restore. We need to reverse that value so
199 ; we can just into the table and straight-line execute to the
200 ; end of the gr restore.
201 comb,= %r0,%r1,L$0006
202 subi 18,%r1,%r1
203 blr,n %r1,%r0
204 b,n L$0006
205 ldws,ma 4(0,%r20),%r18
207 ldws,ma 4(0,%r20),%r17
209 ldws,ma 4(0,%r20),%r16
211 ldws,ma 4(0,%r20),%r15
213 ldws,ma 4(0,%r20),%r14
215 ldws,ma 4(0,%r20),%r13
217 ldws,ma 4(0,%r20),%r12
219 ldws,ma 4(0,%r20),%r11
221 ldws,ma 4(0,%r20),%r10
223 ldws,ma 4(0,%r20),%r9
225 ldws,ma 4(0,%r20),%r8
227 ldws,ma 4(0,%r20),%r7
229 ldws,ma 4(0,%r20),%r6
231 ldws,ma 4(0,%r20),%r5
233 ldws,ma 4(0,%r20),%r4
235 ldws,ma 4(0,%r20),%r3
237 L$0006
238 ; All gr restore are done. Align the temporary frame pointer and
239 ; do the fr restore.
240 ldo 7(%r20),%r20
241 depi 0,31,3,%r20
243 comb,= %r0,%r22,L$0007
244 subi 21,%r22,%r22
245 blr,n %r22,%r0
246 b,n L$0007
247 fldws,ma 8(0,%r20),%fr21
249 fldws,ma 8(0,%r20),%fr20
251 fldws,ma 8(0,%r20),%fr19
253 fldws,ma 8(0,%r20),%fr18
255 fldws,ma 8(0,%r20),%fr17
257 fldws,ma 8(0,%r20),%fr16
259 fldws,ma 8(0,%r20),%fr15
261 fldws,ma 8(0,%r20),%fr14
263 fldws,ma 8(0,%r20),%fr13
265 fldws,ma 8(0,%r20),%fr12
267 L$0007
268 ; Return and deallocate our frame.
269 bv 0(%r31)
270 copy %r21,%r30
271 .EXIT
272 .PROCEND