qemu-s390x
[Top][All Lists]
Advanced

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

Re: [PATCH 0/4] target/s390x: CC fixes


From: Ilya Leoshkevich
Subject: Re: [PATCH 0/4] target/s390x: CC fixes
Date: Fri, 03 Nov 2023 17:44:54 +0100
User-agent: Evolution 3.48.4 (3.48.4-1.fc38)

On Tue, 2023-10-31 at 09:38 +0100, David Hildenbrand wrote:
> On 31.10.23 06:32, Ilya Leoshkevich wrote:
> > Hi,
> > 
> > This series fixes two issues with updating CC. David was suggesting
> > a
> > bigger rewrite [1], but I did not dare do this (yet). Instead,
> > these
> 
> I started coding that up but was distracted by other things; last
> time I 
> looked at that, I concluded that the way we are calculating the carry
> in 
> not suitable when we're doing two additions (like ADD LOGICAL WITH
> CARRY).

Do you per chance remember any details? IIUC the code in question is:

static DisasJumpType op_addc64(DisasContext *s, DisasOps *o)
{
    compute_carry(s);

    TCGv_i64 zero = tcg_constant_i64(0);
    tcg_gen_add2_i64(o->out, cc_src, o->in1, zero, cc_src, zero);
    tcg_gen_add2_i64(o->out, cc_src, o->out, cc_src, o->in2, zero);

    return DISAS_NEXT;
}

This looks correct to me, because the 128-bit result of the first
addition is passed fully to the second addition, and the upper half is
always either 0 or 1.

I played with chaining ADD-LOGICAL-WITH-CARRYs with various inputs, and
could not produce any wrong calculations in the emulation.

Best regards,
Ilya

[...]



reply via email to

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