From nobody Mon Feb 9 22:39:21 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.45 as permitted sender) client-ip=209.85.221.45; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f45.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.45 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1615566283; cv=none; d=zohomail.com; s=zohoarc; b=SC7HB+rbpJkTsD+80dz8Idpa49HC4K/K1SmVr/H6xEyDf7mNIC0T7FZCg2nTMZNiVD/i+I0BJdRQ7kam2nJ8xbV+yhze+HkWmmNCkiYwFM8GpdeTk8if1osUmCUwYEKWuJh18CVKvtm/Dj+2D51HDECeJQlbtGpByXL89uhd7v8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615566283; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=cj7xaGDPrgy2UUgO8dM6PRrVcsRJS/AQHkPM7IdHo58=; b=hr5TjmzEljNmQ73UsjSQD7+GxzqauRPAY46b/CSg9Ud2Jq5fSBEilk+tvpLhi+BW8VA2GgSNKqI82wO0gMxKVho5HEC7XgIKAkYyZmzG243NJ4UojKw8CoXEhYbh8zlS4XDwCJ7SBrO6pdqwD1uWMLNG1UC8M8hkJDLfP9evTvQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.45 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) by mx.zohomail.com with SMTPS id 1615566283953771.8735005098847; Fri, 12 Mar 2021 08:24:43 -0800 (PST) Received: by mail-wr1-f45.google.com with SMTP id t9so2098099wrn.11 for ; Fri, 12 Mar 2021 08:24:43 -0800 (PST) Return-Path: Return-Path: Received: from localhost.localdomain (17.red-88-21-201.staticip.rima-tde.net. [88.21.201.17]) by smtp.gmail.com with ESMTPSA id a5sm8254544wrs.35.2021.03.12.08.24.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Mar 2021 08:24:41 -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=cj7xaGDPrgy2UUgO8dM6PRrVcsRJS/AQHkPM7IdHo58=; b=Oy+8h9Urgsi8flv6zMXCr8t3k4HIqX9EM+KD3MldAL45NjN8bfWVD9CAn3HRPLNS96 FXcjO1+I1xir0DYHbvrXv5y0XBekACXWuWlNmaNyCoNsJ3dGFnV66bh02M67hDBjlNYL Bwxgd4e+dWOTMKgeJArLIVy3SzLPAsSOEm2DX3QwauEpNZN4AmJ61+71KRag/pXw5i6u P8cR+XkeeifaNHu6z7DpLw4fjgC20gQBIOrQ5FhgnHHWS11C6YfspXjF83GAyMQf84ix ETq/SmYKyay6bXIaj4uWQ3KlvOC3XKCXOKLIL+a65aR4SpciMqJPUWOzE9zOk/YH0yXZ ytUA== 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=cj7xaGDPrgy2UUgO8dM6PRrVcsRJS/AQHkPM7IdHo58=; b=lhwbyMMZVnw01N578rc0LqcE9Vcxs6qM8JsZw9Gx2Aui+ju9FJeTYpld6V8GGYCPXw Uhfbg7j4NsbIBWwU+h6SrcR5MwrDDoiX+iwvFGKtCdcoPuijq1jSiNIfV0WdbqWECnFt cz2iNObM9QjoBdHmgT9CtusOEFQTmjm6Gzs1pSIgEYopFn9FD9VT1hVlF241/DFazN9n uMflkm2aGhe8ZZJQuReig4UY1sUdeHzXDiwgNKYth7TbWAUWwSjEnYj/k57ktPjrsXXj SGmQ5oEEx6hJSeGeLV1dVJ0MVKiQxCqHjSiJB83sZHGjHvApQJ7fqZQ4Hak1Eg3QIjbd MFfA== X-Gm-Message-State: AOAM531Oo3qfhIQaEPH6AjcAuwsOiTaFxy0h6ENu2pvFZqZagMid2mdt 8HyuGLrl9zZif8QkmhxHQeE= X-Google-Smtp-Source: ABdhPJwXptNh9KrFE+vicYo0lLqav6YOgn1veqRUNAkRTGtFTzaEzhcgj9xnuyOsnzUcpOfWXwxENg== X-Received: by 2002:adf:e68e:: with SMTP id r14mr14602282wrm.273.1615566282091; Fri, 12 Mar 2021 08:24:42 -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: Jiaxun Yang , "Maciej W . Rozycki" , Aleksandar Rikalo , Aurelien Jarno , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Fredrik Noring , Richard Henderson Subject: [PATCH v3 1/5] target/mips/tx79: Introduce LQ opcode (Load Quadword) Date: Fri, 12 Mar 2021 17:24:30 +0100 Message-Id: <20210312162434.1869129-2-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210312162434.1869129-1-f4bug@amsat.org> References: <20210312162434.1869129-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) Introduce the LQ opcode (Load Quadword) and remove unreachable code. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-Id: <20210214175912.732946-26-f4bug@amsat.org> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- target/mips/tx79.decode | 8 ++++++++ target/mips/translate.c | 16 ++-------------- target/mips/tx79_translate.c | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 14 deletions(-) diff --git a/target/mips/tx79.decode b/target/mips/tx79.decode index 0f748b53a64..f1f17470a00 100644 --- a/target/mips/tx79.decode +++ b/target/mips/tx79.decode @@ -13,6 +13,8 @@ =20 &rtype rs rt rd sa =20 +&itype base rt offset + ########################################################################### # Named instruction formats. These are generally used to # reduce the amount of duplication between instruction patterns. @@ -22,6 +24,8 @@ @rs ...... rs:5 ..... .......... ...... &rtype rt=3D0 rd= =3D0 sa=3D0 @rd ...... .......... rd:5 ..... ...... &rtype rs=3D0 rt= =3D0 sa=3D0 =20 +@ldst ...... base:5 rt:5 offset:16 &itype + ########################################################################### =20 MFHI1 011100 0000000000 ..... 00000 010000 @rd @@ -37,3 +41,7 @@ PCPYLD 011100 ..... ..... ..... 01110 001001 @= rs_rt_rd =20 PCPYUD 011100 ..... ..... ..... 01110 101001 @rs_rt_rd PCPYH 011100 00000 ..... ..... 11011 101001 @rt_rd + +# SPECIAL + +LQ 011110 ..... ..... ................ @ldst diff --git a/target/mips/translate.c b/target/mips/translate.c index c518bf3963b..c822083f031 100644 --- a/target/mips/translate.c +++ b/target/mips/translate.c @@ -1167,7 +1167,6 @@ enum { =20 enum { MMI_OPC_CLASS_MMI =3D 0x1C << 26, /* Same as OPC_SPECIAL2 */ - MMI_OPC_LQ =3D 0x1E << 26, /* Same as OPC_MSA */ MMI_OPC_SQ =3D 0x1F << 26, /* Same as OPC_SPECIAL3 */ }; =20 @@ -24429,11 +24428,6 @@ static void decode_mmi(CPUMIPSState *env, DisasCon= text *ctx) } } =20 -static void gen_mmi_lq(CPUMIPSState *env, DisasContext *ctx) -{ - gen_reserved_instruction(ctx); /* TODO: MMI_OPC_LQ */ -} - static void gen_mmi_sq(DisasContext *ctx, int base, int rt, int offset) { gen_reserved_instruction(ctx); /* TODO: MMI_OPC_SQ */ @@ -25332,14 +25326,8 @@ static bool decode_opc_legacy(CPUMIPSState *env, D= isasContext *ctx) gen_compute_branch(ctx, op, 4, rs, rt, offset, 4); } break; - case OPC_MDMX: /* MMI_OPC_LQ */ - if (ctx->insn_flags & INSN_R5900) { -#if defined(TARGET_MIPS64) - gen_mmi_lq(env, ctx); -#endif - } else { - /* MDMX: Not implemented. */ - } + case OPC_MDMX: + /* MDMX: Not implemented. */ break; case OPC_PCREL: check_insn(ctx, ISA_MIPS_R6); diff --git a/target/mips/tx79_translate.c b/target/mips/tx79_translate.c index ad83774b977..b5a9eb3de76 100644 --- a/target/mips/tx79_translate.c +++ b/target/mips/tx79_translate.c @@ -177,6 +177,41 @@ static bool trans_MTLO1(DisasContext *ctx, arg_rtype *= a) * SQ rt, offset(base) Store Quadword */ =20 +static bool trans_LQ(DisasContext *ctx, arg_itype *a) +{ + TCGv_i64 t0; + TCGv addr; + + if (a->rt =3D=3D 0) { + /* nop */ + return true; + } + + t0 =3D tcg_temp_new_i64(); + addr =3D tcg_temp_new(); + + gen_base_offset_addr(ctx, addr, a->base, a->offset); + /* + * Clear least-significant four bits of the effective + * address, effectively creating an aligned address. + */ + tcg_gen_andi_tl(addr, addr, ~0xf); + + /* Lower half */ + tcg_gen_qemu_ld_i64(t0, addr, ctx->mem_idx, MO_TEQ); + gen_store_gpr(t0, a->rt); + + /* Upper half */ + tcg_gen_addi_i64(addr, addr, 8); + tcg_gen_qemu_ld_i64(t0, addr, ctx->mem_idx, MO_TEQ); + gen_store_gpr_hi(t0, a->rt); + + tcg_temp_free(t0); + tcg_temp_free(addr); + + return true; +} + /* * Multiply and Divide (19 instructions) * ------------------------------------- --=20 2.26.2