From patchwork Thu Aug 19 09:04:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 499715 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp330638jab; Thu, 19 Aug 2021 02:11:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9itZzsRX6lutt3qkf17v0oB35iB8tFbmt8X7UEePaUAudD5aSC+SFqyhAT3IcA0SMdifd X-Received: by 2002:a92:6711:: with SMTP id b17mr9247937ilc.122.1629364260090; Thu, 19 Aug 2021 02:11:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629364260; cv=none; d=google.com; s=arc-20160816; b=mh6tzC0R+qxnhJOC38ap0uzwCRmeHEeCIIKJ9lGMJbF/v/WWyM87RWD27oQhlyYiDl VBX8u3wO6MUzWcbYcGh/Ptk1WN53W4ixLXBQaof4vJDbpXWX9nhUKNCudueqMcZEONvG LIrPXjNmeIJm2NJMliErXHj3/Dgycvk2wFkyCuhvSYizRaeet/+ge88fdrhluTuESwTs I+Eh1s+0zsydJ1XLC5gARStOaO9/5ZVaekFdM6gfOQjF29rEFqC+v/nAVMw5uYEtfXtl XT5cnoGzlV2IUnc99DH5FxE0Yuv2OUAKU2br1pXimqnu0ygQrSGHYK6BK/hOX03u7v0C VsZQ== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=ZtzgxMrimjDaolvyiQ4xom5y79yzDTt02qA1Y6+PMUo=; b=WHmAt2cR1uei8ncxFoevlibOs9Z/JNomfkPKJqOeAadoHG8iPpptRJf7kr0So9HhlM gntHubzcqnCQUXG/sMg//9+7OsrfkWyE6n6dsSZM02xhfxWVIO8JcEyYTlulW3KzSNFb g+1BKOqKkslcgtXWvE2jffaXf1NCASg4Q40CD/4c4desyFBYirB58I95s0K8ZfRG/LVR q092NzJ67sUQ/nnJjbljOF0pu4uA7D/DcI5HdtBL/ry7PU+WMgx4c/KK9fNLWyclYuP+ wJK7TjAO8oW26Kh6lqaoVJDW7es97OmmxXIAn4pbXf9Rz78A8avyNr9S27VF9SiZHqXR V+1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=RkRR9d0M; 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 v16si2616320jal.55.2021.08.19.02.11.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Aug 2021 02:11:00 -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=RkRR9d0M; 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 ([::1]:38562 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mGe4h-00017x-HY for patch@linaro.org; Thu, 19 Aug 2021 05:10:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43058) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mGdzD-0005s0-S3 for qemu-devel@nongnu.org; Thu, 19 Aug 2021 05:05:19 -0400 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]:55961) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mGdzC-00009k-84 for qemu-devel@nongnu.org; Thu, 19 Aug 2021 05:05:19 -0400 Received: by mail-pj1-x102d.google.com with SMTP id mq3so4462197pjb.5 for ; Thu, 19 Aug 2021 02:05: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 :mime-version:content-transfer-encoding; bh=ZtzgxMrimjDaolvyiQ4xom5y79yzDTt02qA1Y6+PMUo=; b=RkRR9d0Mzi/vjBI9nLZi6FKS1j8kAHrIm1s89nZDTDBuORQc9YrTQk2/dME74wdaC7 2NGfTCxCZC4/io2OKZ6GBCQp6hZbC7lwdeNXU+M5IQtDQ13Z6cb9FplPKusNTtQDvbk4 EG6ZnU3YqHvHOgccIStxCpff/d2tee3sE602thVdxROHIiDB7CwXqMn+fAo+zc27KBAo x/GsVrTnBh7Iye5qObDMBgsqGXfe/p/tUvWElseJngqG3i4qwVkHwWC5xtWT7wEtWkiN tgBMobbgTZFf6kkU346KInDdF+FJ8jEI2z6k4tAb5LE8IBVhrFLx5j+1YfeJR2odkNkG TDSA== 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:mime-version:content-transfer-encoding; bh=ZtzgxMrimjDaolvyiQ4xom5y79yzDTt02qA1Y6+PMUo=; b=ioNY4AgsHoloXrW2Dj4uoVOi0vxNREhj38GGkbJ0hveAr4kQBuN2Gts/zI8CmrEtxB NqZGESNmtkAes2AM62JNw6e2O6R2Rnm/WLAkp2x2dnu3M13vCHvlyITOIPlDMl3jRn0L EsZrQO8c2uev6C50LstuoT0RIRUbIstV/YXEbIQMOtF6Q6Or3hf5SBRNf3BiO/xt4hyx rpDPru/fY0akaewx8TcTeUBz6GaCe2u38vtBN4N/3WWw/CaPpyRQZAn5xeVDO1ev51Z7 I0rn0lB8/0hZf0KvzZPMdDQHvZkMXafhn+Qx77lYHOrtcp5dwOhtwXcgjGBEHAeYMgvA 8mjA== X-Gm-Message-State: AOAM5325j3x+tEPYca7rNiewLTljvLSjbPxt2vOqpcc3tHG4lgRhTkoy rsxX4mAbkoOfcbSQLtsVRcawAf8SATqluA== X-Received: by 2002:a17:90a:d711:: with SMTP id y17mr2584911pju.97.1629363916784; Thu, 19 Aug 2021 02:05:16 -0700 (PDT) Received: from localhost.localdomain ([173.197.107.15]) by smtp.gmail.com with ESMTPSA id j13sm2944707pgp.29.2021.08.19.02.05.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Aug 2021 02:05:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 07/21] target/riscv: Use gen_arith for mulh and mulhu Date: Wed, 18 Aug 2021 23:04:48 -1000 Message-Id: <20210819090502.428068-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210819090502.428068-1-richard.henderson@linaro.org> References: <20210819090502.428068-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alistair.francis@wdc.com, bin.meng@windriver.com, qemu-riscv@nongnu.org, Bin Meng Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Split out gen_mulh and gen_mulhu and use the common helper. Reviewed-by: Bin Meng Reviewed-by: Alistair Francis Signed-off-by: Richard Henderson --- target/riscv/insn_trans/trans_rvm.c.inc | 40 +++++++++++-------------- 1 file changed, 18 insertions(+), 22 deletions(-) -- 2.25.1 diff --git a/target/riscv/insn_trans/trans_rvm.c.inc b/target/riscv/insn_trans/trans_rvm.c.inc index 3d93b24c25..80552be7a3 100644 --- a/target/riscv/insn_trans/trans_rvm.c.inc +++ b/target/riscv/insn_trans/trans_rvm.c.inc @@ -25,20 +25,18 @@ static bool trans_mul(DisasContext *ctx, arg_mul *a) return gen_arith(ctx, a, EXT_NONE, tcg_gen_mul_tl); } +static void gen_mulh(TCGv ret, TCGv s1, TCGv s2) +{ + TCGv discard = tcg_temp_new(); + + tcg_gen_muls2_tl(discard, ret, s1, s2); + tcg_temp_free(discard); +} + static bool trans_mulh(DisasContext *ctx, arg_mulh *a) { REQUIRE_EXT(ctx, RVM); - TCGv source1 = tcg_temp_new(); - TCGv source2 = tcg_temp_new(); - gen_get_gpr(ctx, source1, a->rs1); - gen_get_gpr(ctx, source2, a->rs2); - - tcg_gen_muls2_tl(source2, source1, source1, source2); - - gen_set_gpr(ctx, a->rd, source1); - tcg_temp_free(source1); - tcg_temp_free(source2); - return true; + return gen_arith(ctx, a, EXT_NONE, gen_mulh); } static bool trans_mulhsu(DisasContext *ctx, arg_mulhsu *a) @@ -47,20 +45,18 @@ static bool trans_mulhsu(DisasContext *ctx, arg_mulhsu *a) return gen_arith(ctx, a, EXT_NONE, gen_mulhsu); } +static void gen_mulhu(TCGv ret, TCGv s1, TCGv s2) +{ + TCGv discard = tcg_temp_new(); + + tcg_gen_mulu2_tl(discard, ret, s1, s2); + tcg_temp_free(discard); +} + static bool trans_mulhu(DisasContext *ctx, arg_mulhu *a) { REQUIRE_EXT(ctx, RVM); - TCGv source1 = tcg_temp_new(); - TCGv source2 = tcg_temp_new(); - gen_get_gpr(ctx, source1, a->rs1); - gen_get_gpr(ctx, source2, a->rs2); - - tcg_gen_mulu2_tl(source2, source1, source1, source2); - - gen_set_gpr(ctx, a->rd, source1); - tcg_temp_free(source1); - tcg_temp_free(source2); - return true; + return gen_arith(ctx, a, EXT_NONE, gen_mulhu); } static bool trans_div(DisasContext *ctx, arg_div *a)