qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] SPARC target : Fix carry flagupdate inaddxcc an


From: Blue Swirl
Subject: Re: [Qemu-devel] [PATCH] SPARC target : Fix carry flagupdate inaddxcc and subxc
Date: Thu, 13 Apr 2006 20:39:53 +0200

As far as the V flag is concerned, mmm, I'm not really sure whether we should
change something in the sparc code. If we compare to the arm code, we don't
take into account the fact that the carry flag is set before.

We'd probably need some extensive tests and their associated expected results.

I made a small test program (attached) to test the addx instruction. The program calculates the sum of two 64-bit values, given on the command line as 32-bit lower and upper parts. Native system produces following:
$ ./addx -1 -1 0x80000000 -1
ffffffffffffffff + ffffffff80000000 = ffffffff7fffffff, NZVC: 9
while unpatched Qemu the following:
$ qemu-sparc ./addx -1 -1 0x80000000 -1
ffffffffffffffff + ffffffff80000000 = ffffffff7fffffff, NZVC: 8

So the carry flag not set. When your patch is applied, the output is identical:
ffffffffffffffff + ffffffff80000000 = ffffffff7fffffff, NZVC: 9

I couldn't think of a combination of values that would set the V flag when there is also a carry from the 32-bit addition, any suggestions?

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar - get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/

Attachment: addx.c
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]