From patchwork Tue Aug 17 21:17: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: 498127 Delivered-To: patch@linaro.org Received: by 2002:a17:907:2648:0:0:0:0 with SMTP id ar8csp3528410ejc; Tue, 17 Aug 2021 14:22:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwyokHkdU4RWUI4mpYduBRKM/vIUgAovOX+308JNdVfvvjSSb+RcHKimFa9RnNY/+9yP3R5 X-Received: by 2002:ad4:5551:: with SMTP id v17mr5502181qvy.11.1629235342907; Tue, 17 Aug 2021 14:22:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629235342; cv=none; d=google.com; s=arc-20160816; b=yr87iBUmkuPGx3hQjmKU4rhaWHIR0PsLQ/J73WyeIovCqqvBGuJWEvTCrE1UbGKmZr DSs5RoNdb9SvdupVWAZ7WXW00fBs/cQQx6ILYEisjk0criGeBL3q0WC2js9zkB3H7gez +XnP8iDnbLkk6VzHSY97YqLFoY3DTJlBx26kwS1nRoH20mGQbcvOSH8ZIo1qJjeow/8d qRBjaRKGHs1Vq2lN38dRh4h6OX0QLmORsSIIHeDMal/8KF3N6erfGUNKJxolZemyWhpq VVYAnKJL3lVHs9pSvf0Wbv7iGjbZsyJL1CJTVpk3MZ9PTDt5NVSDTfhaAUEaWPaT0Cdn eIfQ== 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=VfaTNl6cZJeuhpoWMW6b1lJ/gL2AkVre0lGbvDe+dvQ=; b=B+ywoIitEPuAWlJ6w1rjd3RuEqcHuc0fRcVjjwUJ+wm9p3VKsQ9KYU4d8kYhiG8qoA uAnPtGSMcB3R+AKlz5+uXFPdSKBOhOKO47wuYH7mw5mwBj/sHwO94ykvyXVkK/Yd/sRn Byq/6GPfLNWLiFLhGE/0Vuypv/cbLTn+JYo3+I7khGAXXL3wMufLtOA6EFEli3Cngkrn jmXr+X2uVmn7manw2Yx8fZ0XovNngNjzV+7WrFcJ7zdL5umWeKnYEp9k8zSD1NPrOLtB GVf57F8C5FG2SyHdon3ME97O/X790YepAbewaXMHUPro55zew4Mz6JEo21n4w/+hn7RV D2Ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=UND8A57W; 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 z64si2383162qkd.62.2021.08.17.14.22.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 17 Aug 2021 14:22:22 -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=UND8A57W; 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]:48526 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mG6XO-0006rt-7b for patch@linaro.org; Tue, 17 Aug 2021 17:22:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43470) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mG6TU-0001Br-Aw for qemu-devel@nongnu.org; Tue, 17 Aug 2021 17:18:20 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]:45648) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mG6TS-00015p-2C for qemu-devel@nongnu.org; Tue, 17 Aug 2021 17:18:20 -0400 Received: by mail-pf1-x42f.google.com with SMTP id i133so5824pfe.12 for ; Tue, 17 Aug 2021 14:18: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=VfaTNl6cZJeuhpoWMW6b1lJ/gL2AkVre0lGbvDe+dvQ=; b=UND8A57WXN1a7YFdKXdeJNup1uzGMa7pf8H3ejNaffID9qtwq2PWTfC9p5hA4xuIUC QKTZATkr7/vL4oZSr6AKZfpdUGX7UZPsR6zvQY+5nF3JMz4bGgqPKAZwcAtRZgjhCuho neCo5CGlcSMpiMl1XclH6vsoo+EsyuwVOsCVLg2jdIklNJuWLtj7qNa2349nb2vuKkfR +2ehTl9FLquICbb3XCvnuzrxM/tj8lArNdMSDHlaoyxiO3BfumI/A5DzQMzS22OJhS9L iwtB8kTvFsmwapiGifa6bKJoTlG8kPyL9B2oLca2OoF6G1YQUMEYn6pegvsWEzZxnGPW b24Q== 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=VfaTNl6cZJeuhpoWMW6b1lJ/gL2AkVre0lGbvDe+dvQ=; b=haZ8UDtPjF4AujfSNTMfr3eKAsQftFHVQ1ypBY187x6snREniv0/NOFCGsNRvouElM A30qZ3UEq144aY05g05vrZ683Leklm+/w0GUNeBhgy4aFMv7tOD/SG3SFP3WZWRnnYoV RKOMzSFvoKEwwUnjSQsHroXg36xmfuo0XvaqrHKU9d1opt4IvmPb0WPGAu9yOBpobJyB 5/MvxEdBOlA9esArALyq2QjDusnaHB9OeW74VyZZvYJ44MepSWwlHg0aVf2ro2qpSvi6 mtU98ckFYZ/SSMDujW5ucElmsmjmkltdK0SpVhZTfTiyuPbNWIwW+WTY7Z7fIa6V4ImZ pFJQ== X-Gm-Message-State: AOAM533wk/vS2znQTbmqvJSbFv+2Ibu4Tf68aDy/7kcNu/YKa3+LBo6G +M2mHDKzgGDHNg5dyvPo3xspboHoPy52sg== X-Received: by 2002:a65:63d0:: with SMTP id n16mr5263861pgv.432.1629235096661; Tue, 17 Aug 2021 14:18:16 -0700 (PDT) Received: from localhost.localdomain ([173.197.107.15]) by smtp.gmail.com with ESMTPSA id q1sm2978637pjl.44.2021.08.17.14.18.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Aug 2021 14:18:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 06/21] target/riscv: Remove gen_arith_div* Date: Tue, 17 Aug 2021 11:17:48 -1000 Message-Id: <20210817211803.283639-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210817211803.283639-1-richard.henderson@linaro.org> References: <20210817211803.283639-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.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, zhiwei_liu@c-sky.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use ctx->w and the enhanced gen_arith function. Signed-off-by: Richard Henderson --- target/riscv/translate.c | 42 ------------------------- target/riscv/insn_trans/trans_rvm.c.inc | 16 +++++----- 2 files changed, 8 insertions(+), 50 deletions(-) -- 2.25.1 Reviewed-by: Bin Meng Reviewed-by: Alistair Francis diff --git a/target/riscv/translate.c b/target/riscv/translate.c index 4819682bf1..e337dca01b 100644 --- a/target/riscv/translate.c +++ b/target/riscv/translate.c @@ -491,48 +491,6 @@ static bool gen_arith_imm_tl(DisasContext *ctx, arg_i *a, DisasExtend ext, return true; } -static bool gen_arith_div_w(DisasContext *ctx, arg_r *a, - void(*func)(TCGv, TCGv, TCGv)) -{ - TCGv source1, source2; - source1 = tcg_temp_new(); - source2 = tcg_temp_new(); - - gen_get_gpr(ctx, source1, a->rs1); - gen_get_gpr(ctx, source2, a->rs2); - tcg_gen_ext32s_tl(source1, source1); - tcg_gen_ext32s_tl(source2, source2); - - (*func)(source1, source1, source2); - - tcg_gen_ext32s_tl(source1, source1); - gen_set_gpr(ctx, a->rd, source1); - tcg_temp_free(source1); - tcg_temp_free(source2); - return true; -} - -static bool gen_arith_div_uw(DisasContext *ctx, arg_r *a, - void(*func)(TCGv, TCGv, TCGv)) -{ - TCGv source1, source2; - source1 = tcg_temp_new(); - source2 = tcg_temp_new(); - - gen_get_gpr(ctx, source1, a->rs1); - gen_get_gpr(ctx, source2, a->rs2); - tcg_gen_ext32u_tl(source1, source1); - tcg_gen_ext32u_tl(source2, source2); - - (*func)(source1, source1, source2); - - tcg_gen_ext32s_tl(source1, source1); - gen_set_gpr(ctx, a->rd, source1); - tcg_temp_free(source1); - tcg_temp_free(source2); - return true; -} - static void gen_pack(TCGv ret, TCGv arg1, TCGv arg2) { tcg_gen_deposit_tl(ret, arg1, arg2, diff --git a/target/riscv/insn_trans/trans_rvm.c.inc b/target/riscv/insn_trans/trans_rvm.c.inc index 013b3f7009..3d93b24c25 100644 --- a/target/riscv/insn_trans/trans_rvm.c.inc +++ b/target/riscv/insn_trans/trans_rvm.c.inc @@ -99,30 +99,30 @@ static bool trans_divw(DisasContext *ctx, arg_divw *a) { REQUIRE_64BIT(ctx); REQUIRE_EXT(ctx, RVM); - - return gen_arith_div_w(ctx, a, &gen_div); + ctx->w = true; + return gen_arith(ctx, a, EXT_SIGN, gen_div); } static bool trans_divuw(DisasContext *ctx, arg_divuw *a) { REQUIRE_64BIT(ctx); REQUIRE_EXT(ctx, RVM); - - return gen_arith_div_uw(ctx, a, &gen_divu); + ctx->w = true; + return gen_arith(ctx, a, EXT_ZERO, gen_divu); } static bool trans_remw(DisasContext *ctx, arg_remw *a) { REQUIRE_64BIT(ctx); REQUIRE_EXT(ctx, RVM); - - return gen_arith_div_w(ctx, a, &gen_rem); + ctx->w = true; + return gen_arith(ctx, a, EXT_SIGN, gen_rem); } static bool trans_remuw(DisasContext *ctx, arg_remuw *a) { REQUIRE_64BIT(ctx); REQUIRE_EXT(ctx, RVM); - - return gen_arith_div_uw(ctx, a, &gen_remu); + ctx->w = true; + return gen_arith(ctx, a, EXT_ZERO, gen_remu); }