From nobody Tue Feb 10 01:31:13 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.218.48 as permitted sender) client-ip=209.85.218.48; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-ej1-f48.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.218.48 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1607459844; cv=none; d=zohomail.com; s=zohoarc; b=WsEhM9OV61GSNsfSTRC7fmDX9+vj7EIdyShQtCV2o0q+Cf3R2VkcSZJZJ1zDYg6eE/kHPwqVqepU1aZkLV9HYk4+FrcFu12UJNN31b3yWl/nKDcS+2AGnj7qM6Bk9k7BxxNGVAx4ATV8j1Qptbokhw12nIzw13Ptwx6QyPUGUYI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607459844; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=egytU2KQefn/Es9E3Yg/Fw4QqJAhSkiglactlGUyVCU=; b=ns+J0IOgnkA5yt6TW3cDcJEB2Dw6a9dvqiBKYWOXAbTRAYTrzh6aSjxrIN8Nymee1hCtIIf+dSHsONAaRUJXJJljucskMD+p7utwBX/EdYdpfXhIdu4zCX/K6mpfURMVLq7I6NdXBJBWPeXCN778VTUn6GbFW+TuL4UbDdiVWr4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.218.48 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) by mx.zohomail.com with SMTPS id 1607459844668111.45138806843272; Tue, 8 Dec 2020 12:37:24 -0800 (PST) Received: by mail-ej1-f48.google.com with SMTP id jx16so26509185ejb.10 for ; Tue, 08 Dec 2020 12:37:24 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (101.red-88-21-206.staticip.rima-tde.net. [88.21.206.101]) by smtp.gmail.com with ESMTPSA id o11sm16729199ejh.55.2020.12.08.12.37.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Dec 2020 12:37:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=egytU2KQefn/Es9E3Yg/Fw4QqJAhSkiglactlGUyVCU=; b=Em4kDzEydRSpWB0wkn/pAjsy2bc0IBWLImt3h9jogbBxzBmm8fIP/aEOM64pg45IrR MAAKDjjYfFc6dNEKimwUNTwuaqVAcygzH8lBqKMZMMSrLLGvVpyECNvRJydKFRbzNAF5 aEDRqcWlXRTW1PrukmpqS4PPLDH9U2KK35CwoiF1qUZ2GddIinjsGoRHlcUP2KSSuxGK 2SEjO72u0rsk56f3TnOMJo2RZUs3N3noGr0JdxjE09YBoyOfPsz6Cb44Orbnw294g4M+ +1xBfxI5BuO+gUE16fIvzUwAjc1flrqvneJ8vMhqdIRGL/iJEC1kUuwXwL1ZXTuRnr9D GTew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=egytU2KQefn/Es9E3Yg/Fw4QqJAhSkiglactlGUyVCU=; b=ToZ4iaYABcuEy3MkuAXrgn9kIsIxVimi8CtcLOzLAYg9VZ+q0ODVZoP/s4o9wn6dAZ FopJEZZw9cj/tIKo18I4KQJ01Je1svur8kKmT8Q56+iZ3AyQRqJHaPteU89qgD/Ebeo8 KGVwY6EM8R+mtQpIeo+tbtXPd+s2AoTf2V/3gPoIOKgGlLdce9X6nJsmNCSK5qDSByEV sspuQ6i87whppu942Riu7YLtnUq6y4q2bXbfWQYDPxZ3oFvyAfVsRfjD20d6nMgvtkWR lnFn5JAUpvCBZzXSGV/G+5p0raGcr4qMBfVD1XLgcYnvf9gOErazAraRcj4lQoMcOckD T0Pg== X-Gm-Message-State: AOAM53315lhLWMAFBdSoZloNQHHtRlj7loql8yfSc4cP8WUj4AXNpfSu mpp96FosE+miFWqXFFLPckt9LLERLOs= X-Google-Smtp-Source: ABdhPJw8goCIEoICDSfUVecsS7ZFt20DYxjX+sKYEKAAubi/XgQE8ru6zltSk8fFiIchfYRUL9S61g== X-Received: by 2002:a17:906:26c6:: with SMTP id u6mr24291050ejc.349.1607459842774; Tue, 08 Dec 2020 12:37:22 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Aurelien Jarno , Aleksandar Rikalo , Jiaxun Yang , Richard Henderson Subject: [PATCH 03/13] target/mips: Introduce decodetree helpers for MSA LSA/DLSA opcodes Date: Tue, 8 Dec 2020 21:36:54 +0100 Message-Id: <20201208203704.243704-4-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201208203704.243704-1-f4bug@amsat.org> References: <20201208203704.243704-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) Add the LSA opcode to the MSA32 decodetree config, add DLSA to a new config for the MSA64 ASE, and call decode_msa64() in the main decode_opc() loop. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- target/mips/translate.h | 3 +++ target/mips/mod-msa32.decode | 4 ++++ target/mips/mod-msa64.decode | 17 +++++++++++++++++ target/mips/mod-msa_translate.c | 15 +++++++++++++++ target/mips/translate.c | 5 +++++ target/mips/meson.build | 5 +++++ 6 files changed, 49 insertions(+) create mode 100644 target/mips/mod-msa64.decode diff --git a/target/mips/translate.h b/target/mips/translate.h index 4eb218e2c9f..00601232b97 100644 --- a/target/mips/translate.h +++ b/target/mips/translate.h @@ -97,5 +97,8 @@ void msa_translate_init(void); =20 /* decodetree generated */ bool decode_msa32(DisasContext *ctx, uint32_t insn); +#if defined(TARGET_MIPS64) +bool decode_msa64(DisasContext *ctx, uint32_t insn); +#endif =20 #endif diff --git a/target/mips/mod-msa32.decode b/target/mips/mod-msa32.decode index d69675132b8..0b2f0863251 100644 --- a/target/mips/mod-msa32.decode +++ b/target/mips/mod-msa32.decode @@ -10,11 +10,15 @@ # (Document Number: MD00866-2B-MSA32-AFP-01.12) # =20 +&lsa rd rt rs sa &msa_bz df wt s16 =20 +@lsa ...... rs:5 rt:5 rd:5 ... sa:2 ...... &lsa @bz ...... ... .. wt:5 s16:16 &msa_bz df=3D3 @bz_df ...... ... df:2 wt:5 s16:16 &msa_bz =20 +LSA 000000 ..... ..... ..... 000 .. 000101 @lsa + BZ_V 010001 01011 ..... ................ @bz BNZ_V 010001 01111 ..... ................ @bz =20 diff --git a/target/mips/mod-msa64.decode b/target/mips/mod-msa64.decode new file mode 100644 index 00000000000..8dcbbcd8538 --- /dev/null +++ b/target/mips/mod-msa64.decode @@ -0,0 +1,17 @@ +# MIPS SIMD Architecture Module instruction set +# +# Copyright (C) 2020 Philippe Mathieu-Daud=C3=A9 +# +# SPDX-License-Identifier: LGPL-2.1-or-later +# +# Reference: +# MIPS Architecture for Programmers Volume IV-j +# The MIPS64 SIMD Architecture Module, Revision 1.12 +# (Document Number: MD00868-1D-MSA64-AFP-01.12) +# + +&lsa rd rt rs sa !extern + +@lsa ...... rs:5 rt:5 rd:5 ... sa:2 ...... &lsa + +DLSA 000000 ..... ..... ..... 000 .. 010101 @lsa diff --git a/target/mips/mod-msa_translate.c b/target/mips/mod-msa_translat= e.c index 7e7fc0644ff..7af0c2fd657 100644 --- a/target/mips/mod-msa_translate.c +++ b/target/mips/mod-msa_translate.c @@ -20,6 +20,9 @@ =20 /* Include the auto-generated decoder. */ #include "decode-mod-msa32.c.inc" +#if defined(TARGET_MIPS64) +#include "decode-mod-msa64.c.inc" +#endif /* TARGET_MIPS64 */ =20 #define OPC_MSA (0x1E << 26) =20 @@ -2268,3 +2271,15 @@ static bool trans_MSA(DisasContext *ctx, arg_MSA *a) =20 return true; } + +static bool trans_LSA(DisasContext *ctx, arg_LSA *a) +{ + return gen_LSA(ctx, a->rd, a->rt, a->rs, a->sa); +} + +#if defined(TARGET_MIPS64) +static bool trans_DLSA(DisasContext *ctx, arg_LSA *a) +{ + return gen_DLSA(ctx, a->rd, a->rt, a->rs, a->sa); +} +#endif /* TARGET_MIPS64 */ diff --git a/target/mips/translate.c b/target/mips/translate.c index 752a06afa21..b3c45d6211a 100644 --- a/target/mips/translate.c +++ b/target/mips/translate.c @@ -28311,6 +28311,11 @@ static void decode_opc(CPUMIPSState *env, DisasCon= text *ctx) /* Transition to the auto-generated decoder. */ =20 /* ISA Extensions */ +#if defined(TARGET_MIPS64) + if (ase_msa_available(env) && decode_msa64(ctx, ctx->opcode)) { + return; + } +#endif /* TARGET_MIPS64 */ if (ase_msa_available(env) && decode_msa32(ctx, ctx->opcode)) { return; } diff --git a/target/mips/meson.build b/target/mips/meson.build index 9e42c341a90..124b5f7d49d 100644 --- a/target/mips/meson.build +++ b/target/mips/meson.build @@ -1,6 +1,9 @@ gen =3D [ decodetree.process('mod-msa32.decode', extra_args: [ '--decode=3Ddecode_= msa32' ]), ] +gen64 =3D [ + decodetree.process('mod-msa64.decode', extra_args: [ '--decode=3Ddecode_= msa64' ]), +] =20 mips_ss =3D ss.source_set() mips_ss.add(gen) @@ -18,6 +21,8 @@ 'translate_addr_const.c', 'mod-msa_translate.c', )) +mips_ss.add(when: 'TARGET_MIPS64', if_true: gen64) + mips_ss.add(when: 'CONFIG_KVM', if_true: files('kvm.c')) =20 mips_softmmu_ss =3D ss.source_set() --=20 2.26.2