From patchwork Wed May 1 05:05:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 163201 Delivered-To: patch@linaro.org Received: by 2002:a92:7e86:0:0:0:0:0 with SMTP id q6csp4133700ill; Tue, 30 Apr 2019 22:26:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqzhfKzQ4MuZSeNDQob5xV9Hw++IfYZZ2euJY1j0t9tCAewkM+N1fB+hMDU9W4kma6KIzjD0 X-Received: by 2002:a5d:52c4:: with SMTP id r4mr36949590wrv.79.1556688371861; Tue, 30 Apr 2019 22:26:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556688371; cv=none; d=google.com; s=arc-20160816; b=lJt8ow6W60UZgLqod9OM97azv6lqkhuSLYo4NRAL19Gm3/C93y8gI0V2/prDpNnbb3 aS87uU5qXv+xQPIoJF/Rg8sFKZaZ4oH199qXhNmKNt6lnvjJZxw2KoAxbwlNIGr8faE9 r4uZz6YsArkJD/6Ri+ZNZHc8BtPIne2zvrAdFZq+J75JF5Lzdk9DapIDzuTwQjWeMMGn dSdxNRf/t6QIujmhoz6ZPXNKBSNVmiYJrwlAvva2gLQJf7hImhMFRNGIkbfZCmzFJHBw SZrALNzIxA3F2Sfd2qRfKuU95fRJZGpJKIgFIDtkxUBs2u02YQ1xx/q8W/D/oeCpV3Po 4A5Q== 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=lPp9ip0cQ55VftFpGYXkoRqMh2/FWH1IUHTaHYTSufE=; b=QYYp4y98x1eHuNGDuIKki8UemFB65aBcwB5EHJzgkMH4PHRjjCj0NCt7GrmVR+tQvK 31tXKaeHxGnFUSI0JDDxRSQA1z0Fqr7ijyGi+s02z6+/Lc76YRoAmTtvQMpmRlzKaa8Z 6YhQYhZIKPGBEUrteVPUKCrDiv2YaJIdi1hI7Q33NdLJ+OkmgxJcXMuQTYOcWJlhkKK+ 1WLzp0SMZm+nrjDz4QlorQ+r8F1UYUiwE76uYJJkiP6tMRHNI/mhryOfQBs5wG1Lhnpq 93HIDi7xeErLiMx39VfHJRmrndPrd4Pn0q4KVrQCguCepSFmoJQVwKxCn21+gOfEHySe tvhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=KBDC2y8h; 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 15si1082163wmp.105.2019.04.30.22.26.11 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 30 Apr 2019 22:26:11 -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=KBDC2y8h; 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]:36530 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLhkw-0007DQ-Rg for patch@linaro.org; Wed, 01 May 2019 01:26:10 -0400 Received: from eggs.gnu.org ([209.51.188.92]:38521) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLhRm-0006lM-5u for qemu-devel@nongnu.org; Wed, 01 May 2019 01:06:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hLhRj-00035R-44 for qemu-devel@nongnu.org; Wed, 01 May 2019 01:06:22 -0400 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]:39218) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hLhRi-00033z-UW for qemu-devel@nongnu.org; Wed, 01 May 2019 01:06:19 -0400 Received: by mail-pl1-x641.google.com with SMTP id e92so7750692plb.6 for ; Tue, 30 Apr 2019 22:06:17 -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=lPp9ip0cQ55VftFpGYXkoRqMh2/FWH1IUHTaHYTSufE=; b=KBDC2y8hv9ok5CTyFuwYt0KAHGVpU2qnT4wC4qETyqvnjGgobEVz0OFYyU5xxaOMR0 bfeYGiISl6LPpuQtt28rEWmeyNVLQjoq+daKlFv/7Q7o9ZlamTBhyQCV7v5/jqa/1gdl SR0bLmsB1bKqfDgYpF4cjAVQxh6CXGY5UiJLkkwhOxkco5gKnE2yT6Y//rFsShBL7W0O 5V+Wv+m/EyLtCgO1T13RoazsAthfsNXZKVpZkDXcwEvDSmV3FQJwyDZMCI1O3tJOyJA0 VFjnqsNQH0ikcCn2TvCBH0hLJ1LL9/aSmKLRHeCNuZm+zEw7LISqWZjTFa2w5imabQ8p WmqA== 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=lPp9ip0cQ55VftFpGYXkoRqMh2/FWH1IUHTaHYTSufE=; b=VBe6ovllVbZul3722umUJdXSckKLihIJR4gZx6UAZaTCTQ96bUN146ixhzqv41m5Pl IRnwOJT8GZNRTL1JqHbSkH5PHSObHI9bCKQno0RGYX/SZsj4X7avor46rQdohvoHK3D0 /yfc6+IyOGK8aManRqp1VrAuIhiIoq9Wbb6qH8KN0XsqEygnZVv2eqO7zB/KzIW6WKL0 EyabbqGZmIyObMVfd+6cZ4+MFXurrpNzxv/veimP5fsCIJQVyQyDWSyhQShqyjH0ZFtH 19xzj8Z/ISMXBGNQoedYRYCsR7alC/ddJ5h3LLuCOar4VukuiXX/XIsvZJrtjV3Fbjhy T6dg== X-Gm-Message-State: APjAAAUX7njHER9Ao5adLgRVJB+hOp4RuEjW7DOdT9+Oto4QHDhRAn0h 07PGNGJ0wZFX08KkxQebw8hL6f0zKW0= X-Received: by 2002:a17:902:b10c:: with SMTP id q12mr38637184plr.254.1556687176259; Tue, 30 Apr 2019 22:06:16 -0700 (PDT) Received: from localhost.localdomain (97-113-189-189.tukw.qwest.net. [97.113.189.189]) by smtp.gmail.com with ESMTPSA id t127sm9687251pfb.106.2019.04.30.22.06.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Apr 2019 22:06:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 30 Apr 2019 22:05:33 -0700 Message-Id: <20190501050536.15580-27-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190501050536.15580-1-richard.henderson@linaro.org> References: <20190501050536.15580-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::641 Subject: [Qemu-devel] [PATCH v2 26/29] 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 Gibson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Cc: David Gibson 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); } }