From patchwork Wed Jul 22 09:15:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Chang X-Patchwork-Id: 11677901 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C02D6159A for ; Wed, 22 Jul 2020 09:36:08 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 95E902065F for ; Wed, 22 Jul 2020 09:36:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b="c7H16sQN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 95E902065F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:36646 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jyBAV-0001PF-QT for patchwork-qemu-devel@patchwork.kernel.org; Wed, 22 Jul 2020 05:36:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53920) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jyAuu-00029i-3o for qemu-devel@nongnu.org; Wed, 22 Jul 2020 05:20:00 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]:41165) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jyAus-0005dz-HY for qemu-devel@nongnu.org; Wed, 22 Jul 2020 05:19:59 -0400 Received: by mail-pf1-x431.google.com with SMTP id w126so699129pfw.8 for ; Wed, 22 Jul 2020 02:19:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=CQyiOAp6zSE2OTRbXxeepqY8bKy5Uz4AiqvMqjbMfOM=; b=c7H16sQNWt6UJE0pkVg5XGwDoixWPzVs/7Q7ofvPJGvfG5HVHntrQGeA797hLSLRjz R5oB/gT2/1PgiP2JjxGH0xKwMp6+CDSBSmEUNfZEe55WZrXwr7X1Ndou9sbNUYKEkO6x dRSkeZKeqwNil88QZQRs4ZFzXmS+djtmlQ97IyZjQ8TEgRNYlwecxXGji1T28wx5zQMn 8CBFL0ZzxW/q3OEB0AKUqiYMZ65OYZJDt6swIBGq/QvXrz3WsfLbeSHpQHniThFOgpGC e08+jRDRDY6OK8IuV+zNfsEjBCqeYLzHDpyPTlXwobyL3wY8KUbNEPIEg1+gdDl4w2bp sxSA== 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; bh=CQyiOAp6zSE2OTRbXxeepqY8bKy5Uz4AiqvMqjbMfOM=; b=gSNH/Hf2GmuvDYI6ruftcMbIjadn6NmkCYnEhyjJ1BW++OHOYdRMv2d12eqALncQyR BV44mR8PxBquBGEc1zy4O00XFqGNjpZEs5uTzFOZUM6yXlaSvDYyI9vsnw6DBCmv5t4x H3JD+uv5K3HpGDELkNyHzLJNn5O8jCOq/1HX3EQHq5dncZn2Pic5EGRvOhoq30Kcs/vz Y3VYlWDiSHPei3iYSWt5+HbAIVdYDxLSrsz+lcdCnv78NIahnWm4fdpcHT2f/pSbLDHW nBtV5u8e5KhIje64STYpNjJBadxH6CEEhQNZpV75YD1oIRxTwkRciR7T2tOZE4wCHpRb MRCA== X-Gm-Message-State: AOAM531bq02a4UnAagPEUC7jYX155przzLBp3EyrcZ+Eqv8TpzTbLshD jjHiF2dUOnDuM9Cl2RHwxqg+l5dZr2U= X-Google-Smtp-Source: ABdhPJyO03RQLudeckfTeqc1WvA1AWq0kSaubRbtv/C/kTqGbgpOBlyUaLiiceVuOVbBfpCbvL7N+w== X-Received: by 2002:a65:640c:: with SMTP id a12mr25949125pgv.88.1595409597031; Wed, 22 Jul 2020 02:19:57 -0700 (PDT) Received: from frankchang-ThinkPad-T490.internal.sifive.com (114-34-229-221.HINET-IP.hinet.net. [114.34.229.221]) by smtp.gmail.com with ESMTPSA id c125sm22301879pfa.119.2020.07.22.02.19.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jul 2020 02:19:56 -0700 (PDT) From: frank.chang@sifive.com To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Subject: [RFC v2 32/76] target/riscv: rvv-0.9: mask population count instruction Date: Wed, 22 Jul 2020 17:15:55 +0800 Message-Id: <20200722091641.8834-33-frank.chang@sifive.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200722091641.8834-1-frank.chang@sifive.com> References: <20200722091641.8834-1-frank.chang@sifive.com> Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=frank.chang@sifive.com; helo=mail-pf1-x431.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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, URIBL_BLOCKED=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: Sagar Karandikar , Frank Chang , Bastian Koppelmann , Richard Henderson , Alistair Francis , Palmer Dabbelt , LIU Zhiwei Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Frank Chang Signed-off-by: Frank Chang Reviewed-by: Richard Henderson --- target/riscv/helper.h | 2 +- target/riscv/insn32.decode | 2 +- target/riscv/insn_trans/trans_rvv.inc.c | 7 ++++--- target/riscv/vector_helper.c | 6 +++--- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/target/riscv/helper.h b/target/riscv/helper.h index 8cf5c4c065..e9e1c4e2f5 100644 --- a/target/riscv/helper.h +++ b/target/riscv/helper.h @@ -1048,7 +1048,7 @@ DEF_HELPER_6(vmnor_mm, void, ptr, ptr, ptr, ptr, env, i32) DEF_HELPER_6(vmornot_mm, void, ptr, ptr, ptr, ptr, env, i32) DEF_HELPER_6(vmxnor_mm, void, ptr, ptr, ptr, ptr, env, i32) -DEF_HELPER_4(vmpopc_m, tl, ptr, ptr, env, i32) +DEF_HELPER_4(vpopc_m, tl, ptr, ptr, env, i32) DEF_HELPER_4(vmfirst_m, tl, ptr, ptr, env, i32) diff --git a/target/riscv/insn32.decode b/target/riscv/insn32.decode index 7ad936e605..c9c9f30742 100644 --- a/target/riscv/insn32.decode +++ b/target/riscv/insn32.decode @@ -573,7 +573,7 @@ vmor_mm 011010 - ..... ..... 010 ..... 1010111 @r vmnor_mm 011110 - ..... ..... 010 ..... 1010111 @r vmornot_mm 011100 - ..... ..... 010 ..... 1010111 @r vmxnor_mm 011111 - ..... ..... 010 ..... 1010111 @r -vmpopc_m 010100 . ..... ----- 010 ..... 1010111 @r2_vm +vpopc_m 010000 . ..... 10000 010 ..... 1010111 @r2_vm vmfirst_m 010101 . ..... ----- 010 ..... 1010111 @r2_vm vmsbf_m 010110 . ..... 00001 010 ..... 1010111 @r2_vm vmsif_m 010110 . ..... 00011 010 ..... 1010111 @r2_vm diff --git a/target/riscv/insn_trans/trans_rvv.inc.c b/target/riscv/insn_trans/trans_rvv.inc.c index 89209a5d18..cca06dd1d3 100644 --- a/target/riscv/insn_trans/trans_rvv.inc.c +++ b/target/riscv/insn_trans/trans_rvv.inc.c @@ -2933,8 +2933,8 @@ GEN_MM_TRANS(vmnor_mm) GEN_MM_TRANS(vmornot_mm) GEN_MM_TRANS(vmxnor_mm) -/* Vector mask population count vmpopc */ -static bool trans_vmpopc_m(DisasContext *s, arg_rmr *a) +/* Vector mask population count vpopc */ +static bool trans_vpopc_m(DisasContext *s, arg_rmr *a) { if (require_rvv(s) && vext_check_isa_ill(s)) { @@ -2954,13 +2954,14 @@ static bool trans_vmpopc_m(DisasContext *s, arg_rmr *a) tcg_gen_addi_ptr(src2, cpu_env, vreg_ofs(s, a->rs2)); tcg_gen_addi_ptr(mask, cpu_env, vreg_ofs(s, 0)); - gen_helper_vmpopc_m(dst, mask, src2, cpu_env, desc); + gen_helper_vpopc_m(dst, mask, src2, cpu_env, desc); gen_set_gpr(a->rd, dst); tcg_temp_free_ptr(mask); tcg_temp_free_ptr(src2); tcg_temp_free(dst); tcg_temp_free_i32(desc); + return true; } return false; diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c index 53867a6a2d..d3824304ec 100644 --- a/target/riscv/vector_helper.c +++ b/target/riscv/vector_helper.c @@ -4655,9 +4655,9 @@ GEN_VEXT_MASK_VV(vmnor_mm, DO_NOR) GEN_VEXT_MASK_VV(vmornot_mm, DO_ORNOT) GEN_VEXT_MASK_VV(vmxnor_mm, DO_XNOR) -/* Vector mask population count vmpopc */ -target_ulong HELPER(vmpopc_m)(void *v0, void *vs2, CPURISCVState *env, - uint32_t desc) +/* Vector mask population count vpopc */ +target_ulong HELPER(vpopc_m)(void *v0, void *vs2, CPURISCVState *env, + uint32_t desc) { target_ulong cnt = 0; uint32_t vm = vext_vm(desc);