From patchwork Thu Jan 20 16:52:58 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 79728 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id EED3CB70CC for ; Fri, 21 Jan 2011 03:56:55 +1100 (EST) Received: from localhost ([127.0.0.1]:37651 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pfxoa-0004mm-8Z for incoming@patchwork.ozlabs.org; Thu, 20 Jan 2011 11:56:52 -0500 Received: from [140.186.70.92] (port=49162 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pfxln-0002F5-36 for qemu-devel@nongnu.org; Thu, 20 Jan 2011 11:54:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PfxlG-0006pU-4c for qemu-devel@nongnu.org; Thu, 20 Jan 2011 11:53:58 -0500 Received: from eu1sys200aog112.obsmtp.com ([207.126.144.133]:38462) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PfxlF-0006mk-RV for qemu-devel@nongnu.org; Thu, 20 Jan 2011 11:53:26 -0500 Received: from source ([167.4.1.35]) (using TLSv1) by eu1sys200aob112.postini.com ([207.126.147.11]) with SMTP ID DSNKTThogjnHC01khOz3Ae+TF59uYfCXmjmq@postini.com; Thu, 20 Jan 2011 16:53:25 UTC Received: from zeta.dmz-us.st.com (ns4.st.com [167.4.16.71]) by beta.dmz-us.st.com (STMicroelectronics) with ESMTP id E578EF5; Thu, 20 Jan 2011 16:53:20 +0000 (GMT) Received: from Webmail-eu.st.com (safex1hubcas5.st.com [10.75.90.71]) by zeta.dmz-us.st.com (STMicroelectronics) with ESMTP id 5F1A01B1; Thu, 20 Jan 2011 16:53:20 +0000 (GMT) Received: from [164.129.122.40] (164.129.122.40) by webmail-eu.st.com (10.75.90.13) with Microsoft SMTP Server (TLS) id 8.2.234.1; Thu, 20 Jan 2011 17:52:58 +0100 Message-ID: <4D38686A.5070207@st.com> Date: Thu, 20 Jan 2011 17:52:58 +0100 From: Christophe Lyon User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.9.2.13) Gecko/20101207 Lightning/1.0b2 Thunderbird/3.1.7 MIME-Version: 1.0 To: Peter Maydell Subject: Re: [Qemu-devel] [PATCH] target-arm: Fix garbage collection of temporaries in Neon emulation. References: <4D35A4FB.3030403@st.com> <4D35C6BE.5060502@st.com> <4D36F746.30307@st.com> In-Reply-To: X-Enigmail-Version: 1.1.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Cc: "qemu-devel@nongnu.org" X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org > I would personally prefer slightly less terse commit messages > (for instance it might be nice to list the affected instructions in > this case). The convention is also to preface the summary line > with the file or directory affected, ie "target-arm: Fix garbage > collection of temporaries in Neon emulation". > OK, so here is the same patch with an updated description: target-arm: Fix garbage collection of temporaries in Neon emulation of MULL and friends (VMLAL, VQDMLAL, VMLSL, VQDMLSL, VMULL, VQDMULL) as well as (VSHRN, VRSHRN, VQSHRN, VQRSHRN). Signed-off-by: Christophe Lyon --- target-arm/translate.c | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 deletions(-) diff --git a/target-arm/translate.c b/target-arm/translate.c index 57664bc..b3e3d70 100644 --- a/target-arm/translate.c +++ b/target-arm/translate.c @@ -4176,6 +4176,13 @@ static inline void gen_neon_mull(TCGv_i64 dest, TCGv a, TCGv b, int size, int u) break; default: abort(); } + + /* gen_helper_neon_mull_[su]{8|16} do not free their parameters. + Don't forget to clean them now. */ + if (size < 2) { + dead_tmp(a); + dead_tmp(b); + } } /* Translate a NEON data processing instruction. Return nonzero if the @@ -4840,7 +4847,7 @@ static int disas_neon_data_insn(CPUState * env, DisasContext *s, uint32_t insn) if (size == 3) { tcg_temp_free_i64(tmp64); } else { - dead_tmp(tmp2); + tcg_temp_free_i32(tmp2); } } else if (op == 10) { /* VSHLL */ @@ -5076,8 +5083,6 @@ static int disas_neon_data_insn(CPUState * env, DisasContext *s, uint32_t insn) case 8: case 9: case 10: case 11: case 12: case 13: /* VMLAL, VQDMLAL, VMLSL, VQDMLSL, VMULL, VQDMULL */ gen_neon_mull(cpu_V0, tmp, tmp2, size, u); - dead_tmp(tmp2); - dead_tmp(tmp); break; case 14: /* Polynomial VMULL */ cpu_abort(env, "Polynomial VMULL not implemented"); @@ -5228,6 +5233,10 @@ static int disas_neon_data_insn(CPUState * env, DisasContext *s, uint32_t insn) return 1; tmp2 = neon_get_scalar(size, rm); + /* We need a copy of tmp2 because gen_neon_mull + * deletes it during pass 0. */ + tmp4 = new_tmp(); + tcg_gen_mov_i32(tmp4, tmp2); tmp3 = neon_load_reg(rn, 1); for (pass = 0; pass < 2; pass++) { @@ -5235,9 +5244,9 @@ static int disas_neon_data_insn(CPUState * env, DisasContext *s, uint32_t insn) tmp = neon_load_reg(rn, 0); } else { tmp = tmp3; + tmp2 = tmp4; } gen_neon_mull(cpu_V0, tmp, tmp2, size, u); - dead_tmp(tmp); if (op == 6 || op == 7) { gen_neon_negl(cpu_V0, size); } @@ -5264,7 +5273,6 @@ static int disas_neon_data_insn(CPUState * env, DisasContext *s, uint32_t insn) neon_store_reg64(cpu_V0, rd + pass); } - dead_tmp(tmp2); break; default: /* 14 and 15 are RESERVED */