qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] ppc32 guests: fix computation of XER.{CA, OV} i


From: Tristan Gingold
Subject: Re: [Qemu-devel] [PATCH] ppc32 guests: fix computation of XER.{CA, OV} in addme, subfme, mullwo
Date: Thu, 19 Jun 2008 04:36:43 -0400


On Jun 19, 2008, at 3:36 AM, Julian Seward wrote:


addme   00000000 XER.CA=1  = 00000000 (cr 00000000 xer 20000000)

Did I miss the obvious, but why does 0 + 1 - 1 generate a carry ?

Because (as per the docs) it's computing rA + XER.CA + 0xFFFF_FFFF,
which is 0 + 1 + 0xFFFF_FFFF == 0x1_0000_0000.  Which does indeed
carry.  I tested now on both a 7447 and a G5 and they both do that.

Ok thanks.  So addme set the carry unless both xer.ca and rA are 0.

Your expression is a little bit complex, especially the second part.
If xer_ca = 1 then res == argL, right ?

For reference:

 void do_addmeo (void)
 {
+    uint32_t argL = T0;
+    uint32_t res  = T0 + xer_ca + (-1);
+ uint32_t carried = res < argL || ((xer_ca & 1) == 1 && res == argL);

Tristan.





reply via email to

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