mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
target-m68k: Inline shifts
Also manage word and byte operands and fix the computation of overflow in the case of M68000 arithmetic shifts. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Richard Henderson <rth@twiddle.net> Message-Id: <1478699171-10637-4-git-send-email-rth@twiddle.net>
This commit is contained in:
parent
72d2e4b6a4
commit
367790cce8
3 changed files with 202 additions and 81 deletions
|
@ -284,58 +284,6 @@ void HELPER(set_sr)(CPUM68KState *env, uint32_t val)
|
|||
m68k_switch_sp(env);
|
||||
}
|
||||
|
||||
uint32_t HELPER(shl_cc)(CPUM68KState *env, uint32_t val, uint32_t shift)
|
||||
{
|
||||
uint64_t result;
|
||||
|
||||
shift &= 63;
|
||||
result = (uint64_t)val << shift;
|
||||
|
||||
env->cc_c = (result >> 32) & 1;
|
||||
env->cc_n = result;
|
||||
env->cc_z = result;
|
||||
env->cc_v = 0;
|
||||
env->cc_x = shift ? env->cc_c : env->cc_x;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
uint32_t HELPER(shr_cc)(CPUM68KState *env, uint32_t val, uint32_t shift)
|
||||
{
|
||||
uint64_t temp;
|
||||
uint32_t result;
|
||||
|
||||
shift &= 63;
|
||||
temp = (uint64_t)val << 32 >> shift;
|
||||
result = temp >> 32;
|
||||
|
||||
env->cc_c = (temp >> 31) & 1;
|
||||
env->cc_n = result;
|
||||
env->cc_z = result;
|
||||
env->cc_v = 0;
|
||||
env->cc_x = shift ? env->cc_c : env->cc_x;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
uint32_t HELPER(sar_cc)(CPUM68KState *env, uint32_t val, uint32_t shift)
|
||||
{
|
||||
uint64_t temp;
|
||||
uint32_t result;
|
||||
|
||||
shift &= 63;
|
||||
temp = (int64_t)val << 32 >> shift;
|
||||
result = temp >> 32;
|
||||
|
||||
env->cc_c = (temp >> 31) & 1;
|
||||
env->cc_n = result;
|
||||
env->cc_z = result;
|
||||
env->cc_v = result ^ val;
|
||||
env->cc_x = shift ? env->cc_c : env->cc_x;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* FPU helpers. */
|
||||
uint32_t HELPER(f64_to_i32)(CPUM68KState *env, float64 val)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue