3 #ifdef TARGET_WORDS_BIGENDIAN
4 #define GET_LMASK(v) ((v) & 3)
6 #define GET_LMASK(v) (((v) & 3) ^ 3)
9 void glue(do_lwl
, MEMSUFFIX
) (uint32_t tmp
)
11 #if defined (DEBUG_OP)
12 target_ulong sav
= T0
;
15 switch (GET_LMASK(T0
)) {
20 T0
= (int32_t)((tmp
<< 8) | (T1
& 0x000000FF));
23 T0
= (int32_t)((tmp
<< 16) | (T1
& 0x0000FFFF));
26 T0
= (int32_t)((tmp
<< 24) | (T1
& 0x00FFFFFF));
29 #if defined (DEBUG_OP)
31 fprintf(logfile
, "%s: " TLSZ
" - %08x " TLSZ
" => " TLSZ
"\n",
32 __func__
, sav
, tmp
, T1
, T0
);
38 void glue(do_lwr
, MEMSUFFIX
) (uint32_t tmp
)
40 #if defined (DEBUG_OP)
41 target_ulong sav
= T0
;
44 switch (GET_LMASK(T0
)) {
46 T0
= (int32_t)((tmp
>> 24) | (T1
& 0xFFFFFF00));
49 T0
= (int32_t)((tmp
>> 16) | (T1
& 0xFFFF0000));
52 T0
= (int32_t)((tmp
>> 8) | (T1
& 0xFF000000));
58 #if defined (DEBUG_OP)
60 fprintf(logfile
, "%s: " TLSZ
" - %08x " TLSZ
" => " TLSZ
"\n",
61 __func__
, sav
, tmp
, T1
, T0
);
67 uint32_t glue(do_swl
, MEMSUFFIX
) (uint32_t tmp
)
69 #if defined (DEBUG_OP)
70 target_ulong sav
= tmp
;
73 switch (GET_LMASK(T0
)) {
78 tmp
= (int32_t)((tmp
& 0xFF000000) | ((uint32_t)T1
>> 8));
81 tmp
= (int32_t)((tmp
& 0xFFFF0000) | ((uint32_t)T1
>> 16));
84 tmp
= (int32_t)((tmp
& 0xFFFFFF00) | ((uint32_t)T1
>> 24));
87 #if defined (DEBUG_OP)
89 fprintf(logfile
, "%s: " TLSZ
" - " TLSZ
" " TLSZ
" => %08x\n",
90 __func__
, T0
, sav
, T1
, tmp
);
97 uint32_t glue(do_swr
, MEMSUFFIX
) (uint32_t tmp
)
99 #if defined (DEBUG_OP)
100 target_ulong sav
= tmp
;
103 switch (GET_LMASK(T0
)) {
105 tmp
= (int32_t)((tmp
& 0x00FFFFFF) | (T1
<< 24));
108 tmp
= (int32_t)((tmp
& 0x0000FFFF) | (T1
<< 16));
111 tmp
= (int32_t)((tmp
& 0x000000FF) | (T1
<< 8));
117 #if defined (DEBUG_OP)
119 fprintf(logfile
, "%s: " TLSZ
" - " TLSZ
" " TLSZ
" => %08x\n",
120 __func__
, T0
, sav
, T1
, tmp
);
127 #ifdef MIPS_HAS_MIPS64
129 # ifdef TARGET_WORDS_BIGENDIAN
130 #define GET_LMASK64(v) ((v) & 4)
132 #define GET_LMASK64(v) (((v) & 4) ^ 4)
135 void glue(do_ldl
, MEMSUFFIX
) (uint64_t tmp
)
137 #if defined (DEBUG_OP)
138 target_ulong sav
= T0
;
141 switch (GET_LMASK64(T0
)) {
146 T0
= (tmp
<< 8) | (T1
& 0x00000000000000FFULL
);
149 T0
= (tmp
<< 16) | (T1
& 0x000000000000FFFFULL
);
152 T0
= (tmp
<< 24) | (T1
& 0x0000000000FFFFFFULL
);
155 T0
= (tmp
<< 32) | (T1
& 0x00000000FFFFFFFFULL
);
158 T0
= (tmp
<< 40) | (T1
& 0x000000FFFFFFFFFFULL
);
161 T0
= (tmp
<< 48) | (T1
& 0x0000FFFFFFFFFFFFULL
);
164 T0
= (tmp
<< 56) | (T1
& 0x00FFFFFFFFFFFFFFULL
);
167 #if defined (DEBUG_OP)
169 fprintf(logfile
, "%s: " TLSZ
" - " TLSZ
" " TLSZ
" => " TLSZ
"\n",
170 __func__
, sav
, tmp
, T1
, T0
);
176 void glue(do_ldr
, MEMSUFFIX
) (uint64_t tmp
)
178 #if defined (DEBUG_OP)
179 target_ulong sav
= T0
;
182 switch (GET_LMASK64(T0
)) {
184 T0
= (tmp
>> 56) | (T1
& 0xFFFFFFFFFFFFFF00ULL
);
187 T0
= (tmp
>> 48) | (T1
& 0xFFFFFFFFFFFF0000ULL
);
190 T0
= (tmp
>> 40) | (T1
& 0xFFFFFFFFFF000000ULL
);
193 T0
= (tmp
>> 32) | (T1
& 0xFFFFFFFF00000000ULL
);
196 T0
= (tmp
>> 24) | (T1
& 0xFFFFFF0000000000ULL
);
199 T0
= (tmp
>> 16) | (T1
& 0xFFFF000000000000ULL
);
202 T0
= (tmp
>> 8) | (T1
& 0xFF00000000000000ULL
);
208 #if defined (DEBUG_OP)
210 fprintf(logfile
, "%s: " TLSZ
" - " TLSZ
" " TLSZ
" => " TLSZ
"\n",
211 __func__
, sav
, tmp
, T1
, T0
);
217 uint64_t glue(do_sdl
, MEMSUFFIX
) (uint64_t tmp
)
219 #if defined (DEBUG_OP)
220 target_ulong sav
= tmp
;
223 switch (GET_LMASK64(T0
)) {
228 tmp
= (tmp
& 0xFF00000000000000ULL
) | (T1
>> 8);
231 tmp
= (tmp
& 0xFFFF000000000000ULL
) | (T1
>> 16);
234 tmp
= (tmp
& 0xFFFFFF0000000000ULL
) | (T1
>> 24);
237 tmp
= (tmp
& 0xFFFFFFFF00000000ULL
) | (T1
>> 32);
240 tmp
= (tmp
& 0xFFFFFFFFFF000000ULL
) | (T1
>> 40);
243 tmp
= (tmp
& 0xFFFFFFFFFFFF0000ULL
) | (T1
>> 48);
246 tmp
= (tmp
& 0xFFFFFFFFFFFFFF00ULL
) | (T1
>> 56);
249 #if defined (DEBUG_OP)
251 fprintf(logfile
, "%s: " TLSZ
" - " TLSZ
" " TLSZ
" => " TLSZ
"\n",
252 __func__
, T0
, sav
, T1
, tmp
);
259 uint64_t glue(do_sdr
, MEMSUFFIX
) (uint64_t tmp
)
261 #if defined (DEBUG_OP)
262 target_ulong sav
= tmp
;
265 switch (GET_LMASK64(T0
)) {
267 tmp
= (tmp
& 0x00FFFFFFFFFFFFFFULL
) | (T1
<< 56);
270 tmp
= (tmp
& 0x0000FFFFFFFFFFFFULL
) | (T1
<< 48);
273 tmp
= (tmp
& 0x000000FFFFFFFFFFULL
) | (T1
<< 40);
276 tmp
= (tmp
& 0x00000000FFFFFFFFULL
) | (T1
<< 32);
279 tmp
= (tmp
& 0x0000000000FFFFFFULL
) | (T1
<< 24);
282 tmp
= (tmp
& 0x000000000000FFFFULL
) | (T1
<< 16);
285 tmp
= (tmp
& 0x00000000000000FFULL
) | (T1
<< 8);
291 #if defined (DEBUG_OP)
293 fprintf(logfile
, "%s: " TLSZ
" - " TLSZ
" " TLSZ
" => " TLSZ
"\n",
294 __func__
, T0
, sav
, T1
, tmp
);
301 #endif /* MIPS_HAS_MIPS64 */