[Patch-86512]: Subnormal float support in armv7(with -msoft-float) for intrinsics

Richard Earnshaw (lists) Richard.Earnshaw@arm.com
Mon Jul 23 09:58:00 GMT 2018


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;
>> +}
>> +



More information about the Gcc-patches mailing list