From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44858) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YiCOh-0004Ts-Vc for qemu-devel@nongnu.org; Tue, 14 Apr 2015 21:45:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YiCOd-0000SS-SX for qemu-devel@nongnu.org; Tue, 14 Apr 2015 21:45:47 -0400 Received: from cantor2.suse.de ([195.135.220.15]:32857 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YiCOd-0000SO-Lv for qemu-devel@nongnu.org; Tue, 14 Apr 2015 21:45:43 -0400 From: Alexander Graf Date: Wed, 15 Apr 2015 03:45:41 +0200 Message-Id: <1429062341-59863-1-git-send-email-agraf@suse.de> Subject: [Qemu-devel] [PATCH] s390x: Fix stoc direction List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: afaerber@suse.de, rth@twiddle.net The store conditional instruction wants to store when the condition is fulfilled, so we should branch out when it's not true. The code today branches out when the condition is true, clearly reversing the logic. Fix it up by negating the condition. Signed-off-by: Alexander Graf --- target-s390x/translate.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target-s390x/translate.c b/target-s390x/translate.c index 4f82edd..8ae4912 100644 --- a/target-s390x/translate.c +++ b/target-s390x/translate.c @@ -3082,6 +3082,10 @@ static ExitStatus op_soc(DisasContext *s, DisasOps *o) disas_jcc(s, &c, get_field(s->fields, m3)); + /* We want to store when the condition is fulfilled, so branch + out when it's not */ + c.cond = tcg_invert_cond(c.cond); + lab = gen_new_label(); if (c.is_64) { tcg_gen_brcond_i64(c.cond, c.u.s64.a, c.u.s64.b, lab); -- 1.8.1.4