提交 b854608e 编写于 作者: B bellard

sparc condition code computation fix (Even Rouault)


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1838 c046a42c-6fe2-441c-8c8c-71466251a162
上级 f4e15b4b
...@@ -415,28 +415,50 @@ void OPPROTO op_addx_T1_T0(void) ...@@ -415,28 +415,50 @@ void OPPROTO op_addx_T1_T0(void)
void OPPROTO op_addx_T1_T0_cc(void) void OPPROTO op_addx_T1_T0_cc(void)
{ {
target_ulong src1; target_ulong src1;
src1 = T0; src1 = T0;
T0 += T1 + FLAG_SET(PSR_CARRY); if (FLAG_SET(PSR_CARRY))
env->psr = 0; {
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 #ifdef TARGET_SPARC64
if (!(T0 & 0xffffffff)) if (!(T0 & 0xffffffff))
env->psr |= PSR_ZERO; env->psr |= PSR_ZERO;
if ((int32_t) T0 < 0) if ((int32_t) T0 < 0)
env->psr |= PSR_NEG; env->psr |= PSR_NEG;
if ((T0 & 0xffffffff) < (src1 & 0xffffffff))
env->psr |= PSR_CARRY;
if ((((src1 & 0xffffffff) ^ (T1 & 0xffffffff) ^ -1) & if ((((src1 & 0xffffffff) ^ (T1 & 0xffffffff) ^ -1) &
((src1 & 0xffffffff) ^ (T0 & 0xffffffff))) & (1 << 31)) ((src1 & 0xffffffff) ^ (T0 & 0xffffffff))) & (1 << 31))
env->psr |= PSR_OVF; env->psr |= PSR_OVF;
env->xcc = 0;
if (!T0) if (!T0)
env->xcc |= PSR_ZERO; env->xcc |= PSR_ZERO;
if ((int64_t) T0 < 0) if ((int64_t) T0 < 0)
env->xcc |= PSR_NEG; env->xcc |= PSR_NEG;
if (T0 < src1)
env->xcc |= PSR_CARRY;
if (((src1 ^ T1 ^ -1) & (src1 ^ T0)) & (1ULL << 63)) if (((src1 ^ T1 ^ -1) & (src1 ^ T0)) & (1ULL << 63))
env->xcc |= PSR_OVF; env->xcc |= PSR_OVF;
#else #else
...@@ -444,8 +466,6 @@ void OPPROTO op_addx_T1_T0_cc(void) ...@@ -444,8 +466,6 @@ void OPPROTO op_addx_T1_T0_cc(void)
env->psr |= PSR_ZERO; env->psr |= PSR_ZERO;
if ((int32_t) T0 < 0) if ((int32_t) T0 < 0)
env->psr |= PSR_NEG; env->psr |= PSR_NEG;
if (T0 < src1)
env->psr |= PSR_CARRY;
if (((src1 ^ T1 ^ -1) & (src1 ^ T0)) & (1 << 31)) if (((src1 ^ T1 ^ -1) & (src1 ^ T0)) & (1 << 31))
env->psr |= PSR_OVF; env->psr |= PSR_OVF;
#endif #endif
...@@ -505,28 +525,50 @@ void OPPROTO op_subx_T1_T0(void) ...@@ -505,28 +525,50 @@ void OPPROTO op_subx_T1_T0(void)
void OPPROTO op_subx_T1_T0_cc(void) void OPPROTO op_subx_T1_T0_cc(void)
{ {
target_ulong src1; target_ulong src1;
src1 = T0; src1 = T0;
T0 -= T1 + FLAG_SET(PSR_CARRY); if (FLAG_SET(PSR_CARRY))
env->psr = 0; {
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 #ifdef TARGET_SPARC64
if (!(T0 & 0xffffffff)) if (!(T0 & 0xffffffff))
env->psr |= PSR_ZERO; env->psr |= PSR_ZERO;
if ((int32_t) T0 < 0) if ((int32_t) T0 < 0)
env->psr |= PSR_NEG; env->psr |= PSR_NEG;
if ((src1 & 0xffffffff) < (T1 & 0xffffffff))
env->psr |= PSR_CARRY;
if ((((src1 & 0xffffffff) ^ (T1 & 0xffffffff)) & if ((((src1 & 0xffffffff) ^ (T1 & 0xffffffff)) &
((src1 & 0xffffffff) ^ (T0 & 0xffffffff))) & (1 << 31)) ((src1 & 0xffffffff) ^ (T0 & 0xffffffff))) & (1 << 31))
env->psr |= PSR_OVF; env->psr |= PSR_OVF;
env->xcc = 0;
if (!T0) if (!T0)
env->xcc |= PSR_ZERO; env->xcc |= PSR_ZERO;
if ((int64_t) T0 < 0) if ((int64_t) T0 < 0)
env->xcc |= PSR_NEG; env->xcc |= PSR_NEG;
if (src1 < T1)
env->xcc |= PSR_CARRY;
if (((src1 ^ T1) & (src1 ^ T0)) & (1ULL << 63)) if (((src1 ^ T1) & (src1 ^ T0)) & (1ULL << 63))
env->xcc |= PSR_OVF; env->xcc |= PSR_OVF;
#else #else
...@@ -534,8 +576,6 @@ void OPPROTO op_subx_T1_T0_cc(void) ...@@ -534,8 +576,6 @@ void OPPROTO op_subx_T1_T0_cc(void)
env->psr |= PSR_ZERO; env->psr |= PSR_ZERO;
if ((int32_t) T0 < 0) if ((int32_t) T0 < 0)
env->psr |= PSR_NEG; env->psr |= PSR_NEG;
if (src1 < T1)
env->psr |= PSR_CARRY;
if (((src1 ^ T1) & (src1 ^ T0)) & (1 << 31)) if (((src1 ^ T1) & (src1 ^ T0)) & (1 << 31))
env->psr |= PSR_OVF; env->psr |= PSR_OVF;
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册