From patchwork Mon Feb 11 18:19:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Schnelle X-Patchwork-Id: 10806607 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 45E8413B5 for ; Mon, 11 Feb 2019 18:22:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 38C8F2B191 for ; Mon, 11 Feb 2019 18:22:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2CEA02B18B; Mon, 11 Feb 2019 18:22:13 +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 D21422B0DB for ; Mon, 11 Feb 2019 18:22:12 +0000 (UTC) Received: from localhost ([127.0.0.1]:54271 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtGDc-0005vB-2c for patchwork-qemu-devel@patchwork.kernel.org; Mon, 11 Feb 2019 13:22:12 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48128) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtGCL-0004tV-3y for qemu-devel@nongnu.org; Mon, 11 Feb 2019 13:20:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gtGCI-0004XU-Um for qemu-devel@nongnu.org; Mon, 11 Feb 2019 13:20:52 -0500 Received: from smtp.duncanthrax.net ([2001:470:70c5:1111::170]:59183) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gtGCI-00048A-Ku for qemu-devel@nongnu.org; Mon, 11 Feb 2019 13:20:50 -0500 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=eiGbWKkLJoBQtWp3Bm+Z8u0midBMyLppuLtc6WkFQ4k=; b=J8vL5G2rGeXNry1ynODIB4aCMw s5qIF73gJlOBu9c1s/NpObH5g8ndnsNAmT/qTG2fh6GLpB3QFm7viv/I6BPXJ2V30g6Vq533g4GqL dDoso94HjM6ArnJZPaOSIkLZfKB/BH0XbsqrZSJi5jd2LrvgR5QFFX3XhljR+IPnOepE=; Received: from hsi-kbw-109-193-150-175.hsi7.kabel-badenwuerttemberg.de ([109.193.150.175] 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 1gtGBs-0007Z5-RN; Mon, 11 Feb 2019 19:20:24 +0100 From: Sven Schnelle To: qemu-devel@nongnu.org Date: Mon, 11 Feb 2019 19:19:05 +0100 Message-Id: <20190211181907.2219-4-svens@stackframe.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211181907.2219-2-svens@stackframe.org> References: <20190211181907.2219-2-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 3/5] target/hppa: fix log conditions 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: deller@gmx.de, Sven Schnelle , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Now that do_cond() uses sign overflow for some condition matches we need to roll our own version without sign overflow checks. Signed-off-by: Sven Schnelle --- target/hppa/translate.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 0e8cc8117a..bce8773b1a 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -996,12 +996,35 @@ static DisasCond do_sub_cond(unsigned cf, TCGv_reg res, static DisasCond do_log_cond(unsigned cf, TCGv_reg res) { + DisasCond cond; + TCGv_reg tmp; + switch (cf >> 1) { - case 4: case 5: case 6: - cf &= 1; + case 0: /* never */ + cond = cond_make_f(); + break; + case 1: /* = all bits are zero */ + cond = cond_make_0(TCG_COND_EQ, res); + break; + case 2: /* < leftmost bit is 1 */ + cond = cond_make_0(TCG_COND_LT, res); + break; + case 3: /* <= leftmost bit is 1 or all bits 0 */ + cond = cond_make_0(TCG_COND_LE, res); + break; + case 7: /* OD rightmost bit is 1 */ + tmp = tcg_temp_new(); + tcg_gen_andi_reg(tmp, res, 1); + cond = cond_make_0(TCG_COND_NE, tmp); + tcg_temp_free(tmp); + break; + default: break; } - return do_cond(cf, res, res, res); + if (cf & 1) { + cond.c = tcg_invert_cond(cond.c); + } + return cond; } /* Similar, but for shift/extract/deposit conditions. */