From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44608) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPFJB-0007D0-G2 for qemu-devel@nongnu.org; Wed, 03 Sep 2014 14:29:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XPFJ2-0007ZO-Ff for qemu-devel@nongnu.org; Wed, 03 Sep 2014 14:29:29 -0400 Message-ID: <54075DF5.1050206@gmail.com> Date: Wed, 03 Sep 2014 13:29:09 -0500 From: Tom Musta MIME-Version: 1.0 References: <1409246113-6519-1-git-send-email-pbonzini@redhat.com> <1409246113-6519-10-git-send-email-pbonzini@redhat.com> In-Reply-To: <1409246113-6519-10-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 09/17] ppc: reorganize gen_compute_fprf List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , qemu-devel@nongnu.org Cc: dgibson@redhat.com, qemu-ppc@nongnu.org On 8/28/2014 12:15 PM, Paolo Bonzini wrote: > Signed-off-by: Paolo Bonzini > --- > target-ppc/translate.c | 22 ++++++++++------------ > 1 file changed, 10 insertions(+), 12 deletions(-) > > diff --git a/target-ppc/translate.c b/target-ppc/translate.c > index 0a85a23..afbd336 100644 > --- a/target-ppc/translate.c > +++ b/target-ppc/translate.c > @@ -253,21 +253,19 @@ static inline void gen_compute_fprf(TCGv_i64 arg, int set_fprf, int set_rc) > { > TCGv_i32 t0 = tcg_temp_new_i32(); > > - if (set_fprf != 0) { > - /* This case might be optimized later */ > - tcg_gen_movi_i32(t0, 1); > - gen_helper_compute_fprf(t0, cpu_env, arg, t0); > - if (unlikely(set_rc)) { > - tcg_gen_mov_i32(cpu_crf[1], t0); > - } > - gen_helper_float_check_status(cpu_env); > - } else if (unlikely(set_rc)) { > - /* We always need to compute fpcc */ > - tcg_gen_movi_i32(t0, 0); > - gen_helper_compute_fprf(t0, cpu_env, arg, t0); > + if (set_fprf == 0 && !set_rc) { > + return; > + } > + > + tcg_gen_movi_i32(t0, set_fprf != 0); > + gen_helper_compute_fprf(t0, cpu_env, arg, t0); > + if (set_rc) { > tcg_gen_mov_i32(cpu_crf[1], t0); > } > > + if (set_fprf != 0) { > + gen_helper_float_check_status(cpu_env); > + } > tcg_temp_free_i32(t0); > } > > This has a leak: Opcode 3f 07 12 (fc00048e) leaked temporaries I made this modification on top of your patch to fix it: diff --git a/target-ppc/translate.c b/target-ppc/translate.c index 0911c18..ff9b966 100644 --- a/target-ppc/translate.c +++ b/target-ppc/translate.c @@ -251,12 +251,13 @@ static inline void gen_reset_fpstatus(void) static inline void gen_compute_fprf(TCGv_i64 arg, int set_fprf, int set_rc) { - TCGv_i32 t0 = tcg_temp_new_i32(); + TCGv_i32 t0; if (set_fprf == 0 && !set_rc) { return; } + t0 = tcg_temp_new_i32(); tcg_gen_movi_i32(t0, set_fprf != 0); gen_helper_compute_fprf(t0, cpu_env, arg, t0); if (set_rc) {