From nobody Wed Nov 5 13:48:14 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.zoho.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 1497539797264974.7162285513382; Thu, 15 Jun 2017 08:16:37 -0700 (PDT) Received: from localhost ([::1]:54620 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLWVf-0006xL-KK for importer@patchew.org; Thu, 15 Jun 2017 11:16:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36673) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLVdz-00022a-TA for qemu-devel@nongnu.org; Thu, 15 Jun 2017 10:21:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dLVdv-00061Q-Ub for qemu-devel@nongnu.org; Thu, 15 Jun 2017 10:21:07 -0400 Received: from mx2.rt-rk.com ([89.216.37.149]:50787 helo=mail.rt-rk.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dLVdv-0005mk-MC for qemu-devel@nongnu.org; Thu, 15 Jun 2017 10:21:03 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.rt-rk.com (Postfix) with ESMTP id BDE221A4B90; Thu, 15 Jun 2017 16:20:39 +0200 (CEST) Received: from rtrkw223-lin.domain.local (rtrkw223-lin.domain.local [10.10.13.53]) by mail.rt-rk.com (Postfix) with ESMTPSA id A4E5D1A4B8E; Thu, 15 Jun 2017 16:20:39 +0200 (CEST) X-Virus-Scanned: amavisd-new at rt-rk.com From: Miodrag Dinic To: aurelien@aurel32.net, yongbok.kim@imgtec.com, qemu-devel@nongnu.org Date: Thu, 15 Jun 2017 16:20:33 +0200 Message-Id: <1497536433-28009-1-git-send-email-miodrag.dinic@rt-rk.com> X-Mailer: git-send-email 1.9.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 89.216.37.149 X-Mailman-Approved-At: Thu, 15 Jun 2017 11:15:26 -0400 Subject: [Qemu-devel] [PATCH] target/mips: fix msa copy_[s|u]_df rd = 0 corner case X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: miodrag.dinic@imgtec.com, aleksandar.markovic@imgtec.com, petar.jovanovic@imgtec.com, raghu.gandham@imgtec.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Miodrag Dinic This patch fixes the msa copy_[s|u]_df instruction emulation when the destination register rd is zero. Without this patch the zero register would get clobbered, which should never happen because it is supposed to be hardwired to 0. Fix this corner case by explicitly checking rd =3D 0 and effectively making these instructions emulation no-op in that case. Signed-off-by: Miodrag Dinic Acked-by: Aurelien Jarno Reviewed-by: Aurelien Jarno --- target/mips/translate.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/target/mips/translate.c b/target/mips/translate.c index 559f8fe..befb87f 100644 --- a/target/mips/translate.c +++ b/target/mips/translate.c @@ -18712,10 +18712,14 @@ static void gen_msa_elm_df(CPUMIPSState *env, Dis= asContext *ctx, uint32_t df, #endif switch (MASK_MSA_ELM(ctx->opcode)) { case OPC_COPY_S_df: - gen_helper_msa_copy_s_df(cpu_env, tdf, twd, tws, tn); + if (likely(wd !=3D 0)) { + gen_helper_msa_copy_s_df(cpu_env, tdf, twd, tws, tn); + } break; case OPC_COPY_U_df: - gen_helper_msa_copy_u_df(cpu_env, tdf, twd, tws, tn); + if (likely(wd !=3D 0)) { + gen_helper_msa_copy_u_df(cpu_env, tdf, twd, tws, tn); + } break; case OPC_INSERT_df: gen_helper_msa_insert_df(cpu_env, tdf, twd, tws, tn); --=20 1.9.1