On 06/19/2018 02:29 AM, Richard Biener wrote:
> On Mon, Jun 18, 2018 at 4:01 PM Wilco Dijkstra <wilco.dijks...@arm.com> wrote:
>>
>> GCC currently defaults to -fmath-errno.  This generates code assuming math
>> functions set errno and the application checks errno.  Few applications
>> test errno and various systems and math libraries no longer set errno since 
>> it
>> is optional.  GCC generates much faster code for simple math functions with
>> -fno-math-errno such as sqrt and lround (avoiding a call and PLT 
>> redirection).
>> Therefore it is reasonable to change the default to -fno-math-errno.  This is
>> already the case for non-C languages.  Only change the default for C99 and
>> later.
>>
>> long f(float x) { return lroundf(x) + 1; }
>>
>> by default:
>>
>> f:
>>         str     x30, [sp, -16]!
>>         bl      lroundf
>>         add     x0, x0, 1
>>         ldr     x30, [sp], 16
>>         ret
>>
>> With -fno-math-errno:
>>
>> f:
>>         fcvtas  x0, s0
>>         add     x0, x0, 1
>>         ret
>>
>> Passes regress on AArch64. OK for commit?
> 
> There are a number of regression tests that check for errno handling
> (I added some to avoid aliasing for example).  Please make sure to
> add explicit -fmath-errno to those that do not already have it set
> (I guess such patch would be obvious and independent of this one).
> 
> A grep -r errno testsuite/ is only 159 lines but it might not
> catch all cases - the one I'm refering to above matches because
> of a comment only:
> 
> testsuite/gcc.dg/tree-ssa/ssa-dse-15.c:  /* We should be able to DSE this 
> store
> (p may point to errno).  */
We're concerned about errno as potentially set by malloc here.  It's
unrelated to the math-errno work.


Jeff

Reply via email to