From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37711) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4ucC-0003ME-AF for qemu-devel@nongnu.org; Wed, 09 Jul 2014 12:21:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X4uc6-0005JQ-Vq for qemu-devel@nongnu.org; Wed, 09 Jul 2014 12:21:04 -0400 Received: from mail-pd0-x229.google.com ([2607:f8b0:400e:c02::229]:56474) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4uc6-0005JF-Pt for qemu-devel@nongnu.org; Wed, 09 Jul 2014 12:20:58 -0400 Received: by mail-pd0-f169.google.com with SMTP id ft15so2461628pdb.14 for ; Wed, 09 Jul 2014 09:20:58 -0700 (PDT) Sender: Richard Henderson From: Richard Henderson Date: Wed, 9 Jul 2014 09:20:28 -0700 Message-Id: <1404922834-28169-13-git-send-email-rth@twiddle.net> In-Reply-To: <1404922834-28169-1-git-send-email-rth@twiddle.net> References: <1404922834-28169-1-git-send-email-rth@twiddle.net> Subject: [Qemu-devel] [PULL 12/18] target-alpha: Ignore the unused fp_status exceptions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, viro@ZenIV.linux.org.uk Mask out the exceptions that have no correspondance on Alpha so that zero/non-zero tests work as expected. Reported-by: Al Viro Signed-off-by: Richard Henderson --- target-alpha/fpu_helper.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/target-alpha/fpu_helper.c b/target-alpha/fpu_helper.c index 9b297de..f7fe31e 100644 --- a/target-alpha/fpu_helper.c +++ b/target-alpha/fpu_helper.c @@ -68,12 +68,17 @@ static inline void fp_exc_raise1(CPUAlphaState *env, uintptr_t retaddr, arith_excp(env, retaddr, hw_exc, 1ull << regno); } +/* There are several flags that softfloat raises that are irrelevant. */ +#define EXC_MASK (float_flag_invalid | float_flag_int_overflow \ + | float_flag_divbyzero | float_flag_overflow \ + | float_flag_underflow | float_flag_inexact) + /* Raise exceptions for ieee fp insns without software completion. In that case there are no exceptions that don't trap; the mask doesn't apply. */ void helper_fp_exc_raise(CPUAlphaState *env, uint32_t ignore, uint32_t regno) { - uint32_t exc = (uint8_t)env->fp_status.float_exception_flags; + uint32_t exc = env->fp_status.float_exception_flags & EXC_MASK; if (exc) { env->fpcr_exc_status |= exc; exc &= ~ignore; @@ -86,7 +91,7 @@ void helper_fp_exc_raise(CPUAlphaState *env, uint32_t ignore, uint32_t regno) /* Raise exceptions for ieee fp insns with software completion. */ void helper_fp_exc_raise_s(CPUAlphaState *env, uint32_t ignore, uint32_t regno) { - uint32_t exc = (uint8_t)env->fp_status.float_exception_flags; + uint32_t exc = env->fp_status.float_exception_flags & EXC_MASK; if (exc) { env->fpcr_exc_status |= exc; exc &= ~ignore; -- 1.9.3