From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 94389 invoked by alias); 28 Apr 2016 15:03:12 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 93741 invoked by uid 89); 28 Apr 2016 15:03:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 spammy= X-HELO: mailrelay7.public.one.com Received: from mailrelay7.public.one.com (HELO mailrelay7.public.one.com) (91.198.169.215) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 28 Apr 2016 15:03:02 +0000 X-HalOne-Cookie: 2d8ef451bc86b99f5820a19cf62eed7aaa184bdf X-HalOne-ID: 4a250ed2-0d52-11e6-bb5b-b82a72cffc46 Received: from localhost.localdomain (unknown [91.135.11.213]) by smtpfilter4.public.one.com (Halon Mail Gateway) with ESMTPSA; Thu, 28 Apr 2016 15:02:55 +0000 (UTC) Subject: Re: [PATCH 4/6] [ARC] Handle FPX NaN within optimized floating point library. To: Claudiu Zissulescu , "gcc-patches@gcc.gnu.org" References: <1460990028-5718-1-git-send-email-claziss@synopsys.com> <1460990028-5718-5-git-send-email-claziss@synopsys.com> <5721F3A5.6000404@amylaar.uk> <098ECE41A0A6114BB2A07F1EC238DE8966189EBB@de02wembxa.internal.synopsys.com> <5721F6E2.6060507@amylaar.uk> <098ECE41A0A6114BB2A07F1EC238DE8966189F39@de02wembxa.internal.synopsys.com> Cc: "Francois.Bedard@synopsys.com" , "jeremy.bennett@embecosm.com" From: Joern Wolfgang Rennecke Message-ID: <5722261F.1070102@amylaar.uk> Date: Thu, 28 Apr 2016 15:03:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <098ECE41A0A6114BB2A07F1EC238DE8966189F39@de02wembxa.internal.synopsys.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2016-04/txt/msg01846.txt.bz2 On 28/04/16 15:11, Claudiu Zissulescu wrote: > Sure thing, running for ARC700, using original implementation and enabled guarded code for FPX handling: > > [0x000002a2] 0xc000 K Z ld_s r0,[sp,0x0] : lw [0x5000c0c0] => 0xffffffff : (w1) r0 <= 0xffffffff * > [0x000002a4] 0xc101 K Z ld_s r1,[sp,0x4] : lw [0x5000c0c4] => 0x7fefffff : (w1) r1 <= 0x7fefffff * > [0x000002a6] 0xc202 K Z ld_s r2,[sp,0x8] : lw [0x5000c0c8] => 0xffffffff : (w1) r2 <= 0xffffffff * > [0x000002a8] 0xc303 K Z ld_s r3,[sp,0xc] : lw [0x5000c0cc] => 0x7fefffff : (w1) r3 <= 0x7fefffff * > [0x000002aa] 0x0aea0000 K Z bl 0x2e8 : (w0) r31 <= 0x000002ae * > [0x00000590] 0x091d00e1 K Z brne.d r1,r3,0x1c > [0x00000594] 0x2153050c K Z bmsk r12,r1,0x14 : (w0) r12 <= 0x000fffff * > [0x00000598] 0x200580be K Z or.f 0,r0,r2 * > [0x0000059c] 0x24cf1562 K N bset.ne r12,r12,0x15 : (w0) r12 <= 0x002fffff * > [0x000005a0] 0x2414904c K N add1.f r12,r12,r1 : (w0) r12 <= 0x000ffffd * > [0x000005a4] 0x7fe0 K C j_s.d [blink] * > [0x000005a6] 0x20cc8086 KD C cmp.cc r0,r2 > > I see, we basically have an overflow. I think the DPFP_COMPAT / __HS__ variant should be something like: brne DBL0H,DBL1H,.Lhighdiff mov_s r12,0x00200000 or.f 0,DBL0L,DBL1L bset.ne r12,r12,0 add1.f r12,r12,DBL0H /* set c iff NaN; also, clear z if NaN. */ j_s.d [blink] cmp.cc DBL0L,DBL1L ... Where the mov_s could be replaced with something else that loads the same value, depending on what instructions are supported.