Received: from eggs.gnu.org ([2001:4830:134:3::10]:49965) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c48Hc-0001nj-Vb for qemu-devel@nongnu.org; Tue, 08 Nov 2016 10:25:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c48HZ-0002Ut-FY for qemu-devel@nongnu.org; Tue, 08 Nov 2016 10:25:56 -0500 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:35968) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c48HZ-0002Sy-8U for qemu-devel@nongnu.org; Tue, 08 Nov 2016 10:25:53 -0500 Received: by mail-wm0-x243.google.com with SMTP id c17so23262565wmc.3 for ; Tue, 08 Nov 2016 07:25:53 -0800 (PST) Sender: Richard Henderson References: <20161107144445.14069-1-kbastian@mail.uni-paderborn.de> <20161107144445.14069-2-kbastian@mail.uni-paderborn.de> <036ccf78-710b-074a-1e6b-e3948061ee5f@twiddle.net> <55ef6c4f-034b-a3a0-7235-9412ed028763@mail.uni-paderborn.de> <1702f187-c135-eba2-0901-4b8f22284ecd@twiddle.net> <198b9a18-6584-bbec-4a03-5b63dc804950@mail.uni-paderborn.de> From: Richard Henderson Message-ID: Date: Tue, 8 Nov 2016 16:25:48 +0100 MIME-Version: 1.0 In-Reply-To: <198b9a18-6584-bbec-4a03-5b63dc804950@mail.uni-paderborn.de> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 1/5] target-tricore: Added FTOUZ instruction List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bastian Koppelmann , qemu-devel@nongnu.org On 11/08/2016 04:12 PM, Bastian Koppelmann wrote: > On 11/08/2016 04:06 PM, Richard Henderson wrote: >> On 11/08/2016 02:37 PM, Bastian Koppelmann wrote: >>> Consider 0x836d4e86 as an input which is clearly negative, however >>> float_flag_invalid is not set. The hardware on the other hand does set >>> it. >> >> Hmm. This is -0x1.da9d0cp-121. Softfloat claims that we should round >> to zero first, and only if the result is still < 0, raise invalid. >> Which does sound plausible as a common behaviour. > > TriCore does it the other way round. > >> >> Does your hardware raise invalid for true -0.0, i.e. 0x80000000? > > No, -0.0 does not raise invalid. Then I suppose the check should look like flags = f_get_excp_flags(env); if (flags & float_flag_invalid) { flags &= ~float_flag_inexact; } else if (float32_lt_quiet(f_arg, 0, &env->status)) { flags = float_flag_invalid; } if (flags) { f_update_psw_flags(env, flags); } Note that the 0.0 that you use is truncated to 0 by C for the uint32_t argument. r~