sparc condition code computation fix (Even Rouault)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1838 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
bellard 2006-04-23 21:33:48 +00:00
parent f4e15b4b4b
commit b854608e0c

View File

@ -415,28 +415,50 @@ void OPPROTO op_addx_T1_T0(void)
void OPPROTO op_addx_T1_T0_cc(void)
{
target_ulong src1;
src1 = T0;
T0 += T1 + FLAG_SET(PSR_CARRY);
env->psr = 0;
if (FLAG_SET(PSR_CARRY))
{
T0 += T1 + 1;
env->psr = 0;
#ifdef TARGET_SPARC64
if ((T0 & 0xffffffff) <= (src1 & 0xffffffff))
env->psr |= PSR_CARRY;
env->xcc = 0;
if (T0 <= src1)
env->xcc |= PSR_CARRY;
#else
if (T0 <= src1)
env->psr |= PSR_CARRY;
#endif
}
else
{
T0 += T1;
env->psr = 0;
#ifdef TARGET_SPARC64
if ((T0 & 0xffffffff) < (src1 & 0xffffffff))
env->psr |= PSR_CARRY;
env->xcc = 0;
if (T0 < src1)
env->xcc |= PSR_CARRY;
#else
if (T0 < src1)
env->psr |= PSR_CARRY;
#endif
}
#ifdef TARGET_SPARC64
if (!(T0 & 0xffffffff))
env->psr |= PSR_ZERO;
if ((int32_t) T0 < 0)
env->psr |= PSR_NEG;
if ((T0 & 0xffffffff) < (src1 & 0xffffffff))
env->psr |= PSR_CARRY;
if ((((src1 & 0xffffffff) ^ (T1 & 0xffffffff) ^ -1) &
((src1 & 0xffffffff) ^ (T0 & 0xffffffff))) & (1 << 31))
env->psr |= PSR_OVF;
env->xcc = 0;
if (!T0)
env->xcc |= PSR_ZERO;
if ((int64_t) T0 < 0)
env->xcc |= PSR_NEG;
if (T0 < src1)
env->xcc |= PSR_CARRY;
if (((src1 ^ T1 ^ -1) & (src1 ^ T0)) & (1ULL << 63))
env->xcc |= PSR_OVF;
#else
@ -444,8 +466,6 @@ void OPPROTO op_addx_T1_T0_cc(void)
env->psr |= PSR_ZERO;
if ((int32_t) T0 < 0)
env->psr |= PSR_NEG;
if (T0 < src1)
env->psr |= PSR_CARRY;
if (((src1 ^ T1 ^ -1) & (src1 ^ T0)) & (1 << 31))
env->psr |= PSR_OVF;
#endif
@ -505,28 +525,50 @@ void OPPROTO op_subx_T1_T0(void)
void OPPROTO op_subx_T1_T0_cc(void)
{
target_ulong src1;
src1 = T0;
T0 -= T1 + FLAG_SET(PSR_CARRY);
env->psr = 0;
if (FLAG_SET(PSR_CARRY))
{
T0 -= T1 + 1;
env->psr = 0;
#ifdef TARGET_SPARC64
if ((src1 & 0xffffffff) <= (T1 & 0xffffffff))
env->psr |= PSR_CARRY;
env->xcc = 0;
if (src1 <= T1)
env->xcc |= PSR_CARRY;
#else
if (src1 <= T1)
env->psr |= PSR_CARRY;
#endif
}
else
{
T0 -= T1;
env->psr = 0;
#ifdef TARGET_SPARC64
if ((src1 & 0xffffffff) < (T1 & 0xffffffff))
env->psr |= PSR_CARRY;
env->xcc = 0;
if (src1 < T1)
env->xcc |= PSR_CARRY;
#else
if (src1 < T1)
env->psr |= PSR_CARRY;
#endif
}
#ifdef TARGET_SPARC64
if (!(T0 & 0xffffffff))
env->psr |= PSR_ZERO;
if ((int32_t) T0 < 0)
env->psr |= PSR_NEG;
if ((src1 & 0xffffffff) < (T1 & 0xffffffff))
env->psr |= PSR_CARRY;
if ((((src1 & 0xffffffff) ^ (T1 & 0xffffffff)) &
((src1 & 0xffffffff) ^ (T0 & 0xffffffff))) & (1 << 31))
env->psr |= PSR_OVF;
env->xcc = 0;
if (!T0)
env->xcc |= PSR_ZERO;
if ((int64_t) T0 < 0)
env->xcc |= PSR_NEG;
if (src1 < T1)
env->xcc |= PSR_CARRY;
if (((src1 ^ T1) & (src1 ^ T0)) & (1ULL << 63))
env->xcc |= PSR_OVF;
#else
@ -534,8 +576,6 @@ void OPPROTO op_subx_T1_T0_cc(void)
env->psr |= PSR_ZERO;
if ((int32_t) T0 < 0)
env->psr |= PSR_NEG;
if (src1 < T1)
env->psr |= PSR_CARRY;
if (((src1 ^ T1) & (src1 ^ T0)) & (1 << 31))
env->psr |= PSR_OVF;
#endif