aboutsummaryrefslogtreecommitdiff
path: root/target-mips
diff options
context:
space:
mode:
Diffstat (limited to 'target-mips')
-rw-r--r--target-mips/helper.h10
-rw-r--r--target-mips/op_helper.c10
-rw-r--r--target-mips/translate.c32
3 files changed, 31 insertions, 21 deletions
diff --git a/target-mips/helper.h b/target-mips/helper.h
index eed8bd5..7dfc259 100644
--- a/target-mips/helper.h
+++ b/target-mips/helper.h
@@ -251,12 +251,12 @@ DEF_HELPER(void, do_pmon, (int function))
DEF_HELPER(void, do_wait, (void))
/* Bitfield operations. */
-DEF_HELPER(target_ulong, do_ext, (target_ulong t0, target_ulong t1, uint32_t pos, uint32_t size))
+DEF_HELPER(target_ulong, do_ext, (target_ulong t1, uint32_t pos, uint32_t size))
DEF_HELPER(target_ulong, do_ins, (target_ulong t0, target_ulong t1, uint32_t pos, uint32_t size))
-DEF_HELPER(target_ulong, do_wsbh, (target_ulong t0, target_ulong t1))
+DEF_HELPER(target_ulong, do_wsbh, (target_ulong t1))
#ifdef TARGET_MIPS64
-DEF_HELPER(target_ulong, do_dext, (target_ulong t0, target_ulong t1, uint32_t pos, uint32_t size))
+DEF_HELPER(target_ulong, do_dext, (target_ulong t1, uint32_t pos, uint32_t size))
DEF_HELPER(target_ulong, do_dins, (target_ulong t0, target_ulong t1, uint32_t pos, uint32_t size))
-DEF_HELPER(target_ulong, do_dsbh, (target_ulong t0, target_ulong t1))
-DEF_HELPER(target_ulong, do_dshd, (target_ulong t0, target_ulong t1))
+DEF_HELPER(target_ulong, do_dsbh, (target_ulong t1))
+DEF_HELPER(target_ulong, do_dshd, (target_ulong t1))
#endif
diff --git a/target-mips/op_helper.c b/target-mips/op_helper.c
index 6c1d048..3098563 100644
--- a/target-mips/op_helper.c
+++ b/target-mips/op_helper.c
@@ -1867,7 +1867,7 @@ target_ulong do_rdhwr_ccres(void)
}
/* Bitfield operations. */
-target_ulong do_ext(target_ulong t0, target_ulong t1, uint32_t pos, uint32_t size)
+target_ulong do_ext(target_ulong t1, uint32_t pos, uint32_t size)
{
return (int32_t)((t1 >> pos) & ((size < 32) ? ((1 << size) - 1) : ~0));
}
@@ -1879,13 +1879,13 @@ target_ulong do_ins(target_ulong t0, target_ulong t1, uint32_t pos, uint32_t siz
return (int32_t)((t0 & ~mask) | ((t1 << pos) & mask));
}
-target_ulong do_wsbh(target_ulong t0, target_ulong t1)
+target_ulong do_wsbh(target_ulong t1)
{
return (int32_t)(((t1 << 8) & ~0x00FF00FF) | ((t1 >> 8) & 0x00FF00FF));
}
#if defined(TARGET_MIPS64)
-target_ulong do_dext(target_ulong t0, target_ulong t1, uint32_t pos, uint32_t size)
+target_ulong do_dext(target_ulong t1, uint32_t pos, uint32_t size)
{
return (t1 >> pos) & ((size < 64) ? ((1ULL << size) - 1) : ~0ULL);
}
@@ -1897,12 +1897,12 @@ target_ulong do_dins(target_ulong t0, target_ulong t1, uint32_t pos, uint32_t si
return (t0 & ~mask) | ((t1 << pos) & mask);
}
-target_ulong do_dsbh(target_ulong t0, target_ulong t1)
+target_ulong do_dsbh(target_ulong t1)
{
return ((t1 << 8) & ~0x00FF00FF00FF00FFULL) | ((t1 >> 8) & 0x00FF00FF00FF00FFULL);
}
-target_ulong do_dshd(target_ulong t0, target_ulong t1)
+target_ulong do_dshd(target_ulong t1)
{
t1 = ((t1 << 16) & ~0x0000FFFF0000FFFFULL) | ((t1 >> 16) & 0x0000FFFF0000FFFFULL);
return (t1 << 32) | (t1 >> 32);
diff --git a/target-mips/translate.c b/target-mips/translate.c
index a4329f3..9d3340e 100644
--- a/target-mips/translate.c
+++ b/target-mips/translate.c
@@ -464,12 +464,12 @@ static inline void tcg_gen_helper_0_2i(void *func, TCGv arg1, TCGv arg2, TCGv ar
tcg_temp_free(tmp);
}
-static inline void tcg_gen_helper_0_2ii(void *func, TCGv arg1, TCGv arg2, TCGv arg3, TCGv arg4)
+static inline void tcg_gen_helper_0_1ii(void *func, TCGv arg1, TCGv arg2, TCGv arg3)
{
- TCGv tmp1 = tcg_const_i32(arg3);
+ TCGv tmp1 = tcg_const_i32(arg2);
TCGv tmp2 = tcg_const_i32(arg3);
- tcg_gen_helper_0_4(func, arg1, arg2, tmp1, tmp2);
+ tcg_gen_helper_0_3(func, arg1, tmp1, tmp2);
tcg_temp_free(tmp1);
tcg_temp_free(tmp2);
}
@@ -490,6 +490,16 @@ static inline void tcg_gen_helper_1_1i(void *func, TCGv ret, TCGv arg1, TCGv arg
tcg_temp_free(tmp);
}
+static inline void tcg_gen_helper_1_1ii(void *func, TCGv ret, TCGv arg1, TCGv arg2, TCGv arg3)
+{
+ TCGv tmp1 = tcg_const_i32(arg2);
+ TCGv tmp2 = tcg_const_i32(arg3);
+
+ tcg_gen_helper_1_3(func, ret, arg1, tmp1, tmp2);
+ tcg_temp_free(tmp1);
+ tcg_temp_free(tmp2);
+}
+
static inline void tcg_gen_helper_1_2i(void *func, TCGv ret, TCGv arg1, TCGv arg2, TCGv arg3)
{
TCGv tmp = tcg_const_i32(arg3);
@@ -501,7 +511,7 @@ static inline void tcg_gen_helper_1_2i(void *func, TCGv ret, TCGv arg1, TCGv arg
static inline void tcg_gen_helper_1_2ii(void *func, TCGv ret, TCGv arg1, TCGv arg2, TCGv arg3, TCGv arg4)
{
TCGv tmp1 = tcg_const_i32(arg3);
- TCGv tmp2 = tcg_const_i32(arg3);
+ TCGv tmp2 = tcg_const_i32(arg4);
tcg_gen_helper_1_4(func, ret, arg1, arg2, tmp1, tmp2);
tcg_temp_free(tmp1);
@@ -2748,23 +2758,23 @@ static void gen_bitops (DisasContext *ctx, uint32_t opc, int rt,
case OPC_EXT:
if (lsb + msb > 31)
goto fail;
- tcg_gen_helper_1_2ii(do_ext, t0, t0, t1, lsb, msb + 1);
+ tcg_gen_helper_1_1ii(do_ext, t0, t1, lsb, msb + 1);
break;
#if defined(TARGET_MIPS64)
case OPC_DEXTM:
if (lsb + msb > 63)
goto fail;
- tcg_gen_helper_1_2ii(do_dext, t0, t0, t1, lsb, msb + 1 + 32);
+ tcg_gen_helper_1_1ii(do_dext, t0, t1, lsb, msb + 1 + 32);
break;
case OPC_DEXTU:
if (lsb + msb > 63)
goto fail;
- tcg_gen_helper_1_2ii(do_dext, t0, t0, t1, lsb + 32, msb + 1);
+ tcg_gen_helper_1_1ii(do_dext, t0, t1, lsb + 32, msb + 1);
break;
case OPC_DEXT:
if (lsb + msb > 63)
goto fail;
- tcg_gen_helper_1_2ii(do_dext, t0, t0, t1, lsb, msb + 1);
+ tcg_gen_helper_1_1ii(do_dext, t0, t1, lsb, msb + 1);
break;
#endif
case OPC_INS:
@@ -7388,7 +7398,7 @@ static void decode_opc (CPUState *env, DisasContext *ctx)
switch (op2) {
case OPC_WSBH:
gen_load_gpr(t1, rt);
- tcg_gen_helper_1_2(do_wsbh, t0, t0, t1);
+ tcg_gen_helper_1_1(do_wsbh, t0, t1);
gen_store_gpr(t0, rd);
break;
case OPC_SEB:
@@ -7490,11 +7500,11 @@ static void decode_opc (CPUState *env, DisasContext *ctx)
switch (op2) {
case OPC_DSBH:
gen_load_gpr(t1, rt);
- tcg_gen_helper_1_2(do_dsbh, t0, t0, t1);
+ tcg_gen_helper_1_1(do_dsbh, t0, t1);
break;
case OPC_DSHD:
gen_load_gpr(t1, rt);
- tcg_gen_helper_1_2(do_dshd, t0, t0, t1);
+ tcg_gen_helper_1_1(do_dshd, t0, t1);
break;
default: /* Invalid */
MIPS_INVAL("dbshfl");