1209513Simp/*  This file contains the vector save and restore routines.
2209513Simp *
3209552Simp *   Copyright (C) 2004 Free Software Foundation, Inc.
4209513Simp * 
5209513Simp * This file is free software; you can redistribute it and/or modify it
6209513Simp * under the terms of the GNU General Public License as published by the
7209513Simp * Free Software Foundation; either version 2, or (at your option) any
8209513Simp * later version.
9209513Simp * 
10209513Simp * In addition to the permissions in the GNU General Public License, the
11209513Simp * Free Software Foundation gives you unlimited permission to link the
12209513Simp * compiled version of this file with other programs, and to distribute
13209513Simp * those programs without any restriction coming from the use of this
14209513Simp * file.  (The General Public License restrictions do apply in other
15209513Simp * respects; for example, they cover modification of the file, and
16209513Simp * distribution when not linked into another program.)
17209513Simp * 
18209513Simp * This file is distributed in the hope that it will be useful, but
19209513Simp * WITHOUT ANY WARRANTY; without even the implied warranty of
20209513Simp * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21209513Simp * General Public License for more details.
22209513Simp * 
23209513Simp * You should have received a copy of the GNU General Public License
24209513Simp * along with this program; see the file COPYING.  If not, write to
25209513Simp * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
26209513Simp * Boston, MA 02110-1301, USA.
27209513Simp * 
28209513Simp *  As a special exception, if you link this library with files
29209513Simp *  compiled with GCC to produce an executable, this does not cause the
30209513Simp *  resulting executable to be covered by the GNU General Public License.
31209513Simp *  This exception does not however invalidate any other reasons why the
32209513Simp *  executable file might be covered by the GNU General Public License.
33209513Simp */ 
34220059Sjpaetzel
35209513Simp/* Vector save/restore routines for Darwin.  Note that each vector
36234985Sjpaetzel   save/restore requires 2 instructions (8 bytes.)
37209513Simp
38209513Simp   THE SAVE AND RESTORE ROUTINES CAN HAVE ONLY ONE GLOBALLY VISIBLE
39209513Simp   ENTRY POINT - callers have to jump to "saveFP+60" to save f29..f31,
40209513Simp   for example.  For FP reg saves/restores, it takes one instruction
41209513Simp   (4 bytes) to do the operation; for Vector regs, 2 instructions are
42209513Simp   required (8 bytes.).   */
43209513Simp
44209513Simp	.machine ppc7400
45209513Simp.text
46220059Sjpaetzel	.align 2
47209513Simp
48247705Sjpaetzel.private_extern saveVEC
49209513SimpsaveVEC:
50209513Simp	li r11,-192
51209513Simp	stvx v20,r11,r0
52209513Simp	li r11,-176
53209513Simp	stvx v21,r11,r0
54209513Simp	li r11,-160
55209513Simp	stvx v22,r11,r0
56209513Simp	li r11,-144
57209513Simp	stvx v23,r11,r0
58220059Sjpaetzel	li r11,-128
59209513Simp	stvx v24,r11,r0
60234985Sjpaetzel	li r11,-112
61209513Simp	stvx v25,r11,r0
62209513Simp	li r11,-96
63209513Simp	stvx v26,r11,r0
64209513Simp	li r11,-80
65209513Simp	stvx v27,r11,r0
66209513Simp	li r11,-64
67209513Simp	stvx v28,r11,r0
68209513Simp	li r11,-48
69209513Simp	stvx v29,r11,r0
70220059Sjpaetzel	li r11,-32
71209513Simp	stvx v30,r11,r0
72228990Suqs	li r11,-16
73209513Simp	stvx v31,r11,r0
74234985Sjpaetzel	blr
75209513Simp
76209513Simp.private_extern restVEC
77209513SimprestVEC:
78209513Simp	li r11,-192
79209513Simp	lvx v20,r11,r0
80209513Simp	li r11,-176
81209513Simp	lvx v21,r11,r0
82209513Simp	li r11,-160
83209513Simp	lvx v22,r11,r0
84209513Simp	li r11,-144
85212337Simp	lvx v23,r11,r0
86209513Simp	li r11,-128
87209513Simp	lvx v24,r11,r0
88209513Simp	li r11,-112
89209513Simp	lvx v25,r11,r0
90209513Simp	li r11,-96
91209513Simp	lvx v26,r11,r0
92209513Simp	li r11,-80
93209513Simp	lvx v27,r11,r0
94209513Simp	li r11,-64
95209513Simp	lvx v28,r11,r0
96209513Simp	li r11,-48
97209513Simp	lvx v29,r11,r0
98209513Simp	li r11,-32
99209513Simp	lvx v30,r11,r0
100209513Simp	li r11,-16
101209513Simp	lvx v31,r11,r0
102209513Simp	blr
103209513Simp
104220059Sjpaetzel/* saveVEC_vr11 -- as saveVEC but VRsave is returned in R11.  */
105209513Simp
106228990Suqs.private_extern saveVEC_vr11
107234985SjpaetzelsaveVEC_vr11:
108209513Simp	li r11,-192
109209513Simp	stvx v20,r11,r0
110209513Simp	li r11,-176
111209513Simp	stvx v21,r11,r0
112209513Simp	li r11,-160
113209513Simp	stvx v22,r11,r0
114209513Simp	li r11,-144
115209513Simp	stvx v23,r11,r0
116209513Simp	li r11,-128
117209513Simp	stvx v24,r11,r0
118209513Simp	li r11,-112
119209513Simp	stvx v25,r11,r0
120209513Simp	li r11,-96
121209513Simp	stvx v26,r11,r0
122209513Simp	li r11,-80
123209513Simp	stvx v27,r11,r0
124209513Simp	li r11,-64
125228990Suqs	stvx v28,r11,r0
126209513Simp	li r11,-48
127209513Simp	stvx v29,r11,r0
128209513Simp	li r11,-32
129220059Sjpaetzel	stvx v30,r11,r0
130209513Simp	li r11,-16
131209513Simp	stvx v31,r11,r0
132209513Simp	mfspr r11,VRsave
133220059Sjpaetzel	blr
134220059Sjpaetzel
135211730Simp/* As restVec, but the original VRsave value passed in R10.  */
136234985Sjpaetzel
137211730Simp.private_extern restVEC_vr10
138211730SimprestVEC_vr10:
139211730Simp	li r11,-192
140211730Simp	lvx v20,r11,r0
141211730Simp	li r11,-176
142211730Simp	lvx v21,r11,r0
143211730Simp	li r11,-160
144211730Simp	lvx v22,r11,r0
145211730Simp	li r11,-144
146209513Simp	lvx v23,r11,r0
147209513Simp	li r11,-128
148209513Simp	lvx v24,r11,r0
149209513Simp	li r11,-112
150209513Simp	lvx v25,r11,r0
151209513Simp	li r11,-96
152209513Simp	lvx v26,r11,r0
153209513Simp	li r11,-80
154209513Simp	lvx v27,r11,r0
155209513Simp	li r11,-64
156209513Simp	lvx v28,r11,r0
157209513Simp	li r11,-48
158209513Simp	lvx v29,r11,r0
159209513Simp	li r11,-32
160209513Simp	lvx v30,r11,r0
161209513Simp	li r11,-16
162209513Simp	lvx v31,r11,r0
163209513Simp				/* restore VRsave from R10.  */
164209513Simp	mtspr VRsave,r10
165209513Simp	blr
166209513Simp