public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: [Patch-86512]: Subnormal float support in armv7(with -msoft-float) for intrinsics
@ 2018-07-20 13:38 Wilco Dijkstra
  2018-07-20 16:00 ` Umesh Kalappa
  0 siblings, 1 reply; 20+ messages in thread
From: Wilco Dijkstra @ 2018-07-20 13:38 UTC (permalink / raw)
  To: umesh.kalappa0, GCC Patches; +Cc: nd, Szabolcs Nagy, Ramana Radhakrishnan

Hi Umesh,

Looking at your patch, this would break all results which need to be normalized.


Index: libgcc/config/arm/ieee754-df.S
===================================================================
--- libgcc/config/arm/ieee754-df.S	(revision 262850)
+++ libgcc/config/arm/ieee754-df.S	(working copy)
@@ -203,8 +203,11 @@
 #endif
 
 	@ Determine how to normalize the result.
+	@ if result is denormal i.e (exp)=0,then don't normalise the result,
 LSYM(Lad_p):
 	cmp	xh, #0x00100000
+	blt	LSYM(Lad_e)
+	cmp	xh, #0x00100000
 	bcc	LSYM(Lad_a)
 	cmp	xh, #0x00200000
 	bcc	LSYM(Lad_e)

It seems Lad_a doesn't correctly handle the case where the result is a denormal. For this case
the result is correct so nothing else needs to be done. This requires an explicit test that the
exponent is zero - other cases still need to be renormalized as usual. This code looks overly
complex so any change will require extensive testing of all the corner cases.

Wilco

^ permalink raw reply	[flat|nested] 20+ messages in thread
* [Patch-86512]: Subnormal float support in armv7(with -msoft-float) for intrinsics
@ 2018-07-18 12:31 Umesh Kalappa
  2018-07-20 12:05 ` Umesh Kalappa
  2018-07-20 13:30 ` Szabolcs Nagy
  0 siblings, 2 replies; 20+ messages in thread
From: Umesh Kalappa @ 2018-07-18 12:31 UTC (permalink / raw)
  To: gcc-patches; +Cc: Szabolcs Nagy, nd, Ramana Radhakrishnan

[-- Attachment #1: Type: text/plain, Size: 2524 bytes --]

Hi Nagy/Ramana,

Please help us to review the attached patch and do let me know your comments .

No regress in the  gcc.target  suite for arm target.

Thank you
~Umesh

On Tue, Jul 17, 2018 at 4:01 PM, Umesh Kalappa <umesh.kalappa0@gmail.com> wrote:
> Will do, thanks.
> Thanks
>
> On Tue, Jul 17, 2018, 3:24 PM Ramana Radhakrishnan
> <ramana.gcc@googlemail.com> wrote:
>>
>> On Tue, Jul 17, 2018 at 10:41 AM, Umesh Kalappa
>> <umesh.kalappa0@gmail.com> wrote:
>> > Hi Nagy,
>> >
>> > Please  help us with your comments on the attached patch for the issue
>> > (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86512)
>> >
>> > Thank you and waiting for your inputs on the same.
>>
>>
>> Patches should be sent to gcc-patches@gcc.gnu.org with a clear
>> description of what the patch hopes to
>> achieve and why this is correct, how was it tested and if a regression
>> test needs to be added - add one please.
>> Please read https://gcc.gnu.org/contribute.html before sending a patch.
>>
>> This is the wrong list to send patches to.
>>
>> regards
>> Ramana
>> > ~Umesh
>> >
>> > On Fri, Jul 13, 2018 at 1:22 PM, Umesh Kalappa
>> > <umesh.kalappa0@gmail.com> wrote:
>> >> Thank you and issue  raised at
>> >> gcc-patches@gcc.gnu.org
>> >>
>> >> ~Umesh
>> >>
>> >> On Thu, Jul 12, 2018 at 9:33 PM, Szabolcs Nagy <szabolcs.nagy@arm.com>
>> >> wrote:
>> >>> On 12/07/18 16:20, Umesh Kalappa wrote:
>> >>>>
>> >>>> Hi everyone,
>> >>>>
>> >>>> we have our source base ,that was compiled for armv7 on gcc8.1 with
>> >>>> soft-float and for following input
>> >>>>
>> >>>> a=0x0010000000000000
>> >>>> b=0x0000000000000001
>> >>>>
>> >>>>   result = a - b ;
>> >>>>
>> >>>> we are getting the result as "0x000ffffffffffffe" and with
>> >>>> -mhard-float (disabled the flush to zero mode ) we are getting the
>> >>>> result as ""0x000fffffffffffff" as expected.
>> >>>>
>> >>>
>> >>> please submit it as a bug report to bugzilla
>> >>>
>> >>>
>> >>>> while debugging the soft-float code,we see that ,the compiler calls
>> >>>> the intrinsic "__aeabi_dsub" with arm calling conventions i.e passing
>> >>>> "a" in r0 and r1 registers and respectively for "b".
>> >>>>
>> >>>> we are investigating the routine "__aeabi_dsub" that comes from
>> >>>> libgcc
>> >>>> for incorrect result  and meanwhile we would like to know that
>> >>>>
>> >>>> a)do libgcc routines/intrinsic for float operations support or
>> >>>> consider the subnormal values ? ,if so how we can enable the same.
>> >>>>
>> >>>> Thank you
>> >>>> ~Umesh
>> >>>>
>> >>>

[-- Attachment #2: pr86512.patch --]
[-- Type: application/octet-stream, Size: 2084 bytes --]

Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog	(revision 262850)
+++ gcc/testsuite/ChangeLog	(working copy)
@@ -1,3 +1,8 @@
+2018-07-18  Umesh Kalappa <umesh.kalappa0@gmail.com>
+
+	PR libgcc/86512
+	* gcc.target/arm/pr86512.c :New test.
+
 2018-07-18  Richard Biener  <rguenther@suse.de>
 
 	PR debug/86523
Index: gcc/testsuite/gcc.target/arm/pr86512.c
===================================================================
--- gcc/testsuite/gcc.target/arm/pr86512.c	(nonexistent)
+++ gcc/testsuite/gcc.target/arm/pr86512.c	(working copy)
@@ -0,0 +1,30 @@
+/* { dg-do run } */
+/* { dg-options "-O0 -msoft-float" } */
+
+#include<stdlib.h>
+#include<stdint.h>
+#define PRIx64    "llx"
+
+typedef union
+{
+    double d;
+    uint64_t i;
+} u;
+
+int main()
+{
+  u smallestPositiveNormal, smallesPositiveSubnormal, expectedResult, result;
+
+  smallesPositiveSubnormal.i = 1;
+
+  smallestPositiveNormal.i = 0x0010000000000000;
+  expectedResult.i = 0x000fffffffffffff;
+  result.d = smallestPositiveNormal.d - smallesPositiveSubnormal.d;
+
+
+  if (result.i != expectedResult.i)
+	abort();
+	
+  return 0;
+}
+
Index: libgcc/ChangeLog
===================================================================
--- libgcc/ChangeLog	(revision 262850)
+++ libgcc/ChangeLog	(working copy)
@@ -1,3 +1,9 @@
+2018-07-18  Umesh Kalappa <umesh.kalappa0@gmail.com>
+	
+	PR libgcc/86512 
+	* config/arm/ieee754-df.S :Don't normalise the denormal result.
+
+
 2018-07-05  James Clarke  <jrtc27@jrtc27.com>
 
 	* configure: Regenerated.
Index: libgcc/config/arm/ieee754-df.S
===================================================================
--- libgcc/config/arm/ieee754-df.S	(revision 262850)
+++ libgcc/config/arm/ieee754-df.S	(working copy)
@@ -203,8 +203,11 @@
 #endif
 
 	@ Determine how to normalize the result.
+	@ if result is denormal i.e (exp)=0,then don't normalise the result,
 LSYM(Lad_p):
 	cmp	xh, #0x00100000
+	blt	LSYM(Lad_e)
+	cmp	xh, #0x00100000
 	bcc	LSYM(Lad_a)
 	cmp	xh, #0x00200000
 	bcc	LSYM(Lad_e)

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2018-08-02 16:50 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-20 13:38 [Patch-86512]: Subnormal float support in armv7(with -msoft-float) for intrinsics Wilco Dijkstra
2018-07-20 16:00 ` Umesh Kalappa
2018-07-20 16:34   ` Wilco Dijkstra
2018-07-23  7:46     ` Umesh Kalappa
2018-07-23  9:58       ` Richard Earnshaw (lists)
2018-07-23 11:09         ` Umesh Kalappa
2018-07-23 11:42           ` Ramana Radhakrishnan
2018-07-23 11:54           ` Wilco Dijkstra
2018-07-24  8:39             ` Umesh Kalappa
2018-07-25 17:04               ` Umesh Kalappa
2018-07-26 16:36                 ` Nicolas Pitre
2018-07-27 13:32                   ` Wilco Dijkstra
2018-07-27 15:50                     ` Nicolas Pitre
2018-07-27 16:01                       ` Nicolas Pitre
2018-07-27 16:05                       ` Wilco Dijkstra
2018-07-27 16:45                         ` Nicolas Pitre
2018-08-02 16:50                           ` Richard Earnshaw (lists)
  -- strict thread matches above, loose matches on Subject: below --
2018-07-18 12:31 Umesh Kalappa
2018-07-20 12:05 ` Umesh Kalappa
2018-07-20 13:30 ` Szabolcs Nagy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).