From nobody Wed Nov 5 16:38:17 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail header.i=@amazon.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 153565849214679.49181262373588; Thu, 30 Aug 2018 12:48:12 -0700 (PDT) Received: from localhost ([::1]:50596 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvSvL-0002ur-3x for importer@patchew.org; Thu, 30 Aug 2018 15:48:11 -0400 Received: from eggs.gnu.org ([208.118.235.92]:59958) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvSss-00010D-4J for qemu-devel@nongnu.org; Thu, 30 Aug 2018 15:45:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fvSiE-0008T6-EM for qemu-devel@nongnu.org; Thu, 30 Aug 2018 15:34:42 -0400 Received: from smtp-fw-33001.amazon.com ([207.171.190.10]:63982) by eggs.gnu.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.71) (envelope-from ) id 1fvSiE-0008Sm-1q for qemu-devel@nongnu.org; Thu, 30 Aug 2018 15:34:38 -0400 Received: from sea3-co-svc-lb6-vlan2.sea.amazon.com (HELO email-inbound-relay-2b-8cc5d68b.us-west-2.amazon.com) ([10.47.22.34]) by smtp-border-fw-out-33001.sea14.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 30 Aug 2018 19:32:09 +0000 Received: from ua08cfde8192f59f8a244.ant.amazon.com (pdx2-ws-svc-lb17-vlan2.amazon.com [10.247.140.66]) by email-inbound-relay-2b-8cc5d68b.us-west-2.amazon.com (8.14.7/8.14.7) with ESMTP id w7UJUPDw069803 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 30 Aug 2018 19:30:25 GMT Received: from ua08cfde8192f59f8a244.ant.amazon.com (localhost [127.0.0.1]) by ua08cfde8192f59f8a244.ant.amazon.com (8.15.2/8.15.2/Debian-3) with ESMTP id w7UJUOBD020233; Thu, 30 Aug 2018 15:30:24 -0400 Received: (from jancraig@localhost) by ua08cfde8192f59f8a244.ant.amazon.com (8.15.2/8.15.2/Submit) id w7UJUOXs020232; Thu, 30 Aug 2018 15:30:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1535657678; x=1567193678; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=Lj6y3mkKMYoyYQpmlev6RePCoECzk6DZGB0v3+X45Ik=; b=QLCOTEgDjisQ4fbDTen0gunTd5ypLyCq/ZevMJf2dMG5CqSOOEI5Wb+j 88uMLwOeGOKUXTUUNT/sVzayYJpvpIapeVr0zhdPUY+3/+lxeYJhtQQc2 71jsqOxN9H/VJL4s4IAZ1jnJWANV89qPIyT5N4Vx11hKbf9tPEZv+qsUg k=; X-IronPort-AV: E=Sophos;i="5.53,307,1531785600"; d="scan'208";a="751298845" To: qemu-devel@nongnu.org Date: Thu, 30 Aug 2018 15:30:14 -0400 Message-Id: <20180830193019.20104-5-jancraig@amazon.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180830193019.20104-1-jancraig@amazon.com> References: <20180830193019.20104-1-jancraig@amazon.com> Precedence: Bulk X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 207.171.190.10 Subject: [Qemu-devel] [PATCH v4 4/9] target/mips: Add MXU instructions S32I2M and S32M2I X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Craig Janeczek via Qemu-devel Reply-To: Craig Janeczek Cc: aurelien@aurel32.net, amarkovic@wavecomp.com, Craig Janeczek Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This commit makes the MXU registers and the utility functions for reading/writing to them. This is required for full MXU instruction support. Adds support for emulating the S32I2M and S32M2I MXU instructions. Signed-off-by: Craig Janeczek --- v1 - initial patch v2 - Fix checkpatch.pl errors - remove mips64 ifdef - changed bitfield usage to extract32 - squashed register addition patch into this one v3 - Split register addition and opcode enum definition into seperate patc= hes - Split gen_mxu function into command specific gen_mxu_ functions v4 - changed MXU register utility functions to take in unsigned argument - Created seperate utility functions for MXU_CR - Moved ins handling to mxu specific switch statement target/mips/translate.c | 83 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/target/mips/translate.c b/target/mips/translate.c index 53d896ebf9..41081ee066 100644 --- a/target/mips/translate.c +++ b/target/mips/translate.c @@ -1619,6 +1619,34 @@ static inline void gen_store_gpr (TCGv t, int reg) tcg_gen_mov_tl(cpu_gpr[reg], t); } =20 +/* MXU General purpose registers moves. */ +static inline void gen_load_mxu_gpr(TCGv t, unsigned int reg) +{ + if (reg =3D=3D 0) { + tcg_gen_movi_tl(t, 0); + } else if (reg <=3D 15) { + tcg_gen_mov_tl(t, mxu_gpr[reg - 1]); + } +} + +static inline void gen_store_mxu_gpr(TCGv t, unsigned int reg) +{ + if (reg > 0 && reg <=3D 15) { + tcg_gen_mov_tl(mxu_gpr[reg - 1], t); + } +} + +/* MXU control register moves. */ +static inline void gen_load_mxu_cr(TCGv t) +{ + tcg_gen_mov_tl(t, mxu_CR); +} + +static inline void gen_store_mxu_cr(TCGv t) +{ + tcg_gen_mov_tl(mxu_CR, t); +} + /* Moves to/from shadow registers. */ static inline void gen_load_srsgpr (int from, int to) { @@ -3807,6 +3835,51 @@ static void gen_cl (DisasContext *ctx, uint32_t opc, } } =20 +/* MXU Instructions */ + +/* S32I2M XRa, rb - Register move from GRF to XRF */ +static void gen_mxu_s32i2m(DisasContext *ctx, uint32_t opc) +{ + TCGv t0; + uint32_t xra, rb; + + t0 =3D tcg_temp_new(); + + xra =3D extract32(ctx->opcode, 6, 5); + rb =3D extract32(ctx->opcode, 16, 5); + + gen_load_gpr(t0, rb); + if (xra <=3D 15) { + gen_store_mxu_gpr(t0, xra); + } else if (xra =3D=3D 16) { + gen_store_mxu_cr(t0); + } + + tcg_temp_free(t0); +} + +/* S32M2I XRa, rb - Register move from XRF to GRF */ +static void gen_mxu_s32m2i(DisasContext *ctx, uint32_t opc) +{ + TCGv t0; + uint32_t xra, rb; + + t0 =3D tcg_temp_new(); + + xra =3D extract32(ctx->opcode, 6, 5); + rb =3D extract32(ctx->opcode, 16, 5); + + if (xra <=3D 15) { + gen_load_mxu_gpr(t0, xra); + } else if (xra =3D=3D 16) { + gen_load_mxu_cr(t0); + } + + gen_store_gpr(t0, rb); + + tcg_temp_free(t0); +} + /* Godson integer instructions */ static void gen_loongson_integer(DisasContext *ctx, uint32_t opc, int rd, int rs, int rt) @@ -17870,6 +17943,15 @@ static void decode_opc_special2_mxu(CPUMIPSState *= env, DisasContext *ctx) case OPC_MUL: gen_arith(ctx, op1, rd, rs, rt); break; + + case OPC_MXU_S32I2M: + gen_mxu_s32i2m(ctx, op1); + break; + + case OPC_MXU_S32M2I: + gen_mxu_s32m2i(ctx, op1); + break; + default: /* Invalid */ MIPS_INVAL("special2_mxu"); generate_exception_end(ctx, EXCP_RI); @@ -17909,6 +17991,7 @@ static void decode_opc_special2_legacy(CPUMIPSState= *env, DisasContext *ctx) check_insn(ctx, INSN_LOONGSON2F); gen_loongson_integer(ctx, op1, rd, rs, rt); break; + case OPC_CLO: case OPC_CLZ: check_insn(ctx, ISA_MIPS32); --=20 2.18.0