aboutsummaryrefslogtreecommitdiff
path: root/target-mips/op_helper_mem.c
diff options
context:
space:
mode:
Diffstat (limited to 'target-mips/op_helper_mem.c')
-rw-r--r--target-mips/op_helper_mem.c50
1 files changed, 26 insertions, 24 deletions
diff --git a/target-mips/op_helper_mem.c b/target-mips/op_helper_mem.c
index e8ec22b15a..6af78ce057 100644
--- a/target-mips/op_helper_mem.c
+++ b/target-mips/op_helper_mem.c
@@ -1,3 +1,5 @@
+#undef DEBUG_OP
+
#ifdef TARGET_WORDS_BIGENDIAN
#define GET_LMASK(v) ((v) & 3)
#else
@@ -12,21 +14,21 @@ void glue(do_lwl, MEMSUFFIX) (uint32_t tmp)
switch (GET_LMASK(T0)) {
case 0:
- T0 = tmp;
+ T0 = (int32_t)tmp;
break;
case 1:
- T0 = (tmp << 8) | (T1 & 0x000000FF);
+ T0 = (int32_t)((tmp << 8) | (T1 & 0x000000FF));
break;
case 2:
- T0 = (tmp << 16) | (T1 & 0x0000FFFF);
+ T0 = (int32_t)((tmp << 16) | (T1 & 0x0000FFFF));
break;
case 3:
- T0 = (tmp << 24) | (T1 & 0x00FFFFFF);
+ T0 = (int32_t)((tmp << 24) | (T1 & 0x00FFFFFF));
break;
}
#if defined (DEBUG_OP)
if (logfile) {
- fprintf(logfile, "%s: %08x - %08x %08x => %08x\n",
+ fprintf(logfile, "%s: " TLSZ " - %08x " TLSZ " => " TLSZ "\n",
__func__, sav, tmp, T1, T0);
}
#endif
@@ -41,21 +43,21 @@ void glue(do_lwr, MEMSUFFIX) (uint32_t tmp)
switch (GET_LMASK(T0)) {
case 0:
- T0 = (tmp >> 24) | (T1 & 0xFFFFFF00);
+ T0 = (int32_t)((tmp >> 24) | (T1 & 0xFFFFFF00));
break;
case 1:
- T0 = (tmp >> 16) | (T1 & 0xFFFF0000);
+ T0 = (int32_t)((tmp >> 16) | (T1 & 0xFFFF0000));
break;
case 2:
- T0 = (tmp >> 8) | (T1 & 0xFF000000);
+ T0 = (int32_t)((tmp >> 8) | (T1 & 0xFF000000));
break;
case 3:
- T0 = tmp;
+ T0 = (int32_t)tmp;
break;
}
#if defined (DEBUG_OP)
if (logfile) {
- fprintf(logfile, "%s: %08x - %08x %08x => %08x\n",
+ fprintf(logfile, "%s: " TLSZ " - %08x " TLSZ " => " TLSZ "\n",
__func__, sav, tmp, T1, T0);
}
#endif
@@ -70,21 +72,21 @@ uint32_t glue(do_swl, MEMSUFFIX) (uint32_t tmp)
switch (GET_LMASK(T0)) {
case 0:
- tmp = T1;
+ tmp = (int32_t)T1;
break;
case 1:
- tmp = (tmp & 0xFF000000) | (T1 >> 8);
+ tmp = (int32_t)((tmp & 0xFF000000) | ((uint32_t)T1 >> 8));
break;
case 2:
- tmp = (tmp & 0xFFFF0000) | (T1 >> 16);
+ tmp = (int32_t)((tmp & 0xFFFF0000) | ((uint32_t)T1 >> 16));
break;
case 3:
- tmp = (tmp & 0xFFFFFF00) | (T1 >> 24);
+ tmp = (int32_t)((tmp & 0xFFFFFF00) | ((uint32_t)T1 >> 24));
break;
}
#if defined (DEBUG_OP)
if (logfile) {
- fprintf(logfile, "%s: %08x - %08x %08x => %08x\n",
+ fprintf(logfile, "%s: " TLSZ " - " TLSZ " " TLSZ " => %08x\n",
__func__, T0, sav, T1, tmp);
}
#endif
@@ -100,21 +102,21 @@ uint32_t glue(do_swr, MEMSUFFIX) (uint32_t tmp)
switch (GET_LMASK(T0)) {
case 0:
- tmp = (tmp & 0x00FFFFFF) | (T1 << 24);
+ tmp = (int32_t)((tmp & 0x00FFFFFF) | (T1 << 24));
break;
case 1:
- tmp = (tmp & 0x0000FFFF) | (T1 << 16);
+ tmp = (int32_t)((tmp & 0x0000FFFF) | (T1 << 16));
break;
case 2:
- tmp = (tmp & 0x000000FF) | (T1 << 8);
+ tmp = (int32_t)((tmp & 0x000000FF) | (T1 << 8));
break;
case 3:
- tmp = T1;
+ tmp = (int32_t)T1;
break;
}
#if defined (DEBUG_OP)
if (logfile) {
- fprintf(logfile, "%s: %08x - %08x %08x => %08x\n",
+ fprintf(logfile, "%s: " TLSZ " - " TLSZ " " TLSZ " => %08x\n",
__func__, T0, sav, T1, tmp);
}
#endif
@@ -164,7 +166,7 @@ void glue(do_ldl, MEMSUFFIX) (uint64_t tmp)
}
#if defined (DEBUG_OP)
if (logfile) {
- fprintf(logfile, "%s: %08x - %08x %08x => %08x\n",
+ fprintf(logfile, "%s: " TLSZ " - " TLSZ " " TLSZ " => " TLSZ "\n",
__func__, sav, tmp, T1, T0);
}
#endif
@@ -205,7 +207,7 @@ void glue(do_ldr, MEMSUFFIX) (uint64_t tmp)
}
#if defined (DEBUG_OP)
if (logfile) {
- fprintf(logfile, "%s: %08x - %08x %08x => %08x\n",
+ fprintf(logfile, "%s: " TLSZ " - " TLSZ " " TLSZ " => " TLSZ "\n",
__func__, sav, tmp, T1, T0);
}
#endif
@@ -246,7 +248,7 @@ uint64_t glue(do_sdl, MEMSUFFIX) (uint64_t tmp)
}
#if defined (DEBUG_OP)
if (logfile) {
- fprintf(logfile, "%s: %08x - %08x %08x => %08x\n",
+ fprintf(logfile, "%s: " TLSZ " - " TLSZ " " TLSZ " => " TLSZ "\n",
__func__, T0, sav, T1, tmp);
}
#endif
@@ -288,7 +290,7 @@ uint64_t glue(do_sdr, MEMSUFFIX) (uint64_t tmp)
}
#if defined (DEBUG_OP)
if (logfile) {
- fprintf(logfile, "%s: %08x - %08x %08x => %08x\n",
+ fprintf(logfile, "%s: " TLSZ " - " TLSZ " " TLSZ " => " TLSZ "\n",
__func__, T0, sav, T1, tmp);
}
#endif