root / target-ppc / op_mem.h @ bfa1e5cf
History | View | Annotate | Download (33.6 kB)
1 | 76a66253 | j_mayer | /*
|
---|---|---|---|
2 | 76a66253 | j_mayer | * PowerPC emulation micro-operations for qemu.
|
3 | 5fafdf24 | ths | *
|
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 | e1833e1f | j_mayer | do_raise_exception_err(POWERPC_EXCP_PROGRAM, |
300 | e1833e1f | j_mayer | POWERPC_EXCP_INVAL | |
301 | e1833e1f | j_mayer | POWERPC_EXCP_INVAL_LSWX); |
302 | d9bce9d9 | j_mayer | } else {
|
303 | d9bce9d9 | j_mayer | glue(do_lsw, MEMSUFFIX)(PARAM1); |
304 | d9bce9d9 | j_mayer | } |
305 | d9bce9d9 | j_mayer | } |
306 | d9bce9d9 | j_mayer | RETURN(); |
307 | d9bce9d9 | j_mayer | } |
308 | d9bce9d9 | j_mayer | |
309 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
310 | d9bce9d9 | j_mayer | void OPPROTO glue(op_lswx_64, MEMSUFFIX) (void) |
311 | d9bce9d9 | j_mayer | { |
312 | d9bce9d9 | j_mayer | /* Note: T1 comes from xer_bc then no cast is needed */
|
313 | d9bce9d9 | j_mayer | if (likely(T1 != 0)) { |
314 | d9bce9d9 | j_mayer | if (unlikely((PARAM1 < PARAM2 && (PARAM1 + T1) > PARAM2) ||
|
315 | d9bce9d9 | j_mayer | (PARAM1 < PARAM3 && (PARAM1 + T1) > PARAM3))) { |
316 | e1833e1f | j_mayer | do_raise_exception_err(POWERPC_EXCP_PROGRAM, |
317 | e1833e1f | j_mayer | POWERPC_EXCP_INVAL | |
318 | e1833e1f | j_mayer | POWERPC_EXCP_INVAL_LSWX); |
319 | d9bce9d9 | j_mayer | } else {
|
320 | d9bce9d9 | j_mayer | glue(do_lsw_64, MEMSUFFIX)(PARAM1); |
321 | d9bce9d9 | j_mayer | } |
322 | d9bce9d9 | j_mayer | } |
323 | d9bce9d9 | j_mayer | RETURN(); |
324 | d9bce9d9 | j_mayer | } |
325 | d9bce9d9 | j_mayer | #endif
|
326 | d9bce9d9 | j_mayer | |
327 | d9bce9d9 | j_mayer | void OPPROTO glue(op_lswx_le, MEMSUFFIX) (void) |
328 | 9a64fbe4 | bellard | { |
329 | d9bce9d9 | j_mayer | /* Note: T1 comes from xer_bc then no cast is needed */
|
330 | d9bce9d9 | j_mayer | if (likely(T1 != 0)) { |
331 | 76a66253 | j_mayer | if (unlikely((PARAM1 < PARAM2 && (PARAM1 + T1) > PARAM2) ||
|
332 | 76a66253 | j_mayer | (PARAM1 < PARAM3 && (PARAM1 + T1) > PARAM3))) { |
333 | e1833e1f | j_mayer | do_raise_exception_err(POWERPC_EXCP_PROGRAM, |
334 | e1833e1f | j_mayer | POWERPC_EXCP_INVAL | |
335 | e1833e1f | j_mayer | POWERPC_EXCP_INVAL_LSWX); |
336 | 9a64fbe4 | bellard | } else {
|
337 | d9bce9d9 | j_mayer | glue(do_lsw_le, MEMSUFFIX)(PARAM1); |
338 | 9a64fbe4 | bellard | } |
339 | 9a64fbe4 | bellard | } |
340 | 9a64fbe4 | bellard | RETURN(); |
341 | 9a64fbe4 | bellard | } |
342 | 9a64fbe4 | bellard | |
343 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
344 | d9bce9d9 | j_mayer | void OPPROTO glue(op_lswx_le_64, MEMSUFFIX) (void) |
345 | 111bfab3 | bellard | { |
346 | d9bce9d9 | j_mayer | /* Note: T1 comes from xer_bc then no cast is needed */
|
347 | d9bce9d9 | j_mayer | if (likely(T1 != 0)) { |
348 | 76a66253 | j_mayer | if (unlikely((PARAM1 < PARAM2 && (PARAM1 + T1) > PARAM2) ||
|
349 | 76a66253 | j_mayer | (PARAM1 < PARAM3 && (PARAM1 + T1) > PARAM3))) { |
350 | e1833e1f | j_mayer | do_raise_exception_err(POWERPC_EXCP_PROGRAM, |
351 | e1833e1f | j_mayer | POWERPC_EXCP_INVAL | |
352 | e1833e1f | j_mayer | POWERPC_EXCP_INVAL_LSWX); |
353 | 111bfab3 | bellard | } else {
|
354 | d9bce9d9 | j_mayer | glue(do_lsw_le_64, MEMSUFFIX)(PARAM1); |
355 | 111bfab3 | bellard | } |
356 | 111bfab3 | bellard | } |
357 | 111bfab3 | bellard | RETURN(); |
358 | 111bfab3 | bellard | } |
359 | d9bce9d9 | j_mayer | #endif
|
360 | d9bce9d9 | j_mayer | |
361 | d9bce9d9 | j_mayer | void OPPROTO glue(op_stsw, MEMSUFFIX) (void) |
362 | d9bce9d9 | j_mayer | { |
363 | d9bce9d9 | j_mayer | glue(do_stsw, MEMSUFFIX)(PARAM1); |
364 | d9bce9d9 | j_mayer | RETURN(); |
365 | d9bce9d9 | j_mayer | } |
366 | d9bce9d9 | j_mayer | |
367 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
368 | d9bce9d9 | j_mayer | void OPPROTO glue(op_stsw_64, MEMSUFFIX) (void) |
369 | d9bce9d9 | j_mayer | { |
370 | d9bce9d9 | j_mayer | glue(do_stsw_64, MEMSUFFIX)(PARAM1); |
371 | d9bce9d9 | j_mayer | RETURN(); |
372 | d9bce9d9 | j_mayer | } |
373 | d9bce9d9 | j_mayer | #endif
|
374 | 111bfab3 | bellard | |
375 | d9bce9d9 | j_mayer | void OPPROTO glue(op_stsw_le, MEMSUFFIX) (void) |
376 | 9a64fbe4 | bellard | { |
377 | d9bce9d9 | j_mayer | glue(do_stsw_le, MEMSUFFIX)(PARAM1); |
378 | 9a64fbe4 | bellard | RETURN(); |
379 | 9a64fbe4 | bellard | } |
380 | 9a64fbe4 | bellard | |
381 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
382 | d9bce9d9 | j_mayer | void OPPROTO glue(op_stsw_le_64, MEMSUFFIX) (void) |
383 | 111bfab3 | bellard | { |
384 | d9bce9d9 | j_mayer | glue(do_stsw_le_64, MEMSUFFIX)(PARAM1); |
385 | 111bfab3 | bellard | RETURN(); |
386 | 111bfab3 | bellard | } |
387 | d9bce9d9 | j_mayer | #endif
|
388 | 111bfab3 | bellard | |
389 | 9a64fbe4 | bellard | /*** Floating-point store ***/
|
390 | 9a64fbe4 | bellard | #define PPC_STF_OP(name, op) \
|
391 | d9bce9d9 | j_mayer | void OPPROTO glue(glue(op_st, name), MEMSUFFIX) (void) \ |
392 | d9bce9d9 | j_mayer | { \ |
393 | d9bce9d9 | j_mayer | glue(op, MEMSUFFIX)((uint32_t)T0, FT0); \ |
394 | d9bce9d9 | j_mayer | RETURN(); \ |
395 | d9bce9d9 | j_mayer | } |
396 | d9bce9d9 | j_mayer | |
397 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
398 | d9bce9d9 | j_mayer | #define PPC_STF_OP_64(name, op) \
|
399 | d9bce9d9 | j_mayer | void OPPROTO glue(glue(glue(op_st, name), _64), MEMSUFFIX) (void) \ |
400 | 9a64fbe4 | bellard | { \ |
401 | d9bce9d9 | j_mayer | glue(op, MEMSUFFIX)((uint64_t)T0, FT0); \ |
402 | 9a64fbe4 | bellard | RETURN(); \ |
403 | 9a64fbe4 | bellard | } |
404 | d9bce9d9 | j_mayer | #endif
|
405 | 9a64fbe4 | bellard | |
406 | 9a64fbe4 | bellard | PPC_STF_OP(fd, stfq); |
407 | 9a64fbe4 | bellard | PPC_STF_OP(fs, stfl); |
408 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
409 | d9bce9d9 | j_mayer | PPC_STF_OP_64(fd, stfq); |
410 | d9bce9d9 | j_mayer | PPC_STF_OP_64(fs, stfl); |
411 | d9bce9d9 | j_mayer | #endif
|
412 | 9a64fbe4 | bellard | |
413 | 111bfab3 | bellard | static inline void glue(stfqr, MEMSUFFIX) (target_ulong EA, double d) |
414 | 111bfab3 | bellard | { |
415 | 111bfab3 | bellard | union {
|
416 | 111bfab3 | bellard | double d;
|
417 | 111bfab3 | bellard | uint64_t u; |
418 | 111bfab3 | bellard | } u; |
419 | 111bfab3 | bellard | |
420 | 111bfab3 | bellard | u.d = d; |
421 | 111bfab3 | bellard | u.u = ((u.u & 0xFF00000000000000ULL) >> 56) | |
422 | 111bfab3 | bellard | ((u.u & 0x00FF000000000000ULL) >> 40) | |
423 | 111bfab3 | bellard | ((u.u & 0x0000FF0000000000ULL) >> 24) | |
424 | 111bfab3 | bellard | ((u.u & 0x000000FF00000000ULL) >> 8) | |
425 | 111bfab3 | bellard | ((u.u & 0x00000000FF000000ULL) << 8) | |
426 | 111bfab3 | bellard | ((u.u & 0x0000000000FF0000ULL) << 24) | |
427 | 111bfab3 | bellard | ((u.u & 0x000000000000FF00ULL) << 40) | |
428 | 111bfab3 | bellard | ((u.u & 0x00000000000000FFULL) << 56); |
429 | 111bfab3 | bellard | glue(stfq, MEMSUFFIX)(EA, u.d); |
430 | 111bfab3 | bellard | } |
431 | 111bfab3 | bellard | |
432 | 111bfab3 | bellard | static inline void glue(stflr, MEMSUFFIX) (target_ulong EA, float f) |
433 | 111bfab3 | bellard | { |
434 | 111bfab3 | bellard | union {
|
435 | 111bfab3 | bellard | float f;
|
436 | 111bfab3 | bellard | uint32_t u; |
437 | 111bfab3 | bellard | } u; |
438 | 111bfab3 | bellard | |
439 | 111bfab3 | bellard | u.f = f; |
440 | 111bfab3 | bellard | u.u = ((u.u & 0xFF000000UL) >> 24) | |
441 | 111bfab3 | bellard | ((u.u & 0x00FF0000ULL) >> 8) | |
442 | 111bfab3 | bellard | ((u.u & 0x0000FF00UL) << 8) | |
443 | 111bfab3 | bellard | ((u.u & 0x000000FFULL) << 24); |
444 | 111bfab3 | bellard | glue(stfl, MEMSUFFIX)(EA, u.f); |
445 | 111bfab3 | bellard | } |
446 | 111bfab3 | bellard | |
447 | 111bfab3 | bellard | PPC_STF_OP(fd_le, stfqr); |
448 | 111bfab3 | bellard | PPC_STF_OP(fs_le, stflr); |
449 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
450 | d9bce9d9 | j_mayer | PPC_STF_OP_64(fd_le, stfqr); |
451 | d9bce9d9 | j_mayer | PPC_STF_OP_64(fs_le, stflr); |
452 | d9bce9d9 | j_mayer | #endif
|
453 | 111bfab3 | bellard | |
454 | 9a64fbe4 | bellard | /*** Floating-point load ***/
|
455 | 9a64fbe4 | bellard | #define PPC_LDF_OP(name, op) \
|
456 | d9bce9d9 | j_mayer | void OPPROTO glue(glue(op_l, name), MEMSUFFIX) (void) \ |
457 | d9bce9d9 | j_mayer | { \ |
458 | d9bce9d9 | j_mayer | FT0 = glue(op, MEMSUFFIX)((uint32_t)T0); \ |
459 | d9bce9d9 | j_mayer | RETURN(); \ |
460 | d9bce9d9 | j_mayer | } |
461 | d9bce9d9 | j_mayer | |
462 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
463 | d9bce9d9 | j_mayer | #define PPC_LDF_OP_64(name, op) \
|
464 | d9bce9d9 | j_mayer | void OPPROTO glue(glue(glue(op_l, name), _64), MEMSUFFIX) (void) \ |
465 | 9a64fbe4 | bellard | { \ |
466 | d9bce9d9 | j_mayer | FT0 = glue(op, MEMSUFFIX)((uint64_t)T0); \ |
467 | 9a64fbe4 | bellard | RETURN(); \ |
468 | 9a64fbe4 | bellard | } |
469 | d9bce9d9 | j_mayer | #endif
|
470 | 9a64fbe4 | bellard | |
471 | 9a64fbe4 | bellard | PPC_LDF_OP(fd, ldfq); |
472 | 9a64fbe4 | bellard | PPC_LDF_OP(fs, ldfl); |
473 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
474 | d9bce9d9 | j_mayer | PPC_LDF_OP_64(fd, ldfq); |
475 | d9bce9d9 | j_mayer | PPC_LDF_OP_64(fs, ldfl); |
476 | d9bce9d9 | j_mayer | #endif
|
477 | 9a64fbe4 | bellard | |
478 | 111bfab3 | bellard | static inline double glue(ldfqr, MEMSUFFIX) (target_ulong EA) |
479 | 111bfab3 | bellard | { |
480 | 111bfab3 | bellard | union {
|
481 | 111bfab3 | bellard | double d;
|
482 | 111bfab3 | bellard | uint64_t u; |
483 | 111bfab3 | bellard | } u; |
484 | 111bfab3 | bellard | |
485 | 111bfab3 | bellard | u.d = glue(ldfq, MEMSUFFIX)(EA); |
486 | 111bfab3 | bellard | u.u = ((u.u & 0xFF00000000000000ULL) >> 56) | |
487 | 111bfab3 | bellard | ((u.u & 0x00FF000000000000ULL) >> 40) | |
488 | 111bfab3 | bellard | ((u.u & 0x0000FF0000000000ULL) >> 24) | |
489 | 111bfab3 | bellard | ((u.u & 0x000000FF00000000ULL) >> 8) | |
490 | 111bfab3 | bellard | ((u.u & 0x00000000FF000000ULL) << 8) | |
491 | 111bfab3 | bellard | ((u.u & 0x0000000000FF0000ULL) << 24) | |
492 | 111bfab3 | bellard | ((u.u & 0x000000000000FF00ULL) << 40) | |
493 | 111bfab3 | bellard | ((u.u & 0x00000000000000FFULL) << 56); |
494 | 111bfab3 | bellard | |
495 | 111bfab3 | bellard | return u.d;
|
496 | 111bfab3 | bellard | } |
497 | 111bfab3 | bellard | |
498 | 111bfab3 | bellard | static inline float glue(ldflr, MEMSUFFIX) (target_ulong EA) |
499 | 111bfab3 | bellard | { |
500 | 111bfab3 | bellard | union {
|
501 | 111bfab3 | bellard | float f;
|
502 | 111bfab3 | bellard | uint32_t u; |
503 | 111bfab3 | bellard | } u; |
504 | 111bfab3 | bellard | |
505 | 111bfab3 | bellard | u.f = glue(ldfl, MEMSUFFIX)(EA); |
506 | 111bfab3 | bellard | u.u = ((u.u & 0xFF000000UL) >> 24) | |
507 | 111bfab3 | bellard | ((u.u & 0x00FF0000ULL) >> 8) | |
508 | 111bfab3 | bellard | ((u.u & 0x0000FF00UL) << 8) | |
509 | 111bfab3 | bellard | ((u.u & 0x000000FFULL) << 24); |
510 | 111bfab3 | bellard | |
511 | 111bfab3 | bellard | return u.f;
|
512 | 111bfab3 | bellard | } |
513 | 111bfab3 | bellard | |
514 | 111bfab3 | bellard | PPC_LDF_OP(fd_le, ldfqr); |
515 | 111bfab3 | bellard | PPC_LDF_OP(fs_le, ldflr); |
516 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
517 | d9bce9d9 | j_mayer | PPC_LDF_OP_64(fd_le, ldfqr); |
518 | d9bce9d9 | j_mayer | PPC_LDF_OP_64(fs_le, ldflr); |
519 | d9bce9d9 | j_mayer | #endif
|
520 | 111bfab3 | bellard | |
521 | 985a19d6 | bellard | /* Load and set reservation */
|
522 | d9bce9d9 | j_mayer | void OPPROTO glue(op_lwarx, MEMSUFFIX) (void) |
523 | d9bce9d9 | j_mayer | { |
524 | d9bce9d9 | j_mayer | if (unlikely(T0 & 0x03)) { |
525 | e1833e1f | j_mayer | do_raise_exception(POWERPC_EXCP_ALIGN); |
526 | d9bce9d9 | j_mayer | } else {
|
527 | d9bce9d9 | j_mayer | T1 = glue(ldl, MEMSUFFIX)((uint32_t)T0); |
528 | 36081602 | j_mayer | env->reserve = (uint32_t)T0; |
529 | d9bce9d9 | j_mayer | } |
530 | d9bce9d9 | j_mayer | RETURN(); |
531 | d9bce9d9 | j_mayer | } |
532 | d9bce9d9 | j_mayer | |
533 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
534 | d9bce9d9 | j_mayer | void OPPROTO glue(op_lwarx_64, MEMSUFFIX) (void) |
535 | d9bce9d9 | j_mayer | { |
536 | d9bce9d9 | j_mayer | if (unlikely(T0 & 0x03)) { |
537 | e1833e1f | j_mayer | do_raise_exception(POWERPC_EXCP_ALIGN); |
538 | d9bce9d9 | j_mayer | } else {
|
539 | d9bce9d9 | j_mayer | T1 = glue(ldl, MEMSUFFIX)((uint64_t)T0); |
540 | 36081602 | j_mayer | env->reserve = (uint64_t)T0; |
541 | d9bce9d9 | j_mayer | } |
542 | d9bce9d9 | j_mayer | RETURN(); |
543 | d9bce9d9 | j_mayer | } |
544 | d9bce9d9 | j_mayer | |
545 | 426613db | j_mayer | void OPPROTO glue(op_ldarx, MEMSUFFIX) (void) |
546 | 426613db | j_mayer | { |
547 | 426613db | j_mayer | if (unlikely(T0 & 0x03)) { |
548 | e1833e1f | j_mayer | do_raise_exception(POWERPC_EXCP_ALIGN); |
549 | 426613db | j_mayer | } else {
|
550 | 426613db | j_mayer | T1 = glue(ldq, MEMSUFFIX)((uint32_t)T0); |
551 | 36081602 | j_mayer | env->reserve = (uint32_t)T0; |
552 | 426613db | j_mayer | } |
553 | 426613db | j_mayer | RETURN(); |
554 | 426613db | j_mayer | } |
555 | 426613db | j_mayer | |
556 | d9bce9d9 | j_mayer | void OPPROTO glue(op_ldarx_64, MEMSUFFIX) (void) |
557 | d9bce9d9 | j_mayer | { |
558 | d9bce9d9 | j_mayer | if (unlikely(T0 & 0x03)) { |
559 | e1833e1f | j_mayer | do_raise_exception(POWERPC_EXCP_ALIGN); |
560 | d9bce9d9 | j_mayer | } else {
|
561 | d9bce9d9 | j_mayer | T1 = glue(ldq, MEMSUFFIX)((uint64_t)T0); |
562 | 36081602 | j_mayer | env->reserve = (uint64_t)T0; |
563 | d9bce9d9 | j_mayer | } |
564 | d9bce9d9 | j_mayer | RETURN(); |
565 | d9bce9d9 | j_mayer | } |
566 | d9bce9d9 | j_mayer | #endif
|
567 | d9bce9d9 | j_mayer | |
568 | d9bce9d9 | j_mayer | void OPPROTO glue(op_lwarx_le, MEMSUFFIX) (void) |
569 | d9bce9d9 | j_mayer | { |
570 | d9bce9d9 | j_mayer | if (unlikely(T0 & 0x03)) { |
571 | e1833e1f | j_mayer | do_raise_exception(POWERPC_EXCP_ALIGN); |
572 | d9bce9d9 | j_mayer | } else {
|
573 | d9bce9d9 | j_mayer | T1 = glue(ld32r, MEMSUFFIX)((uint32_t)T0); |
574 | 36081602 | j_mayer | env->reserve = (uint32_t)T0; |
575 | d9bce9d9 | j_mayer | } |
576 | d9bce9d9 | j_mayer | RETURN(); |
577 | d9bce9d9 | j_mayer | } |
578 | d9bce9d9 | j_mayer | |
579 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
580 | d9bce9d9 | j_mayer | void OPPROTO glue(op_lwarx_le_64, MEMSUFFIX) (void) |
581 | 985a19d6 | bellard | { |
582 | 76a66253 | j_mayer | if (unlikely(T0 & 0x03)) { |
583 | e1833e1f | j_mayer | do_raise_exception(POWERPC_EXCP_ALIGN); |
584 | 985a19d6 | bellard | } else {
|
585 | d9bce9d9 | j_mayer | T1 = glue(ld32r, MEMSUFFIX)((uint64_t)T0); |
586 | 36081602 | j_mayer | env->reserve = (uint64_t)T0; |
587 | 985a19d6 | bellard | } |
588 | 985a19d6 | bellard | RETURN(); |
589 | 985a19d6 | bellard | } |
590 | 985a19d6 | bellard | |
591 | 426613db | j_mayer | void OPPROTO glue(op_ldarx_le, MEMSUFFIX) (void) |
592 | 426613db | j_mayer | { |
593 | 426613db | j_mayer | if (unlikely(T0 & 0x03)) { |
594 | e1833e1f | j_mayer | do_raise_exception(POWERPC_EXCP_ALIGN); |
595 | 426613db | j_mayer | } else {
|
596 | 426613db | j_mayer | T1 = glue(ld64r, MEMSUFFIX)((uint32_t)T0); |
597 | 36081602 | j_mayer | env->reserve = (uint32_t)T0; |
598 | 426613db | j_mayer | } |
599 | 426613db | j_mayer | RETURN(); |
600 | 426613db | j_mayer | } |
601 | 426613db | j_mayer | |
602 | d9bce9d9 | j_mayer | void OPPROTO glue(op_ldarx_le_64, MEMSUFFIX) (void) |
603 | 111bfab3 | bellard | { |
604 | 76a66253 | j_mayer | if (unlikely(T0 & 0x03)) { |
605 | e1833e1f | j_mayer | do_raise_exception(POWERPC_EXCP_ALIGN); |
606 | 111bfab3 | bellard | } else {
|
607 | d9bce9d9 | j_mayer | T1 = glue(ld64r, MEMSUFFIX)((uint64_t)T0); |
608 | 36081602 | j_mayer | env->reserve = (uint64_t)T0; |
609 | 111bfab3 | bellard | } |
610 | 111bfab3 | bellard | RETURN(); |
611 | 111bfab3 | bellard | } |
612 | d9bce9d9 | j_mayer | #endif
|
613 | 111bfab3 | bellard | |
614 | 9a64fbe4 | bellard | /* Store with reservation */
|
615 | d9bce9d9 | j_mayer | void OPPROTO glue(op_stwcx, MEMSUFFIX) (void) |
616 | d9bce9d9 | j_mayer | { |
617 | d9bce9d9 | j_mayer | if (unlikely(T0 & 0x03)) { |
618 | e1833e1f | j_mayer | do_raise_exception(POWERPC_EXCP_ALIGN); |
619 | d9bce9d9 | j_mayer | } else {
|
620 | 36081602 | j_mayer | if (unlikely(env->reserve != (uint32_t)T0)) {
|
621 | 966439a6 | j_mayer | env->crf[0] = xer_so;
|
622 | d9bce9d9 | j_mayer | } else {
|
623 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)T0, T1); |
624 | 966439a6 | j_mayer | env->crf[0] = xer_so | 0x02; |
625 | d9bce9d9 | j_mayer | } |
626 | d9bce9d9 | j_mayer | } |
627 | 36081602 | j_mayer | env->reserve = -1;
|
628 | d9bce9d9 | j_mayer | RETURN(); |
629 | d9bce9d9 | j_mayer | } |
630 | d9bce9d9 | j_mayer | |
631 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
632 | d9bce9d9 | j_mayer | void OPPROTO glue(op_stwcx_64, MEMSUFFIX) (void) |
633 | d9bce9d9 | j_mayer | { |
634 | d9bce9d9 | j_mayer | if (unlikely(T0 & 0x03)) { |
635 | e1833e1f | j_mayer | do_raise_exception(POWERPC_EXCP_ALIGN); |
636 | d9bce9d9 | j_mayer | } else {
|
637 | 36081602 | j_mayer | if (unlikely(env->reserve != (uint64_t)T0)) {
|
638 | 966439a6 | j_mayer | env->crf[0] = xer_so;
|
639 | d9bce9d9 | j_mayer | } else {
|
640 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)T0, T1); |
641 | 966439a6 | j_mayer | env->crf[0] = xer_so | 0x02; |
642 | d9bce9d9 | j_mayer | } |
643 | d9bce9d9 | j_mayer | } |
644 | 36081602 | j_mayer | env->reserve = -1;
|
645 | d9bce9d9 | j_mayer | RETURN(); |
646 | d9bce9d9 | j_mayer | } |
647 | d9bce9d9 | j_mayer | |
648 | 426613db | j_mayer | void OPPROTO glue(op_stdcx, MEMSUFFIX) (void) |
649 | 426613db | j_mayer | { |
650 | 426613db | j_mayer | if (unlikely(T0 & 0x03)) { |
651 | e1833e1f | j_mayer | do_raise_exception(POWERPC_EXCP_ALIGN); |
652 | 426613db | j_mayer | } else {
|
653 | 36081602 | j_mayer | if (unlikely(env->reserve != (uint32_t)T0)) {
|
654 | 966439a6 | j_mayer | env->crf[0] = xer_so;
|
655 | 426613db | j_mayer | } else {
|
656 | 426613db | j_mayer | glue(stq, MEMSUFFIX)((uint32_t)T0, T1); |
657 | 966439a6 | j_mayer | env->crf[0] = xer_so | 0x02; |
658 | 426613db | j_mayer | } |
659 | 426613db | j_mayer | } |
660 | 36081602 | j_mayer | env->reserve = -1;
|
661 | 426613db | j_mayer | RETURN(); |
662 | 426613db | j_mayer | } |
663 | 426613db | j_mayer | |
664 | d9bce9d9 | j_mayer | void OPPROTO glue(op_stdcx_64, MEMSUFFIX) (void) |
665 | 9a64fbe4 | bellard | { |
666 | 76a66253 | j_mayer | if (unlikely(T0 & 0x03)) { |
667 | e1833e1f | j_mayer | do_raise_exception(POWERPC_EXCP_ALIGN); |
668 | 9a64fbe4 | bellard | } else {
|
669 | 36081602 | j_mayer | if (unlikely(env->reserve != (uint64_t)T0)) {
|
670 | 966439a6 | j_mayer | env->crf[0] = xer_so;
|
671 | 9a64fbe4 | bellard | } else {
|
672 | d9bce9d9 | j_mayer | glue(stq, MEMSUFFIX)((uint64_t)T0, T1); |
673 | 966439a6 | j_mayer | env->crf[0] = xer_so | 0x02; |
674 | d9bce9d9 | j_mayer | } |
675 | d9bce9d9 | j_mayer | } |
676 | 36081602 | j_mayer | env->reserve = -1;
|
677 | d9bce9d9 | j_mayer | RETURN(); |
678 | d9bce9d9 | j_mayer | } |
679 | d9bce9d9 | j_mayer | #endif
|
680 | d9bce9d9 | j_mayer | |
681 | d9bce9d9 | j_mayer | void OPPROTO glue(op_stwcx_le, MEMSUFFIX) (void) |
682 | d9bce9d9 | j_mayer | { |
683 | d9bce9d9 | j_mayer | if (unlikely(T0 & 0x03)) { |
684 | e1833e1f | j_mayer | do_raise_exception(POWERPC_EXCP_ALIGN); |
685 | d9bce9d9 | j_mayer | } else {
|
686 | 36081602 | j_mayer | if (unlikely(env->reserve != (uint32_t)T0)) {
|
687 | 966439a6 | j_mayer | env->crf[0] = xer_so;
|
688 | d9bce9d9 | j_mayer | } else {
|
689 | d9bce9d9 | j_mayer | glue(st32r, MEMSUFFIX)((uint32_t)T0, T1); |
690 | 966439a6 | j_mayer | env->crf[0] = xer_so | 0x02; |
691 | 9a64fbe4 | bellard | } |
692 | 9a64fbe4 | bellard | } |
693 | 36081602 | j_mayer | env->reserve = -1;
|
694 | 9a64fbe4 | bellard | RETURN(); |
695 | 9a64fbe4 | bellard | } |
696 | 9a64fbe4 | bellard | |
697 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
698 | d9bce9d9 | j_mayer | void OPPROTO glue(op_stwcx_le_64, MEMSUFFIX) (void) |
699 | 111bfab3 | bellard | { |
700 | 76a66253 | j_mayer | if (unlikely(T0 & 0x03)) { |
701 | e1833e1f | j_mayer | do_raise_exception(POWERPC_EXCP_ALIGN); |
702 | 111bfab3 | bellard | } else {
|
703 | 36081602 | j_mayer | if (unlikely(env->reserve != (uint64_t)T0)) {
|
704 | 966439a6 | j_mayer | env->crf[0] = xer_so;
|
705 | 111bfab3 | bellard | } else {
|
706 | d9bce9d9 | j_mayer | glue(st32r, MEMSUFFIX)((uint64_t)T0, T1); |
707 | 966439a6 | j_mayer | env->crf[0] = xer_so | 0x02; |
708 | 111bfab3 | bellard | } |
709 | 111bfab3 | bellard | } |
710 | 36081602 | j_mayer | env->reserve = -1;
|
711 | 111bfab3 | bellard | RETURN(); |
712 | 111bfab3 | bellard | } |
713 | 111bfab3 | bellard | |
714 | 426613db | j_mayer | void OPPROTO glue(op_stdcx_le, MEMSUFFIX) (void) |
715 | 426613db | j_mayer | { |
716 | 426613db | j_mayer | if (unlikely(T0 & 0x03)) { |
717 | e1833e1f | j_mayer | do_raise_exception(POWERPC_EXCP_ALIGN); |
718 | 426613db | j_mayer | } else {
|
719 | 36081602 | j_mayer | if (unlikely(env->reserve != (uint32_t)T0)) {
|
720 | 966439a6 | j_mayer | env->crf[0] = xer_so;
|
721 | 426613db | j_mayer | } else {
|
722 | 426613db | j_mayer | glue(st64r, MEMSUFFIX)((uint32_t)T0, T1); |
723 | 966439a6 | j_mayer | env->crf[0] = xer_so | 0x02; |
724 | 426613db | j_mayer | } |
725 | 426613db | j_mayer | } |
726 | 36081602 | j_mayer | env->reserve = -1;
|
727 | 426613db | j_mayer | RETURN(); |
728 | 426613db | j_mayer | } |
729 | 426613db | j_mayer | |
730 | d9bce9d9 | j_mayer | void OPPROTO glue(op_stdcx_le_64, MEMSUFFIX) (void) |
731 | d9bce9d9 | j_mayer | { |
732 | d9bce9d9 | j_mayer | if (unlikely(T0 & 0x03)) { |
733 | e1833e1f | j_mayer | do_raise_exception(POWERPC_EXCP_ALIGN); |
734 | d9bce9d9 | j_mayer | } else {
|
735 | 36081602 | j_mayer | if (unlikely(env->reserve != (uint64_t)T0)) {
|
736 | 966439a6 | j_mayer | env->crf[0] = xer_so;
|
737 | d9bce9d9 | j_mayer | } else {
|
738 | d9bce9d9 | j_mayer | glue(st64r, MEMSUFFIX)((uint64_t)T0, T1); |
739 | 966439a6 | j_mayer | env->crf[0] = xer_so | 0x02; |
740 | d9bce9d9 | j_mayer | } |
741 | d9bce9d9 | j_mayer | } |
742 | 36081602 | j_mayer | env->reserve = -1;
|
743 | d9bce9d9 | j_mayer | RETURN(); |
744 | d9bce9d9 | j_mayer | } |
745 | d9bce9d9 | j_mayer | #endif
|
746 | d9bce9d9 | j_mayer | |
747 | d9bce9d9 | j_mayer | void OPPROTO glue(op_dcbz, MEMSUFFIX) (void) |
748 | d9bce9d9 | j_mayer | { |
749 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x00), 0); |
750 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x04), 0); |
751 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x08), 0); |
752 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x0C), 0); |
753 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x10), 0); |
754 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x14), 0); |
755 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x18), 0); |
756 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x1C), 0); |
757 | d9bce9d9 | j_mayer | #if DCACHE_LINE_SIZE == 64 |
758 | d9bce9d9 | j_mayer | /* XXX: cache line size should be 64 for POWER & PowerPC 601 */
|
759 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x20UL), 0); |
760 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x24UL), 0); |
761 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x28UL), 0); |
762 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x2CUL), 0); |
763 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x30UL), 0); |
764 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x34UL), 0); |
765 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x38UL), 0); |
766 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x3CUL), 0); |
767 | d9bce9d9 | j_mayer | #endif
|
768 | d9bce9d9 | j_mayer | RETURN(); |
769 | d9bce9d9 | j_mayer | } |
770 | d9bce9d9 | j_mayer | |
771 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
772 | d9bce9d9 | j_mayer | void OPPROTO glue(op_dcbz_64, MEMSUFFIX) (void) |
773 | 9a64fbe4 | bellard | { |
774 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x00), 0); |
775 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x04), 0); |
776 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x08), 0); |
777 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x0C), 0); |
778 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x10), 0); |
779 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x14), 0); |
780 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x18), 0); |
781 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x1C), 0); |
782 | 76a66253 | j_mayer | #if DCACHE_LINE_SIZE == 64 |
783 | 76a66253 | j_mayer | /* XXX: cache line size should be 64 for POWER & PowerPC 601 */
|
784 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x20UL), 0); |
785 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x24UL), 0); |
786 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x28UL), 0); |
787 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x2CUL), 0); |
788 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x30UL), 0); |
789 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x34UL), 0); |
790 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x38UL), 0); |
791 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x3CUL), 0); |
792 | 76a66253 | j_mayer | #endif
|
793 | 9a64fbe4 | bellard | RETURN(); |
794 | 9a64fbe4 | bellard | } |
795 | d9bce9d9 | j_mayer | #endif
|
796 | 9a64fbe4 | bellard | |
797 | 36f69651 | j_mayer | /* Instruction cache block invalidate */
|
798 | 36f69651 | j_mayer | void OPPROTO glue(op_icbi, MEMSUFFIX) (void) |
799 | 36f69651 | j_mayer | { |
800 | 36f69651 | j_mayer | glue(do_icbi, MEMSUFFIX)(); |
801 | 36f69651 | j_mayer | RETURN(); |
802 | 36f69651 | j_mayer | } |
803 | 36f69651 | j_mayer | |
804 | 36f69651 | j_mayer | #if defined(TARGET_PPC64)
|
805 | 36f69651 | j_mayer | void OPPROTO glue(op_icbi_64, MEMSUFFIX) (void) |
806 | 36f69651 | j_mayer | { |
807 | 36f69651 | j_mayer | glue(do_icbi_64, MEMSUFFIX)(); |
808 | 36f69651 | j_mayer | RETURN(); |
809 | 36f69651 | j_mayer | } |
810 | 36f69651 | j_mayer | #endif
|
811 | 36f69651 | j_mayer | |
812 | 9a64fbe4 | bellard | /* External access */
|
813 | d9bce9d9 | j_mayer | void OPPROTO glue(op_eciwx, MEMSUFFIX) (void) |
814 | d9bce9d9 | j_mayer | { |
815 | d9bce9d9 | j_mayer | T1 = glue(ldl, MEMSUFFIX)((uint32_t)T0); |
816 | d9bce9d9 | j_mayer | RETURN(); |
817 | d9bce9d9 | j_mayer | } |
818 | d9bce9d9 | j_mayer | |
819 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
820 | d9bce9d9 | j_mayer | void OPPROTO glue(op_eciwx_64, MEMSUFFIX) (void) |
821 | d9bce9d9 | j_mayer | { |
822 | d9bce9d9 | j_mayer | T1 = glue(ldl, MEMSUFFIX)((uint64_t)T0); |
823 | d9bce9d9 | j_mayer | RETURN(); |
824 | d9bce9d9 | j_mayer | } |
825 | d9bce9d9 | j_mayer | #endif
|
826 | d9bce9d9 | j_mayer | |
827 | d9bce9d9 | j_mayer | void OPPROTO glue(op_ecowx, MEMSUFFIX) (void) |
828 | d9bce9d9 | j_mayer | { |
829 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)T0, T1); |
830 | d9bce9d9 | j_mayer | RETURN(); |
831 | d9bce9d9 | j_mayer | } |
832 | d9bce9d9 | j_mayer | |
833 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
834 | d9bce9d9 | j_mayer | void OPPROTO glue(op_ecowx_64, MEMSUFFIX) (void) |
835 | 9a64fbe4 | bellard | { |
836 | d9bce9d9 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)T0, T1); |
837 | 9a64fbe4 | bellard | RETURN(); |
838 | 9a64fbe4 | bellard | } |
839 | d9bce9d9 | j_mayer | #endif
|
840 | 9a64fbe4 | bellard | |
841 | d9bce9d9 | j_mayer | void OPPROTO glue(op_eciwx_le, MEMSUFFIX) (void) |
842 | 9a64fbe4 | bellard | { |
843 | d9bce9d9 | j_mayer | T1 = glue(ld32r, MEMSUFFIX)((uint32_t)T0); |
844 | 9a64fbe4 | bellard | RETURN(); |
845 | 9a64fbe4 | bellard | } |
846 | 9a64fbe4 | bellard | |
847 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
848 | d9bce9d9 | j_mayer | void OPPROTO glue(op_eciwx_le_64, MEMSUFFIX) (void) |
849 | 111bfab3 | bellard | { |
850 | d9bce9d9 | j_mayer | T1 = glue(ld32r, MEMSUFFIX)((uint64_t)T0); |
851 | 111bfab3 | bellard | RETURN(); |
852 | 111bfab3 | bellard | } |
853 | d9bce9d9 | j_mayer | #endif
|
854 | 111bfab3 | bellard | |
855 | d9bce9d9 | j_mayer | void OPPROTO glue(op_ecowx_le, MEMSUFFIX) (void) |
856 | 111bfab3 | bellard | { |
857 | d9bce9d9 | j_mayer | glue(st32r, MEMSUFFIX)((uint32_t)T0, T1); |
858 | 111bfab3 | bellard | RETURN(); |
859 | 111bfab3 | bellard | } |
860 | 111bfab3 | bellard | |
861 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
862 | d9bce9d9 | j_mayer | void OPPROTO glue(op_ecowx_le_64, MEMSUFFIX) (void) |
863 | d9bce9d9 | j_mayer | { |
864 | d9bce9d9 | j_mayer | glue(st32r, MEMSUFFIX)((uint64_t)T0, T1); |
865 | d9bce9d9 | j_mayer | RETURN(); |
866 | d9bce9d9 | j_mayer | } |
867 | d9bce9d9 | j_mayer | #endif
|
868 | d9bce9d9 | j_mayer | |
869 | 76a66253 | j_mayer | /* XXX: those micro-ops need tests ! */
|
870 | 76a66253 | j_mayer | /* PowerPC 601 specific instructions (POWER bridge) */
|
871 | 76a66253 | j_mayer | void OPPROTO glue(op_POWER_lscbx, MEMSUFFIX) (void) |
872 | 76a66253 | j_mayer | { |
873 | 76a66253 | j_mayer | /* When byte count is 0, do nothing */
|
874 | d9bce9d9 | j_mayer | if (likely(T1 != 0)) { |
875 | 76a66253 | j_mayer | glue(do_POWER_lscbx, MEMSUFFIX)(PARAM1, PARAM2, PARAM3); |
876 | 76a66253 | j_mayer | } |
877 | 76a66253 | j_mayer | RETURN(); |
878 | 76a66253 | j_mayer | } |
879 | 76a66253 | j_mayer | |
880 | 76a66253 | j_mayer | /* POWER2 quad load and store */
|
881 | 76a66253 | j_mayer | /* XXX: TAGs are not managed */
|
882 | 76a66253 | j_mayer | void OPPROTO glue(op_POWER2_lfq, MEMSUFFIX) (void) |
883 | 76a66253 | j_mayer | { |
884 | 76a66253 | j_mayer | glue(do_POWER2_lfq, MEMSUFFIX)(); |
885 | 76a66253 | j_mayer | RETURN(); |
886 | 76a66253 | j_mayer | } |
887 | 76a66253 | j_mayer | |
888 | 76a66253 | j_mayer | void glue(op_POWER2_lfq_le, MEMSUFFIX) (void) |
889 | 76a66253 | j_mayer | { |
890 | 76a66253 | j_mayer | glue(do_POWER2_lfq_le, MEMSUFFIX)(); |
891 | 76a66253 | j_mayer | RETURN(); |
892 | 76a66253 | j_mayer | } |
893 | 76a66253 | j_mayer | |
894 | 76a66253 | j_mayer | void OPPROTO glue(op_POWER2_stfq, MEMSUFFIX) (void) |
895 | 76a66253 | j_mayer | { |
896 | 76a66253 | j_mayer | glue(do_POWER2_stfq, MEMSUFFIX)(); |
897 | 76a66253 | j_mayer | RETURN(); |
898 | 76a66253 | j_mayer | } |
899 | 76a66253 | j_mayer | |
900 | 76a66253 | j_mayer | void OPPROTO glue(op_POWER2_stfq_le, MEMSUFFIX) (void) |
901 | 76a66253 | j_mayer | { |
902 | 76a66253 | j_mayer | glue(do_POWER2_stfq_le, MEMSUFFIX)(); |
903 | 76a66253 | j_mayer | RETURN(); |
904 | 76a66253 | j_mayer | } |
905 | 76a66253 | j_mayer | |
906 | 35cdaad6 | j_mayer | #if defined(TARGET_PPCEMB)
|
907 | 0487d6a8 | j_mayer | /* SPE extension */
|
908 | 0487d6a8 | j_mayer | #define _PPC_SPE_LD_OP(name, op) \
|
909 | 0487d6a8 | j_mayer | void OPPROTO glue(glue(op_spe_l, name), MEMSUFFIX) (void) \ |
910 | 0487d6a8 | j_mayer | { \ |
911 | 0487d6a8 | j_mayer | T1_64 = glue(op, MEMSUFFIX)((uint32_t)T0); \ |
912 | 0487d6a8 | j_mayer | RETURN(); \ |
913 | 0487d6a8 | j_mayer | } |
914 | 0487d6a8 | j_mayer | |
915 | 0487d6a8 | j_mayer | #if defined(TARGET_PPC64)
|
916 | 0487d6a8 | j_mayer | #define _PPC_SPE_LD_OP_64(name, op) \
|
917 | 0487d6a8 | j_mayer | void OPPROTO glue(glue(glue(op_spe_l, name), _64), MEMSUFFIX) (void) \ |
918 | 0487d6a8 | j_mayer | { \ |
919 | 0487d6a8 | j_mayer | T1_64 = glue(op, MEMSUFFIX)((uint64_t)T0); \ |
920 | 0487d6a8 | j_mayer | RETURN(); \ |
921 | 0487d6a8 | j_mayer | } |
922 | 0487d6a8 | j_mayer | #define PPC_SPE_LD_OP(name, op) \
|
923 | 0487d6a8 | j_mayer | _PPC_SPE_LD_OP(name, op); \ |
924 | 0487d6a8 | j_mayer | _PPC_SPE_LD_OP_64(name, op) |
925 | 0487d6a8 | j_mayer | #else
|
926 | 0487d6a8 | j_mayer | #define PPC_SPE_LD_OP(name, op) \
|
927 | 0487d6a8 | j_mayer | _PPC_SPE_LD_OP(name, op) |
928 | 0487d6a8 | j_mayer | #endif
|
929 | 0487d6a8 | j_mayer | |
930 | 0487d6a8 | j_mayer | |
931 | 0487d6a8 | j_mayer | #define _PPC_SPE_ST_OP(name, op) \
|
932 | 0487d6a8 | j_mayer | void OPPROTO glue(glue(op_spe_st, name), MEMSUFFIX) (void) \ |
933 | 0487d6a8 | j_mayer | { \ |
934 | 0487d6a8 | j_mayer | glue(op, MEMSUFFIX)((uint32_t)T0, T1_64); \ |
935 | 0487d6a8 | j_mayer | RETURN(); \ |
936 | 0487d6a8 | j_mayer | } |
937 | 0487d6a8 | j_mayer | |
938 | 0487d6a8 | j_mayer | #if defined(TARGET_PPC64)
|
939 | 0487d6a8 | j_mayer | #define _PPC_SPE_ST_OP_64(name, op) \
|
940 | 0487d6a8 | j_mayer | void OPPROTO glue(glue(glue(op_spe_st, name), _64), MEMSUFFIX) (void) \ |
941 | 0487d6a8 | j_mayer | { \ |
942 | 0487d6a8 | j_mayer | glue(op, MEMSUFFIX)((uint64_t)T0, T1_64); \ |
943 | 0487d6a8 | j_mayer | RETURN(); \ |
944 | 0487d6a8 | j_mayer | } |
945 | 0487d6a8 | j_mayer | #define PPC_SPE_ST_OP(name, op) \
|
946 | 0487d6a8 | j_mayer | _PPC_SPE_ST_OP(name, op); \ |
947 | 0487d6a8 | j_mayer | _PPC_SPE_ST_OP_64(name, op) |
948 | 0487d6a8 | j_mayer | #else
|
949 | 0487d6a8 | j_mayer | #define PPC_SPE_ST_OP(name, op) \
|
950 | 0487d6a8 | j_mayer | _PPC_SPE_ST_OP(name, op) |
951 | 0487d6a8 | j_mayer | #endif
|
952 | 0487d6a8 | j_mayer | |
953 | 0487d6a8 | j_mayer | #if !defined(TARGET_PPC64)
|
954 | 0487d6a8 | j_mayer | PPC_SPE_LD_OP(dd, ldq); |
955 | 0487d6a8 | j_mayer | PPC_SPE_ST_OP(dd, stq); |
956 | 0487d6a8 | j_mayer | PPC_SPE_LD_OP(dd_le, ld64r); |
957 | 0487d6a8 | j_mayer | PPC_SPE_ST_OP(dd_le, st64r); |
958 | 0487d6a8 | j_mayer | #endif
|
959 | 0487d6a8 | j_mayer | static inline uint64_t glue(spe_ldw, MEMSUFFIX) (target_ulong EA) |
960 | 0487d6a8 | j_mayer | { |
961 | 0487d6a8 | j_mayer | uint64_t ret; |
962 | 0487d6a8 | j_mayer | ret = (uint64_t)glue(ldl, MEMSUFFIX)(EA) << 32;
|
963 | 0487d6a8 | j_mayer | ret |= (uint64_t)glue(ldl, MEMSUFFIX)(EA + 4);
|
964 | 0487d6a8 | j_mayer | return ret;
|
965 | 0487d6a8 | j_mayer | } |
966 | 0487d6a8 | j_mayer | PPC_SPE_LD_OP(dw, spe_ldw); |
967 | 0487d6a8 | j_mayer | static inline void glue(spe_stdw, MEMSUFFIX) (target_ulong EA, uint64_t data) |
968 | 0487d6a8 | j_mayer | { |
969 | 0487d6a8 | j_mayer | glue(stl, MEMSUFFIX)(EA, data >> 32);
|
970 | 0487d6a8 | j_mayer | glue(stl, MEMSUFFIX)(EA + 4, data);
|
971 | 0487d6a8 | j_mayer | } |
972 | 0487d6a8 | j_mayer | PPC_SPE_ST_OP(dw, spe_stdw); |
973 | 0487d6a8 | j_mayer | static inline uint64_t glue(spe_ldw_le, MEMSUFFIX) (target_ulong EA) |
974 | 0487d6a8 | j_mayer | { |
975 | 0487d6a8 | j_mayer | uint64_t ret; |
976 | 0487d6a8 | j_mayer | ret = (uint64_t)glue(ld32r, MEMSUFFIX)(EA) << 32;
|
977 | 0487d6a8 | j_mayer | ret |= (uint64_t)glue(ld32r, MEMSUFFIX)(EA + 4);
|
978 | 0487d6a8 | j_mayer | return ret;
|
979 | 0487d6a8 | j_mayer | } |
980 | 0487d6a8 | j_mayer | PPC_SPE_LD_OP(dw_le, spe_ldw_le); |
981 | 0487d6a8 | j_mayer | static inline void glue(spe_stdw_le, MEMSUFFIX) (target_ulong EA, |
982 | 0487d6a8 | j_mayer | uint64_t data) |
983 | 0487d6a8 | j_mayer | { |
984 | 0487d6a8 | j_mayer | glue(st32r, MEMSUFFIX)(EA, data >> 32);
|
985 | 0487d6a8 | j_mayer | glue(st32r, MEMSUFFIX)(EA + 4, data);
|
986 | 0487d6a8 | j_mayer | } |
987 | 0487d6a8 | j_mayer | PPC_SPE_ST_OP(dw_le, spe_stdw_le); |
988 | 0487d6a8 | j_mayer | static inline uint64_t glue(spe_ldh, MEMSUFFIX) (target_ulong EA) |
989 | 0487d6a8 | j_mayer | { |
990 | 0487d6a8 | j_mayer | uint64_t ret; |
991 | 0487d6a8 | j_mayer | ret = (uint64_t)glue(lduw, MEMSUFFIX)(EA) << 48;
|
992 | 0487d6a8 | j_mayer | ret |= (uint64_t)glue(lduw, MEMSUFFIX)(EA + 2) << 32; |
993 | 0487d6a8 | j_mayer | ret |= (uint64_t)glue(lduw, MEMSUFFIX)(EA + 4) << 16; |
994 | 0487d6a8 | j_mayer | ret |= (uint64_t)glue(lduw, MEMSUFFIX)(EA + 6);
|
995 | 0487d6a8 | j_mayer | return ret;
|
996 | 0487d6a8 | j_mayer | } |
997 | 0487d6a8 | j_mayer | PPC_SPE_LD_OP(dh, spe_ldh); |
998 | 0487d6a8 | j_mayer | static inline void glue(spe_stdh, MEMSUFFIX) (target_ulong EA, uint64_t data) |
999 | 0487d6a8 | j_mayer | { |
1000 | 0487d6a8 | j_mayer | glue(stw, MEMSUFFIX)(EA, data >> 48);
|
1001 | 0487d6a8 | j_mayer | glue(stw, MEMSUFFIX)(EA + 2, data >> 32); |
1002 | 0487d6a8 | j_mayer | glue(stw, MEMSUFFIX)(EA + 4, data >> 16); |
1003 | 0487d6a8 | j_mayer | glue(stw, MEMSUFFIX)(EA + 6, data);
|
1004 | 0487d6a8 | j_mayer | } |
1005 | 0487d6a8 | j_mayer | PPC_SPE_ST_OP(dh, spe_stdh); |
1006 | 0487d6a8 | j_mayer | static inline uint64_t glue(spe_ldh_le, MEMSUFFIX) (target_ulong EA) |
1007 | 0487d6a8 | j_mayer | { |
1008 | 0487d6a8 | j_mayer | uint64_t ret; |
1009 | 0487d6a8 | j_mayer | ret = (uint64_t)glue(ld16r, MEMSUFFIX)(EA) << 48;
|
1010 | 0487d6a8 | j_mayer | ret |= (uint64_t)glue(ld16r, MEMSUFFIX)(EA + 2) << 32; |
1011 | 0487d6a8 | j_mayer | ret |= (uint64_t)glue(ld16r, MEMSUFFIX)(EA + 4) << 16; |
1012 | 0487d6a8 | j_mayer | ret |= (uint64_t)glue(ld16r, MEMSUFFIX)(EA + 6);
|
1013 | 0487d6a8 | j_mayer | return ret;
|
1014 | 0487d6a8 | j_mayer | } |
1015 | 0487d6a8 | j_mayer | PPC_SPE_LD_OP(dh_le, spe_ldh_le); |
1016 | 0487d6a8 | j_mayer | static inline void glue(spe_stdh_le, MEMSUFFIX) (target_ulong EA, |
1017 | 0487d6a8 | j_mayer | uint64_t data) |
1018 | 0487d6a8 | j_mayer | { |
1019 | 0487d6a8 | j_mayer | glue(st16r, MEMSUFFIX)(EA, data >> 48);
|
1020 | 0487d6a8 | j_mayer | glue(st16r, MEMSUFFIX)(EA + 2, data >> 32); |
1021 | 0487d6a8 | j_mayer | glue(st16r, MEMSUFFIX)(EA + 4, data >> 16); |
1022 | 0487d6a8 | j_mayer | glue(st16r, MEMSUFFIX)(EA + 6, data);
|
1023 | 0487d6a8 | j_mayer | } |
1024 | 0487d6a8 | j_mayer | PPC_SPE_ST_OP(dh_le, spe_stdh_le); |
1025 | 0487d6a8 | j_mayer | static inline uint64_t glue(spe_lwhe, MEMSUFFIX) (target_ulong EA) |
1026 | 0487d6a8 | j_mayer | { |
1027 | 0487d6a8 | j_mayer | uint64_t ret; |
1028 | 0487d6a8 | j_mayer | ret = (uint64_t)glue(lduw, MEMSUFFIX)(EA) << 48;
|
1029 | 0487d6a8 | j_mayer | ret |= (uint64_t)glue(lduw, MEMSUFFIX)(EA + 2) << 16; |
1030 | 0487d6a8 | j_mayer | return ret;
|
1031 | 0487d6a8 | j_mayer | } |
1032 | 0487d6a8 | j_mayer | PPC_SPE_LD_OP(whe, spe_lwhe); |
1033 | 0487d6a8 | j_mayer | static inline void glue(spe_stwhe, MEMSUFFIX) (target_ulong EA, uint64_t data) |
1034 | 0487d6a8 | j_mayer | { |
1035 | 0487d6a8 | j_mayer | glue(stw, MEMSUFFIX)(EA, data >> 48);
|
1036 | 0487d6a8 | j_mayer | glue(stw, MEMSUFFIX)(EA + 2, data >> 16); |
1037 | 0487d6a8 | j_mayer | } |
1038 | 0487d6a8 | j_mayer | PPC_SPE_ST_OP(whe, spe_stwhe); |
1039 | 0487d6a8 | j_mayer | static inline uint64_t glue(spe_lwhe_le, MEMSUFFIX) (target_ulong EA) |
1040 | 0487d6a8 | j_mayer | { |
1041 | 0487d6a8 | j_mayer | uint64_t ret; |
1042 | 0487d6a8 | j_mayer | ret = (uint64_t)glue(ld16r, MEMSUFFIX)(EA) << 48;
|
1043 | 0487d6a8 | j_mayer | ret |= (uint64_t)glue(ld16r, MEMSUFFIX)(EA + 2) << 16; |
1044 | 0487d6a8 | j_mayer | return ret;
|
1045 | 0487d6a8 | j_mayer | } |
1046 | 0487d6a8 | j_mayer | PPC_SPE_LD_OP(whe_le, spe_lwhe_le); |
1047 | 0487d6a8 | j_mayer | static inline void glue(spe_stwhe_le, MEMSUFFIX) (target_ulong EA, |
1048 | 0487d6a8 | j_mayer | uint64_t data) |
1049 | 0487d6a8 | j_mayer | { |
1050 | 0487d6a8 | j_mayer | glue(st16r, MEMSUFFIX)(EA, data >> 48);
|
1051 | 0487d6a8 | j_mayer | glue(st16r, MEMSUFFIX)(EA + 2, data >> 16); |
1052 | 0487d6a8 | j_mayer | } |
1053 | 0487d6a8 | j_mayer | PPC_SPE_ST_OP(whe_le, spe_stwhe_le); |
1054 | 0487d6a8 | j_mayer | static inline uint64_t glue(spe_lwhou, MEMSUFFIX) (target_ulong EA) |
1055 | 0487d6a8 | j_mayer | { |
1056 | 0487d6a8 | j_mayer | uint64_t ret; |
1057 | 0487d6a8 | j_mayer | ret = (uint64_t)glue(lduw, MEMSUFFIX)(EA) << 32;
|
1058 | 0487d6a8 | j_mayer | ret |= (uint64_t)glue(lduw, MEMSUFFIX)(EA + 2);
|
1059 | 0487d6a8 | j_mayer | return ret;
|
1060 | 0487d6a8 | j_mayer | } |
1061 | 0487d6a8 | j_mayer | PPC_SPE_LD_OP(whou, spe_lwhou); |
1062 | 0487d6a8 | j_mayer | static inline uint64_t glue(spe_lwhos, MEMSUFFIX) (target_ulong EA) |
1063 | 0487d6a8 | j_mayer | { |
1064 | 0487d6a8 | j_mayer | uint64_t ret; |
1065 | 0487d6a8 | j_mayer | ret = ((uint64_t)((int32_t)glue(ldsw, MEMSUFFIX)(EA))) << 32;
|
1066 | 0487d6a8 | j_mayer | ret |= (uint64_t)((int32_t)glue(ldsw, MEMSUFFIX)(EA + 2));
|
1067 | 0487d6a8 | j_mayer | return ret;
|
1068 | 0487d6a8 | j_mayer | } |
1069 | 0487d6a8 | j_mayer | PPC_SPE_LD_OP(whos, spe_lwhos); |
1070 | 0487d6a8 | j_mayer | static inline void glue(spe_stwho, MEMSUFFIX) (target_ulong EA, uint64_t data) |
1071 | 0487d6a8 | j_mayer | { |
1072 | 0487d6a8 | j_mayer | glue(stw, MEMSUFFIX)(EA, data >> 32);
|
1073 | 0487d6a8 | j_mayer | glue(stw, MEMSUFFIX)(EA + 2, data);
|
1074 | 0487d6a8 | j_mayer | } |
1075 | 0487d6a8 | j_mayer | PPC_SPE_ST_OP(who, spe_stwho); |
1076 | 0487d6a8 | j_mayer | static inline uint64_t glue(spe_lwhou_le, MEMSUFFIX) (target_ulong EA) |
1077 | 0487d6a8 | j_mayer | { |
1078 | 0487d6a8 | j_mayer | uint64_t ret; |
1079 | 0487d6a8 | j_mayer | ret = (uint64_t)glue(ld16r, MEMSUFFIX)(EA) << 32;
|
1080 | 0487d6a8 | j_mayer | ret |= (uint64_t)glue(ld16r, MEMSUFFIX)(EA + 2);
|
1081 | 0487d6a8 | j_mayer | return ret;
|
1082 | 0487d6a8 | j_mayer | } |
1083 | 0487d6a8 | j_mayer | PPC_SPE_LD_OP(whou_le, spe_lwhou_le); |
1084 | 0487d6a8 | j_mayer | static inline uint64_t glue(spe_lwhos_le, MEMSUFFIX) (target_ulong EA) |
1085 | 0487d6a8 | j_mayer | { |
1086 | 0487d6a8 | j_mayer | uint64_t ret; |
1087 | 0487d6a8 | j_mayer | ret = ((uint64_t)((int32_t)glue(ld16rs, MEMSUFFIX)(EA))) << 32;
|
1088 | 0487d6a8 | j_mayer | ret |= (uint64_t)((int32_t)glue(ld16rs, MEMSUFFIX)(EA + 2));
|
1089 | 0487d6a8 | j_mayer | return ret;
|
1090 | 0487d6a8 | j_mayer | } |
1091 | 0487d6a8 | j_mayer | PPC_SPE_LD_OP(whos_le, spe_lwhos_le); |
1092 | 0487d6a8 | j_mayer | static inline void glue(spe_stwho_le, MEMSUFFIX) (target_ulong EA, |
1093 | 0487d6a8 | j_mayer | uint64_t data) |
1094 | 0487d6a8 | j_mayer | { |
1095 | 0487d6a8 | j_mayer | glue(st16r, MEMSUFFIX)(EA, data >> 32);
|
1096 | 0487d6a8 | j_mayer | glue(st16r, MEMSUFFIX)(EA + 2, data);
|
1097 | 0487d6a8 | j_mayer | } |
1098 | 0487d6a8 | j_mayer | PPC_SPE_ST_OP(who_le, spe_stwho_le); |
1099 | 0487d6a8 | j_mayer | #if !defined(TARGET_PPC64)
|
1100 | 0487d6a8 | j_mayer | static inline void glue(spe_stwwo, MEMSUFFIX) (target_ulong EA, uint64_t data) |
1101 | 0487d6a8 | j_mayer | { |
1102 | 0487d6a8 | j_mayer | glue(stl, MEMSUFFIX)(EA, data); |
1103 | 0487d6a8 | j_mayer | } |
1104 | 0487d6a8 | j_mayer | PPC_SPE_ST_OP(wwo, spe_stwwo); |
1105 | 0487d6a8 | j_mayer | static inline void glue(spe_stwwo_le, MEMSUFFIX) (target_ulong EA, |
1106 | 36081602 | j_mayer | uint64_t data) |
1107 | 0487d6a8 | j_mayer | { |
1108 | 0487d6a8 | j_mayer | glue(st32r, MEMSUFFIX)(EA, data); |
1109 | 0487d6a8 | j_mayer | } |
1110 | 0487d6a8 | j_mayer | PPC_SPE_ST_OP(wwo_le, spe_stwwo_le); |
1111 | 0487d6a8 | j_mayer | #endif
|
1112 | 0487d6a8 | j_mayer | static inline uint64_t glue(spe_lh, MEMSUFFIX) (target_ulong EA) |
1113 | 0487d6a8 | j_mayer | { |
1114 | 0487d6a8 | j_mayer | uint16_t tmp; |
1115 | 0487d6a8 | j_mayer | tmp = glue(lduw, MEMSUFFIX)(EA); |
1116 | 0487d6a8 | j_mayer | return ((uint64_t)tmp << 48) | ((uint64_t)tmp << 16); |
1117 | 0487d6a8 | j_mayer | } |
1118 | 0487d6a8 | j_mayer | PPC_SPE_LD_OP(h, spe_lh); |
1119 | 0487d6a8 | j_mayer | static inline uint64_t glue(spe_lh_le, MEMSUFFIX) (target_ulong EA) |
1120 | 0487d6a8 | j_mayer | { |
1121 | 0487d6a8 | j_mayer | uint16_t tmp; |
1122 | 0487d6a8 | j_mayer | tmp = glue(ld16r, MEMSUFFIX)(EA); |
1123 | 0487d6a8 | j_mayer | return ((uint64_t)tmp << 48) | ((uint64_t)tmp << 16); |
1124 | 0487d6a8 | j_mayer | } |
1125 | 0487d6a8 | j_mayer | PPC_SPE_LD_OP(h_le, spe_lh_le); |
1126 | 0487d6a8 | j_mayer | static inline uint64_t glue(spe_lwwsplat, MEMSUFFIX) (target_ulong EA) |
1127 | 0487d6a8 | j_mayer | { |
1128 | 0487d6a8 | j_mayer | uint32_t tmp; |
1129 | 0487d6a8 | j_mayer | tmp = glue(ldl, MEMSUFFIX)(EA); |
1130 | 0487d6a8 | j_mayer | return ((uint64_t)tmp << 32) | (uint64_t)tmp; |
1131 | 0487d6a8 | j_mayer | } |
1132 | 0487d6a8 | j_mayer | PPC_SPE_LD_OP(wwsplat, spe_lwwsplat); |
1133 | 0487d6a8 | j_mayer | static inline uint64_t glue(spe_lwwsplat_le, MEMSUFFIX) (target_ulong EA) |
1134 | 0487d6a8 | j_mayer | { |
1135 | 0487d6a8 | j_mayer | uint32_t tmp; |
1136 | 0487d6a8 | j_mayer | tmp = glue(ld32r, MEMSUFFIX)(EA); |
1137 | 0487d6a8 | j_mayer | return ((uint64_t)tmp << 32) | (uint64_t)tmp; |
1138 | 0487d6a8 | j_mayer | } |
1139 | 0487d6a8 | j_mayer | PPC_SPE_LD_OP(wwsplat_le, spe_lwwsplat_le); |
1140 | 0487d6a8 | j_mayer | static inline uint64_t glue(spe_lwhsplat, MEMSUFFIX) (target_ulong EA) |
1141 | 0487d6a8 | j_mayer | { |
1142 | 0487d6a8 | j_mayer | uint64_t ret; |
1143 | 0487d6a8 | j_mayer | uint16_t tmp; |
1144 | 0487d6a8 | j_mayer | tmp = glue(lduw, MEMSUFFIX)(EA); |
1145 | 0487d6a8 | j_mayer | ret = ((uint64_t)tmp << 48) | ((uint64_t)tmp << 32); |
1146 | 0487d6a8 | j_mayer | tmp = glue(lduw, MEMSUFFIX)(EA + 2);
|
1147 | 0487d6a8 | j_mayer | ret |= ((uint64_t)tmp << 16) | (uint64_t)tmp;
|
1148 | 0487d6a8 | j_mayer | return ret;
|
1149 | 0487d6a8 | j_mayer | } |
1150 | 0487d6a8 | j_mayer | PPC_SPE_LD_OP(whsplat, spe_lwhsplat); |
1151 | 0487d6a8 | j_mayer | static inline uint64_t glue(spe_lwhsplat_le, MEMSUFFIX) (target_ulong EA) |
1152 | 0487d6a8 | j_mayer | { |
1153 | 0487d6a8 | j_mayer | uint64_t ret; |
1154 | 0487d6a8 | j_mayer | uint16_t tmp; |
1155 | 0487d6a8 | j_mayer | tmp = glue(ld16r, MEMSUFFIX)(EA); |
1156 | 0487d6a8 | j_mayer | ret = ((uint64_t)tmp << 48) | ((uint64_t)tmp << 32); |
1157 | 0487d6a8 | j_mayer | tmp = glue(ld16r, MEMSUFFIX)(EA + 2);
|
1158 | 0487d6a8 | j_mayer | ret |= ((uint64_t)tmp << 16) | (uint64_t)tmp;
|
1159 | 0487d6a8 | j_mayer | return ret;
|
1160 | 0487d6a8 | j_mayer | } |
1161 | 0487d6a8 | j_mayer | PPC_SPE_LD_OP(whsplat_le, spe_lwhsplat_le); |
1162 | 35cdaad6 | j_mayer | #endif /* defined(TARGET_PPCEMB) */ |
1163 | 0487d6a8 | j_mayer | |
1164 | 9a64fbe4 | bellard | #undef MEMSUFFIX |