From patchwork Wed Apr 20 10:12:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 92137 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 10CD4B6FC1 for ; Wed, 20 Apr 2011 20:14:07 +1000 (EST) Received: from localhost ([::1]:57628 helo=lists2.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QCUQ8-0002Mo-BT for incoming@patchwork.ozlabs.org; Wed, 20 Apr 2011 06:14:04 -0400 Received: from eggs.gnu.org ([140.186.70.92]:43264) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QCUOZ-0008Rq-40 for qemu-devel@nongnu.org; Wed, 20 Apr 2011 06:12:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QCUOX-0004So-Tr for qemu-devel@nongnu.org; Wed, 20 Apr 2011 06:12:27 -0400 Received: from hall.aurel32.net ([88.191.126.93]:43746) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QCUOX-0004SL-MB for qemu-devel@nongnu.org; Wed, 20 Apr 2011 06:12:25 -0400 Received: from [90.84.144.153] (helo=volta.aurel32.net) by hall.aurel32.net with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1QCUOW-0002qO-QX; Wed, 20 Apr 2011 12:12:25 +0200 Received: from aurel32 by volta.aurel32.net with local (Exim 4.72) (envelope-from ) id 1QCUOO-0006HQ-KT; Wed, 20 Apr 2011 12:12:16 +0200 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Wed, 20 Apr 2011 12:12:03 +0200 Message-Id: <1303294329-22634-15-git-send-email-aurelien@aurel32.net> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1303294329-22634-1-git-send-email-aurelien@aurel32.net> References: <1303294329-22634-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 v2 14/20] target-i386: fix helper_fsqrt() 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 Reviewed-by: Peter Maydell Signed-off-by: Aurelien Jarno --- target-i386/exec.h | 4 ++++ target-i386/op_helper.c | 7 ++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/target-i386/exec.h b/target-i386/exec.h index b2af894..292e0de 100644 --- a/target-i386/exec.h +++ b/target-i386/exec.h @@ -114,6 +114,7 @@ static inline void svm_check_intercept(uint32_t type) #define floatx_div floatx80_div #define floatx_mul floatx80_mul #define floatx_sub floatx80_sub +#define floatx_sqrt floatx80_sqrt #define floatx_abs floatx80_abs #define floatx_chs floatx80_chs #define floatx_scalbn floatx80_scalbn @@ -121,6 +122,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_neg floatx80_is_neg #define floatx_is_zero floatx80_is_zero #else #define floatx_to_int32 float64_to_int32 @@ -137,6 +139,7 @@ static inline void svm_check_intercept(uint32_t type) #define floatx_div float64_div #define floatx_mul float64_mul #define floatx_sub float64_sub +#define floatx_sqrt float64_sqrt #define floatx_abs float64_abs #define floatx_chs float64_chs #define floatx_scalbn float64_scalbn @@ -144,6 +147,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_neg float64_is_neg #define floatx_is_zero float64_is_zero #endif diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c index b22462f..02edfea 100644 --- a/target-i386/op_helper.c +++ b/target-i386/op_helper.c @@ -4152,14 +4152,11 @@ void helper_fyl2xp1(void) void helper_fsqrt(void) { - CPU86_LDouble fptemp; - - fptemp = ST0; - if (fptemp<0.0) { + if (floatx_is_neg(ST0)) { env->fpus &= (~0x4700); /* (C3,C2,C1,C0) <-- 0000 */ env->fpus |= 0x400; } - ST0 = sqrt(fptemp); + ST0 = floatx_sqrt(ST0, &env->fp_status); } void helper_fsincos(void)