From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48429) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aC88y-0005Jz-QW for qemu-devel@nongnu.org; Thu, 24 Dec 2015 10:49:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aC88u-0000Y9-ON for qemu-devel@nongnu.org; Thu, 24 Dec 2015 10:49:32 -0500 Received: from mail113-249.mail.alibaba.com ([205.204.113.249]:42126 helo=us-alimail-mta1.hst.scl.en.alidc.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aC88u-0000W9-1k for qemu-devel@nongnu.org; Thu, 24 Dec 2015 10:49:28 -0500 Message-ID: <567C14BB.20405@emindsoft.com.cn> Date: Thu, 24 Dec 2015 23:52:27 +0800 From: Chen Gang MIME-Version: 1.0 References: <1450907315-10135-1-git-send-email-chengang@emindsoft.com.cn> <1450907315-10135-3-git-send-email-chengang@emindsoft.com.cn> <567B292B.6070207@twiddle.net> In-Reply-To: <567B292B.6070207@twiddle.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v4 2/4] target-tilegx: Add single floating point implementation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson , peter.maydell@linaro.org, cmetcalf@ezchip.com Cc: qemu-devel@nongnu.org On 12/24/15 07:07, Richard Henderson wrote: > On 12/23/2015 01:48 PM, chengang@emindsoft.com.cn wrote: >> +static float32 sfmt_to_float32(uint64_t sfmt) >> +{ >> + uint32_t sign = get_fsingle_sign(sfmt); >> + uint32_t man = get_fsingle_man(sfmt); >> + uint32_t exp = get_fsingle_exp(sfmt); >> + float32 f; >> + >> + if (get_fsingle_calc(sfmt) == TILEGX_F_CALC_CVT) { >> + if (sign) { >> + f = int32_to_float32(0 - man, &fp_status); >> + } else { >> + f = uint32_to_float32(man, &fp_status); >> + } >> + exp += get_f32_exp(f) - 0x9e; >> + if ((int32_t) exp < 0) { >> + return float32_infinity | float32_set_sign(float32_zero, sign); >> + } else if (exp >= 0xff) { >> + return float32_zero | float32_set_sign(float32_zero, sign); >> + } else { >> + set_f32_exp(&f, exp); >> + } > > > What in the world are you attempting to do here? > This is not normalization. This is not even remotely > correct with respect to zero or infinity. > For fdouble, I use almost the same way, but can get the correct result ( pass gcc testsuite for fdouble, include inf and zero tests). But tests will never enough, we can not say the fdouble implementation must be OK. So please help check the fdouble implementation in details, again, when you have time, it may still have issues. > Moreover, I thought we agreed to do away with that CALC bit. > OK, I will try, next. I will copy and reconstruct related code from qemu fpu implementation instead of (u)int32/64_to_float32/64 functions (just like you said, I guess). Hope I can finish within 2015-12-31. Thanks. -- Chen Gang (陈刚) Open, share, and attitude like air, water, and life which God blessed