diff options
author | Yongbok Kim <yongbok.kim@imgtec.com> | 2014-06-27 08:49:05 +0100 |
---|---|---|
committer | Leon Alrae <leon.alrae@imgtec.com> | 2014-10-13 12:38:25 +0100 |
commit | 15eacb9b525ad7f6b9326eeb8eeb151721d66570 (patch) | |
tree | 1ab333d0bb613ff37474b5ffe001b6ae67937e13 /target-mips/op_helper.c | |
parent | 01f72885794124f94b24d97daf3c8630424cfd79 (diff) |
target-mips: add ALIGN, DALIGN, BITSWAP and DBITSWAP instructions
Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'target-mips/op_helper.c')
-rw-r--r-- | target-mips/op_helper.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/target-mips/op_helper.c b/target-mips/op_helper.c index df97b35f87..c9841e26f8 100644 --- a/target-mips/op_helper.c +++ b/target-mips/op_helper.c @@ -266,6 +266,29 @@ target_ulong helper_mulshiu(CPUMIPSState *env, target_ulong arg1, (uint64_t)(uint32_t)arg2); } +static inline target_ulong bitswap(target_ulong v) +{ + v = ((v >> 1) & (target_ulong)0x5555555555555555) | + ((v & (target_ulong)0x5555555555555555) << 1); + v = ((v >> 2) & (target_ulong)0x3333333333333333) | + ((v & (target_ulong)0x3333333333333333) << 2); + v = ((v >> 4) & (target_ulong)0x0F0F0F0F0F0F0F0F) | + ((v & (target_ulong)0x0F0F0F0F0F0F0F0F) << 4); + return v; +} + +#ifdef TARGET_MIPS64 +target_ulong helper_dbitswap(target_ulong rt) +{ + return bitswap(rt); +} +#endif + +target_ulong helper_bitswap(target_ulong rt) +{ + return (int32_t)bitswap(rt); +} + #ifndef CONFIG_USER_ONLY static inline hwaddr do_translate_address(CPUMIPSState *env, |