This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch-86512]: Subnormal float support in armv7(with -msoft-float) for intrinsics
- From: Ramana Radhakrishnan <ramana dot gcc at googlemail dot com>
- To: Umesh Kalappa <umesh dot kalappa0 at gmail dot com>
- Cc: "Richard Earnshaw (lists)" <Richard dot Earnshaw at arm dot com>, Wilco Dijkstra <Wilco dot Dijkstra at arm dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, nd <nd at arm dot com>, Szabolcs Nagy <Szabolcs dot Nagy at arm dot com>, Ramana Radhakrishnan <Ramana dot Radhakrishnan at arm dot com>
- Date: Mon, 23 Jul 2018 12:42:22 +0100
- Subject: Re: [Patch-86512]: Subnormal float support in armv7(with -msoft-float) for intrinsics
- References: <DB5PR08MB10300230C683B33FB0297BDF83510@DB5PR08MB1030.eurprd08.prod.outlook.com> <CAGfacvT7M=m01B105qDDYqKowcCAd1n3=w4nFN1+EBBwQPJVaQ@mail.gmail.com> <DB5PR08MB103097543FC99F2E37D2144383510@DB5PR08MB1030.eurprd08.prod.outlook.com> <CAGfacvQcDvW9qDta3bDtF=v6qk2Q3RmKW562B6aANTjd3_bvAg@mail.gmail.com> <df243b50-bcd0-99c6-e7a0-67f4cdef3526@arm.com> <CAGfacvTugFMBn0PSUjBt0uAF0=qGZGOUE8Ve72QBqq7TkSSFXA@mail.gmail.com>
On Mon, Jul 23, 2018 at 12:09 PM, Umesh Kalappa
<umesh.kalappa0@gmail.com> wrote:
> Hi Richard,
>
> We tested on the SP and yes the problem persist on the SP too and
> attached patch will fix the both SP and DP issues for the denormal
> resultant.
> We bootstrapped the compiler ,look ok to us with minimal testing ,
Have you run the full gcc testsuite as you should do if you want to
submit a patch and checked for no regressions ?
Ramana
>
> Any floating point test-suite to test for the attached patch ? any
> recommendations or inputs ?
>
> Thank you again
> ~Umesh
>
>
> On Mon, Jul 23, 2018 at 3:28 PM, Richard Earnshaw (lists)
> <Richard.Earnshaw@arm.com> wrote:
>> So why is this only changing the double-precision implementation?
>> Surely, a problem like this will normally be common to both SP and DP
>> floating-point computations.
>>
>> R.
>>
>> On 23/07/18 08:46, Umesh Kalappa wrote:
>>> Thank you Wilco for the inputs and we agree that the fix break down
>>> for the case.
>>>
>>> Meanwhile ,attached patch will take care the inputs and we are testing
>>> the patch vigorously ,would you recommended any test-suite out there
>>> for the same ?
>>>
>>> Thank you
>>> ~Umesh
>>>
>>>
>>> On Fri, Jul 20, 2018 at 10:04 PM, Wilco Dijkstra <Wilco.Dijkstra@arm.com> wrote:
>>>> Umesh Kalappa wrote:
>>>>
>>>>> We tried some of the normalisation numbers and the fix works and please
>>>>> could you help us with the input ,where if you see that fix breaks down.
>>>>
>>>> Well try any set of inputs which require normalisation. You'll find these no
>>>> longer get normalised and so will get incorrect results. Try basic cases like
>>>> 1.0 - 0.75 which I think will return 0.625...
>>>>
>>>> A basic test would be to run old vs new on a large set of inputs to verify
>>>> there aren't any obvious differences.
>>>>
>>>> Wilco
>>>>
>>>>
>>>> pr86512.patch
>>>>
>>>>
>>>> Index: libgcc/config/arm/ieee754-df.S
>>>> ===================================================================
>>>> --- libgcc/config/arm/ieee754-df.S (revision 262850)
>>>> +++ libgcc/config/arm/ieee754-df.S (working copy)
>>>> @@ -203,6 +203,7 @@
>>>> #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
>>>> bcc LSYM(Lad_a)
>>>> @@ -235,6 +236,8 @@
>>>>
>>>> @ Result must be shifted left and exponent adjusted.
>>>> LSYM(Lad_a):
>>>> + cmp r4,#0x0
>>>> + beq LSYM(Lad_e)
>>>> movs ip, ip, lsl #1
>>>> adcs xl, xl, xl
>>>> adc xh, xh, xh
>>>> 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,28 @@
>>>> +/* { dg-do run } */
>>>> +/* { dg-options "-O0 -msoft-float" } */
>>>> +
>>>> +#include<stdlib.h>
>>>> +#include<stdint.h>
>>>> +
>>>> +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;
>>>> +}
>>>> +
>>