From patchwork Sat Apr 20 07:34:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 162572 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp308614jan; Sat, 20 Apr 2019 00:52:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqwR5H4KuGzO7fBi68E+nKfVu7kP+h6xtYQtCSwZLfokNPZwFDZj62bpM71akbjlgq7dMAVD X-Received: by 2002:adf:df0a:: with SMTP id y10mr6044457wrl.304.1555746766436; Sat, 20 Apr 2019 00:52:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555746766; cv=none; d=google.com; s=arc-20160816; b=sfGGBW7VIWJ0Qowcv4H8vJOOU6uZgrKlxGQz/eXS7Cda1K40LFe/mv42IqpErb8eq2 o8J7iCaypSeNNEEmbe6cd9YaA8ZZmIzxgkfHHkajH/ZSQ+pEYSkQ/iyro2xpI0Cn2gKv pJKQRkwBU3oHQQqlP8nK9/W2msenoVv/ESv8GI+SjXQpRbhEJMoVd0fdx+hUfSBpUdYF uK8q+7WIBhPB/3OcXXJjx5rebbnSrmMhpo2mrRxOlOb2vUswh7SSIir2ci7aw2vS5CjO +zXlx6aRYJ+hylTY0n/TPYQ0mDXSO2Tzn2ZEmYd/07ovWoBgR8ULvi/bDkG6oO5KJTrk 0WLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=BobRUDDq3dnwwt/qXps0agrFTDkezRLKK87vg29L7R4=; b=u/tllVi92KID+fIcVDmFyLCArR9G27unSxtDbSCM66BOWU2MdGTHQg6agXNGS+VzvU V5V92ILopXfi9WXiRfMvTSbPvS6rMok9uTIsxafIjojN6DpWYggjzCda/t5qbada01YM pIUwOtxk/L8AepARCvdnxiNxKSr0Zktw68INnxMJqeWHV/sLe5376I1bXFIIu2ZheluW nQTl1cBY9jzh+h/eHPUkOVBJX7wq/D7NmYDoJKM8HJ2zQ7jdq3qsBZBspYpSDGD5wwfG urkvO/BFRgS4mjIiZdhb0UqRnyx1mcuuGeKscdxLv+bxvVYp4uQAnRR1RWNgtPCdRkYZ wTYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Lq9jyXh8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w7si5600367wrv.200.2019.04.20.00.52.46 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 20 Apr 2019 00:52:46 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Lq9jyXh8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:38309 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hHknl-00070J-9U for patch@linaro.org; Sat, 20 Apr 2019 03:52:45 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40373) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hHkXG-0000gZ-IK for qemu-devel@nongnu.org; Sat, 20 Apr 2019 03:35:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hHkXC-0000H0-0t for qemu-devel@nongnu.org; Sat, 20 Apr 2019 03:35:39 -0400 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]:42015) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hHkXB-0008U2-Oj for qemu-devel@nongnu.org; Sat, 20 Apr 2019 03:35:37 -0400 Received: by mail-pl1-x642.google.com with SMTP id cv12so3533292plb.9 for ; Sat, 20 Apr 2019 00:35:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BobRUDDq3dnwwt/qXps0agrFTDkezRLKK87vg29L7R4=; b=Lq9jyXh8dPQfAeeu4RrTpPeVB2gyMKcVeSZMBgb5+1gQ/oyvIohjbIT9XgDzqxFuLW 3WdexrYihohU3f2hHtsidux2k6boZnbiC5f5zP1SkMnJmfbhVEQCDUZnToVTYe4NIAJA 5ICft3oUq+SgsijbfXuWdAzGJFsxF/Na9e53cLT7ha9EcKySJo0LSsGUmGeraVZBpUo/ KpY1gWMDl3B0gqhQP3islPdYkG2wOgeRXqVNdh32pz9GU0p623qaY7SJpHoDhVB+K6ka 5+nFUoCwT8BWH0pYcOAvGGqBcR6SYDeRezoWY3VRBfAJgOLtEDuehP59kHnL/RqHEw8P Lc2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=BobRUDDq3dnwwt/qXps0agrFTDkezRLKK87vg29L7R4=; b=ldVaWplsR1jKH9HhIcZA2LsJrnWPWcZuP/NNpPASTKXtwkYDFTL6ZBtH/xav6kK21L 7SGl/nZocUmWyisSHiTogry612zdIhrDDDR1oGwSJ5zhTkWr8rkCZPKu+HnrctVKCjFR fbN0Tr2WL4LBkuw1Ne4R08o+fvlzxitXFizFjLzag3m4Zy5K+oKAP8K0Pv1EVkuYxnmu yTUdLnz0J/BL0waUiBDbW6TB40WWBNcHB02cSAncO1sm8rpDWIPMVVAspkY5raR/VHd/ mXrH/KHcP1w18SRSDjF77DXZvwhpS1XtkBz6UrcsYmrStcwyptS1EOmhJBSC82af6+ML Uz6A== X-Gm-Message-State: APjAAAVl7g/F7AL28jZg3iSQo57+ALrsVAMedR3aUFbuqeGJOzfBARqQ H3RgYSG8uu3TiCjNPhutNL7V3jUGypI= X-Received: by 2002:a17:902:778d:: with SMTP id o13mr2589862pll.314.1555745723146; Sat, 20 Apr 2019 00:35:23 -0700 (PDT) Received: from localhost.localdomain (rrcs-66-91-136-155.west.biz.rr.com. [66.91.136.155]) by smtp.gmail.com with ESMTPSA id z22sm7025492pgv.23.2019.04.20.00.35.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 20 Apr 2019 00:35:22 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 19 Apr 2019 21:34:27 -1000 Message-Id: <20190420073442.7488-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190420073442.7488-1-richard.henderson@linaro.org> References: <20190420073442.7488-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::642 Subject: [Qemu-devel] [PATCH 23/38] target/ppc: Use tcg_gen_abs_tl 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: david@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- target/ppc/translate.c | 80 +++++++++++++++++------------------------- 1 file changed, 32 insertions(+), 48 deletions(-) -- 2.17.1 diff --git a/target/ppc/translate.c b/target/ppc/translate.c index badc1ae1a3..97b8e8ddaf 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -5013,39 +5013,27 @@ static void gen_ecowx(DisasContext *ctx) /* abs - abs. */ static void gen_abs(DisasContext *ctx) { - TCGLabel *l1 = gen_new_label(); - TCGLabel *l2 = gen_new_label(); - tcg_gen_brcondi_tl(TCG_COND_GE, cpu_gpr[rA(ctx->opcode)], 0, l1); - tcg_gen_neg_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]); - tcg_gen_br(l2); - gen_set_label(l1); - tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]); - gen_set_label(l2); - if (unlikely(Rc(ctx->opcode) != 0)) - gen_set_Rc0(ctx, cpu_gpr[rD(ctx->opcode)]); + TCGv d = cpu_gpr[rD(ctx->opcode)]; + TCGv a = cpu_gpr[rA(ctx->opcode)]; + + tcg_gen_abs_tl(d, a); + if (unlikely(Rc(ctx->opcode) != 0)) { + gen_set_Rc0(ctx, d); + } } /* abso - abso. */ static void gen_abso(DisasContext *ctx) { - TCGLabel *l1 = gen_new_label(); - TCGLabel *l2 = gen_new_label(); - TCGLabel *l3 = gen_new_label(); - /* Start with XER OV disabled, the most likely case */ - tcg_gen_movi_tl(cpu_ov, 0); - tcg_gen_brcondi_tl(TCG_COND_GE, cpu_gpr[rA(ctx->opcode)], 0, l2); - tcg_gen_brcondi_tl(TCG_COND_NE, cpu_gpr[rA(ctx->opcode)], 0x80000000, l1); - tcg_gen_movi_tl(cpu_ov, 1); - tcg_gen_movi_tl(cpu_so, 1); - tcg_gen_br(l2); - gen_set_label(l1); - tcg_gen_neg_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]); - tcg_gen_br(l3); - gen_set_label(l2); - tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]); - gen_set_label(l3); - if (unlikely(Rc(ctx->opcode) != 0)) - gen_set_Rc0(ctx, cpu_gpr[rD(ctx->opcode)]); + TCGv d = cpu_gpr[rD(ctx->opcode)]; + TCGv a = cpu_gpr[rA(ctx->opcode)]; + + tcg_gen_setcondi_tl(TCG_COND_EQ, cpu_ov, a, 0x80000000); + tcg_gen_abs_tl(d, a); + tcg_gen_or_tl(cpu_so, cpu_so, cpu_ov); + if (unlikely(Rc(ctx->opcode) != 0)) { + gen_set_Rc0(ctx, d); + } } /* clcs */ @@ -5265,33 +5253,29 @@ static void gen_mulo(DisasContext *ctx) /* nabs - nabs. */ static void gen_nabs(DisasContext *ctx) { - TCGLabel *l1 = gen_new_label(); - TCGLabel *l2 = gen_new_label(); - tcg_gen_brcondi_tl(TCG_COND_GT, cpu_gpr[rA(ctx->opcode)], 0, l1); - tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]); - tcg_gen_br(l2); - gen_set_label(l1); - tcg_gen_neg_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]); - gen_set_label(l2); - if (unlikely(Rc(ctx->opcode) != 0)) - gen_set_Rc0(ctx, cpu_gpr[rD(ctx->opcode)]); + TCGv d = cpu_gpr[rD(ctx->opcode)]; + TCGv a = cpu_gpr[rA(ctx->opcode)]; + + tcg_gen_abs_tl(d, a); + tcg_gen_neg_tl(d, d); + if (unlikely(Rc(ctx->opcode) != 0)) { + gen_set_Rc0(ctx, d); + } } /* nabso - nabso. */ static void gen_nabso(DisasContext *ctx) { - TCGLabel *l1 = gen_new_label(); - TCGLabel *l2 = gen_new_label(); - tcg_gen_brcondi_tl(TCG_COND_GT, cpu_gpr[rA(ctx->opcode)], 0, l1); - tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]); - tcg_gen_br(l2); - gen_set_label(l1); - tcg_gen_neg_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]); - gen_set_label(l2); + TCGv d = cpu_gpr[rD(ctx->opcode)]; + TCGv a = cpu_gpr[rA(ctx->opcode)]; + + tcg_gen_abs_tl(d, a); + tcg_gen_neg_tl(d, d); /* nabs never overflows */ tcg_gen_movi_tl(cpu_ov, 0); - if (unlikely(Rc(ctx->opcode) != 0)) - gen_set_Rc0(ctx, cpu_gpr[rD(ctx->opcode)]); + if (unlikely(Rc(ctx->opcode) != 0)) { + gen_set_Rc0(ctx, d); + } } /* rlmi - rlmi. */