mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
target-mips: implement DSP (d)append sub-class with TCG
DSP instruction from the (d)append sub-class can be implemented with TCG. Use a different function for these instructions are they are quite different from compare-pick sub-class. Fix BALIGN instruction for negative value, where the value should be zero-extended before being shift to the right. Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
This commit is contained in:
parent
0a16c79cc4
commit
df6126a7f2
3 changed files with 87 additions and 126 deletions
|
@ -3111,73 +3111,6 @@ PICK_INSN(pick_pw, 2, MIPSDSP_LLO, 32, 0);
|
|||
#endif
|
||||
#undef PICK_INSN
|
||||
|
||||
#define APPEND_INSN(name, ret_32) \
|
||||
target_ulong helper_##name(target_ulong rt, target_ulong rs, uint32_t sa) \
|
||||
{ \
|
||||
target_ulong temp; \
|
||||
\
|
||||
if (ret_32) { \
|
||||
temp = ((rt & MIPSDSP_LLO) << sa) | \
|
||||
((rs & MIPSDSP_LLO) & ((0x01 << sa) - 1)); \
|
||||
temp = (target_long)(int32_t)(temp & MIPSDSP_LLO); \
|
||||
} else { \
|
||||
temp = (rt << sa) | (rs & ((0x01 << sa) - 1)); \
|
||||
} \
|
||||
\
|
||||
return temp; \
|
||||
}
|
||||
|
||||
APPEND_INSN(append, 1);
|
||||
#ifdef TARGET_MIPS64
|
||||
APPEND_INSN(dappend, 0);
|
||||
#endif
|
||||
#undef APPEND_INSN
|
||||
|
||||
#define PREPEND_INSN(name, or_val, ret_32) \
|
||||
target_ulong helper_##name(target_ulong rs, target_ulong rt, \
|
||||
uint32_t sa) \
|
||||
{ \
|
||||
sa |= or_val; \
|
||||
\
|
||||
if (1) { \
|
||||
return (target_long)(int32_t)(uint32_t) \
|
||||
(((rs & MIPSDSP_LLO) << (32 - sa)) | \
|
||||
((rt & MIPSDSP_LLO) >> sa)); \
|
||||
} else { \
|
||||
return (rs << (64 - sa)) | (rt >> sa); \
|
||||
} \
|
||||
}
|
||||
|
||||
PREPEND_INSN(prepend, 0, 1);
|
||||
#ifdef TARGET_MIPS64
|
||||
PREPEND_INSN(prependw, 0, 0);
|
||||
PREPEND_INSN(prependd, 0x20, 0);
|
||||
#endif
|
||||
#undef PREPEND_INSN
|
||||
|
||||
#define BALIGN_INSN(name, filter, ret32) \
|
||||
target_ulong helper_##name(target_ulong rs, target_ulong rt, uint32_t bp) \
|
||||
{ \
|
||||
bp = bp & 0x03; \
|
||||
\
|
||||
if ((bp & 1) == 0) { \
|
||||
return rt; \
|
||||
} else { \
|
||||
if (ret32) { \
|
||||
return (target_long)(int32_t)((rt << (8 * bp)) | \
|
||||
(rs >> (8 * (4 - bp)))); \
|
||||
} else { \
|
||||
return (rt << (8 * bp)) | (rs >> (8 * (8 - bp))); \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
BALIGN_INSN(balign, 0x03, 1);
|
||||
#if defined(TARGET_MIPS64)
|
||||
BALIGN_INSN(dbalign, 0x07, 0);
|
||||
#endif
|
||||
#undef BALIGN_INSN
|
||||
|
||||
target_ulong helper_packrl_ph(target_ulong rs, target_ulong rt)
|
||||
{
|
||||
uint32_t rsl, rth;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue