From patchwork Wed Apr 15 01:45:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 461328 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 09D5A140276 for ; Wed, 15 Apr 2015 11:46:03 +1000 (AEST) Received: from localhost ([::1]:58473 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YiCOv-0004l8-8V for incoming@patchwork.ozlabs.org; Tue, 14 Apr 2015 21:46:01 -0400 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 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 91DC2AB9A; Wed, 15 Apr 2015 01:45:42 +0000 (UTC) From: Alexander Graf To: qemu-devel@nongnu.org Date: Wed, 15 Apr 2015 03:45:41 +0200 Message-Id: <1429062341-59863-1-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.8.1.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 195.135.220.15 Cc: afaerber@suse.de, rth@twiddle.net Subject: [Qemu-devel] [PATCH] s390x: Fix stoc direction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 Reviewed-by: Richard Henderson --- 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);