From patchwork Mon Apr 18 21:00:05 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 91847 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 959DB1007D9 for ; Tue, 19 Apr 2011 07:01:03 +1000 (EST) Received: from localhost ([::1]:39797 helo=lists2.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QBvZ7-0007Zp-1L for incoming@patchwork.ozlabs.org; Mon, 18 Apr 2011 17:01:01 -0400 Received: from eggs.gnu.org ([140.186.70.92]:59418) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QBvYc-0007Qo-Hk for qemu-devel@nongnu.org; Mon, 18 Apr 2011 17:00:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QBvYb-0004mU-J9 for qemu-devel@nongnu.org; Mon, 18 Apr 2011 17:00:30 -0400 Received: from hall.aurel32.net ([88.191.126.93]:44206) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QBvYb-0004mD-E8 for qemu-devel@nongnu.org; Mon, 18 Apr 2011 17:00:29 -0400 Received: from [2001:470:d4ed:0:5e26:aff:fe2b:6f5b] (helo=volta.aurel32.net) by hall.aurel32.net with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1QBvYa-000287-Lg; Mon, 18 Apr 2011 23:00:28 +0200 Received: from aurel32 by volta.aurel32.net with local (Exim 4.72) (envelope-from ) id 1QBvYU-0005TR-LH; Mon, 18 Apr 2011 23:00:22 +0200 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Mon, 18 Apr 2011 23:00:05 +0200 Message-Id: <1303160412-8107-14-git-send-email-aurelien@aurel32.net> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1303160412-8107-1-git-send-email-aurelien@aurel32.net> References: <1303160412-8107-1-git-send-email-aurelien@aurel32.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 88.191.126.93 Cc: Aurelien Jarno Subject: [Qemu-devel] [PATCH 13/20] target-i386: fix helper_fdiv() wrt softfloat X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Aurelien Jarno Reviewed-by: Peter Maydell --- target-i386/exec.h | 4 ++++ target-i386/op_helper.c | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/target-i386/exec.h b/target-i386/exec.h index 211cc8c..b2af894 100644 --- a/target-i386/exec.h +++ b/target-i386/exec.h @@ -111,6 +111,7 @@ static inline void svm_check_intercept(uint32_t type) #define floatx_to_float32 floatx80_to_float32 #define floatx_to_float64 floatx80_to_float64 #define floatx_add floatx80_add +#define floatx_div floatx80_div #define floatx_mul floatx80_mul #define floatx_sub floatx80_sub #define floatx_abs floatx80_abs @@ -120,6 +121,7 @@ static inline void svm_check_intercept(uint32_t type) #define floatx_compare floatx80_compare #define floatx_compare_quiet floatx80_compare_quiet #define floatx_is_any_nan floatx80_is_any_nan +#define floatx_is_zero floatx80_is_zero #else #define floatx_to_int32 float64_to_int32 #define floatx_to_int64 float64_to_int64 @@ -132,6 +134,7 @@ static inline void svm_check_intercept(uint32_t type) #define floatx_to_float32 float64_to_float32 #define floatx_to_float64(x, e) (x) #define floatx_add float64_add +#define floatx_div float64_div #define floatx_mul float64_mul #define floatx_sub float64_sub #define floatx_abs float64_abs @@ -141,6 +144,7 @@ static inline void svm_check_intercept(uint32_t type) #define floatx_compare float64_compare #define floatx_compare_quiet float64_compare_quiet #define floatx_is_any_nan float64_is_any_nan +#define floatx_is_zero float64_is_zero #endif #define RC_MASK 0xc00 diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c index 9e5ca72..d0d639c 100644 --- a/target-i386/op_helper.c +++ b/target-i386/op_helper.c @@ -3440,9 +3440,10 @@ static void fpu_set_exception(int mask) static inline CPU86_LDouble helper_fdiv(CPU86_LDouble a, CPU86_LDouble b) { - if (b == 0.0) + if (floatx_is_zero(b)) { fpu_set_exception(FPUS_ZE); - return a / b; + } + return floatx_div(a, b, &env->fp_status); } static void fpu_raise_exception(void)