From patchwork Tue Jun 20 09:37:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Song Gao X-Patchwork-Id: 1797101 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QlhTz2QzCz20XS for ; Tue, 20 Jun 2023 19:41:27 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBXoo-00074a-VZ; Tue, 20 Jun 2023 05:38:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBXoi-00072F-Qp for qemu-devel@nongnu.org; Tue, 20 Jun 2023 05:38:31 -0400 Received: from mail.loongson.cn ([114.242.206.163]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBXoe-0006HG-J4 for qemu-devel@nongnu.org; Tue, 20 Jun 2023 05:38:28 -0400 Received: from loongson.cn (unknown [10.2.5.185]) by gateway (Coremail) with SMTP id _____8DxCeqKc5FkjiUHAA--.14722S3; Tue, 20 Jun 2023 17:38:18 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.185]) by localhost.localdomain (Coremail) with SMTP id AQAAf8BxduSGc5FkzIQhAA--.28394S9; Tue, 20 Jun 2023 17:38:18 +0800 (CST) From: Song Gao To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org Subject: [PATCH v1 07/46] target/loongarch: Implement xvneg Date: Tue, 20 Jun 2023 17:37:35 +0800 Message-Id: <20230620093814.123650-8-gaosong@loongson.cn> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230620093814.123650-1-gaosong@loongson.cn> References: <20230620093814.123650-1-gaosong@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAf8BxduSGc5FkzIQhAA--.28394S9 X-CM-SenderInfo: 5jdr20tqj6z05rqj20fqof0/ X-Coremail-Antispam: 1Uk129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7 ZEXasCq-sGcSsGvfJ3UbIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVrnUUvcSsGvfC2Kfnx nUUI43ZEXa7xR_UUUUUUUUU== Received-SPF: pass client-ip=114.242.206.163; envelope-from=gaosong@loongson.cn; helo=mail.loongson.cn X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This patch includes: - XVNEG.{B/H/W/D}. Signed-off-by: Song Gao --- target/loongarch/disas.c | 10 ++++++++++ target/loongarch/insn_trans/trans_lasx.c.inc | 20 ++++++++++++++++++++ target/loongarch/insns.decode | 7 +++++++ 3 files changed, 37 insertions(+) diff --git a/target/loongarch/disas.c b/target/loongarch/disas.c index 7b84766fa8..eefd16e3f1 100644 --- a/target/loongarch/disas.c +++ b/target/loongarch/disas.c @@ -1713,6 +1713,11 @@ static void output_xx_i(DisasContext *ctx, arg_xx_i *a, const char *mnemonic) output(ctx, mnemonic, "x%d, x%d, 0x%x", a->xd, a->xj, a->imm); } +static void output_xx(DisasContext *ctx, arg_xx *a, const char *mnemonic) +{ + output(ctx, mnemonic, "x%d, x%d", a->xd, a->xj); +} + static void output_xr(DisasContext *ctx, arg_xr *a, const char *mnemonic) { output(ctx, mnemonic, "x%d, r%d", a->xd, a->rj); @@ -1738,6 +1743,11 @@ INSN_LASX(xvsubi_hu, xx_i) INSN_LASX(xvsubi_wu, xx_i) INSN_LASX(xvsubi_du, xx_i) +INSN_LASX(xvneg_b, xx) +INSN_LASX(xvneg_h, xx) +INSN_LASX(xvneg_w, xx) +INSN_LASX(xvneg_d, xx) + INSN_LASX(xvreplgr2vr_b, xr) INSN_LASX(xvreplgr2vr_h, xr) INSN_LASX(xvreplgr2vr_w, xr) diff --git a/target/loongarch/insn_trans/trans_lasx.c.inc b/target/loongarch/insn_trans/trans_lasx.c.inc index a42e92f930..cea944c3ba 100644 --- a/target/loongarch/insn_trans/trans_lasx.c.inc +++ b/target/loongarch/insn_trans/trans_lasx.c.inc @@ -59,6 +59,21 @@ static bool gvec_xsubi(DisasContext *ctx, arg_xx_i *a, MemOp mop) return true; } +static bool gvec_xx(DisasContext *ctx, arg_xx *a, MemOp mop, + void (*func)(unsigned, uint32_t, uint32_t, + uint32_t, uint32_t)) +{ + uint32_t xd_ofs, xj_ofs; + + CHECK_ASXE; + + xd_ofs = vec_full_offset(a->xd); + xj_ofs = vec_full_offset(a->xj); + + func(mop, xd_ofs, xj_ofs, 32, ctx->vl / 8); + return true; +} + TRANS(xvadd_b, gvec_xxx, MO_8, tcg_gen_gvec_add) TRANS(xvadd_h, gvec_xxx, MO_16, tcg_gen_gvec_add) TRANS(xvadd_w, gvec_xxx, MO_32, tcg_gen_gvec_add) @@ -111,6 +126,11 @@ TRANS(xvsubi_hu, gvec_xsubi, MO_16) TRANS(xvsubi_wu, gvec_xsubi, MO_32) TRANS(xvsubi_du, gvec_xsubi, MO_64) +TRANS(xvneg_b, gvec_xx, MO_8, tcg_gen_gvec_neg) +TRANS(xvneg_h, gvec_xx, MO_16, tcg_gen_gvec_neg) +TRANS(xvneg_w, gvec_xx, MO_32, tcg_gen_gvec_neg) +TRANS(xvneg_d, gvec_xx, MO_64, tcg_gen_gvec_neg) + static bool gvec_dupx(DisasContext *ctx, arg_xr *a, MemOp mop) { TCGv src = gpr_src(ctx, a->rj, EXT_NONE); diff --git a/target/loongarch/insns.decode b/target/loongarch/insns.decode index 0bed748216..78452c622c 100644 --- a/target/loongarch/insns.decode +++ b/target/loongarch/insns.decode @@ -1301,6 +1301,7 @@ vstelm_b 0011 000110 .... ........ ..... ..... @vr_i8i4 # LASX Argument sets # +&xx xd xj &xxx xd xj xk &xr xd rj &xx_i xd xj imm @@ -1309,6 +1310,7 @@ vstelm_b 0011 000110 .... ........ ..... ..... @vr_i8i4 # LASX Formats # +@xx .... ........ ..... ..... xj:5 xd:5 &xx @xxx .... ........ ..... xk:5 xj:5 xd:5 &xxx @xr .... ........ ..... ..... rj:5 xd:5 &xr @xx_ui5 .... ........ ..... imm:5 xj:5 xd:5 &xx_i @@ -1333,6 +1335,11 @@ xvsubi_hu 0111 01101000 11001 ..... ..... ..... @xx_ui5 xvsubi_wu 0111 01101000 11010 ..... ..... ..... @xx_ui5 xvsubi_du 0111 01101000 11011 ..... ..... ..... @xx_ui5 +xvneg_b 0111 01101001 11000 01100 ..... ..... @xx +xvneg_h 0111 01101001 11000 01101 ..... ..... @xx +xvneg_w 0111 01101001 11000 01110 ..... ..... @xx +xvneg_d 0111 01101001 11000 01111 ..... ..... @xx + xvreplgr2vr_b 0111 01101001 11110 00000 ..... ..... @xr xvreplgr2vr_h 0111 01101001 11110 00001 ..... ..... @xr xvreplgr2vr_w 0111 01101001 11110 00010 ..... ..... @xr