Received: from [140.186.70.92] (port=47612 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PcXeC-0001Sl-Fr for qemu-devel@nongnu.org; Tue, 11 Jan 2011 01:24:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PcXeA-0000SF-RG for qemu-devel@nongnu.org; Tue, 11 Jan 2011 01:24:00 -0500 Received: from hall.aurel32.net ([88.191.126.93]:35613) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PcXeA-0000SB-LV for qemu-devel@nongnu.org; Tue, 11 Jan 2011 01:23:58 -0500 Date: Tue, 11 Jan 2011 07:23:57 +0100 From: Aurelien Jarno Subject: Re: [Qemu-devel] [PATCH 3/3] target-ppc: fix sNaN propagation Message-ID: <20110111062357.GW17026@hall.aurel32.net> References: <1293979183-27108-1-git-send-email-aurelien@aurel32.net> <1293979183-27108-4-git-send-email-aurelien@aurel32.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: Aurelien Jarno List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: qemu-devel@nongnu.org, Alexander Graf On Mon, Jan 10, 2011 at 06:14:18PM -0600, Peter Maydell wrote: > On 2 January 2011 08:39, Aurelien Jarno wrote: > > The current FPU code returns 0.0 if one of the operand is a > > signaling NaN and the VXSNAN exception is disabled. > > > > fload_invalid_op_excp() doesn't return a qNaN in case of a VXSNAN > > exception as the operand should be propagated instead of a new > > qNaN to be generated. Fix that by calling fload_invalid_op_excp() > > only for the exception generation (if enabled), and use the softfloat > > code to correctly compute the result. > > > > Cc: Alexander Graf > > Signed-off-by: Aurelien Jarno > > > @@ -1410,10 +1418,10 @@ uint64_t helper_frsp (uint64_t arg) > >     if (unlikely(float64_is_signaling_nan(farg.d))) { > >         /* sNaN square root */ > >        farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN); > > -    } else { > > -       f32 = float64_to_float32(farg.d, &env->fp_status); > > -       farg.d = float32_to_float64(f32, &env->fp_status); > >     } > > +    f32 = float64_to_float32(farg.d, &env->fp_status); > > +    farg.d = float32_to_float64(f32, &env->fp_status); > > + > >     return farg.ll; > >  } > > Most of these changes are to ignoring the result from > fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN), > but this one leaves it assigning a value to farg.ll -- is there > any reason for that? (It looks like the assignment gets > immediately overwritten by the assignment to farg.d later.) It is actually a mistake, though the result is correct. I'll resend the patch after fixing that, thanks for the review. > > @@ -1460,11 +1468,11 @@ uint64_t helper_fres (uint64_t arg) > >     if (unlikely(float64_is_signaling_nan(farg.d))) { > >         /* sNaN reciprocal */ > >         farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN); > > -    } else { > > -        farg.d = float64_div(float64_one, farg.d, &env->fp_status); > > -        f32 = float64_to_float32(farg.d, &env->fp_status); > > -        farg.d = float32_to_float64(f32, &env->fp_status); > >     } > > +    farg.d = float64_div(float64_one, farg.d, &env->fp_status); > > +    f32 = float64_to_float32(farg.d, &env->fp_status); > > +    farg.d = float32_to_float64(f32, &env->fp_status); > > + > >     return farg.ll; > >  } > > > > Ditto for this hunk. > > Looks plausible to me other than that. > Same here. -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@aurel32.net http://www.aurel32.net