On Fri, Apr 28, 2006 at 04:51:39PM +0200, Dirk Behme wrote:
> Daniel Jacobowitz wrote:
> >I haven't tested the patched qemu, but I did test the expressions
> >themselves in standalone code, and they definitely do not detect
> >overflow.
> 
> Maybe you can test Ralf's alternative proposal
> 
> http://lists.gnu.org/archive/html/qemu-devel/2006-02/msg00154.html
> 
> as well?

Using 64-bit math for this would be awful for performance.  My original
checks were wrong; we just need to use a correct fix...  Lightly
tested, but I think this is right for add:

-    if ((T0 >> 31) ^ (T1 >> 31) ^ (tmp >> 31)) {
+    if (~(T0 ^ T1) & (T0 ^ tmp) & 0x80000000) {

And this for sub:

-    if (!((T0 >> 31) ^ (T1 >> 31) ^ (tmp >> 31))) {
+    if ((T0 ^ T1) & (T0 ^ tmp) & 0x80000000) {


-- 
Daniel Jacobowitz
CodeSourcery


_______________________________________________
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel

Reply via email to