From patchwork Mon Mar 11 19:15:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Schnelle X-Patchwork-Id: 10848215 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5757914DE for ; Mon, 11 Mar 2019 19:43:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 422D329287 for ; Mon, 11 Mar 2019 19:43:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3350A292B7; Mon, 11 Mar 2019 19:43:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9221329287 for ; Mon, 11 Mar 2019 19:43:42 +0000 (UTC) Received: from localhost ([127.0.0.1]:39243 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3Qpp-0007wR-Uf for patchwork-qemu-devel@patchwork.kernel.org; Mon, 11 Mar 2019 15:43:41 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34199) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3Qb0-000408-5O for qemu-devel@nongnu.org; Mon, 11 Mar 2019 15:28:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3QPI-0007WL-6B for qemu-devel@nongnu.org; Mon, 11 Mar 2019 15:16:17 -0400 Received: from smtp.duncanthrax.net ([2001:470:70c5:1111::170]:56175) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h3QPH-0007SX-L5 for qemu-devel@nongnu.org; Mon, 11 Mar 2019 15:16:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=duncanthrax.net; s=dkim; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=t/LnXJcJmhULubJxs2sdLX2OcR5UFpTtzE8whiOhpwc=; b=AZPk89sSxWsw/i8cS1pXEYG6+h 0hp+eTwYdBU3yt4rPg2SJi1RnYUQZX/nHMbDOZNHhxe8XHsslnZ/HhTZd+EvMrltxB/5Rk18enn0M 2ixQt3m2vCk4Z4aPfE4P6uKCQ5S0OxbC79z3Y0GfhYQN8x6IO6yPao/DWupUsvZqlCwA=; Received: from [134.3.47.207] (helo=t470p.stackframe.org) by smtp.eurescom.eu with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1h3QPD-0005b3-45; Mon, 11 Mar 2019 20:16:11 +0100 From: Sven Schnelle To: Richard Henderson Date: Mon, 11 Mar 2019 20:15:52 +0100 Message-Id: <20190311191602.25796-2-svens@stackframe.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190311191602.25796-1-svens@stackframe.org> References: <20190311191602.25796-1-svens@stackframe.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:470:70c5:1111::170 Subject: [Qemu-devel] [PATCH 01/11] target/hppa: fix overwriting source reg in addb X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sven Schnelle , qemu-devel@nongnu.org, Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP When one of the source registers is the same as the destination register, the source register gets overwritten with the destionation value before do_add_sv() is called, which leads to unexpection condition matches. Signed-off-by: Sven Schnelle Reviewed-by: Richard Henderson --- target/hppa/translate.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index dc5636fe94..7001c2eb80 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -3033,7 +3033,7 @@ static bool do_addb(DisasContext *ctx, unsigned r, TCGv_reg in1, DisasCond cond; in2 = load_gpr(ctx, r); - dest = dest_gpr(ctx, r); + dest = tcg_temp_new(); sv = NULL; cb_msb = NULL; @@ -3049,6 +3049,8 @@ static bool do_addb(DisasContext *ctx, unsigned r, TCGv_reg in1, } cond = do_cond(c * 2 + f, dest, cb_msb, sv); + save_gpr(ctx, r, dest); + tcg_temp_free(dest); return do_cbranch(ctx, disp, n, &cond); }