root / target-ppc / op_mem.h @ 3c4c9f9f
History | View | Annotate | Download (33.2 kB)
1 | 76a66253 | j_mayer | /*
|
---|---|---|---|
2 | 76a66253 | j_mayer | * PowerPC emulation micro-operations for qemu.
|
3 | 76a66253 | j_mayer | *
|
4 | 76a66253 | j_mayer | * Copyright (c) 2003-2007 Jocelyn Mayer
|
5 | 76a66253 | j_mayer | *
|
6 | 76a66253 | j_mayer | * This library is free software; you can redistribute it and/or
|
7 | 76a66253 | j_mayer | * modify it under the terms of the GNU Lesser General Public
|
8 | 76a66253 | j_mayer | * License as published by the Free Software Foundation; either
|
9 | 76a66253 | j_mayer | * version 2 of the License, or (at your option) any later version.
|
10 | 76a66253 | j_mayer | *
|
11 | 76a66253 | j_mayer | * This library is distributed in the hope that it will be useful,
|
12 | 76a66253 | j_mayer | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 | 76a66253 | j_mayer | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14 | 76a66253 | j_mayer | * Lesser General Public License for more details.
|
15 | 76a66253 | j_mayer | *
|
16 | 76a66253 | j_mayer | * You should have received a copy of the GNU Lesser General Public
|
17 | 76a66253 | j_mayer | * License along with this library; if not, write to the Free Software
|
18 | 76a66253 | j_mayer | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
19 | 76a66253 | j_mayer | */
|
20 | 9a64fbe4 | bellard | |
21 | 0fa85d43 | bellard | static inline uint16_t glue(ld16r, MEMSUFFIX) (target_ulong EA) |
22 | 9a64fbe4 | bellard | { |
23 | ac9eb073 | bellard | uint16_t tmp = glue(lduw, MEMSUFFIX)(EA); |
24 | 9a64fbe4 | bellard | return ((tmp & 0xFF00) >> 8) | ((tmp & 0x00FF) << 8); |
25 | 9a64fbe4 | bellard | } |
26 | 9a64fbe4 | bellard | |
27 | 111bfab3 | bellard | static inline int32_t glue(ld16rs, MEMSUFFIX) (target_ulong EA) |
28 | 111bfab3 | bellard | { |
29 | 111bfab3 | bellard | int16_t tmp = glue(lduw, MEMSUFFIX)(EA); |
30 | 76a66253 | j_mayer | return (int16_t)((tmp & 0xFF00) >> 8) | ((tmp & 0x00FF) << 8); |
31 | 111bfab3 | bellard | } |
32 | 111bfab3 | bellard | |
33 | 0fa85d43 | bellard | static inline uint32_t glue(ld32r, MEMSUFFIX) (target_ulong EA) |
34 | 9a64fbe4 | bellard | { |
35 | ac9eb073 | bellard | uint32_t tmp = glue(ldl, MEMSUFFIX)(EA); |
36 | 9a64fbe4 | bellard | return ((tmp & 0xFF000000) >> 24) | ((tmp & 0x00FF0000) >> 8) | |
37 | 9a64fbe4 | bellard | ((tmp & 0x0000FF00) << 8) | ((tmp & 0x000000FF) << 24); |
38 | 9a64fbe4 | bellard | } |
39 | 9a64fbe4 | bellard | |
40 | 35cdaad6 | j_mayer | #if defined(TARGET_PPC64) || defined(TARGET_PPCEMB)
|
41 | d9bce9d9 | j_mayer | static inline uint64_t glue(ld64r, MEMSUFFIX) (target_ulong EA) |
42 | d9bce9d9 | j_mayer | { |
43 | d9bce9d9 | j_mayer | uint64_t tmp = glue(ldq, MEMSUFFIX)(EA); |
44 | d9bce9d9 | j_mayer | return ((tmp & 0xFF00000000000000ULL) >> 56) | |
45 | d9bce9d9 | j_mayer | ((tmp & 0x00FF000000000000ULL) >> 40) | |
46 | d9bce9d9 | j_mayer | ((tmp & 0x0000FF0000000000ULL) >> 24) | |
47 | d9bce9d9 | j_mayer | ((tmp & 0x000000FF00000000ULL) >> 8) | |
48 | d9bce9d9 | j_mayer | ((tmp & 0x00000000FF000000ULL) << 8) | |
49 | d9bce9d9 | j_mayer | ((tmp & 0x0000000000FF0000ULL) << 24) | |
50 | d9bce9d9 | j_mayer | ((tmp & 0x000000000000FF00ULL) << 40) | |
51 | d9bce9d9 | j_mayer | ((tmp & 0x00000000000000FFULL) << 54); |
52 | d9bce9d9 | j_mayer | } |
53 | 0487d6a8 | j_mayer | #endif
|
54 | 0487d6a8 | j_mayer | |
55 | 0487d6a8 | j_mayer | #if defined(TARGET_PPC64)
|
56 | 0487d6a8 | j_mayer | static inline int64_t glue(ldsl, MEMSUFFIX) (target_ulong EA) |
57 | 0487d6a8 | j_mayer | { |
58 | 0487d6a8 | j_mayer | return (int32_t)glue(ldl, MEMSUFFIX)(EA);
|
59 | 0487d6a8 | j_mayer | } |
60 | d9bce9d9 | j_mayer | |
61 | d9bce9d9 | j_mayer | static inline int64_t glue(ld32rs, MEMSUFFIX) (target_ulong EA) |
62 | d9bce9d9 | j_mayer | { |
63 | d9bce9d9 | j_mayer | uint32_t tmp = glue(ldl, MEMSUFFIX)(EA); |
64 | d9bce9d9 | j_mayer | return (int32_t)((tmp & 0xFF000000) >> 24) | ((tmp & 0x00FF0000) >> 8) | |
65 | d9bce9d9 | j_mayer | ((tmp & 0x0000FF00) << 8) | ((tmp & 0x000000FF) << 24); |
66 | d9bce9d9 | j_mayer | } |
67 | d9bce9d9 | j_mayer | #endif
|
68 | d9bce9d9 | j_mayer | |
69 | 0fa85d43 | bellard | static inline void glue(st16r, MEMSUFFIX) (target_ulong EA, uint16_t data) |
70 | 9a64fbe4 | bellard | { |
71 | 9a64fbe4 | bellard | uint16_t tmp = ((data & 0xFF00) >> 8) | ((data & 0x00FF) << 8); |
72 | ac9eb073 | bellard | glue(stw, MEMSUFFIX)(EA, tmp); |
73 | 9a64fbe4 | bellard | } |
74 | 9a64fbe4 | bellard | |
75 | 0fa85d43 | bellard | static inline void glue(st32r, MEMSUFFIX) (target_ulong EA, uint32_t data) |
76 | 9a64fbe4 | bellard | { |
77 | 9a64fbe4 | bellard | uint32_t tmp = ((data & 0xFF000000) >> 24) | ((data & 0x00FF0000) >> 8) | |
78 | 9a64fbe4 | bellard | ((data & 0x0000FF00) << 8) | ((data & 0x000000FF) << 24); |
79 | ac9eb073 | bellard | glue(stl, MEMSUFFIX)(EA, tmp); |
80 | 9a64fbe4 | bellard | } |
81 | 9a64fbe4 | bellard | |
82 | 35cdaad6 | j_mayer | #if defined(TARGET_PPC64) || defined(TARGET_PPCEMB)
|
83 | d9bce9d9 | j_mayer | static inline void glue(st64r, MEMSUFFIX) (target_ulong EA, uint64_t data) |
84 | d9bce9d9 | j_mayer | { |
85 | d9bce9d9 | j_mayer | uint64_t tmp = ((data & 0xFF00000000000000ULL) >> 56) | |
86 | d9bce9d9 | j_mayer | ((data & 0x00FF000000000000ULL) >> 40) | |
87 | d9bce9d9 | j_mayer | ((data & 0x0000FF0000000000ULL) >> 24) | |
88 | d9bce9d9 | j_mayer | ((data & 0x000000FF00000000ULL) >> 8) | |
89 | d9bce9d9 | j_mayer | ((data & 0x00000000FF000000ULL) << 8) | |
90 | d9bce9d9 | j_mayer | ((data & 0x0000000000FF0000ULL) << 24) | |
91 | d9bce9d9 | j_mayer | ((data & 0x000000000000FF00ULL) << 40) | |
92 | d9bce9d9 | j_mayer | ((data & 0x00000000000000FFULL) << 56); |
93 | d9bce9d9 | j_mayer | glue(stq, MEMSUFFIX)(EA, tmp); |
94 | d9bce9d9 | j_mayer | } |
95 | d9bce9d9 | j_mayer | #endif
|
96 | d9bce9d9 | j_mayer | |
97 | 9a64fbe4 | bellard | /*** Integer load ***/
|
98 | 9a64fbe4 | bellard | #define PPC_LD_OP(name, op) \
|
99 | d9bce9d9 | j_mayer | void OPPROTO glue(glue(op_l, name), MEMSUFFIX) (void) \ |
100 | 9a64fbe4 | bellard | { \ |
101 | d9bce9d9 | j_mayer | T1 = glue(op, MEMSUFFIX)((uint32_t)T0); \ |
102 | 9a64fbe4 | bellard | RETURN(); \ |
103 | 9a64fbe4 | bellard | } |
104 | 9a64fbe4 | bellard | |
105 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
106 | d9bce9d9 | j_mayer | #define PPC_LD_OP_64(name, op) \
|
107 | d9bce9d9 | j_mayer | void OPPROTO glue(glue(glue(op_l, name), _64), MEMSUFFIX) (void) \ |
108 | d9bce9d9 | j_mayer | { \ |
109 | d9bce9d9 | j_mayer | T1 = glue(op, MEMSUFFIX)((uint64_t)T0); \ |
110 | d9bce9d9 | j_mayer | RETURN(); \ |
111 | d9bce9d9 | j_mayer | } |
112 | d9bce9d9 | j_mayer | #endif
|
113 | d9bce9d9 | j_mayer | |
114 | 9a64fbe4 | bellard | #define PPC_ST_OP(name, op) \
|
115 | d9bce9d9 | j_mayer | void OPPROTO glue(glue(op_st, name), MEMSUFFIX) (void) \ |
116 | 9a64fbe4 | bellard | { \ |
117 | d9bce9d9 | j_mayer | glue(op, MEMSUFFIX)((uint32_t)T0, T1); \ |
118 | 9a64fbe4 | bellard | RETURN(); \ |
119 | 9a64fbe4 | bellard | } |
120 | 9a64fbe4 | bellard | |
121 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
122 | d9bce9d9 | j_mayer | #define PPC_ST_OP_64(name, op) \
|
123 | d9bce9d9 | j_mayer | void OPPROTO glue(glue(glue(op_st, name), _64), MEMSUFFIX) (void) \ |
124 | d9bce9d9 | j_mayer | { \ |
125 | d9bce9d9 | j_mayer | glue(op, MEMSUFFIX)((uint64_t)T0, T1); \ |
126 | d9bce9d9 | j_mayer | RETURN(); \ |
127 | d9bce9d9 | j_mayer | } |
128 | d9bce9d9 | j_mayer | #endif
|
129 | d9bce9d9 | j_mayer | |
130 | ac9eb073 | bellard | PPC_LD_OP(bz, ldub); |
131 | ac9eb073 | bellard | PPC_LD_OP(ha, ldsw); |
132 | ac9eb073 | bellard | PPC_LD_OP(hz, lduw); |
133 | ac9eb073 | bellard | PPC_LD_OP(wz, ldl); |
134 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
135 | d9bce9d9 | j_mayer | PPC_LD_OP(d, ldq); |
136 | d9bce9d9 | j_mayer | PPC_LD_OP(wa, ldsl); |
137 | d9bce9d9 | j_mayer | PPC_LD_OP_64(d, ldq); |
138 | d9bce9d9 | j_mayer | PPC_LD_OP_64(wa, ldsl); |
139 | d9bce9d9 | j_mayer | PPC_LD_OP_64(bz, ldub); |
140 | d9bce9d9 | j_mayer | PPC_LD_OP_64(ha, ldsw); |
141 | d9bce9d9 | j_mayer | PPC_LD_OP_64(hz, lduw); |
142 | d9bce9d9 | j_mayer | PPC_LD_OP_64(wz, ldl); |
143 | d9bce9d9 | j_mayer | #endif
|
144 | 9a64fbe4 | bellard | |
145 | 111bfab3 | bellard | PPC_LD_OP(ha_le, ld16rs); |
146 | 111bfab3 | bellard | PPC_LD_OP(hz_le, ld16r); |
147 | 111bfab3 | bellard | PPC_LD_OP(wz_le, ld32r); |
148 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
149 | d9bce9d9 | j_mayer | PPC_LD_OP(d_le, ld64r); |
150 | d9bce9d9 | j_mayer | PPC_LD_OP(wa_le, ld32rs); |
151 | d9bce9d9 | j_mayer | PPC_LD_OP_64(d_le, ld64r); |
152 | d9bce9d9 | j_mayer | PPC_LD_OP_64(wa_le, ld32rs); |
153 | d9bce9d9 | j_mayer | PPC_LD_OP_64(ha_le, ld16rs); |
154 | d9bce9d9 | j_mayer | PPC_LD_OP_64(hz_le, ld16r); |
155 | d9bce9d9 | j_mayer | PPC_LD_OP_64(wz_le, ld32r); |
156 | d9bce9d9 | j_mayer | #endif
|
157 | 111bfab3 | bellard | |
158 | 9a64fbe4 | bellard | /*** Integer store ***/
|
159 | ac9eb073 | bellard | PPC_ST_OP(b, stb); |
160 | ac9eb073 | bellard | PPC_ST_OP(h, stw); |
161 | ac9eb073 | bellard | PPC_ST_OP(w, stl); |
162 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
163 | d9bce9d9 | j_mayer | PPC_ST_OP(d, stq); |
164 | d9bce9d9 | j_mayer | PPC_ST_OP_64(d, stq); |
165 | d9bce9d9 | j_mayer | PPC_ST_OP_64(b, stb); |
166 | d9bce9d9 | j_mayer | PPC_ST_OP_64(h, stw); |
167 | d9bce9d9 | j_mayer | PPC_ST_OP_64(w, stl); |
168 | d9bce9d9 | j_mayer | #endif
|
169 | 9a64fbe4 | bellard | |
170 | 111bfab3 | bellard | PPC_ST_OP(h_le, st16r); |
171 | 111bfab3 | bellard | PPC_ST_OP(w_le, st32r); |
172 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
173 | d9bce9d9 | j_mayer | PPC_ST_OP(d_le, st64r); |
174 | d9bce9d9 | j_mayer | PPC_ST_OP_64(d_le, st64r); |
175 | d9bce9d9 | j_mayer | PPC_ST_OP_64(h_le, st16r); |
176 | d9bce9d9 | j_mayer | PPC_ST_OP_64(w_le, st32r); |
177 | d9bce9d9 | j_mayer | #endif
|
178 | 111bfab3 | bellard | |
179 | 9a64fbe4 | bellard | /*** Integer load and store with byte reverse ***/
|
180 | ac9eb073 | bellard | PPC_LD_OP(hbr, ld16r); |
181 | ac9eb073 | bellard | PPC_LD_OP(wbr, ld32r); |
182 | ac9eb073 | bellard | PPC_ST_OP(hbr, st16r); |
183 | ac9eb073 | bellard | PPC_ST_OP(wbr, st32r); |
184 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
185 | d9bce9d9 | j_mayer | PPC_LD_OP_64(hbr, ld16r); |
186 | d9bce9d9 | j_mayer | PPC_LD_OP_64(wbr, ld32r); |
187 | d9bce9d9 | j_mayer | PPC_ST_OP_64(hbr, st16r); |
188 | d9bce9d9 | j_mayer | PPC_ST_OP_64(wbr, st32r); |
189 | d9bce9d9 | j_mayer | #endif
|
190 | 9a64fbe4 | bellard | |
191 | 111bfab3 | bellard | PPC_LD_OP(hbr_le, lduw); |
192 | 111bfab3 | bellard | PPC_LD_OP(wbr_le, ldl); |
193 | 111bfab3 | bellard | PPC_ST_OP(hbr_le, stw); |
194 | 111bfab3 | bellard | PPC_ST_OP(wbr_le, stl); |
195 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
196 | d9bce9d9 | j_mayer | PPC_LD_OP_64(hbr_le, lduw); |
197 | d9bce9d9 | j_mayer | PPC_LD_OP_64(wbr_le, ldl); |
198 | d9bce9d9 | j_mayer | PPC_ST_OP_64(hbr_le, stw); |
199 | d9bce9d9 | j_mayer | PPC_ST_OP_64(wbr_le, stl); |
200 | d9bce9d9 | j_mayer | #endif
|
201 | 111bfab3 | bellard | |
202 | 9a64fbe4 | bellard | /*** Integer load and store multiple ***/
|
203 | d9bce9d9 | j_mayer | void OPPROTO glue(op_lmw, MEMSUFFIX) (void) |
204 | 9a64fbe4 | bellard | { |
205 | 76a66253 | j_mayer | glue(do_lmw, MEMSUFFIX)(PARAM1); |
206 | 9a64fbe4 | bellard | RETURN(); |
207 | 9a64fbe4 | bellard | } |
208 | 9a64fbe4 | bellard | |
209 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
210 | d9bce9d9 | j_mayer | void OPPROTO glue(op_lmw_64, MEMSUFFIX) (void) |
211 | d9bce9d9 | j_mayer | { |
212 | d9bce9d9 | j_mayer | glue(do_lmw_64, MEMSUFFIX)(PARAM1); |
213 | d9bce9d9 | j_mayer | RETURN(); |
214 | d9bce9d9 | j_mayer | } |
215 | d9bce9d9 | j_mayer | #endif
|
216 | d9bce9d9 | j_mayer | |
217 | d9bce9d9 | j_mayer | void OPPROTO glue(op_lmw_le, MEMSUFFIX) (void) |
218 | 9a64fbe4 | bellard | { |
219 | 76a66253 | j_mayer | glue(do_lmw_le, MEMSUFFIX)(PARAM1); |
220 | 9a64fbe4 | bellard | RETURN(); |
221 | 9a64fbe4 | bellard | } |
222 | 9a64fbe4 | bellard | |
223 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
224 | d9bce9d9 | j_mayer | void OPPROTO glue(op_lmw_le_64, MEMSUFFIX) (void) |
225 | d9bce9d9 | j_mayer | { |
226 | d9bce9d9 | j_mayer | glue(do_lmw_le_64, MEMSUFFIX)(PARAM1); |
227 | d9bce9d9 | j_mayer | RETURN(); |
228 | d9bce9d9 | j_mayer | } |
229 | d9bce9d9 | j_mayer | #endif
|
230 | d9bce9d9 | j_mayer | |
231 | d9bce9d9 | j_mayer | void OPPROTO glue(op_stmw, MEMSUFFIX) (void) |
232 | 111bfab3 | bellard | { |
233 | 76a66253 | j_mayer | glue(do_stmw, MEMSUFFIX)(PARAM1); |
234 | 111bfab3 | bellard | RETURN(); |
235 | 111bfab3 | bellard | } |
236 | 111bfab3 | bellard | |
237 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
238 | d9bce9d9 | j_mayer | void OPPROTO glue(op_stmw_64, MEMSUFFIX) (void) |
239 | d9bce9d9 | j_mayer | { |
240 | d9bce9d9 | j_mayer | glue(do_stmw_64, MEMSUFFIX)(PARAM1); |
241 | d9bce9d9 | j_mayer | RETURN(); |
242 | d9bce9d9 | j_mayer | } |
243 | d9bce9d9 | j_mayer | #endif
|
244 | d9bce9d9 | j_mayer | |
245 | d9bce9d9 | j_mayer | void OPPROTO glue(op_stmw_le, MEMSUFFIX) (void) |
246 | 111bfab3 | bellard | { |
247 | 76a66253 | j_mayer | glue(do_stmw_le, MEMSUFFIX)(PARAM1); |
248 | 111bfab3 | bellard | RETURN(); |
249 | 111bfab3 | bellard | } |
250 | 111bfab3 | bellard | |
251 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
252 | d9bce9d9 | j_mayer | void OPPROTO glue(op_stmw_le_64, MEMSUFFIX) (void) |
253 | d9bce9d9 | j_mayer | { |
254 | d9bce9d9 | j_mayer | glue(do_stmw_le_64, MEMSUFFIX)(PARAM1); |
255 | d9bce9d9 | j_mayer | RETURN(); |
256 | d9bce9d9 | j_mayer | } |
257 | d9bce9d9 | j_mayer | #endif
|
258 | d9bce9d9 | j_mayer | |
259 | 9a64fbe4 | bellard | /*** Integer load and store strings ***/
|
260 | d9bce9d9 | j_mayer | void OPPROTO glue(op_lswi, MEMSUFFIX) (void) |
261 | d9bce9d9 | j_mayer | { |
262 | d9bce9d9 | j_mayer | glue(do_lsw, MEMSUFFIX)(PARAM1); |
263 | d9bce9d9 | j_mayer | RETURN(); |
264 | d9bce9d9 | j_mayer | } |
265 | d9bce9d9 | j_mayer | |
266 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
267 | d9bce9d9 | j_mayer | void OPPROTO glue(op_lswi_64, MEMSUFFIX) (void) |
268 | 9a64fbe4 | bellard | { |
269 | d9bce9d9 | j_mayer | glue(do_lsw_64, MEMSUFFIX)(PARAM1); |
270 | 9a64fbe4 | bellard | RETURN(); |
271 | 9a64fbe4 | bellard | } |
272 | d9bce9d9 | j_mayer | #endif
|
273 | 9a64fbe4 | bellard | |
274 | d9bce9d9 | j_mayer | void OPPROTO glue(op_lswi_le, MEMSUFFIX) (void) |
275 | 111bfab3 | bellard | { |
276 | d9bce9d9 | j_mayer | glue(do_lsw_le, MEMSUFFIX)(PARAM1); |
277 | 111bfab3 | bellard | RETURN(); |
278 | 111bfab3 | bellard | } |
279 | 111bfab3 | bellard | |
280 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
281 | d9bce9d9 | j_mayer | void OPPROTO glue(op_lswi_le_64, MEMSUFFIX) (void) |
282 | d9bce9d9 | j_mayer | { |
283 | d9bce9d9 | j_mayer | glue(do_lsw_le_64, MEMSUFFIX)(PARAM1); |
284 | d9bce9d9 | j_mayer | RETURN(); |
285 | d9bce9d9 | j_mayer | } |
286 | d9bce9d9 | j_mayer | #endif
|
287 | d9bce9d9 | j_mayer | |
288 | 9a64fbe4 | bellard | /* PPC32 specification says we must generate an exception if
|
289 | 9a64fbe4 | bellard | * rA is in the range of registers to be loaded.
|
290 | 9a64fbe4 | bellard | * In an other hand, IBM says this is valid, but rA won't be loaded.
|
291 | 9a64fbe4 | bellard | * For now, I'll follow the spec...
|
292 | 9a64fbe4 | bellard | */
|
293 | d9bce9d9 | j_mayer | void OPPROTO glue(op_lswx, MEMSUFFIX) (void) |
294 | d9bce9d9 | j_mayer | { |
295 | d9bce9d9 | j_mayer | /* Note: T1 comes from xer_bc then no cast is needed */
|
296 | d9bce9d9 | j_mayer | if (likely(T1 != 0)) { |
297 | d9bce9d9 | j_mayer | if (unlikely((PARAM1 < PARAM2 && (PARAM1 + T1) > PARAM2) ||
|
298 | d9bce9d9 | j_mayer | (PARAM1 < PARAM3 && (PARAM1 + T1) > PARAM3))) { |
299 | d9bce9d9 | j_mayer | do_raise_exception_err(EXCP_PROGRAM, EXCP_INVAL | EXCP_INVAL_LSWX); |
300 | d9bce9d9 | j_mayer | } else {
|
301 | d9bce9d9 | j_mayer | glue(do_lsw, MEMSUFFIX)(PARAM1); |
302 | d9bce9d9 | j_mayer | } |
303 | d9bce9d9 | j_mayer | } |
304 | d9bce9d9 | j_mayer | RETURN(); |
305 | d9bce9d9 | j_mayer | } |
306 | d9bce9d9 | j_mayer | |
307 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
308 | d9bce9d9 | j_mayer | void OPPROTO glue(op_lswx_64, MEMSUFFIX) (void) |
309 | d9bce9d9 | j_mayer | { |
310 | d9bce9d9 | j_mayer | /* Note: T1 comes from xer_bc then no cast is needed */
|
311 | d9bce9d9 | j_mayer | if (likely(T1 != 0)) { |
312 | d9bce9d9 | j_mayer | if (unlikely((PARAM1 < PARAM2 && (PARAM1 + T1) > PARAM2) ||
|
313 | d9bce9d9 | j_mayer | (PARAM1 < PARAM3 && (PARAM1 + T1) > PARAM3))) { |
314 | d9bce9d9 | j_mayer | do_raise_exception_err(EXCP_PROGRAM, EXCP_INVAL | EXCP_INVAL_LSWX); |
315 | d9bce9d9 | j_mayer | } else {
|
316 | d9bce9d9 | j_mayer | glue(do_lsw_64, MEMSUFFIX)(PARAM1); |
317 | d9bce9d9 | j_mayer | } |
318 | d9bce9d9 | j_mayer | } |
319 | d9bce9d9 | j_mayer | RETURN(); |
320 | d9bce9d9 | j_mayer | } |
321 | d9bce9d9 | j_mayer | #endif
|
322 | d9bce9d9 | j_mayer | |
323 | d9bce9d9 | j_mayer | void OPPROTO glue(op_lswx_le, MEMSUFFIX) (void) |
324 | 9a64fbe4 | bellard | { |
325 | d9bce9d9 | j_mayer | /* Note: T1 comes from xer_bc then no cast is needed */
|
326 | d9bce9d9 | j_mayer | if (likely(T1 != 0)) { |
327 | 76a66253 | j_mayer | if (unlikely((PARAM1 < PARAM2 && (PARAM1 + T1) > PARAM2) ||
|
328 | 76a66253 | j_mayer | (PARAM1 < PARAM3 && (PARAM1 + T1) > PARAM3))) { |
329 | 9fddaa0c | bellard | do_raise_exception_err(EXCP_PROGRAM, EXCP_INVAL | EXCP_INVAL_LSWX); |
330 | 9a64fbe4 | bellard | } else {
|
331 | d9bce9d9 | j_mayer | glue(do_lsw_le, MEMSUFFIX)(PARAM1); |
332 | 9a64fbe4 | bellard | } |
333 | 9a64fbe4 | bellard | } |
334 | 9a64fbe4 | bellard | RETURN(); |
335 | 9a64fbe4 | bellard | } |
336 | 9a64fbe4 | bellard | |
337 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
338 | d9bce9d9 | j_mayer | void OPPROTO glue(op_lswx_le_64, MEMSUFFIX) (void) |
339 | 111bfab3 | bellard | { |
340 | d9bce9d9 | j_mayer | /* Note: T1 comes from xer_bc then no cast is needed */
|
341 | d9bce9d9 | j_mayer | if (likely(T1 != 0)) { |
342 | 76a66253 | j_mayer | if (unlikely((PARAM1 < PARAM2 && (PARAM1 + T1) > PARAM2) ||
|
343 | 76a66253 | j_mayer | (PARAM1 < PARAM3 && (PARAM1 + T1) > PARAM3))) { |
344 | 111bfab3 | bellard | do_raise_exception_err(EXCP_PROGRAM, EXCP_INVAL | EXCP_INVAL_LSWX); |
345 | 111bfab3 | bellard | } else {
|
346 | d9bce9d9 | j_mayer | glue(do_lsw_le_64, MEMSUFFIX)(PARAM1); |
347 | 111bfab3 | bellard | } |
348 | 111bfab3 | bellard | } |
349 | 111bfab3 | bellard | RETURN(); |
350 | 111bfab3 | bellard | } |
351 | d9bce9d9 | j_mayer | #endif
|
352 | d9bce9d9 | j_mayer | |
353 | d9bce9d9 | j_mayer | void OPPROTO glue(op_stsw, MEMSUFFIX) (void) |
354 | d9bce9d9 | j_mayer | { |
355 | d9bce9d9 | j_mayer | glue(do_stsw, MEMSUFFIX)(PARAM1); |
356 | d9bce9d9 | j_mayer | RETURN(); |
357 | d9bce9d9 | j_mayer | } |
358 | d9bce9d9 | j_mayer | |
359 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
360 | d9bce9d9 | j_mayer | void OPPROTO glue(op_stsw_64, MEMSUFFIX) (void) |
361 | d9bce9d9 | j_mayer | { |
362 | d9bce9d9 | j_mayer | glue(do_stsw_64, MEMSUFFIX)(PARAM1); |
363 | d9bce9d9 | j_mayer | RETURN(); |
364 | d9bce9d9 | j_mayer | } |
365 | d9bce9d9 | j_mayer | #endif
|
366 | 111bfab3 | bellard | |
367 | d9bce9d9 | j_mayer | void OPPROTO glue(op_stsw_le, MEMSUFFIX) (void) |
368 | 9a64fbe4 | bellard | { |
369 | d9bce9d9 | j_mayer | glue(do_stsw_le, MEMSUFFIX)(PARAM1); |
370 | 9a64fbe4 | bellard | RETURN(); |
371 | 9a64fbe4 | bellard | } |
372 | 9a64fbe4 | bellard | |
373 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
374 | d9bce9d9 | j_mayer | void OPPROTO glue(op_stsw_le_64, MEMSUFFIX) (void) |
375 | 111bfab3 | bellard | { |
376 | d9bce9d9 | j_mayer | glue(do_stsw_le_64, MEMSUFFIX)(PARAM1); |
377 | 111bfab3 | bellard | RETURN(); |
378 | 111bfab3 | bellard | } |
379 | d9bce9d9 | j_mayer | #endif
|
380 | 111bfab3 | bellard | |
381 | 9a64fbe4 | bellard | /*** Floating-point store ***/
|
382 | 9a64fbe4 | bellard | #define PPC_STF_OP(name, op) \
|
383 | d9bce9d9 | j_mayer | void OPPROTO glue(glue(op_st, name), MEMSUFFIX) (void) \ |
384 | d9bce9d9 | j_mayer | { \ |
385 | d9bce9d9 | j_mayer | glue(op, MEMSUFFIX)((uint32_t)T0, FT0); \ |
386 | d9bce9d9 | j_mayer | RETURN(); \ |
387 | d9bce9d9 | j_mayer | } |
388 | d9bce9d9 | j_mayer | |
389 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
390 | d9bce9d9 | j_mayer | #define PPC_STF_OP_64(name, op) \
|
391 | d9bce9d9 | j_mayer | void OPPROTO glue(glue(glue(op_st, name), _64), MEMSUFFIX) (void) \ |
392 | 9a64fbe4 | bellard | { \ |
393 | d9bce9d9 | j_mayer | glue(op, MEMSUFFIX)((uint64_t)T0, FT0); \ |
394 | 9a64fbe4 | bellard | RETURN(); \ |
395 | 9a64fbe4 | bellard | } |
396 | d9bce9d9 | j_mayer | #endif
|
397 | 9a64fbe4 | bellard | |
398 | 9a64fbe4 | bellard | PPC_STF_OP(fd, stfq); |
399 | 9a64fbe4 | bellard | PPC_STF_OP(fs, stfl); |
400 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
401 | d9bce9d9 | j_mayer | PPC_STF_OP_64(fd, stfq); |
402 | d9bce9d9 | j_mayer | PPC_STF_OP_64(fs, stfl); |
403 | d9bce9d9 | j_mayer | #endif
|
404 | 9a64fbe4 | bellard | |
405 | 111bfab3 | bellard | static inline void glue(stfqr, MEMSUFFIX) (target_ulong EA, double d) |
406 | 111bfab3 | bellard | { |
407 | 111bfab3 | bellard | union {
|
408 | 111bfab3 | bellard | double d;
|
409 | 111bfab3 | bellard | uint64_t u; |
410 | 111bfab3 | bellard | } u; |
411 | 111bfab3 | bellard | |
412 | 111bfab3 | bellard | u.d = d; |
413 | 111bfab3 | bellard | u.u = ((u.u & 0xFF00000000000000ULL) >> 56) | |
414 | 111bfab3 | bellard | ((u.u & 0x00FF000000000000ULL) >> 40) | |
415 | 111bfab3 | bellard | ((u.u & 0x0000FF0000000000ULL) >> 24) | |
416 | 111bfab3 | bellard | ((u.u & 0x000000FF00000000ULL) >> 8) | |
417 | 111bfab3 | bellard | ((u.u & 0x00000000FF000000ULL) << 8) | |
418 | 111bfab3 | bellard | ((u.u & 0x0000000000FF0000ULL) << 24) | |
419 | 111bfab3 | bellard | ((u.u & 0x000000000000FF00ULL) << 40) | |
420 | 111bfab3 | bellard | ((u.u & 0x00000000000000FFULL) << 56); |
421 | 111bfab3 | bellard | glue(stfq, MEMSUFFIX)(EA, u.d); |
422 | 111bfab3 | bellard | } |
423 | 111bfab3 | bellard | |
424 | 111bfab3 | bellard | static inline void glue(stflr, MEMSUFFIX) (target_ulong EA, float f) |
425 | 111bfab3 | bellard | { |
426 | 111bfab3 | bellard | union {
|
427 | 111bfab3 | bellard | float f;
|
428 | 111bfab3 | bellard | uint32_t u; |
429 | 111bfab3 | bellard | } u; |
430 | 111bfab3 | bellard | |
431 | 111bfab3 | bellard | u.f = f; |
432 | 111bfab3 | bellard | u.u = ((u.u & 0xFF000000UL) >> 24) | |
433 | 111bfab3 | bellard | ((u.u & 0x00FF0000ULL) >> 8) | |
434 | 111bfab3 | bellard | ((u.u & 0x0000FF00UL) << 8) | |
435 | 111bfab3 | bellard | ((u.u & 0x000000FFULL) << 24); |
436 | 111bfab3 | bellard | glue(stfl, MEMSUFFIX)(EA, u.f); |
437 | 111bfab3 | bellard | } |
438 | 111bfab3 | bellard | |
439 | 111bfab3 | bellard | PPC_STF_OP(fd_le, stfqr); |
440 | 111bfab3 | bellard | PPC_STF_OP(fs_le, stflr); |
441 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
442 | d9bce9d9 | j_mayer | PPC_STF_OP_64(fd_le, stfqr); |
443 | d9bce9d9 | j_mayer | PPC_STF_OP_64(fs_le, stflr); |
444 | d9bce9d9 | j_mayer | #endif
|
445 | 111bfab3 | bellard | |
446 | 9a64fbe4 | bellard | /*** Floating-point load ***/
|
447 | 9a64fbe4 | bellard | #define PPC_LDF_OP(name, op) \
|
448 | d9bce9d9 | j_mayer | void OPPROTO glue(glue(op_l, name), MEMSUFFIX) (void) \ |
449 | d9bce9d9 | j_mayer | { \ |
450 | d9bce9d9 | j_mayer | FT0 = glue(op, MEMSUFFIX)((uint32_t)T0); \ |
451 | d9bce9d9 | j_mayer | RETURN(); \ |
452 | d9bce9d9 | j_mayer | } |
453 | d9bce9d9 | j_mayer | |
454 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
455 | d9bce9d9 | j_mayer | #define PPC_LDF_OP_64(name, op) \
|
456 | d9bce9d9 | j_mayer | void OPPROTO glue(glue(glue(op_l, name), _64), MEMSUFFIX) (void) \ |
457 | 9a64fbe4 | bellard | { \ |
458 | d9bce9d9 | j_mayer | FT0 = glue(op, MEMSUFFIX)((uint64_t)T0); \ |
459 | 9a64fbe4 | bellard | RETURN(); \ |
460 | 9a64fbe4 | bellard | } |
461 | d9bce9d9 | j_mayer | #endif
|
462 | 9a64fbe4 | bellard | |
463 | 9a64fbe4 | bellard | PPC_LDF_OP(fd, ldfq); |
464 | 9a64fbe4 | bellard | PPC_LDF_OP(fs, ldfl); |
465 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
466 | d9bce9d9 | j_mayer | PPC_LDF_OP_64(fd, ldfq); |
467 | d9bce9d9 | j_mayer | PPC_LDF_OP_64(fs, ldfl); |
468 | d9bce9d9 | j_mayer | #endif
|
469 | 9a64fbe4 | bellard | |
470 | 111bfab3 | bellard | static inline double glue(ldfqr, MEMSUFFIX) (target_ulong EA) |
471 | 111bfab3 | bellard | { |
472 | 111bfab3 | bellard | union {
|
473 | 111bfab3 | bellard | double d;
|
474 | 111bfab3 | bellard | uint64_t u; |
475 | 111bfab3 | bellard | } u; |
476 | 111bfab3 | bellard | |
477 | 111bfab3 | bellard | u.d = glue(ldfq, MEMSUFFIX)(EA); |
478 | 111bfab3 | bellard | u.u = ((u.u & 0xFF00000000000000ULL) >> 56) | |
479 | 111bfab3 | bellard | ((u.u & 0x00FF000000000000ULL) >> 40) | |
480 | 111bfab3 | bellard | ((u.u & 0x0000FF0000000000ULL) >> 24) | |
481 | 111bfab3 | bellard | ((u.u & 0x000000FF00000000ULL) >> 8) | |
482 | 111bfab3 | bellard | ((u.u & 0x00000000FF000000ULL) << 8) | |
483 | 111bfab3 | bellard | ((u.u & 0x0000000000FF0000ULL) << 24) | |
484 | 111bfab3 | bellard | ((u.u & 0x000000000000FF00ULL) << 40) | |
485 | 111bfab3 | bellard | ((u.u & 0x00000000000000FFULL) << 56); |
486 | 111bfab3 | bellard | |
487 | 111bfab3 | bellard | return u.d;
|
488 | 111bfab3 | bellard | } |
489 | 111bfab3 | bellard | |
490 | 111bfab3 | bellard | static inline float glue(ldflr, MEMSUFFIX) (target_ulong EA) |
491 | 111bfab3 | bellard | { |
492 | 111bfab3 | bellard | union {
|
493 | 111bfab3 | bellard | float f;
|
494 | 111bfab3 | bellard | uint32_t u; |
495 | 111bfab3 | bellard | } u; |
496 | 111bfab3 | bellard | |
497 | 111bfab3 | bellard | u.f = glue(ldfl, MEMSUFFIX)(EA); |
498 | 111bfab3 | bellard | u.u = ((u.u & 0xFF000000UL) >> 24) | |
499 | 111bfab3 | bellard | ((u.u & 0x00FF0000ULL) >> 8) | |
500 | 111bfab3 | bellard | ((u.u & 0x0000FF00UL) << 8) | |
501 | 111bfab3 | bellard | ((u.u & 0x000000FFULL) << 24); |
502 | 111bfab3 | bellard | |
503 | 111bfab3 | bellard | return u.f;
|
504 | 111bfab3 | bellard | } |
505 | 111bfab3 | bellard | |
506 | 111bfab3 | bellard | PPC_LDF_OP(fd_le, ldfqr); |
507 | 111bfab3 | bellard | PPC_LDF_OP(fs_le, ldflr); |
508 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
509 | d9bce9d9 | j_mayer | PPC_LDF_OP_64(fd_le, ldfqr); |
510 | d9bce9d9 | j_mayer | PPC_LDF_OP_64(fs_le, ldflr); |
511 | d9bce9d9 | j_mayer | #endif
|
512 | 111bfab3 | bellard | |
513 | 985a19d6 | bellard | /* Load and set reservation */
|
514 | d9bce9d9 | j_mayer | void OPPROTO glue(op_lwarx, MEMSUFFIX) (void) |
515 | d9bce9d9 | j_mayer | { |
516 | d9bce9d9 | j_mayer | if (unlikely(T0 & 0x03)) { |
517 | d9bce9d9 | j_mayer | do_raise_exception(EXCP_ALIGN); |
518 | d9bce9d9 | j_mayer | } else {
|
519 | d9bce9d9 | j_mayer | T1 = glue(ldl, MEMSUFFIX)((uint32_t)T0); |
520 | d9bce9d9 | j_mayer | regs->reserve = (uint32_t)T0; |
521 | d9bce9d9 | j_mayer | } |
522 | d9bce9d9 | j_mayer | RETURN(); |
523 | d9bce9d9 | j_mayer | } |
524 | d9bce9d9 | j_mayer | |
525 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
526 | d9bce9d9 | j_mayer | void OPPROTO glue(op_lwarx_64, MEMSUFFIX) (void) |
527 | d9bce9d9 | j_mayer | { |
528 | d9bce9d9 | j_mayer | if (unlikely(T0 & 0x03)) { |
529 | d9bce9d9 | j_mayer | do_raise_exception(EXCP_ALIGN); |
530 | d9bce9d9 | j_mayer | } else {
|
531 | d9bce9d9 | j_mayer | T1 = glue(ldl, MEMSUFFIX)((uint64_t)T0); |
532 | d9bce9d9 | j_mayer | regs->reserve = (uint64_t)T0; |
533 | d9bce9d9 | j_mayer | } |
534 | d9bce9d9 | j_mayer | RETURN(); |
535 | d9bce9d9 | j_mayer | } |
536 | d9bce9d9 | j_mayer | |
537 | 426613db | j_mayer | void OPPROTO glue(op_ldarx, MEMSUFFIX) (void) |
538 | 426613db | j_mayer | { |
539 | 426613db | j_mayer | if (unlikely(T0 & 0x03)) { |
540 | 426613db | j_mayer | do_raise_exception(EXCP_ALIGN); |
541 | 426613db | j_mayer | } else {
|
542 | 426613db | j_mayer | T1 = glue(ldq, MEMSUFFIX)((uint32_t)T0); |
543 | 426613db | j_mayer | regs->reserve = (uint32_t)T0; |
544 | 426613db | j_mayer | } |
545 | 426613db | j_mayer | RETURN(); |
546 | 426613db | j_mayer | } |
547 | 426613db | j_mayer | |
548 | d9bce9d9 | j_mayer | void OPPROTO glue(op_ldarx_64, MEMSUFFIX) (void) |
549 | d9bce9d9 | j_mayer | { |
550 | d9bce9d9 | j_mayer | if (unlikely(T0 & 0x03)) { |
551 | d9bce9d9 | j_mayer | do_raise_exception(EXCP_ALIGN); |
552 | d9bce9d9 | j_mayer | } else {
|
553 | d9bce9d9 | j_mayer | T1 = glue(ldq, MEMSUFFIX)((uint64_t)T0); |
554 | d9bce9d9 | j_mayer | regs->reserve = (uint64_t)T0; |
555 | d9bce9d9 | j_mayer | } |
556 | d9bce9d9 | j_mayer | RETURN(); |
557 | d9bce9d9 | j_mayer | } |
558 | d9bce9d9 | j_mayer | #endif
|
559 | d9bce9d9 | j_mayer | |
560 | d9bce9d9 | j_mayer | void OPPROTO glue(op_lwarx_le, MEMSUFFIX) (void) |
561 | d9bce9d9 | j_mayer | { |
562 | d9bce9d9 | j_mayer | if (unlikely(T0 & 0x03)) { |
563 | d9bce9d9 | j_mayer | do_raise_exception(EXCP_ALIGN); |
564 | d9bce9d9 | j_mayer | } else {
|
565 | d9bce9d9 | j_mayer | T1 = glue(ld32r, MEMSUFFIX)((uint32_t)T0); |
566 | d9bce9d9 | j_mayer | regs->reserve = (uint32_t)T0; |
567 | d9bce9d9 | j_mayer | } |
568 | d9bce9d9 | j_mayer | RETURN(); |
569 | d9bce9d9 | j_mayer | } |
570 | d9bce9d9 | j_mayer | |
571 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
572 | d9bce9d9 | j_mayer | void OPPROTO glue(op_lwarx_le_64, MEMSUFFIX) (void) |
573 | 985a19d6 | bellard | { |
574 | 76a66253 | j_mayer | if (unlikely(T0 & 0x03)) { |
575 | 9fddaa0c | bellard | do_raise_exception(EXCP_ALIGN); |
576 | 985a19d6 | bellard | } else {
|
577 | d9bce9d9 | j_mayer | T1 = glue(ld32r, MEMSUFFIX)((uint64_t)T0); |
578 | d9bce9d9 | j_mayer | regs->reserve = (uint64_t)T0; |
579 | 985a19d6 | bellard | } |
580 | 985a19d6 | bellard | RETURN(); |
581 | 985a19d6 | bellard | } |
582 | 985a19d6 | bellard | |
583 | 426613db | j_mayer | void OPPROTO glue(op_ldarx_le, MEMSUFFIX) (void) |
584 | 426613db | j_mayer | { |
585 | 426613db | j_mayer | if (unlikely(T0 & 0x03)) { |
586 | 426613db | j_mayer | do_raise_exception(EXCP_ALIGN); |
587 | 426613db | j_mayer | } else {
|
588 | 426613db | j_mayer | T1 = glue(ld64r, MEMSUFFIX)((uint32_t)T0); |
589 | 426613db | j_mayer | regs->reserve = (uint32_t)T0; |
590 | 426613db | j_mayer | } |
591 | 426613db | j_mayer | RETURN(); |
592 | 426613db | j_mayer | } |
593 | 426613db | j_mayer | |
594 | d9bce9d9 | j_mayer | void OPPROTO glue(op_ldarx_le_64, MEMSUFFIX) (void) |
595 | 111bfab3 | bellard | { |
596 | 76a66253 | j_mayer | if (unlikely(T0 & 0x03)) { |
597 | 111bfab3 | bellard | do_raise_exception(EXCP_ALIGN); |
598 | 111bfab3 | bellard | } else {
|
599 | d9bce9d9 | j_mayer | T1 = glue(ld64r, MEMSUFFIX)((uint64_t)T0); |
600 | d9bce9d9 | j_mayer | regs->reserve = (uint64_t)T0; |
601 | 111bfab3 | bellard | } |
602 | 111bfab3 | bellard | RETURN(); |
603 | 111bfab3 | bellard | } |
604 | d9bce9d9 | j_mayer | #endif
|
605 | 111bfab3 | bellard | |
606 | 9a64fbe4 | bellard | /* Store with reservation */
|
607 | d9bce9d9 | j_mayer | void OPPROTO glue(op_stwcx, MEMSUFFIX) (void) |
608 | d9bce9d9 | j_mayer | { |
609 | d9bce9d9 | j_mayer | if (unlikely(T0 & 0x03)) { |
610 | d9bce9d9 | j_mayer | do_raise_exception(EXCP_ALIGN); |
611 | d9bce9d9 | j_mayer | } else {
|
612 | d9bce9d9 | j_mayer | if (unlikely(regs->reserve != (uint32_t)T0)) {
|
613 | d9bce9d9 | j_mayer | env->crf[0] = xer_ov;
|
614 | d9bce9d9 | j_mayer | } else {
|
615 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)T0, T1); |
616 | d9bce9d9 | j_mayer | env->crf[0] = xer_ov | 0x02; |
617 | d9bce9d9 | j_mayer | } |
618 | d9bce9d9 | j_mayer | } |
619 | d9bce9d9 | j_mayer | regs->reserve = -1;
|
620 | d9bce9d9 | j_mayer | RETURN(); |
621 | d9bce9d9 | j_mayer | } |
622 | d9bce9d9 | j_mayer | |
623 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
624 | d9bce9d9 | j_mayer | void OPPROTO glue(op_stwcx_64, MEMSUFFIX) (void) |
625 | d9bce9d9 | j_mayer | { |
626 | d9bce9d9 | j_mayer | if (unlikely(T0 & 0x03)) { |
627 | d9bce9d9 | j_mayer | do_raise_exception(EXCP_ALIGN); |
628 | d9bce9d9 | j_mayer | } else {
|
629 | d9bce9d9 | j_mayer | if (unlikely(regs->reserve != (uint64_t)T0)) {
|
630 | d9bce9d9 | j_mayer | env->crf[0] = xer_ov;
|
631 | d9bce9d9 | j_mayer | } else {
|
632 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)T0, T1); |
633 | d9bce9d9 | j_mayer | env->crf[0] = xer_ov | 0x02; |
634 | d9bce9d9 | j_mayer | } |
635 | d9bce9d9 | j_mayer | } |
636 | d9bce9d9 | j_mayer | regs->reserve = -1;
|
637 | d9bce9d9 | j_mayer | RETURN(); |
638 | d9bce9d9 | j_mayer | } |
639 | d9bce9d9 | j_mayer | |
640 | 426613db | j_mayer | void OPPROTO glue(op_stdcx, MEMSUFFIX) (void) |
641 | 426613db | j_mayer | { |
642 | 426613db | j_mayer | if (unlikely(T0 & 0x03)) { |
643 | 426613db | j_mayer | do_raise_exception(EXCP_ALIGN); |
644 | 426613db | j_mayer | } else {
|
645 | 426613db | j_mayer | if (unlikely(regs->reserve != (uint32_t)T0)) {
|
646 | 426613db | j_mayer | env->crf[0] = xer_ov;
|
647 | 426613db | j_mayer | } else {
|
648 | 426613db | j_mayer | glue(stq, MEMSUFFIX)((uint32_t)T0, T1); |
649 | 426613db | j_mayer | env->crf[0] = xer_ov | 0x02; |
650 | 426613db | j_mayer | } |
651 | 426613db | j_mayer | } |
652 | 426613db | j_mayer | regs->reserve = -1;
|
653 | 426613db | j_mayer | RETURN(); |
654 | 426613db | j_mayer | } |
655 | 426613db | j_mayer | |
656 | d9bce9d9 | j_mayer | void OPPROTO glue(op_stdcx_64, MEMSUFFIX) (void) |
657 | 9a64fbe4 | bellard | { |
658 | 76a66253 | j_mayer | if (unlikely(T0 & 0x03)) { |
659 | 9fddaa0c | bellard | do_raise_exception(EXCP_ALIGN); |
660 | 9a64fbe4 | bellard | } else {
|
661 | d9bce9d9 | j_mayer | if (unlikely(regs->reserve != (uint64_t)T0)) {
|
662 | 9a64fbe4 | bellard | env->crf[0] = xer_ov;
|
663 | 9a64fbe4 | bellard | } else {
|
664 | d9bce9d9 | j_mayer | glue(stq, MEMSUFFIX)((uint64_t)T0, T1); |
665 | d9bce9d9 | j_mayer | env->crf[0] = xer_ov | 0x02; |
666 | d9bce9d9 | j_mayer | } |
667 | d9bce9d9 | j_mayer | } |
668 | d9bce9d9 | j_mayer | regs->reserve = -1;
|
669 | d9bce9d9 | j_mayer | RETURN(); |
670 | d9bce9d9 | j_mayer | } |
671 | d9bce9d9 | j_mayer | #endif
|
672 | d9bce9d9 | j_mayer | |
673 | d9bce9d9 | j_mayer | void OPPROTO glue(op_stwcx_le, MEMSUFFIX) (void) |
674 | d9bce9d9 | j_mayer | { |
675 | d9bce9d9 | j_mayer | if (unlikely(T0 & 0x03)) { |
676 | d9bce9d9 | j_mayer | do_raise_exception(EXCP_ALIGN); |
677 | d9bce9d9 | j_mayer | } else {
|
678 | d9bce9d9 | j_mayer | if (unlikely(regs->reserve != (uint32_t)T0)) {
|
679 | d9bce9d9 | j_mayer | env->crf[0] = xer_ov;
|
680 | d9bce9d9 | j_mayer | } else {
|
681 | d9bce9d9 | j_mayer | glue(st32r, MEMSUFFIX)((uint32_t)T0, T1); |
682 | 9a64fbe4 | bellard | env->crf[0] = xer_ov | 0x02; |
683 | 9a64fbe4 | bellard | } |
684 | 9a64fbe4 | bellard | } |
685 | 76a66253 | j_mayer | regs->reserve = -1;
|
686 | 9a64fbe4 | bellard | RETURN(); |
687 | 9a64fbe4 | bellard | } |
688 | 9a64fbe4 | bellard | |
689 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
690 | d9bce9d9 | j_mayer | void OPPROTO glue(op_stwcx_le_64, MEMSUFFIX) (void) |
691 | 111bfab3 | bellard | { |
692 | 76a66253 | j_mayer | if (unlikely(T0 & 0x03)) { |
693 | 111bfab3 | bellard | do_raise_exception(EXCP_ALIGN); |
694 | 111bfab3 | bellard | } else {
|
695 | d9bce9d9 | j_mayer | if (unlikely(regs->reserve != (uint64_t)T0)) {
|
696 | 111bfab3 | bellard | env->crf[0] = xer_ov;
|
697 | 111bfab3 | bellard | } else {
|
698 | d9bce9d9 | j_mayer | glue(st32r, MEMSUFFIX)((uint64_t)T0, T1); |
699 | 111bfab3 | bellard | env->crf[0] = xer_ov | 0x02; |
700 | 111bfab3 | bellard | } |
701 | 111bfab3 | bellard | } |
702 | 76a66253 | j_mayer | regs->reserve = -1;
|
703 | 111bfab3 | bellard | RETURN(); |
704 | 111bfab3 | bellard | } |
705 | 111bfab3 | bellard | |
706 | 426613db | j_mayer | void OPPROTO glue(op_stdcx_le, MEMSUFFIX) (void) |
707 | 426613db | j_mayer | { |
708 | 426613db | j_mayer | if (unlikely(T0 & 0x03)) { |
709 | 426613db | j_mayer | do_raise_exception(EXCP_ALIGN); |
710 | 426613db | j_mayer | } else {
|
711 | 426613db | j_mayer | if (unlikely(regs->reserve != (uint32_t)T0)) {
|
712 | 426613db | j_mayer | env->crf[0] = xer_ov;
|
713 | 426613db | j_mayer | } else {
|
714 | 426613db | j_mayer | glue(st64r, MEMSUFFIX)((uint32_t)T0, T1); |
715 | 426613db | j_mayer | env->crf[0] = xer_ov | 0x02; |
716 | 426613db | j_mayer | } |
717 | 426613db | j_mayer | } |
718 | 426613db | j_mayer | regs->reserve = -1;
|
719 | 426613db | j_mayer | RETURN(); |
720 | 426613db | j_mayer | } |
721 | 426613db | j_mayer | |
722 | d9bce9d9 | j_mayer | void OPPROTO glue(op_stdcx_le_64, MEMSUFFIX) (void) |
723 | d9bce9d9 | j_mayer | { |
724 | d9bce9d9 | j_mayer | if (unlikely(T0 & 0x03)) { |
725 | d9bce9d9 | j_mayer | do_raise_exception(EXCP_ALIGN); |
726 | d9bce9d9 | j_mayer | } else {
|
727 | d9bce9d9 | j_mayer | if (unlikely(regs->reserve != (uint64_t)T0)) {
|
728 | d9bce9d9 | j_mayer | env->crf[0] = xer_ov;
|
729 | d9bce9d9 | j_mayer | } else {
|
730 | d9bce9d9 | j_mayer | glue(st64r, MEMSUFFIX)((uint64_t)T0, T1); |
731 | d9bce9d9 | j_mayer | env->crf[0] = xer_ov | 0x02; |
732 | d9bce9d9 | j_mayer | } |
733 | d9bce9d9 | j_mayer | } |
734 | d9bce9d9 | j_mayer | regs->reserve = -1;
|
735 | d9bce9d9 | j_mayer | RETURN(); |
736 | d9bce9d9 | j_mayer | } |
737 | d9bce9d9 | j_mayer | #endif
|
738 | d9bce9d9 | j_mayer | |
739 | d9bce9d9 | j_mayer | void OPPROTO glue(op_dcbz, MEMSUFFIX) (void) |
740 | d9bce9d9 | j_mayer | { |
741 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x00), 0); |
742 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x04), 0); |
743 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x08), 0); |
744 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x0C), 0); |
745 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x10), 0); |
746 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x14), 0); |
747 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x18), 0); |
748 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x1C), 0); |
749 | d9bce9d9 | j_mayer | #if DCACHE_LINE_SIZE == 64 |
750 | d9bce9d9 | j_mayer | /* XXX: cache line size should be 64 for POWER & PowerPC 601 */
|
751 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x20UL), 0); |
752 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x24UL), 0); |
753 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x28UL), 0); |
754 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x2CUL), 0); |
755 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x30UL), 0); |
756 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x34UL), 0); |
757 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x38UL), 0); |
758 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x3CUL), 0); |
759 | d9bce9d9 | j_mayer | #endif
|
760 | d9bce9d9 | j_mayer | RETURN(); |
761 | d9bce9d9 | j_mayer | } |
762 | d9bce9d9 | j_mayer | |
763 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
764 | d9bce9d9 | j_mayer | void OPPROTO glue(op_dcbz_64, MEMSUFFIX) (void) |
765 | 9a64fbe4 | bellard | { |
766 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x00), 0); |
767 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x04), 0); |
768 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x08), 0); |
769 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x0C), 0); |
770 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x10), 0); |
771 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x14), 0); |
772 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x18), 0); |
773 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x1C), 0); |
774 | 76a66253 | j_mayer | #if DCACHE_LINE_SIZE == 64 |
775 | 76a66253 | j_mayer | /* XXX: cache line size should be 64 for POWER & PowerPC 601 */
|
776 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x20UL), 0); |
777 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x24UL), 0); |
778 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x28UL), 0); |
779 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x2CUL), 0); |
780 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x30UL), 0); |
781 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x34UL), 0); |
782 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x38UL), 0); |
783 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x3CUL), 0); |
784 | 76a66253 | j_mayer | #endif
|
785 | 9a64fbe4 | bellard | RETURN(); |
786 | 9a64fbe4 | bellard | } |
787 | d9bce9d9 | j_mayer | #endif
|
788 | 9a64fbe4 | bellard | |
789 | 36f69651 | j_mayer | /* Instruction cache block invalidate */
|
790 | 36f69651 | j_mayer | void OPPROTO glue(op_icbi, MEMSUFFIX) (void) |
791 | 36f69651 | j_mayer | { |
792 | 36f69651 | j_mayer | glue(do_icbi, MEMSUFFIX)(); |
793 | 36f69651 | j_mayer | RETURN(); |
794 | 36f69651 | j_mayer | } |
795 | 36f69651 | j_mayer | |
796 | 36f69651 | j_mayer | #if defined(TARGET_PPC64)
|
797 | 36f69651 | j_mayer | void OPPROTO glue(op_icbi_64, MEMSUFFIX) (void) |
798 | 36f69651 | j_mayer | { |
799 | 36f69651 | j_mayer | glue(do_icbi_64, MEMSUFFIX)(); |
800 | 36f69651 | j_mayer | RETURN(); |
801 | 36f69651 | j_mayer | } |
802 | 36f69651 | j_mayer | #endif
|
803 | 36f69651 | j_mayer | |
804 | 9a64fbe4 | bellard | /* External access */
|
805 | d9bce9d9 | j_mayer | void OPPROTO glue(op_eciwx, MEMSUFFIX) (void) |
806 | d9bce9d9 | j_mayer | { |
807 | d9bce9d9 | j_mayer | T1 = glue(ldl, MEMSUFFIX)((uint32_t)T0); |
808 | d9bce9d9 | j_mayer | RETURN(); |
809 | d9bce9d9 | j_mayer | } |
810 | d9bce9d9 | j_mayer | |
811 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
812 | d9bce9d9 | j_mayer | void OPPROTO glue(op_eciwx_64, MEMSUFFIX) (void) |
813 | d9bce9d9 | j_mayer | { |
814 | d9bce9d9 | j_mayer | T1 = glue(ldl, MEMSUFFIX)((uint64_t)T0); |
815 | d9bce9d9 | j_mayer | RETURN(); |
816 | d9bce9d9 | j_mayer | } |
817 | d9bce9d9 | j_mayer | #endif
|
818 | d9bce9d9 | j_mayer | |
819 | d9bce9d9 | j_mayer | void OPPROTO glue(op_ecowx, MEMSUFFIX) (void) |
820 | d9bce9d9 | j_mayer | { |
821 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)T0, T1); |
822 | d9bce9d9 | j_mayer | RETURN(); |
823 | d9bce9d9 | j_mayer | } |
824 | d9bce9d9 | j_mayer | |
825 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
826 | d9bce9d9 | j_mayer | void OPPROTO glue(op_ecowx_64, MEMSUFFIX) (void) |
827 | 9a64fbe4 | bellard | { |
828 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)T0, T1); |
829 | 9a64fbe4 | bellard | RETURN(); |
830 | 9a64fbe4 | bellard | } |
831 | d9bce9d9 | j_mayer | #endif
|
832 | 9a64fbe4 | bellard | |
833 | d9bce9d9 | j_mayer | void OPPROTO glue(op_eciwx_le, MEMSUFFIX) (void) |
834 | 9a64fbe4 | bellard | { |
835 | d9bce9d9 | j_mayer | T1 = glue(ld32r, MEMSUFFIX)((uint32_t)T0); |
836 | 9a64fbe4 | bellard | RETURN(); |
837 | 9a64fbe4 | bellard | } |
838 | 9a64fbe4 | bellard | |
839 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
840 | d9bce9d9 | j_mayer | void OPPROTO glue(op_eciwx_le_64, MEMSUFFIX) (void) |
841 | 111bfab3 | bellard | { |
842 | d9bce9d9 | j_mayer | T1 = glue(ld32r, MEMSUFFIX)((uint64_t)T0); |
843 | 111bfab3 | bellard | RETURN(); |
844 | 111bfab3 | bellard | } |
845 | d9bce9d9 | j_mayer | #endif
|
846 | 111bfab3 | bellard | |
847 | d9bce9d9 | j_mayer | void OPPROTO glue(op_ecowx_le, MEMSUFFIX) (void) |
848 | 111bfab3 | bellard | { |
849 | d9bce9d9 | j_mayer | glue(st32r, MEMSUFFIX)((uint32_t)T0, T1); |
850 | 111bfab3 | bellard | RETURN(); |
851 | 111bfab3 | bellard | } |
852 | 111bfab3 | bellard | |
853 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
854 | d9bce9d9 | j_mayer | void OPPROTO glue(op_ecowx_le_64, MEMSUFFIX) (void) |
855 | d9bce9d9 | j_mayer | { |
856 | d9bce9d9 | j_mayer | glue(st32r, MEMSUFFIX)((uint64_t)T0, T1); |
857 | d9bce9d9 | j_mayer | RETURN(); |
858 | d9bce9d9 | j_mayer | } |
859 | d9bce9d9 | j_mayer | #endif
|
860 | d9bce9d9 | j_mayer | |
861 | 76a66253 | j_mayer | /* XXX: those micro-ops need tests ! */
|
862 | 76a66253 | j_mayer | /* PowerPC 601 specific instructions (POWER bridge) */
|
863 | 76a66253 | j_mayer | void OPPROTO glue(op_POWER_lscbx, MEMSUFFIX) (void) |
864 | 76a66253 | j_mayer | { |
865 | 76a66253 | j_mayer | /* When byte count is 0, do nothing */
|
866 | d9bce9d9 | j_mayer | if (likely(T1 != 0)) { |
867 | 76a66253 | j_mayer | glue(do_POWER_lscbx, MEMSUFFIX)(PARAM1, PARAM2, PARAM3); |
868 | 76a66253 | j_mayer | } |
869 | 76a66253 | j_mayer | RETURN(); |
870 | 76a66253 | j_mayer | } |
871 | 76a66253 | j_mayer | |
872 | 76a66253 | j_mayer | /* POWER2 quad load and store */
|
873 | 76a66253 | j_mayer | /* XXX: TAGs are not managed */
|
874 | 76a66253 | j_mayer | void OPPROTO glue(op_POWER2_lfq, MEMSUFFIX) (void) |
875 | 76a66253 | j_mayer | { |
876 | 76a66253 | j_mayer | glue(do_POWER2_lfq, MEMSUFFIX)(); |
877 | 76a66253 | j_mayer | RETURN(); |
878 | 76a66253 | j_mayer | } |
879 | 76a66253 | j_mayer | |
880 | 76a66253 | j_mayer | void glue(op_POWER2_lfq_le, MEMSUFFIX) (void) |
881 | 76a66253 | j_mayer | { |
882 | 76a66253 | j_mayer | glue(do_POWER2_lfq_le, MEMSUFFIX)(); |
883 | 76a66253 | j_mayer | RETURN(); |
884 | 76a66253 | j_mayer | } |
885 | 76a66253 | j_mayer | |
886 | 76a66253 | j_mayer | void OPPROTO glue(op_POWER2_stfq, MEMSUFFIX) (void) |
887 | 76a66253 | j_mayer | { |
888 | 76a66253 | j_mayer | glue(do_POWER2_stfq, MEMSUFFIX)(); |
889 | 76a66253 | j_mayer | RETURN(); |
890 | 76a66253 | j_mayer | } |
891 | 76a66253 | j_mayer | |
892 | 76a66253 | j_mayer | void OPPROTO glue(op_POWER2_stfq_le, MEMSUFFIX) (void) |
893 | 76a66253 | j_mayer | { |
894 | 76a66253 | j_mayer | glue(do_POWER2_stfq_le, MEMSUFFIX)(); |
895 | 76a66253 | j_mayer | RETURN(); |
896 | 76a66253 | j_mayer | } |
897 | 76a66253 | j_mayer | |
898 | 35cdaad6 | j_mayer | #if defined(TARGET_PPCEMB)
|
899 | 0487d6a8 | j_mayer | /* SPE extension */
|
900 | 0487d6a8 | j_mayer | #define _PPC_SPE_LD_OP(name, op) \
|
901 | 0487d6a8 | j_mayer | void OPPROTO glue(glue(op_spe_l, name), MEMSUFFIX) (void) \ |
902 | 0487d6a8 | j_mayer | { \ |
903 | 0487d6a8 | j_mayer | T1_64 = glue(op, MEMSUFFIX)((uint32_t)T0); \ |
904 | 0487d6a8 | j_mayer | RETURN(); \ |
905 | 0487d6a8 | j_mayer | } |
906 | 0487d6a8 | j_mayer | |
907 | 0487d6a8 | j_mayer | #if defined(TARGET_PPC64)
|
908 | 0487d6a8 | j_mayer | #define _PPC_SPE_LD_OP_64(name, op) \
|
909 | 0487d6a8 | j_mayer | void OPPROTO glue(glue(glue(op_spe_l, name), _64), MEMSUFFIX) (void) \ |
910 | 0487d6a8 | j_mayer | { \ |
911 | 0487d6a8 | j_mayer | T1_64 = glue(op, MEMSUFFIX)((uint64_t)T0); \ |
912 | 0487d6a8 | j_mayer | RETURN(); \ |
913 | 0487d6a8 | j_mayer | } |
914 | 0487d6a8 | j_mayer | #define PPC_SPE_LD_OP(name, op) \
|
915 | 0487d6a8 | j_mayer | _PPC_SPE_LD_OP(name, op); \ |
916 | 0487d6a8 | j_mayer | _PPC_SPE_LD_OP_64(name, op) |
917 | 0487d6a8 | j_mayer | #else
|
918 | 0487d6a8 | j_mayer | #define PPC_SPE_LD_OP(name, op) \
|
919 | 0487d6a8 | j_mayer | _PPC_SPE_LD_OP(name, op) |
920 | 0487d6a8 | j_mayer | #endif
|
921 | 0487d6a8 | j_mayer | |
922 | 0487d6a8 | j_mayer | |
923 | 0487d6a8 | j_mayer | #define _PPC_SPE_ST_OP(name, op) \
|
924 | 0487d6a8 | j_mayer | void OPPROTO glue(glue(op_spe_st, name), MEMSUFFIX) (void) \ |
925 | 0487d6a8 | j_mayer | { \ |
926 | 0487d6a8 | j_mayer | glue(op, MEMSUFFIX)((uint32_t)T0, T1_64); \ |
927 | 0487d6a8 | j_mayer | RETURN(); \ |
928 | 0487d6a8 | j_mayer | } |
929 | 0487d6a8 | j_mayer | |
930 | 0487d6a8 | j_mayer | #if defined(TARGET_PPC64)
|
931 | 0487d6a8 | j_mayer | #define _PPC_SPE_ST_OP_64(name, op) \
|
932 | 0487d6a8 | j_mayer | void OPPROTO glue(glue(glue(op_spe_st, name), _64), MEMSUFFIX) (void) \ |
933 | 0487d6a8 | j_mayer | { \ |
934 | 0487d6a8 | j_mayer | glue(op, MEMSUFFIX)((uint64_t)T0, T1_64); \ |
935 | 0487d6a8 | j_mayer | RETURN(); \ |
936 | 0487d6a8 | j_mayer | } |
937 | 0487d6a8 | j_mayer | #define PPC_SPE_ST_OP(name, op) \
|
938 | 0487d6a8 | j_mayer | _PPC_SPE_ST_OP(name, op); \ |
939 | 0487d6a8 | j_mayer | _PPC_SPE_ST_OP_64(name, op) |
940 | 0487d6a8 | j_mayer | #else
|
941 | 0487d6a8 | j_mayer | #define PPC_SPE_ST_OP(name, op) \
|
942 | 0487d6a8 | j_mayer | _PPC_SPE_ST_OP(name, op) |
943 | 0487d6a8 | j_mayer | #endif
|
944 | 0487d6a8 | j_mayer | |
945 | 0487d6a8 | j_mayer | #if !defined(TARGET_PPC64)
|
946 | 0487d6a8 | j_mayer | PPC_SPE_LD_OP(dd, ldq); |
947 | 0487d6a8 | j_mayer | PPC_SPE_ST_OP(dd, stq); |
948 | 0487d6a8 | j_mayer | PPC_SPE_LD_OP(dd_le, ld64r); |
949 | 0487d6a8 | j_mayer | PPC_SPE_ST_OP(dd_le, st64r); |
950 | 0487d6a8 | j_mayer | #endif
|
951 | 0487d6a8 | j_mayer | static inline uint64_t glue(spe_ldw, MEMSUFFIX) (target_ulong EA) |
952 | 0487d6a8 | j_mayer | { |
953 | 0487d6a8 | j_mayer | uint64_t ret; |
954 | 0487d6a8 | j_mayer | ret = (uint64_t)glue(ldl, MEMSUFFIX)(EA) << 32;
|
955 | 0487d6a8 | j_mayer | ret |= (uint64_t)glue(ldl, MEMSUFFIX)(EA + 4);
|
956 | 0487d6a8 | j_mayer | return ret;
|
957 | 0487d6a8 | j_mayer | } |
958 | 0487d6a8 | j_mayer | PPC_SPE_LD_OP(dw, spe_ldw); |
959 | 0487d6a8 | j_mayer | static inline void glue(spe_stdw, MEMSUFFIX) (target_ulong EA, uint64_t data) |
960 | 0487d6a8 | j_mayer | { |
961 | 0487d6a8 | j_mayer | glue(stl, MEMSUFFIX)(EA, data >> 32);
|
962 | 0487d6a8 | j_mayer | glue(stl, MEMSUFFIX)(EA + 4, data);
|
963 | 0487d6a8 | j_mayer | } |
964 | 0487d6a8 | j_mayer | PPC_SPE_ST_OP(dw, spe_stdw); |
965 | 0487d6a8 | j_mayer | static inline uint64_t glue(spe_ldw_le, MEMSUFFIX) (target_ulong EA) |
966 | 0487d6a8 | j_mayer | { |
967 | 0487d6a8 | j_mayer | uint64_t ret; |
968 | 0487d6a8 | j_mayer | ret = (uint64_t)glue(ld32r, MEMSUFFIX)(EA) << 32;
|
969 | 0487d6a8 | j_mayer | ret |= (uint64_t)glue(ld32r, MEMSUFFIX)(EA + 4);
|
970 | 0487d6a8 | j_mayer | return ret;
|
971 | 0487d6a8 | j_mayer | } |
972 | 0487d6a8 | j_mayer | PPC_SPE_LD_OP(dw_le, spe_ldw_le); |
973 | 0487d6a8 | j_mayer | static inline void glue(spe_stdw_le, MEMSUFFIX) (target_ulong EA, |
974 | 0487d6a8 | j_mayer | uint64_t data) |
975 | 0487d6a8 | j_mayer | { |
976 | 0487d6a8 | j_mayer | glue(st32r, MEMSUFFIX)(EA, data >> 32);
|
977 | 0487d6a8 | j_mayer | glue(st32r, MEMSUFFIX)(EA + 4, data);
|
978 | 0487d6a8 | j_mayer | } |
979 | 0487d6a8 | j_mayer | PPC_SPE_ST_OP(dw_le, spe_stdw_le); |
980 | 0487d6a8 | j_mayer | static inline uint64_t glue(spe_ldh, MEMSUFFIX) (target_ulong EA) |
981 | 0487d6a8 | j_mayer | { |
982 | 0487d6a8 | j_mayer | uint64_t ret; |
983 | 0487d6a8 | j_mayer | ret = (uint64_t)glue(lduw, MEMSUFFIX)(EA) << 48;
|
984 | 0487d6a8 | j_mayer | ret |= (uint64_t)glue(lduw, MEMSUFFIX)(EA + 2) << 32; |
985 | 0487d6a8 | j_mayer | ret |= (uint64_t)glue(lduw, MEMSUFFIX)(EA + 4) << 16; |
986 | 0487d6a8 | j_mayer | ret |= (uint64_t)glue(lduw, MEMSUFFIX)(EA + 6);
|
987 | 0487d6a8 | j_mayer | return ret;
|
988 | 0487d6a8 | j_mayer | } |
989 | 0487d6a8 | j_mayer | PPC_SPE_LD_OP(dh, spe_ldh); |
990 | 0487d6a8 | j_mayer | static inline void glue(spe_stdh, MEMSUFFIX) (target_ulong EA, uint64_t data) |
991 | 0487d6a8 | j_mayer | { |
992 | 0487d6a8 | j_mayer | glue(stw, MEMSUFFIX)(EA, data >> 48);
|
993 | 0487d6a8 | j_mayer | glue(stw, MEMSUFFIX)(EA + 2, data >> 32); |
994 | 0487d6a8 | j_mayer | glue(stw, MEMSUFFIX)(EA + 4, data >> 16); |
995 | 0487d6a8 | j_mayer | glue(stw, MEMSUFFIX)(EA + 6, data);
|
996 | 0487d6a8 | j_mayer | } |
997 | 0487d6a8 | j_mayer | PPC_SPE_ST_OP(dh, spe_stdh); |
998 | 0487d6a8 | j_mayer | static inline uint64_t glue(spe_ldh_le, MEMSUFFIX) (target_ulong EA) |
999 | 0487d6a8 | j_mayer | { |
1000 | 0487d6a8 | j_mayer | uint64_t ret; |
1001 | 0487d6a8 | j_mayer | ret = (uint64_t)glue(ld16r, MEMSUFFIX)(EA) << 48;
|
1002 | 0487d6a8 | j_mayer | ret |= (uint64_t)glue(ld16r, MEMSUFFIX)(EA + 2) << 32; |
1003 | 0487d6a8 | j_mayer | ret |= (uint64_t)glue(ld16r, MEMSUFFIX)(EA + 4) << 16; |
1004 | 0487d6a8 | j_mayer | ret |= (uint64_t)glue(ld16r, MEMSUFFIX)(EA + 6);
|
1005 | 0487d6a8 | j_mayer | return ret;
|
1006 | 0487d6a8 | j_mayer | } |
1007 | 0487d6a8 | j_mayer | PPC_SPE_LD_OP(dh_le, spe_ldh_le); |
1008 | 0487d6a8 | j_mayer | static inline void glue(spe_stdh_le, MEMSUFFIX) (target_ulong EA, |
1009 | 0487d6a8 | j_mayer | uint64_t data) |
1010 | 0487d6a8 | j_mayer | { |
1011 | 0487d6a8 | j_mayer | glue(st16r, MEMSUFFIX)(EA, data >> 48);
|
1012 | 0487d6a8 | j_mayer | glue(st16r, MEMSUFFIX)(EA + 2, data >> 32); |
1013 | 0487d6a8 | j_mayer | glue(st16r, MEMSUFFIX)(EA + 4, data >> 16); |
1014 | 0487d6a8 | j_mayer | glue(st16r, MEMSUFFIX)(EA + 6, data);
|
1015 | 0487d6a8 | j_mayer | } |
1016 | 0487d6a8 | j_mayer | PPC_SPE_ST_OP(dh_le, spe_stdh_le); |
1017 | 0487d6a8 | j_mayer | static inline uint64_t glue(spe_lwhe, MEMSUFFIX) (target_ulong EA) |
1018 | 0487d6a8 | j_mayer | { |
1019 | 0487d6a8 | j_mayer | uint64_t ret; |
1020 | 0487d6a8 | j_mayer | ret = (uint64_t)glue(lduw, MEMSUFFIX)(EA) << 48;
|
1021 | 0487d6a8 | j_mayer | ret |= (uint64_t)glue(lduw, MEMSUFFIX)(EA + 2) << 16; |
1022 | 0487d6a8 | j_mayer | return ret;
|
1023 | 0487d6a8 | j_mayer | } |
1024 | 0487d6a8 | j_mayer | PPC_SPE_LD_OP(whe, spe_lwhe); |
1025 | 0487d6a8 | j_mayer | static inline void glue(spe_stwhe, MEMSUFFIX) (target_ulong EA, uint64_t data) |
1026 | 0487d6a8 | j_mayer | { |
1027 | 0487d6a8 | j_mayer | glue(stw, MEMSUFFIX)(EA, data >> 48);
|
1028 | 0487d6a8 | j_mayer | glue(stw, MEMSUFFIX)(EA + 2, data >> 16); |
1029 | 0487d6a8 | j_mayer | } |
1030 | 0487d6a8 | j_mayer | PPC_SPE_ST_OP(whe, spe_stwhe); |
1031 | 0487d6a8 | j_mayer | static inline uint64_t glue(spe_lwhe_le, MEMSUFFIX) (target_ulong EA) |
1032 | 0487d6a8 | j_mayer | { |
1033 | 0487d6a8 | j_mayer | uint64_t ret; |
1034 | 0487d6a8 | j_mayer | ret = (uint64_t)glue(ld16r, MEMSUFFIX)(EA) << 48;
|
1035 | 0487d6a8 | j_mayer | ret |= (uint64_t)glue(ld16r, MEMSUFFIX)(EA + 2) << 16; |
1036 | 0487d6a8 | j_mayer | return ret;
|
1037 | 0487d6a8 | j_mayer | } |
1038 | 0487d6a8 | j_mayer | PPC_SPE_LD_OP(whe_le, spe_lwhe_le); |
1039 | 0487d6a8 | j_mayer | static inline void glue(spe_stwhe_le, MEMSUFFIX) (target_ulong EA, |
1040 | 0487d6a8 | j_mayer | uint64_t data) |
1041 | 0487d6a8 | j_mayer | { |
1042 | 0487d6a8 | j_mayer | glue(st16r, MEMSUFFIX)(EA, data >> 48);
|
1043 | 0487d6a8 | j_mayer | glue(st16r, MEMSUFFIX)(EA + 2, data >> 16); |
1044 | 0487d6a8 | j_mayer | } |
1045 | 0487d6a8 | j_mayer | PPC_SPE_ST_OP(whe_le, spe_stwhe_le); |
1046 | 0487d6a8 | j_mayer | static inline uint64_t glue(spe_lwhou, MEMSUFFIX) (target_ulong EA) |
1047 | 0487d6a8 | j_mayer | { |
1048 | 0487d6a8 | j_mayer | uint64_t ret; |
1049 | 0487d6a8 | j_mayer | ret = (uint64_t)glue(lduw, MEMSUFFIX)(EA) << 32;
|
1050 | 0487d6a8 | j_mayer | ret |= (uint64_t)glue(lduw, MEMSUFFIX)(EA + 2);
|
1051 | 0487d6a8 | j_mayer | return ret;
|
1052 | 0487d6a8 | j_mayer | } |
1053 | 0487d6a8 | j_mayer | PPC_SPE_LD_OP(whou, spe_lwhou); |
1054 | 0487d6a8 | j_mayer | static inline uint64_t glue(spe_lwhos, MEMSUFFIX) (target_ulong EA) |
1055 | 0487d6a8 | j_mayer | { |
1056 | 0487d6a8 | j_mayer | uint64_t ret; |
1057 | 0487d6a8 | j_mayer | ret = ((uint64_t)((int32_t)glue(ldsw, MEMSUFFIX)(EA))) << 32;
|
1058 | 0487d6a8 | j_mayer | ret |= (uint64_t)((int32_t)glue(ldsw, MEMSUFFIX)(EA + 2));
|
1059 | 0487d6a8 | j_mayer | return ret;
|
1060 | 0487d6a8 | j_mayer | } |
1061 | 0487d6a8 | j_mayer | PPC_SPE_LD_OP(whos, spe_lwhos); |
1062 | 0487d6a8 | j_mayer | static inline void glue(spe_stwho, MEMSUFFIX) (target_ulong EA, uint64_t data) |
1063 | 0487d6a8 | j_mayer | { |
1064 | 0487d6a8 | j_mayer | glue(stw, MEMSUFFIX)(EA, data >> 32);
|
1065 | 0487d6a8 | j_mayer | glue(stw, MEMSUFFIX)(EA + 2, data);
|
1066 | 0487d6a8 | j_mayer | } |
1067 | 0487d6a8 | j_mayer | PPC_SPE_ST_OP(who, spe_stwho); |
1068 | 0487d6a8 | j_mayer | static inline uint64_t glue(spe_lwhou_le, MEMSUFFIX) (target_ulong EA) |
1069 | 0487d6a8 | j_mayer | { |
1070 | 0487d6a8 | j_mayer | uint64_t ret; |
1071 | 0487d6a8 | j_mayer | ret = (uint64_t)glue(ld16r, MEMSUFFIX)(EA) << 32;
|
1072 | 0487d6a8 | j_mayer | ret |= (uint64_t)glue(ld16r, MEMSUFFIX)(EA + 2);
|
1073 | 0487d6a8 | j_mayer | return ret;
|
1074 | 0487d6a8 | j_mayer | } |
1075 | 0487d6a8 | j_mayer | PPC_SPE_LD_OP(whou_le, spe_lwhou_le); |
1076 | 0487d6a8 | j_mayer | static inline uint64_t glue(spe_lwhos_le, MEMSUFFIX) (target_ulong EA) |
1077 | 0487d6a8 | j_mayer | { |
1078 | 0487d6a8 | j_mayer | uint64_t ret; |
1079 | 0487d6a8 | j_mayer | ret = ((uint64_t)((int32_t)glue(ld16rs, MEMSUFFIX)(EA))) << 32;
|
1080 | 0487d6a8 | j_mayer | ret |= (uint64_t)((int32_t)glue(ld16rs, MEMSUFFIX)(EA + 2));
|
1081 | 0487d6a8 | j_mayer | return ret;
|
1082 | 0487d6a8 | j_mayer | } |
1083 | 0487d6a8 | j_mayer | PPC_SPE_LD_OP(whos_le, spe_lwhos_le); |
1084 | 0487d6a8 | j_mayer | static inline void glue(spe_stwho_le, MEMSUFFIX) (target_ulong EA, |
1085 | 0487d6a8 | j_mayer | uint64_t data) |
1086 | 0487d6a8 | j_mayer | { |
1087 | 0487d6a8 | j_mayer | glue(st16r, MEMSUFFIX)(EA, data >> 32);
|
1088 | 0487d6a8 | j_mayer | glue(st16r, MEMSUFFIX)(EA + 2, data);
|
1089 | 0487d6a8 | j_mayer | } |
1090 | 0487d6a8 | j_mayer | PPC_SPE_ST_OP(who_le, spe_stwho_le); |
1091 | 0487d6a8 | j_mayer | #if !defined(TARGET_PPC64)
|
1092 | 0487d6a8 | j_mayer | static inline void glue(spe_stwwo, MEMSUFFIX) (target_ulong EA, uint64_t data) |
1093 | 0487d6a8 | j_mayer | { |
1094 | 0487d6a8 | j_mayer | glue(stl, MEMSUFFIX)(EA, data); |
1095 | 0487d6a8 | j_mayer | } |
1096 | 0487d6a8 | j_mayer | PPC_SPE_ST_OP(wwo, spe_stwwo); |
1097 | 0487d6a8 | j_mayer | static inline void glue(spe_stwwo_le, MEMSUFFIX) (target_ulong EA, |
1098 | 0487d6a8 | j_mayer | uint64_t data) |
1099 | 0487d6a8 | j_mayer | { |
1100 | 0487d6a8 | j_mayer | glue(st32r, MEMSUFFIX)(EA, data); |
1101 | 0487d6a8 | j_mayer | } |
1102 | 0487d6a8 | j_mayer | PPC_SPE_ST_OP(wwo_le, spe_stwwo_le); |
1103 | 0487d6a8 | j_mayer | #endif
|
1104 | 0487d6a8 | j_mayer | static inline uint64_t glue(spe_lh, MEMSUFFIX) (target_ulong EA) |
1105 | 0487d6a8 | j_mayer | { |
1106 | 0487d6a8 | j_mayer | uint16_t tmp; |
1107 | 0487d6a8 | j_mayer | tmp = glue(lduw, MEMSUFFIX)(EA); |
1108 | 0487d6a8 | j_mayer | return ((uint64_t)tmp << 48) | ((uint64_t)tmp << 16); |
1109 | 0487d6a8 | j_mayer | } |
1110 | 0487d6a8 | j_mayer | PPC_SPE_LD_OP(h, spe_lh); |
1111 | 0487d6a8 | j_mayer | static inline uint64_t glue(spe_lh_le, MEMSUFFIX) (target_ulong EA) |
1112 | 0487d6a8 | j_mayer | { |
1113 | 0487d6a8 | j_mayer | uint16_t tmp; |
1114 | 0487d6a8 | j_mayer | tmp = glue(ld16r, MEMSUFFIX)(EA); |
1115 | 0487d6a8 | j_mayer | return ((uint64_t)tmp << 48) | ((uint64_t)tmp << 16); |
1116 | 0487d6a8 | j_mayer | } |
1117 | 0487d6a8 | j_mayer | PPC_SPE_LD_OP(h_le, spe_lh_le); |
1118 | 0487d6a8 | j_mayer | static inline uint64_t glue(spe_lwwsplat, MEMSUFFIX) (target_ulong EA) |
1119 | 0487d6a8 | j_mayer | { |
1120 | 0487d6a8 | j_mayer | uint32_t tmp; |
1121 | 0487d6a8 | j_mayer | tmp = glue(ldl, MEMSUFFIX)(EA); |
1122 | 0487d6a8 | j_mayer | return ((uint64_t)tmp << 32) | (uint64_t)tmp; |
1123 | 0487d6a8 | j_mayer | } |
1124 | 0487d6a8 | j_mayer | PPC_SPE_LD_OP(wwsplat, spe_lwwsplat); |
1125 | 0487d6a8 | j_mayer | static inline uint64_t glue(spe_lwwsplat_le, MEMSUFFIX) (target_ulong EA) |
1126 | 0487d6a8 | j_mayer | { |
1127 | 0487d6a8 | j_mayer | uint32_t tmp; |
1128 | 0487d6a8 | j_mayer | tmp = glue(ld32r, MEMSUFFIX)(EA); |
1129 | 0487d6a8 | j_mayer | return ((uint64_t)tmp << 32) | (uint64_t)tmp; |
1130 | 0487d6a8 | j_mayer | } |
1131 | 0487d6a8 | j_mayer | PPC_SPE_LD_OP(wwsplat_le, spe_lwwsplat_le); |
1132 | 0487d6a8 | j_mayer | static inline uint64_t glue(spe_lwhsplat, MEMSUFFIX) (target_ulong EA) |
1133 | 0487d6a8 | j_mayer | { |
1134 | 0487d6a8 | j_mayer | uint64_t ret; |
1135 | 0487d6a8 | j_mayer | uint16_t tmp; |
1136 | 0487d6a8 | j_mayer | tmp = glue(lduw, MEMSUFFIX)(EA); |
1137 | 0487d6a8 | j_mayer | ret = ((uint64_t)tmp << 48) | ((uint64_t)tmp << 32); |
1138 | 0487d6a8 | j_mayer | tmp = glue(lduw, MEMSUFFIX)(EA + 2);
|
1139 | 0487d6a8 | j_mayer | ret |= ((uint64_t)tmp << 16) | (uint64_t)tmp;
|
1140 | 0487d6a8 | j_mayer | return ret;
|
1141 | 0487d6a8 | j_mayer | } |
1142 | 0487d6a8 | j_mayer | PPC_SPE_LD_OP(whsplat, spe_lwhsplat); |
1143 | 0487d6a8 | j_mayer | static inline uint64_t glue(spe_lwhsplat_le, MEMSUFFIX) (target_ulong EA) |
1144 | 0487d6a8 | j_mayer | { |
1145 | 0487d6a8 | j_mayer | uint64_t ret; |
1146 | 0487d6a8 | j_mayer | uint16_t tmp; |
1147 | 0487d6a8 | j_mayer | tmp = glue(ld16r, MEMSUFFIX)(EA); |
1148 | 0487d6a8 | j_mayer | ret = ((uint64_t)tmp << 48) | ((uint64_t)tmp << 32); |
1149 | 0487d6a8 | j_mayer | tmp = glue(ld16r, MEMSUFFIX)(EA + 2);
|
1150 | 0487d6a8 | j_mayer | ret |= ((uint64_t)tmp << 16) | (uint64_t)tmp;
|
1151 | 0487d6a8 | j_mayer | return ret;
|
1152 | 0487d6a8 | j_mayer | } |
1153 | 0487d6a8 | j_mayer | PPC_SPE_LD_OP(whsplat_le, spe_lwhsplat_le); |
1154 | 35cdaad6 | j_mayer | #endif /* defined(TARGET_PPCEMB) */ |
1155 | 0487d6a8 | j_mayer | |
1156 | 9a64fbe4 | bellard | #undef MEMSUFFIX |