From patchwork Tue May 14 00:05:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 164078 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp1972331ili; Mon, 13 May 2019 17:13:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqwmxTFfJ/X5EMv363hxOyOGe4F+3AmOoJ2JNyrzzHZ4VZENTq7CFv+BSA8NT+FdcN+dMvIZ X-Received: by 2002:a17:906:1cce:: with SMTP id i14mr24584497ejh.277.1557792816294; Mon, 13 May 2019 17:13:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557792816; cv=none; d=google.com; s=arc-20160816; b=t2ZY7MXrK3CF9YYwhpTw4dYR7ouIATrwbOBAtI25KykQQHBqx3bvACryv2X2Hf35Y1 2TiSX3xPKmVTVirgGCA2wskz0TJ3poXdQf2cu15JfukRrAgqAKOaiAvDG14fb8QTZQEr 6PJ8zliwd8Rrg/4K1/L7jfvE8I3srn9QdMIENZWUimx93pAqme03roUF4tfOW7jwM6U4 LjJSko5Zwkqcdw50c6dUMJQCTdim6maU6ZsaEC7vUa2z31GP5yFzoVXm1wzIsx89LiJn bDsxRoBmJyDDpNTgfaTfpXEJ9N1dD3SXEwnIFGd9B4K6WbjZ/F5doq4fQqH6gMVA+Tz7 AT1A== 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=sLhzMGGDR1ZhuOEjkMPl9rWAydAxNvaV/cqSFAgz/Lc=; b=nwillpw5dVEMvZpPYnxi7MKU3yWTAiOKwLuja2ROvmH99l95kRPHlDWi+wka2uh5xh 0sm1wQpyAmwibdwuhm4/DzjfBAB1HWEYzQ5BPEpID7xxT3Ju8RiaPM6pGcGz9DdI+U/V ScR12/9xVVhlI6eambLehhCZ7Gl5cNTpuoNRATy7yxj4ifcIsTR9K83luIMhcIiCRpMF QjgObPklqRfdkYcSuaMGQbxRiv7SHK8uPNLKghQZMVfXOB4O8LyV3oNFtypfgMoaEhgc nnypYjG5nOuNF2yVbPcMBh/rSi6i2YPS6HaohYh//TIO9J1D2Xh3+q0GiVqRszZlYg+P YOZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=mWeOPVw8; 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 l47si329261edb.198.2019.05.13.17.13.36 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 13 May 2019 17:13:36 -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=mWeOPVw8; 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]:36670 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQL4Z-0006vs-6c for patch@linaro.org; Mon, 13 May 2019 20:13:35 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56181) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQL0V-0003A9-Ui for qemu-devel@nongnu.org; Mon, 13 May 2019 20:09:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQKxd-0003pb-VA for qemu-devel@nongnu.org; Mon, 13 May 2019 20:09:20 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]:45082) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hQKxb-0003hs-Nu for qemu-devel@nongnu.org; Mon, 13 May 2019 20:06:24 -0400 Received: by mail-pl1-x62e.google.com with SMTP id a5so7254778pls.12 for ; Mon, 13 May 2019 17:06:19 -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=sLhzMGGDR1ZhuOEjkMPl9rWAydAxNvaV/cqSFAgz/Lc=; b=mWeOPVw8BrPnhBNWTkiLQ4QHDd/KJRJ5qCgIfVsi37jD5J5U3vuE79UEXwyZ6T+CoW RxJ1sBLV/1y02v+Nlq3RHjRBGGFPL8Y6Nx1RBLx+pOQG2tZacXwdspI9M1ghCNFN6dsM 5DD8hswVfPbLjVdUW5b6YDs2hu5vDWEhYyG7GP65FKh3nryHl1VaVRc571zk8Ok+ljbB a+M3Q8tBHsUOGpSDg0Xf4AVYjdR1bL89vScHyxvLL5exxNb9EbBmU1qbH4cbfuG1qbYx kqDw1q+T5FoUnxdGuqtlY/0jYtVYrU6ApV8hlgNF2i7+Dnz1q0W4zwz/659P9bF0nVi2 Pdcw== 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=sLhzMGGDR1ZhuOEjkMPl9rWAydAxNvaV/cqSFAgz/Lc=; b=mhWF3yw8hEihGNYKMRTaeW1wrlvcZ9oqffYI1O/LBXjGU3SZnJ3tgkd62OucXKcD3G sRIVFyQaqnpTknv29L6KXuWvuDzUA0vPX1Q6Z1352WwxtnJVbnonq8eFYNkwb+Iz3LzC ufhcSw12J6Pzv0sFnqegv+clWWldbbNAMnYptblFoCtCSIEOQtEvqZJhHqLiPW7E3uwk jZj6WxsyUbswoMhI+K7UJpfsbjcSB0NaDVesPNBWYwARGEcS776oZ+1fuHVg65ttmt59 MVUuN20gAJdQKIGNWMgDVpUHuZVpdE6SUZwCUNMWKd87KmQN+zDpQS7FF6G+zpACDK42 EBGg== X-Gm-Message-State: APjAAAVvhq8Tqv95a6M8XRVUz2jwIl+UuHNhSOgMnJoND5Jori6dUra5 pWMTgzafzxb6Y1T+lAFj2jEcR6B0vpY= X-Received: by 2002:a17:902:a405:: with SMTP id p5mr29556378plq.51.1557792377818; Mon, 13 May 2019 17:06:17 -0700 (PDT) Received: from localhost.localdomain (97-113-13-231.tukw.qwest.net. [97.113.13.231]) by smtp.gmail.com with ESMTPSA id u3sm238151pfn.29.2019.05.13.17.06.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 May 2019 17:06:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 13 May 2019 17:05:36 -0700 Message-Id: <20190514000540.4313-28-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190514000540.4313-1-richard.henderson@linaro.org> References: <20190514000540.4313-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::62e Subject: [Qemu-devel] [PULL 27/31] 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: peter.maydell@linux.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- target/ppc/translate.c | 68 +++++++++++++++--------------------------- 1 file changed, 24 insertions(+), 44 deletions(-) -- 2.17.1 diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 8d08625c33..b5217f632f 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -5075,40 +5075,26 @@ 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); + 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, cpu_gpr[rD(ctx->opcode)]); + 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); + 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, cpu_gpr[rD(ctx->opcode)]); + gen_set_Rc0(ctx, d); } } @@ -5344,34 +5330,28 @@ 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); + 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, cpu_gpr[rD(ctx->opcode)]); + 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)]); + gen_set_Rc0(ctx, d); } }