From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:40317) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TM2XM-0001iu-33 for qemu-devel@nongnu.org; Wed, 10 Oct 2012 16:05:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TM2XB-0005lb-GJ for qemu-devel@nongnu.org; Wed, 10 Oct 2012 16:05:47 -0400 Received: from mail-pa0-f45.google.com ([209.85.220.45]:56693) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TM2XA-0005ef-6M for qemu-devel@nongnu.org; Wed, 10 Oct 2012 16:05:37 -0400 Received: by mail-pa0-f45.google.com with SMTP id fb10so969211pad.4 for ; Wed, 10 Oct 2012 13:05:32 -0700 (PDT) Sender: Richard Henderson Message-ID: <5075D50A.9070001@twiddle.net> Date: Wed, 10 Oct 2012 13:05:30 -0700 From: Richard Henderson MIME-Version: 1.0 References: <1349814458-21739-1-git-send-email-aurelien@aurel32.net> <1349814458-21739-4-git-send-email-aurelien@aurel32.net> In-Reply-To: <1349814458-21739-4-git-send-email-aurelien@aurel32.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 03/14] target-mips: fix FPU exceptions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Aurelien Jarno Cc: qemu-devel@nongnu.org On 10/09/2012 01:27 PM, Aurelien Jarno wrote: > - return float64_sqrt(fdt0, &env->active_fpu.fp_status); > + set_float_exception_flags(0, &env->active_fpu.fp_status); > + fdt0 = float64_sqrt(fdt0, &env->active_fpu.fp_status); > + update_fcr31(env); > + return fdt0; While accurate, I can't help but think there'd be less memory traffic if the invariant "fp_status == 0" is maintained between insns. Thus you don't need to reset the flags to 0 in each insn, merely change static inline void update_fcr31(CPUMIPSState *env) { int tmp = ieee_ex_to_mips(get_float_exception_flags(&env->active_fpu.fp_status)); if (tmp) { set_float_exception_flags(0, &env->active_fpu.fp_status); SET_FP_CAUSE(env->active_fpu.fcr31, tmp); if (GET_FP_ENABLE(env->active_fpu.fcr31) & tmp) { helper_raise_exception(env, EXCP_FPE); } else { UPDATE_FP_FLAGS(env->active_fpu.fcr31, tmp); } } } I'll also note that we don't get the proper PC for the trap there. We don't save the PC in the translator before the insn, or, more properly invoke do_restore_state. That clearly ought to be a separate change, however. r~