Fix PowerPC SPE evabs & evneg (thanks to Fabrice Bellard for reporting the bug)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3575
c046a42c-6fe2-441c-8c8c-
71466251a162
/* XXX: those micro-ops need tests ! */
void OPPROTO op_POWER_abs (void)
{
- if (T0 == INT32_MIN)
+ if ((int32_t)T0 == INT32_MIN)
T0 = INT32_MAX;
- else if (T0 < 0)
+ else if ((int32_t)T0 < 0)
T0 = -T0;
RETURN();
}
/* PowerPC 601 specific instructions (POWER bridge) */
void do_POWER_abso (void)
{
- if ((uint32_t)T0 == INT32_MIN) {
+ if ((int32_t)T0 == INT32_MIN) {
T0 = INT32_MAX;
xer_ov = 1;
- xer_so = 1;
- } else {
+ } else if ((int32_t)T0 < 0) {
T0 = -T0;
xer_ov = 0;
+ } else {
+ xer_ov = 0;
}
+ xer_so |= xer_ov;
}
void do_POWER_clcs (void)
/* Fixed-point vector arithmetic */
static always_inline uint32_t _do_eabs (uint32_t val)
{
- if (val != 0x80000000)
- val &= ~0x80000000;
+ if ((val & 0x80000000) && val != 0x80000000)
+ val -= val;
return val;
}
static always_inline uint32_t _do_eneg (uint32_t val)
{
if (val != 0x80000000)
- val ^= 0x80000000;
+ val -= val;
return val;
}