[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] Fix overflow conditions for MIPS add/subtract
From: |
Dirk Behme |
Subject: |
[Qemu-devel] [PATCH] Fix overflow conditions for MIPS add/subtract |
Date: |
Mon, 01 May 2006 18:44:28 +0200 |
User-agent: |
Mozilla Thunderbird 1.0.7 (X11/20050923) |
Fix overflow conditions for MIPS add/subtract as proposed by
Daniel Jacobowitz.
http://lists.gnu.org/archive/html/qemu-devel/2006-04/msg00538.html
Regards
Dirk
--- target-mips/op.c_orig 2006-04-30 09:40:46.000000000 +0200
+++ target-mips/op.c 2006-04-30 09:41:52.000000000 +0200
@@ -206,7 +206,7 @@ void op_addo (void)
tmp = T0;
T0 += T1;
- if (((tmp ^ T1 ^ (-1)) & (T0 ^ T1)) >> 31) {
+ if (~(T0 ^ T1) & (T0 ^ tmp) & 0x80000000) {
/* operands of same sign, result different sign */
CALL_FROM_TB1(do_raise_exception_direct, EXCP_OVERFLOW);
}
@@ -225,7 +225,7 @@ void op_subo (void)
tmp = T0;
T0 = (int32_t)T0 - (int32_t)T1;
- if (((tmp ^ T1) & (tmp ^ T0)) >> 31) {
+ if ((T0 ^ T1) & (T0 ^ tmp) & 0x80000000) {
/* operands of different sign, first operand and result different sign
*/
CALL_FROM_TB1(do_raise_exception_direct, EXCP_OVERFLOW);
}
- [Qemu-devel] [PATCH] Fix overflow conditions for MIPS add/subtract,
Dirk Behme <=