From patchwork Fri Jul 9 04:26:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 471779 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp950074jao; Thu, 8 Jul 2021 21:41:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzMCcO4e/VcjLDrOhQjN3U8H2ezCMbz21VFoE6Wk/vp13f2oxfMaZkD/bMXtYM5SDpR56v X-Received: by 2002:a05:620a:a92:: with SMTP id v18mr35133057qkg.156.1625805662651; Thu, 08 Jul 2021 21:41:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625805662; cv=none; d=google.com; s=arc-20160816; b=y9FPQ7IzpQsFP+j6/Xegr1HMgzYRMwyOlCGcqevkuL7hFT6uJe6sWNfxWj+i/Js3FB XT9f3/W6Ai66uVNUN/O5+yAH51SUad8AZIjDgqFA5lpNGKCVVtBL2wqncbG9sQWxOLfQ gj2rGIATlArFzAfuLQexznLIFeValHP6bZTg0ks5yVKZl9p2V4Yqr7v0MCJDgrSi+bli 92TtX1qpfSR1mUlGsqDciJlMUVd1YPH4pjJud32BhoEk+U2uCSDs8VUZN8GRo18VcMwn IaSECb4jbLsBP8XrK4CVeACdsrPInVXjmcXwVCd2S/e2w/F+exWBlaEqKqR/2EUZNlXG Apcg== 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=lbT7rR4xAZ+TINcw0n3vg8MxSKcWXYHtQH2vV0PJUA8=; b=ZGaQENdEqUSgIO5DhsHAk0nUldMehm4L+T3Lk7WG+/8bMR3dHlQulkSkZ+LZy6QEYz eD1ObtDvzHz/Z1IV5jmJOiDk/I9Y7TnPPfjGuIXpx4sGcM1aDhe4/H+wnUYVQ+3njyU5 o7w/MrZuGZo7ofaIHlVg0mwAItA0/xo+Ub1b2WNXTeYr/zxMznXnuPWG9/I0z0KvNZO2 xGverKzO6SL277/JanP/uILJC4XHAayQScLAy/bNHHM8MoyQjk6rJC5nMppCAmb8Q/oL GwEm8ClPfyV4MZ0EZHH15Az84AbZyyZB/xUYq6WBis5A0tKnb4Y7/PJduDGlorSaPAbf JKMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=GCNmFCvx; 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 r14si1553964qkp.320.2021.07.08.21.41.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Jul 2021 21:41:02 -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=GCNmFCvx; 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]:35438 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m1iJy-0007hI-2J for patch@linaro.org; Fri, 09 Jul 2021 00:41:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53956) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m1i62-0006X7-4d for qemu-devel@nongnu.org; Fri, 09 Jul 2021 00:26:38 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]:39700) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m1i5k-0001Z1-4b for qemu-devel@nongnu.org; Fri, 09 Jul 2021 00:26:37 -0400 Received: by mail-pj1-x102c.google.com with SMTP id p14-20020a17090ad30eb02901731c776526so5197217pju.4 for ; Thu, 08 Jul 2021 21:26: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 :mime-version:content-transfer-encoding; bh=lbT7rR4xAZ+TINcw0n3vg8MxSKcWXYHtQH2vV0PJUA8=; b=GCNmFCvx+2bFPvSIENUpcshqAYTMWkdpmFvPDuO0pMn1alP4Zqw6TuIPTiUEBdEWFC HchAPqDg3fgVLZrcMKG1N9h6N+y0WYGSaJ1gc1g55NucRmhPqXuKe2h6Jrf7o7evhhQn VhdQ4Cv+MezTroeIC9vtIFwmLu8MPU8vV2a4YqJYYNQTSDXbvOaoAiiB240sxn3k33UE qJQlu4UfajGAh4MuupnzoAq7zYlVUglJU1RTiiYunIv5dlI8BqzMLlevDzHoXWSKwunQ nL6y8Fik8JX3ZWo7CSn17kTzV8jQl29cHgn8dmHZ9qPBQ/rsdrUoS/bmozp3axbcUtfx Qoqw== 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=lbT7rR4xAZ+TINcw0n3vg8MxSKcWXYHtQH2vV0PJUA8=; b=Rwdn10xjatUkGOsTtD0oErhccKMVS7UpyNherL/Z0wGy3YUvcYQqjQ4gi/Bm9l/S+6 Hu8ihRO8U+/4rlHErmv7kzDo7oLOOMoP02xgnvvuWZfRvi3dYyGra0yjISGNRKUxPyh+ 4Q+tTwFsSb5xdD6dBYUO770OwDccEE5hM7SG8JdWHCjmEIU+/XU86ExXtT+o3QpX3OA9 S+FDEqbFYm+lk7yHVsc91m1krPi7aNp7nWkuloi6kfkybuG8iNp9eTs6w3frbu3VMDRY jChm1fhfRb3cFPHsedP+tEgV+cyMwJcx3qzcD9bo3Ulkl3mVYdgbHGtjMqWEsTt4KKtu dTZA== X-Gm-Message-State: AOAM5320on4Bnte0F2HuSXMuz00nWFpSmbVbQIvuE0iizEDfchefI0jb E3CxkaMWIdBWTxeq2Ez24Dd5Ugyu6RFt/w== X-Received: by 2002:a17:90a:4e4a:: with SMTP id t10mr35752021pjl.173.1625804778835; Thu, 08 Jul 2021 21:26:18 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id y16sm4406727pfe.70.2021.07.08.21.26.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jul 2021 21:26:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 15/17] target/riscv: Use gen_arith for mulh and mulhu Date: Thu, 8 Jul 2021 21:26:06 -0700 Message-Id: <20210709042608.883256-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210709042608.883256-1-richard.henderson@linaro.org> References: <20210709042608.883256-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102c.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, qemu-riscv@nongnu.org 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. Signed-off-by: Richard Henderson --- target/riscv/translate.c | 16 ++++++++++++++++ target/riscv/insn_trans/trans_rvm.c.inc | 24 ++---------------------- 2 files changed, 18 insertions(+), 22 deletions(-) -- 2.25.1 Reviewed-by: Alistair Francis diff --git a/target/riscv/translate.c b/target/riscv/translate.c index 6ad40e43b0..8ff75a5798 100644 --- a/target/riscv/translate.c +++ b/target/riscv/translate.c @@ -235,6 +235,22 @@ static TCGv gpr_dst(DisasContext *ctx, int reg_num) return cpu_gpr[reg_num]; } +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 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 void gen_mulhsu(TCGv ret, TCGv arg1, TCGv arg2) { TCGv rl = tcg_temp_new(); diff --git a/target/riscv/insn_trans/trans_rvm.c.inc b/target/riscv/insn_trans/trans_rvm.c.inc index 10ecc456fc..34220b824d 100644 --- a/target/riscv/insn_trans/trans_rvm.c.inc +++ b/target/riscv/insn_trans/trans_rvm.c.inc @@ -28,17 +28,7 @@ static bool trans_mul(DisasContext *ctx, arg_mul *a) 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(source1, a->rs1); - gen_get_gpr(source2, a->rs2); - - tcg_gen_muls2_tl(source2, source1, source1, source2); - - gen_set_gpr(a->rd, source1); - tcg_temp_free(source1); - tcg_temp_free(source2); - return true; + return gen_arith(ctx, a, gen_mulh); } static bool trans_mulhsu(DisasContext *ctx, arg_mulhsu *a) @@ -50,17 +40,7 @@ static bool trans_mulhsu(DisasContext *ctx, arg_mulhsu *a) 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(source1, a->rs1); - gen_get_gpr(source2, a->rs2); - - tcg_gen_mulu2_tl(source2, source1, source1, source2); - - gen_set_gpr(a->rd, source1); - tcg_temp_free(source1); - tcg_temp_free(source2); - return true; + return gen_arith(ctx, a, gen_mulhu); } static bool trans_div(DisasContext *ctx, arg_div *a)