OSDN Git Service

52487aab8645a6b591766763247210fc5cd1b780
[pf3gnuchains/gcc-fork.git] / gcc / config / rs6000 / darwin-vecsave.asm
1 /*  This file contains the vector save and restore routines.
2  *
3  *   Copyright (C) 2004, 2009 Free Software Foundation, Inc.
4  * 
5  * This file is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by the
7  * Free Software Foundation; either version 3, or (at your option) any
8  * later version.
9  * 
10  * This file is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  * 
15  * Under Section 7 of GPL version 3, you are granted additional
16  * permissions described in the GCC Runtime Library Exception, version
17  * 3.1, as published by the Free Software Foundation.
18  *
19  * You should have received a copy of the GNU General Public License and
20  * a copy of the GCC Runtime Library Exception along with this program;
21  * see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
22  * <http://www.gnu.org/licenses/>.  */
23  */ 
24
25 /* Vector save/restore routines for Darwin.  Note that each vector
26    save/restore requires 2 instructions (8 bytes.)
27
28    THE SAVE AND RESTORE ROUTINES CAN HAVE ONLY ONE GLOBALLY VISIBLE
29    ENTRY POINT - callers have to jump to "saveFP+60" to save f29..f31,
30    for example.  For FP reg saves/restores, it takes one instruction
31    (4 bytes) to do the operation; for Vector regs, 2 instructions are
32    required (8 bytes.).   */
33
34         .machine ppc7400
35 .text
36         .align 2
37
38 .private_extern saveVEC
39 saveVEC:
40         li r11,-192
41         stvx v20,r11,r0
42         li r11,-176
43         stvx v21,r11,r0
44         li r11,-160
45         stvx v22,r11,r0
46         li r11,-144
47         stvx v23,r11,r0
48         li r11,-128
49         stvx v24,r11,r0
50         li r11,-112
51         stvx v25,r11,r0
52         li r11,-96
53         stvx v26,r11,r0
54         li r11,-80
55         stvx v27,r11,r0
56         li r11,-64
57         stvx v28,r11,r0
58         li r11,-48
59         stvx v29,r11,r0
60         li r11,-32
61         stvx v30,r11,r0
62         li r11,-16
63         stvx v31,r11,r0
64         blr
65
66 .private_extern restVEC
67 restVEC:
68         li r11,-192
69         lvx v20,r11,r0
70         li r11,-176
71         lvx v21,r11,r0
72         li r11,-160
73         lvx v22,r11,r0
74         li r11,-144
75         lvx v23,r11,r0
76         li r11,-128
77         lvx v24,r11,r0
78         li r11,-112
79         lvx v25,r11,r0
80         li r11,-96
81         lvx v26,r11,r0
82         li r11,-80
83         lvx v27,r11,r0
84         li r11,-64
85         lvx v28,r11,r0
86         li r11,-48
87         lvx v29,r11,r0
88         li r11,-32
89         lvx v30,r11,r0
90         li r11,-16
91         lvx v31,r11,r0
92         blr
93
94 /* saveVEC_vr11 -- as saveVEC but VRsave is returned in R11.  */
95
96 .private_extern saveVEC_vr11
97 saveVEC_vr11:
98         li r11,-192
99         stvx v20,r11,r0
100         li r11,-176
101         stvx v21,r11,r0
102         li r11,-160
103         stvx v22,r11,r0
104         li r11,-144
105         stvx v23,r11,r0
106         li r11,-128
107         stvx v24,r11,r0
108         li r11,-112
109         stvx v25,r11,r0
110         li r11,-96
111         stvx v26,r11,r0
112         li r11,-80
113         stvx v27,r11,r0
114         li r11,-64
115         stvx v28,r11,r0
116         li r11,-48
117         stvx v29,r11,r0
118         li r11,-32
119         stvx v30,r11,r0
120         li r11,-16
121         stvx v31,r11,r0
122         mfspr r11,VRsave
123         blr
124
125 /* As restVec, but the original VRsave value passed in R10.  */
126
127 .private_extern restVEC_vr10
128 restVEC_vr10:
129         li r11,-192
130         lvx v20,r11,r0
131         li r11,-176
132         lvx v21,r11,r0
133         li r11,-160
134         lvx v22,r11,r0
135         li r11,-144
136         lvx v23,r11,r0
137         li r11,-128
138         lvx v24,r11,r0
139         li r11,-112
140         lvx v25,r11,r0
141         li r11,-96
142         lvx v26,r11,r0
143         li r11,-80
144         lvx v27,r11,r0
145         li r11,-64
146         lvx v28,r11,r0
147         li r11,-48
148         lvx v29,r11,r0
149         li r11,-32
150         lvx v30,r11,r0
151         li r11,-16
152         lvx v31,r11,r0
153                                 /* restore VRsave from R10.  */
154         mtspr VRsave,r10
155         blr