diff options
author | Petar Jovanovic <petar.jovanovic@imgtec.com> | 2013-05-13 03:35:37 +0200 |
---|---|---|
committer | Aurelien Jarno <aurelien@aurel32.net> | 2013-05-20 18:16:17 +0200 |
commit | d8992825aedbb83b7a0e98284e0527bc82a6f7df (patch) | |
tree | f8d0ad1bbc8935b7f2451af2a8cd80fd3414446d /target-mips/dsp_helper.c | |
parent | 9ce0e9275434bacdeba42dd32e0e8269293fe2cf (diff) |
target-mips: clean-up in BIT_INSV
This is a small follow-up change to "fix incorrect behaviour for INSV".
It includes two minor modifications:
- sizefilter is constant so it can be moved inside of the block,
- several lines of the code are replaced with a call to deposit64.
No functional change.
Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'target-mips/dsp_helper.c')
-rw-r--r-- | target-mips/dsp_helper.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/target-mips/dsp_helper.c b/target-mips/dsp_helper.c index 918a898699..4116de93c3 100644 --- a/target-mips/dsp_helper.c +++ b/target-mips/dsp_helper.c @@ -2902,13 +2902,13 @@ target_ulong helper_bitrev(target_ulong rt) return (target_ulong)rd; } -#define BIT_INSV(name, posfilter, sizefilter, ret_type) \ +#define BIT_INSV(name, posfilter, ret_type) \ target_ulong helper_##name(CPUMIPSState *env, target_ulong rs, \ target_ulong rt) \ { \ uint32_t pos, size, msb, lsb; \ - target_ulong filter; \ - target_ulong temp, temprs, temprt; \ + uint32_t const sizefilter = 0x3F; \ + target_ulong temp; \ target_ulong dspc; \ \ dspc = env->active_tc.DSPControl; \ @@ -2923,18 +2923,14 @@ target_ulong helper_##name(CPUMIPSState *env, target_ulong rs, \ return rt; \ } \ \ - filter = ((int64_t)0x01 << size) - 1; \ - filter = filter << pos; \ - temprs = (rs << pos) & filter; \ - temprt = rt & ~filter; \ - temp = temprs | temprt; \ + temp = deposit64(rt, pos, size, rs); \ \ return (target_long)(ret_type)temp; \ } -BIT_INSV(insv, 0x1F, 0x3F, int32_t); +BIT_INSV(insv, 0x1F, int32_t); #ifdef TARGET_MIPS64 -BIT_INSV(dinsv, 0x7F, 0x3F, target_long); +BIT_INSV(dinsv, 0x7F, target_long); #endif #undef BIT_INSV |