2007-01-01 23:34:37 +03:00
|
|
|
#undef DEBUG_OP
|
|
|
|
|
2005-12-07 00:44:28 +03:00
|
|
|
#ifdef TARGET_WORDS_BIGENDIAN
|
|
|
|
#define GET_LMASK(v) ((v) & 3)
|
|
|
|
#else
|
|
|
|
#define GET_LMASK(v) (((v) & 3) ^ 3)
|
|
|
|
#endif
|
|
|
|
|
2005-12-05 22:59:36 +03:00
|
|
|
void glue(do_lwl, MEMSUFFIX) (uint32_t tmp)
|
2005-07-02 18:58:51 +04:00
|
|
|
{
|
|
|
|
#if defined (DEBUG_OP)
|
|
|
|
target_ulong sav = T0;
|
|
|
|
#endif
|
|
|
|
|
2005-12-07 00:44:28 +03:00
|
|
|
switch (GET_LMASK(T0)) {
|
2005-07-02 18:58:51 +04:00
|
|
|
case 0:
|
2007-01-01 23:34:37 +03:00
|
|
|
T0 = (int32_t)tmp;
|
2005-07-02 18:58:51 +04:00
|
|
|
break;
|
|
|
|
case 1:
|
2007-01-01 23:34:37 +03:00
|
|
|
T0 = (int32_t)((tmp << 8) | (T1 & 0x000000FF));
|
2005-07-02 18:58:51 +04:00
|
|
|
break;
|
|
|
|
case 2:
|
2007-01-01 23:34:37 +03:00
|
|
|
T0 = (int32_t)((tmp << 16) | (T1 & 0x0000FFFF));
|
2005-07-02 18:58:51 +04:00
|
|
|
break;
|
|
|
|
case 3:
|
2007-01-01 23:34:37 +03:00
|
|
|
T0 = (int32_t)((tmp << 24) | (T1 & 0x00FFFFFF));
|
2005-07-02 18:58:51 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
#if defined (DEBUG_OP)
|
|
|
|
if (logfile) {
|
2007-02-21 02:37:21 +03:00
|
|
|
fprintf(logfile, "%s: " TARGET_FMT_lx " - %08x " TARGET_FMT_lx " => " TARGET_FMT_lx "\n",
|
2005-07-02 18:58:51 +04:00
|
|
|
__func__, sav, tmp, T1, T0);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2005-12-05 22:59:36 +03:00
|
|
|
void glue(do_lwr, MEMSUFFIX) (uint32_t tmp)
|
2005-07-02 18:58:51 +04:00
|
|
|
{
|
|
|
|
#if defined (DEBUG_OP)
|
|
|
|
target_ulong sav = T0;
|
|
|
|
#endif
|
|
|
|
|
2005-12-07 00:44:28 +03:00
|
|
|
switch (GET_LMASK(T0)) {
|
2005-07-02 18:58:51 +04:00
|
|
|
case 0:
|
2007-01-01 23:34:37 +03:00
|
|
|
T0 = (int32_t)((tmp >> 24) | (T1 & 0xFFFFFF00));
|
2005-07-02 18:58:51 +04:00
|
|
|
break;
|
|
|
|
case 1:
|
2007-01-01 23:34:37 +03:00
|
|
|
T0 = (int32_t)((tmp >> 16) | (T1 & 0xFFFF0000));
|
2005-07-02 18:58:51 +04:00
|
|
|
break;
|
|
|
|
case 2:
|
2007-01-01 23:34:37 +03:00
|
|
|
T0 = (int32_t)((tmp >> 8) | (T1 & 0xFF000000));
|
2005-07-02 18:58:51 +04:00
|
|
|
break;
|
|
|
|
case 3:
|
2007-01-01 23:34:37 +03:00
|
|
|
T0 = (int32_t)tmp;
|
2005-07-02 18:58:51 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
#if defined (DEBUG_OP)
|
|
|
|
if (logfile) {
|
2007-02-21 02:37:21 +03:00
|
|
|
fprintf(logfile, "%s: " TARGET_FMT_lx " - %08x " TARGET_FMT_lx " => " TARGET_FMT_lx "\n",
|
2005-07-02 18:58:51 +04:00
|
|
|
__func__, sav, tmp, T1, T0);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2005-12-05 22:59:36 +03:00
|
|
|
uint32_t glue(do_swl, MEMSUFFIX) (uint32_t tmp)
|
2005-07-02 18:58:51 +04:00
|
|
|
{
|
|
|
|
#if defined (DEBUG_OP)
|
2006-12-21 04:19:56 +03:00
|
|
|
target_ulong sav = tmp;
|
2005-07-02 18:58:51 +04:00
|
|
|
#endif
|
|
|
|
|
2005-12-07 00:44:28 +03:00
|
|
|
switch (GET_LMASK(T0)) {
|
2005-07-02 18:58:51 +04:00
|
|
|
case 0:
|
2007-01-01 23:34:37 +03:00
|
|
|
tmp = (int32_t)T1;
|
2005-07-02 18:58:51 +04:00
|
|
|
break;
|
|
|
|
case 1:
|
2007-01-01 23:34:37 +03:00
|
|
|
tmp = (int32_t)((tmp & 0xFF000000) | ((uint32_t)T1 >> 8));
|
2005-07-02 18:58:51 +04:00
|
|
|
break;
|
|
|
|
case 2:
|
2007-01-01 23:34:37 +03:00
|
|
|
tmp = (int32_t)((tmp & 0xFFFF0000) | ((uint32_t)T1 >> 16));
|
2005-07-02 18:58:51 +04:00
|
|
|
break;
|
|
|
|
case 3:
|
2007-01-01 23:34:37 +03:00
|
|
|
tmp = (int32_t)((tmp & 0xFFFFFF00) | ((uint32_t)T1 >> 24));
|
2005-07-02 18:58:51 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
#if defined (DEBUG_OP)
|
|
|
|
if (logfile) {
|
2007-02-21 02:37:21 +03:00
|
|
|
fprintf(logfile, "%s: " TARGET_FMT_lx " - " TARGET_FMT_lx " " TARGET_FMT_lx " => %08x\n",
|
2005-07-02 18:58:51 +04:00
|
|
|
__func__, T0, sav, T1, tmp);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
RETURN();
|
2005-12-05 22:59:36 +03:00
|
|
|
return tmp;
|
2005-07-02 18:58:51 +04:00
|
|
|
}
|
|
|
|
|
2005-12-05 22:59:36 +03:00
|
|
|
uint32_t glue(do_swr, MEMSUFFIX) (uint32_t tmp)
|
2005-07-02 18:58:51 +04:00
|
|
|
{
|
|
|
|
#if defined (DEBUG_OP)
|
2006-12-21 04:19:56 +03:00
|
|
|
target_ulong sav = tmp;
|
2005-07-02 18:58:51 +04:00
|
|
|
#endif
|
|
|
|
|
2005-12-07 00:44:28 +03:00
|
|
|
switch (GET_LMASK(T0)) {
|
2005-07-02 18:58:51 +04:00
|
|
|
case 0:
|
2007-01-01 23:34:37 +03:00
|
|
|
tmp = (int32_t)((tmp & 0x00FFFFFF) | (T1 << 24));
|
2005-07-02 18:58:51 +04:00
|
|
|
break;
|
|
|
|
case 1:
|
2007-01-01 23:34:37 +03:00
|
|
|
tmp = (int32_t)((tmp & 0x0000FFFF) | (T1 << 16));
|
2005-07-02 18:58:51 +04:00
|
|
|
break;
|
|
|
|
case 2:
|
2007-01-01 23:34:37 +03:00
|
|
|
tmp = (int32_t)((tmp & 0x000000FF) | (T1 << 8));
|
2005-07-02 18:58:51 +04:00
|
|
|
break;
|
|
|
|
case 3:
|
2007-01-01 23:34:37 +03:00
|
|
|
tmp = (int32_t)T1;
|
2005-07-02 18:58:51 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
#if defined (DEBUG_OP)
|
|
|
|
if (logfile) {
|
2007-02-21 02:37:21 +03:00
|
|
|
fprintf(logfile, "%s: " TARGET_FMT_lx " - " TARGET_FMT_lx " " TARGET_FMT_lx " => %08x\n",
|
2005-07-02 18:58:51 +04:00
|
|
|
__func__, T0, sav, T1, tmp);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
RETURN();
|
2005-12-05 22:59:36 +03:00
|
|
|
return tmp;
|
2005-07-02 18:58:51 +04:00
|
|
|
}
|
2006-12-21 04:19:56 +03:00
|
|
|
|
2007-04-01 16:36:18 +04:00
|
|
|
#ifdef TARGET_MIPS64
|
2006-12-21 04:19:56 +03:00
|
|
|
|
2007-05-06 00:13:13 +04:00
|
|
|
#ifdef TARGET_WORDS_BIGENDIAN
|
|
|
|
#define GET_LMASK64(v) ((v) & 7)
|
2006-12-21 04:19:56 +03:00
|
|
|
#else
|
2007-05-06 00:13:13 +04:00
|
|
|
#define GET_LMASK64(v) (((v) & 7) ^ 7)
|
2006-12-21 04:19:56 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
void glue(do_ldl, MEMSUFFIX) (uint64_t tmp)
|
|
|
|
{
|
|
|
|
#if defined (DEBUG_OP)
|
|
|
|
target_ulong sav = T0;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
switch (GET_LMASK64(T0)) {
|
|
|
|
case 0:
|
|
|
|
T0 = tmp;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
T0 = (tmp << 8) | (T1 & 0x00000000000000FFULL);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
T0 = (tmp << 16) | (T1 & 0x000000000000FFFFULL);
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
T0 = (tmp << 24) | (T1 & 0x0000000000FFFFFFULL);
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
T0 = (tmp << 32) | (T1 & 0x00000000FFFFFFFFULL);
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
T0 = (tmp << 40) | (T1 & 0x000000FFFFFFFFFFULL);
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
T0 = (tmp << 48) | (T1 & 0x0000FFFFFFFFFFFFULL);
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
T0 = (tmp << 56) | (T1 & 0x00FFFFFFFFFFFFFFULL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#if defined (DEBUG_OP)
|
|
|
|
if (logfile) {
|
2007-02-21 02:37:21 +03:00
|
|
|
fprintf(logfile, "%s: " TARGET_FMT_lx " - " TARGET_FMT_lx " " TARGET_FMT_lx " => " TARGET_FMT_lx "\n",
|
2006-12-21 04:19:56 +03:00
|
|
|
__func__, sav, tmp, T1, T0);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void glue(do_ldr, MEMSUFFIX) (uint64_t tmp)
|
|
|
|
{
|
|
|
|
#if defined (DEBUG_OP)
|
|
|
|
target_ulong sav = T0;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
switch (GET_LMASK64(T0)) {
|
|
|
|
case 0:
|
|
|
|
T0 = (tmp >> 56) | (T1 & 0xFFFFFFFFFFFFFF00ULL);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
T0 = (tmp >> 48) | (T1 & 0xFFFFFFFFFFFF0000ULL);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
T0 = (tmp >> 40) | (T1 & 0xFFFFFFFFFF000000ULL);
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
T0 = (tmp >> 32) | (T1 & 0xFFFFFFFF00000000ULL);
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
T0 = (tmp >> 24) | (T1 & 0xFFFFFF0000000000ULL);
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
T0 = (tmp >> 16) | (T1 & 0xFFFF000000000000ULL);
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
T0 = (tmp >> 8) | (T1 & 0xFF00000000000000ULL);
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
T0 = tmp;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#if defined (DEBUG_OP)
|
|
|
|
if (logfile) {
|
2007-02-21 02:37:21 +03:00
|
|
|
fprintf(logfile, "%s: " TARGET_FMT_lx " - " TARGET_FMT_lx " " TARGET_FMT_lx " => " TARGET_FMT_lx "\n",
|
2006-12-21 04:19:56 +03:00
|
|
|
__func__, sav, tmp, T1, T0);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
uint64_t glue(do_sdl, MEMSUFFIX) (uint64_t tmp)
|
|
|
|
{
|
|
|
|
#if defined (DEBUG_OP)
|
|
|
|
target_ulong sav = tmp;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
switch (GET_LMASK64(T0)) {
|
|
|
|
case 0:
|
|
|
|
tmp = T1;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
tmp = (tmp & 0xFF00000000000000ULL) | (T1 >> 8);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
tmp = (tmp & 0xFFFF000000000000ULL) | (T1 >> 16);
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
tmp = (tmp & 0xFFFFFF0000000000ULL) | (T1 >> 24);
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
tmp = (tmp & 0xFFFFFFFF00000000ULL) | (T1 >> 32);
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
tmp = (tmp & 0xFFFFFFFFFF000000ULL) | (T1 >> 40);
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
tmp = (tmp & 0xFFFFFFFFFFFF0000ULL) | (T1 >> 48);
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
tmp = (tmp & 0xFFFFFFFFFFFFFF00ULL) | (T1 >> 56);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#if defined (DEBUG_OP)
|
|
|
|
if (logfile) {
|
2007-02-21 02:37:21 +03:00
|
|
|
fprintf(logfile, "%s: " TARGET_FMT_lx " - " TARGET_FMT_lx " " TARGET_FMT_lx " => " TARGET_FMT_lx "\n",
|
2006-12-21 04:19:56 +03:00
|
|
|
__func__, T0, sav, T1, tmp);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
RETURN();
|
|
|
|
return tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint64_t glue(do_sdr, MEMSUFFIX) (uint64_t tmp)
|
|
|
|
{
|
|
|
|
#if defined (DEBUG_OP)
|
|
|
|
target_ulong sav = tmp;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
switch (GET_LMASK64(T0)) {
|
|
|
|
case 0:
|
|
|
|
tmp = (tmp & 0x00FFFFFFFFFFFFFFULL) | (T1 << 56);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
tmp = (tmp & 0x0000FFFFFFFFFFFFULL) | (T1 << 48);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
tmp = (tmp & 0x000000FFFFFFFFFFULL) | (T1 << 40);
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
tmp = (tmp & 0x00000000FFFFFFFFULL) | (T1 << 32);
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
tmp = (tmp & 0x0000000000FFFFFFULL) | (T1 << 24);
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
tmp = (tmp & 0x000000000000FFFFULL) | (T1 << 16);
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
tmp = (tmp & 0x00000000000000FFULL) | (T1 << 8);
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
tmp = T1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#if defined (DEBUG_OP)
|
|
|
|
if (logfile) {
|
2007-02-21 02:37:21 +03:00
|
|
|
fprintf(logfile, "%s: " TARGET_FMT_lx " - " TARGET_FMT_lx " " TARGET_FMT_lx " => " TARGET_FMT_lx "\n",
|
2006-12-21 04:19:56 +03:00
|
|
|
__func__, T0, sav, T1, tmp);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
RETURN();
|
|
|
|
return tmp;
|
|
|
|
}
|
|
|
|
|
2007-04-01 16:36:18 +04:00
|
|
|
#endif /* TARGET_MIPS64 */
|