From patchwork Mon Aug 23 19:55:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 501552 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp2492103jab; Mon, 23 Aug 2021 12:59:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzi9ToB06ay/TVnT1JZ/OZ0LQK6YwItjGpfm/+bns7P3qya5uvG96v9yzFtgxi0/M8j+cfe X-Received: by 2002:a05:6e02:d06:: with SMTP id g6mr24458191ilj.153.1629748757644; Mon, 23 Aug 2021 12:59:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629748757; cv=none; d=google.com; s=arc-20160816; b=Hgi+xvls5nlYHMHNn7slOeXBGZcncbarHR0eXCp0oyKgKtRGaiwEkcyFMeGwYCepCi pgmShc4sX0UvHfLAmhYOIHB91HGU11X/DRD1RcAh8gMOZxP0a+PRAZ9W8gRqLOektJWt g++uA1M6aCPKEgA4NiPKU8RMVB1lpZk+l5pe9mg4/2o6eTjhks6EDsGtFaLBCw2z5rPK aUGUafx4mAcafo51Vmu8gvhKuNsk74G16bizIyoirvBM15VtAzYitOjhUN5QYNlWkL/Y 563a2hOCmJlYQQSvqvdMuwzkcFtLhzYg5BdSh/ON4fxxQCg/SSBG3rLSJK3nmRzZAyP0 PAOw== 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=nXJ3guWqlzaqn0iKN8apboyIQBkxnjeF9Y5TujOH5pQ=; b=RlwyXor7+HTFxTGJk7rB7bT6Sn0OP5CPS2K44xV/STjrIoL4eRx0Hi8QL04+f1PmsA eNniPor8Xa6ft+ojSkm8hG1VoI5urB0cZGXiPDecPjpgfgS2HXTL82n5B4i+laaj1IsF MfZWZ+uVspEHkBJRGvjn8Y9l078MJ/A7/5vX79CMu1aIZAM+F/ZunYDzC8VDLUMRDd3H 0owHHhGJTqvykCMvlI18Rv5RfQiH4JGUom1B6XLgg/ON7/FwOIxkxwLeZby/xc/XwtSN 7Jb7J7vO6CMrPDcVXSQukw7XLai61tfg443DBIEatyYIgXewGDETHXMufA+nh5KuMa+a 6ByQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Awi5vcmq; 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 g7si14780259jar.3.2021.08.23.12.59.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Aug 2021 12:59:17 -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=Awi5vcmq; 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]:52674 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mIG6H-0004DD-4x for patch@linaro.org; Mon, 23 Aug 2021 15:59:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59332) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIG2p-00062J-Lf for qemu-devel@nongnu.org; Mon, 23 Aug 2021 15:55:43 -0400 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]:34341) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mIG2k-00035f-9S for qemu-devel@nongnu.org; Mon, 23 Aug 2021 15:55:43 -0400 Received: by mail-pj1-x1033.google.com with SMTP id ot2-20020a17090b3b4200b0019127f8ed87so562108pjb.1 for ; Mon, 23 Aug 2021 12:55:37 -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=nXJ3guWqlzaqn0iKN8apboyIQBkxnjeF9Y5TujOH5pQ=; b=Awi5vcmqv/BbDuzZuLKoUjpzsX30zLptlqKsGuZAY0gyWPyKcX+5/eMWHuraiC1u1k Fea33XKg1knbjpIgaGckXMspqUXn1BGhPLvPa3jG+v6RiYlf/j66I4d3YeOWvOLKaky4 S6gvCFOjjfViZjS1EA2I430QYdAZOeOW2PtXqefIoMIjbl0pF2wZ0Lu6nP5xfWjGWedA iG8E2pjeIwt3HHZPgtj1C1WgVmnfToSNoZ6wERkxpAzRvlRs003aXiJLpnxktItrMiiS +lWgUrWSzu91cBS8luDrkYrYh9aZ7U0Vt8FAzZp4JZ8l9wl7Nr4sqK6CajKGpdvcQ+yb 0QHw== 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=nXJ3guWqlzaqn0iKN8apboyIQBkxnjeF9Y5TujOH5pQ=; b=brvrkq4+wjLQvTKkD0Ojb20LRrArK9C4gPkwpcW+UPfTnw+7mNhGkn3zRd17MTfynG a3xuO85PaSm38Qn6bNQ8WkBtne9SQdwXP1rfunPzoRWaleuyrRdyZz0YuBahl3qoVY2b clqulHqe11ZuZTfzb9TZoTcFYusPWO4p7OdUX5Aqq/m9lmx89tlxWFMHDjOmGoYT5xqi luBp8uCYvf6h6A6xg/FPzPX6Q13h12hkECSfmD9IQ5OeYiNQgF3o+3HJLCS9YAgQ1Wvr K2UhEc7rd8zC1xk5/u2tiV/NRJnjHFHPPvkQ90hojmK/geuluVftPnPID4GV20y3p+fo uBVQ== X-Gm-Message-State: AOAM531y0I6x1YQ3r4qKSXVnSeLSO3+kOwdHDptwjzglcEws+E0E+Fjn SmATAEAA8Jaqhv+PElPfnC/hGTcEYIEGdA== X-Received: by 2002:a17:90b:395:: with SMTP id ga21mr227999pjb.159.1629748537006; 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.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Aug 2021 12:55:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 07/24] target/riscv: Remove gen_arith_div* Date: Mon, 23 Aug 2021 12:55:12 -0700 Message-Id: <20210823195529.560295-8-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::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.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" Use ctx->w and the enhanced gen_arith function. Reviewed-by: Bin Meng Reviewed-by: Alistair Francis 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 diff --git a/target/riscv/translate.c b/target/riscv/translate.c index 7dd2839288..1855eacbac 100644 --- a/target/riscv/translate.c +++ b/target/riscv/translate.c @@ -507,48 +507,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); }