From patchwork Mon Aug 23 19:55:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 501556 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp2493922jab; Mon, 23 Aug 2021 13:01:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwNHY6amWVnDgqq6JAxz29jFDdqFImCSp/LClmqrRSkUuxBYVZg1sm0DHglNsBc/hPkMPa5 X-Received: by 2002:a05:6402:2684:: with SMTP id w4mr39481006edd.69.1629748900209; Mon, 23 Aug 2021 13:01:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629748900; cv=none; d=google.com; s=arc-20160816; b=TGTh+hlDsi12R79Kab7Eit+DGyoFJQwT3kw6gQMLINJh4b1O49YxhxPq7x96eWRHAq qvLFiFOTAPdCTQqJ6iWP0m1p4iL3mrx61rpZxUC22h7kpBeDtBzTZjo+tu/51emXSDk4 KHaRA+G8JUFb0N8LDP2r2y37R+5lf2Y/tO0zq0jVpCmM9vy0aVm1WF9PTrOGfc2gKqjU +F0xo7/LV8s6clyvPF6QGPPHUZft9T0PinVQWazcrDoihxdDvbbV4qxswH1l4ZY7mtKm HzAYtBX8SZxi6j9/o8Wa6CIaNayCfll0dlwjsuDjAlDXMXgBW4K66ruNJqCuG2rds8J4 aFWA== 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=pUajFA1wv1wRla08pGaVTiLNZIh93tFjtEF8PrO3fSrzt4SL7FUM0ghrjZrpan+Asw c+jLCi3sjxdnLD3YhA5OTN/EfG5YrSusYLOumtjQf8C0TcuA+Cb9r2orUSUctMODWQ6s r+mOKZCuspxgGxTRJ3eSWYVw1U2l1fRQTCD1fO8uC4x6I6xOpIkCI8nEnlImcJXso9w8 UzyD22R765UdHqiFN46KOuaa/LbAg3xV+EqisklJFRZeL64MiqXnhpIHueSQKFKWhL2u pJ5YHQ8MPRFc41D+sVj4nhiFbxXX4UxwsgGmve3SryJxxVRp7cZu4SjSO+Pq+3tB2/q1 vmIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=dzGccQw1; 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 p1si15383730ejm.169.2021.08.23.13.01.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Aug 2021 13:01:40 -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=dzGccQw1; 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]:32772 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mIG8Z-0001GZ-51 for patch@linaro.org; Mon, 23 Aug 2021 16:01:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59334) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIG2p-00062w-Nd for qemu-devel@nongnu.org; Mon, 23 Aug 2021 15:55:43 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]:34532) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mIG2l-00036F-01 for qemu-devel@nongnu.org; Mon, 23 Aug 2021 15:55:43 -0400 Received: by mail-pl1-x633.google.com with SMTP id j2so6401213pll.1 for ; Mon, 23 Aug 2021 12:55:38 -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=dzGccQw1okVr4STQRfIPzRwzKR8tCS4rlgwZKE7uCYczzsDiOqVb71cyM8nRVsOCyJ pYbavkJgECi0PKlSc3Q088/xl3zBh99XXA395X2ebAmiBx38fJVy/Rfin6ODgTETRdVE 1Gob8sEJzgKABgOUC5k2W+iu39iWeFZPiRSIoEPndbGmJkN07EDILjvvMHGG8eHdZxPx ZbPxofocJITzTQQN6vlXG7bKdPHdCNlXLREGC4zSJuWrpTbAY8FNVCSeH10Lp9wy7Bey U2zAO4JI2jadAxWmBjErgoZw8dyfm0Ay9HCoj7QRCjBhvy+sDUDnE1yNfAz9hMmcTLiJ ik9Q== 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=gFSAT5FgQVuCDHPFsJ9oIbygbdRilzKiwNMYBc18E8JYcObHAhFhWl86wMGpDVLw83 AXVtLusizbU7klmQSyhRTG3HNhyuuO7UOwWaEsh3/Dj8D2aBDNXAnsgUxbxikpIjLH7D ttR6oMiIE/eBG5DlcRl7rNyZjJtbs7DPBOW4eCJ7eG834V3/wrr0cMTrz7py28kVKNk4 PdUmv1+U5nolIJNV5lK6nJG40RKov6qwz7NWOOdl/mD/yZS6NJYcctzExHO+7Zg/r4uU IcOutBtbz+3BYRLAi66dbkRkHwPZgjiV50CvPKjdyb3a0Dib6+x1WtXTGC25DzpO6pIE FkBQ== X-Gm-Message-State: AOAM533H6ywy7GJhlFNoqRdqGhNWKnY5P28jqaVUxwnU33R2pj2tqFVZ TJyyp0h5O7BXSLDTzwNs0UZBfNPjFVr93A== X-Received: by 2002:a17:90b:23d1:: with SMTP id md17mr233092pjb.105.1629748537654; Mon, 23 Aug 2021 12:55:37 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id v15sm16685078pff.105.2021.08.23.12.55.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Aug 2021 12:55:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 08/24] target/riscv: Use gen_arith for mulh and mulhu Date: Mon, 23 Aug 2021 12:55:13 -0700 Message-Id: <20210823195529.560295-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210823195529.560295-1-richard.henderson@linaro.org> References: <20210823195529.560295-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.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=unavailable 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)