From patchwork Wed Sep 1 02:09:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 504986 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp3336591jai; Tue, 31 Aug 2021 19:26:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyWaqDwRUwHfl7xCdQO8aE2Xq0YZb9WQVJuEDjDAk5vX5K2sUhNlJ2pJXW1/gsJa1zK1oE4 X-Received: by 2002:a37:e306:: with SMTP id y6mr6327236qki.203.1630463172472; Tue, 31 Aug 2021 19:26:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630463172; cv=none; d=google.com; s=arc-20160816; b=yUaQXBbZcHRTIcJxrk9KLpv7W2LgnJAJ3xMAng1VWC52f4ztrQ55uAgLOiQmCUxbdV 5O5BcKYLUjIEh6gPhOmUtM4p50YqaNeJCWJUARZWRU+L2CwFOCihXZ22jgircMvD6b8q 65Q1EyAK5RVggyPpgSvptG6P5vctqrIoeQE4OR0k28vzFoTr6PuFbaZM3Jn0sJ/fEj0K I0rkRoRJKTZVppuL2/qmXC1GKU7Olv4mNi0XwMN1DB/z4am5Lt8bSZ94SU+XqUAvy+RW AoIH+ejEKmw+koDeBQw6z6vCxGofBFvnyyQFHF2zH+KG6JGUyKdvNswQxbWcf09VejQP /HCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature:wdcironportexception:ironport-sdr:ironport-sdr :dkim-signature; bh=iEvLoT4nsK0YctPN7im6a7H5XC0A7a1TgXGdILWKv9Q=; b=bTr2ok2FQ6Utw6onEle0yB9qaDqoAUyPuipxuU2Z3riKR9T3aqiSy4divxhdeaS9QF M0nhDKZKCe86B3vagmszCIyS0HopfB+o9VsjXVOQUm/fgA1UzUuubw2k9B9vasKEwPWb YMfmoel7f+sfq/qHOufM55DAvugSamUCATWo0rlvJdg78g9NDD9rboueOR86SyXyMAk+ /KO2wK5qEO/tuMQQj6OxEzVcgocouv2eRfS5wRQvEMS9UmF/QcE3qSgaY4Y9JzZh1lkU 1i7UJMfaakmTG8K4o3/4jNcEbayAb6jhbE84a5EUr9BIe3O6rL7QvJViSQ+sEkeJ8OkI QygA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=a1CVxf7Y; dkim=pass header.i=@opensource.wdc.com header.s=dkim header.b=ZVyiEpmr; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=opensource.wdc.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id l12si1778670qvq.77.2021.08.31.19.26.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 31 Aug 2021 19:26:12 -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=@wdc.com header.s=dkim.wdc.com header.b=a1CVxf7Y; dkim=pass header.i=@opensource.wdc.com header.s=dkim header.b=ZVyiEpmr; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=opensource.wdc.com Received: from localhost ([::1]:55788 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mLFx5-000487-Sb for patch@linaro.org; Tue, 31 Aug 2021 22:26:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47012) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLFjD-0006Y1-0T for qemu-devel@nongnu.org; Tue, 31 Aug 2021 22:11:51 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:10367) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLFjB-0000B3-50 for qemu-devel@nongnu.org; Tue, 31 Aug 2021 22:11:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1630462308; x=1661998308; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2WlTrVAbj0SjSClXEjBSZtxaDgYclx08zJ0DTcYqRRs=; b=a1CVxf7YuGpYFVM9zonXs2V8KWKkduHPWHmxR3teUYiy5lTJqTD7N26M 1mlmG11Mx/6Ynty90vF6X6TWVFDEs2K8AmL5eEA8bP5BLk16XHJcItBzy 9mx0tQNXTnrbhvMn3zAJk2ZJItg4PGr1rvyfoJotBuejakRJq4sl3A0YH rs727Nz+rlarjGN5PnFnVyhh8kuI9wZOdrWr2yE2ipCakG6Gjc4leBk9B Ytszs/wtdwILcPTFXieGynyONiV/CnOfGk8hgzaj13eBdk49SUvqsPtAH AIf3pN3e1eNdCAcS6nmymO6WML8EIMRGQ26OxKKlERWRTbHB72aLtPxrY w==; X-IronPort-AV: E=Sophos;i="5.84,368,1620662400"; d="scan'208";a="178011714" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 01 Sep 2021 10:11:46 +0800 IronPort-SDR: Le6oMNoDEAMiBGa3iT4fU5nUDktdfEHqwomvgLZdsTXmfNAOIbinD0aGgEkPg6R8EPXsXsVxlZ f77cBYMYe3YQfglS1pPi4225e56cLOWheYTN57m4TfbYyL7RUeJI+fX8siUp6GUAzAea9MpbzN i9qYyTNM9QFjVccWuXgsoIJIDcJ6bHtw8XHzVfkXJ1fARSVyc9Frc7f6+zkVZ+W4OS9QL7Zxht b6PtYsKLfIHn94iL6M7F35oyi7s5cbaSBNsrlPtJH87WlORmnv+Rty7o2Z44RPeC8yRhY3O4S+ iis4GIKjy02r0+qxKSXiZwO4 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Aug 2021 18:48:34 -0700 IronPort-SDR: JH55q+yoQzdziZhRIQU6fkqkD99+3YBlfuhEtJz1liEiHLwxYHScnFXuDGtHPiMYe3ynCUT/sN /iDLrXwd9MkKORQMjbd+9Al8bZ5QWTTyMfU4P8oi7AeQwepvA+oX8P3nW12KZeRmv2mG9mwYkk Wo9h/KShAkhcZkTUUvCwc3QC5jhimjxek1Fr1wji/yhtyrxefDjtx7PaJDpyBdlGszDno345Hy AAJPozDWgo+WfuE/Ywo3wNvGg3VeoDtZHjOGTlEXTNJaNwRqQPv7rG6u9oLpUknuCBUVCM1LW2 pw8= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Aug 2021 19:11:46 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4GzncL35dBz1RvlX for ; Tue, 31 Aug 2021 19:11:46 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1630462305; x=1633054306; bh=2WlTrVAbj0SjSClXEj BSZtxaDgYclx08zJ0DTcYqRRs=; b=ZVyiEpmrCSX8W4+kUY+a7joTncbck8nOIP PPIH6l/GyTz5ZdMJIJYd6OsJfDuy2mO6BBDxf3hABkC1hnk91+X7NNdgArjOJKOq CAUinijSfgIbobXkg+6QWJAId92DtLpixeMmBtHYxkXO36gNP8gasNYYKF3vRQw4 BfXB1IBQ8TtMj0CEaPIp1SmY6l15ta8ZOojTTnMzSYMna0fYv3DrBFCe/L4tKJ1K PINKH52tO5x3VD25ypbwBUGkzrkoYGapHd5ksHaV/EYS95ilDlXvSibhuQBZ7RxJ /l7JVgEYNaPtbkip00uRTe8pN03DP6F46m1aKVSXdQZVNaqcCxjA== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id viR1YHHWncoa for ; Tue, 31 Aug 2021 19:11:45 -0700 (PDT) Received: from toolbox.alistair23.me (unknown [10.225.165.16]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4GzncF19yRz1Rvl9; Tue, 31 Aug 2021 19:11:40 -0700 (PDT) From: Alistair Francis To: qemu-devel@nongnu.org, peter.maydell@linaro.org Cc: alistair23@gmail.com, Richard Henderson , Bin Meng , Alistair Francis Subject: [PULL 17/33] target/riscv: Use gen_arith for mulh and mulhu Date: Wed, 1 Sep 2021 12:09:42 +1000 Message-Id: <20210901020958.458454-18-alistair.francis@opensource.wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210901020958.458454-1-alistair.francis@opensource.wdc.com> References: <20210901020958.458454-1-alistair.francis@opensource.wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=216.71.154.42; envelope-from=prvs=871df42ed=alistair.francis@opensource.wdc.com; helo=esa4.hgst.iphmx.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_PASS=-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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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 Message-id: 20210823195529.560295-9-richard.henderson@linaro.org Signed-off-by: Alistair Francis --- target/riscv/insn_trans/trans_rvm.c.inc | 40 +++++++++++-------------- 1 file changed, 18 insertions(+), 22 deletions(-) -- 2.31.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 bool trans_mulh(DisasContext *ctx, arg_mulh *a) +static void gen_mulh(TCGv ret, TCGv s1, TCGv s2) { - 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); + TCGv discard = tcg_temp_new(); - tcg_gen_muls2_tl(source2, source1, source1, source2); + tcg_gen_muls2_tl(discard, ret, s1, s2); + tcg_temp_free(discard); +} - gen_set_gpr(ctx, a->rd, source1); - tcg_temp_free(source1); - tcg_temp_free(source2); - return true; +static bool trans_mulh(DisasContext *ctx, arg_mulh *a) +{ + REQUIRE_EXT(ctx, RVM); + 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 bool trans_mulhu(DisasContext *ctx, arg_mulhu *a) +static void gen_mulhu(TCGv ret, TCGv s1, TCGv s2) { - 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); + TCGv discard = tcg_temp_new(); - tcg_gen_mulu2_tl(source2, source1, source1, source2); + tcg_gen_mulu2_tl(discard, ret, s1, s2); + tcg_temp_free(discard); +} - gen_set_gpr(ctx, a->rd, source1); - tcg_temp_free(source1); - tcg_temp_free(source2); - return true; +static bool trans_mulhu(DisasContext *ctx, arg_mulhu *a) +{ + REQUIRE_EXT(ctx, RVM); + return gen_arith(ctx, a, EXT_NONE, gen_mulhu); } static bool trans_div(DisasContext *ctx, arg_div *a)