[PATCH] Optimize sin(atan(x)) and cos(atan(x)), take 3 (PR tree-optimization/86829)

2018-10-09 Thread Giuliano Augusto Faulin Belinassi
Fixed all issues pointed in the previous iteration. There is now a significant change regarding how the sin(atan(x)) constant is calculated, as now it checks for which values such that computing 1 + x*x won't overflow. There are two reasons for this change: (1) Avoid an intermediate infinity value

Re: [PATCH] Optimize sin(atan(x)) and cos(atan(x)), take 3 (PR tree-optimization/86829)

2018-10-11 Thread Jeff Law
On 10/9/18 5:29 PM, Giuliano Augusto Faulin Belinassi wrote: > Fixed all issues pointed in the previous iteration. > There is now a significant change regarding how the sin(atan(x)) > constant is calculated, as now it checks for which values such that > computing 1 + x*x won't overflow. There are t

Re: [PATCH] Optimize sin(atan(x)) and cos(atan(x)), take 3 (PR tree-optimization/86829)

2018-10-12 Thread Christophe Lyon
On Thu, 11 Oct 2018 at 23:07, Jeff Law wrote: > > On 10/9/18 5:29 PM, Giuliano Augusto Faulin Belinassi wrote: > > Fixed all issues pointed in the previous iteration. > > There is now a significant change regarding how the sin(atan(x)) > > constant is calculated, as now it checks for which values

Re: [PATCH] Optimize sin(atan(x)) and cos(atan(x)), take 3 (PR tree-optimization/86829)

2018-10-12 Thread Richard Biener
On Fri, Oct 12, 2018 at 10:08 AM Christophe Lyon wrote: > > On Thu, 11 Oct 2018 at 23:07, Jeff Law wrote: > > > > On 10/9/18 5:29 PM, Giuliano Augusto Faulin Belinassi wrote: > > > Fixed all issues pointed in the previous iteration. > > > There is now a significant change regarding how the sin(at

Re: [PATCH] Optimize sin(atan(x)) and cos(atan(x)), take 3 (PR tree-optimization/86829)

2018-10-12 Thread Christophe Lyon
On Fri, 12 Oct 2018 at 13:27, Richard Biener wrote: > > On Fri, Oct 12, 2018 at 10:08 AM Christophe Lyon > wrote: > > > > On Thu, 11 Oct 2018 at 23:07, Jeff Law wrote: > > > > > > On 10/9/18 5:29 PM, Giuliano Augusto Faulin Belinassi wrote: > > > > Fixed all issues pointed in the previous iterat

Re: [PATCH] Optimize sin(atan(x)) and cos(atan(x)), take 3 (PR tree-optimization/86829)

2018-10-12 Thread Jeff Law
On 10/12/18 8:11 AM, Christophe Lyon wrote: > On Fri, 12 Oct 2018 at 13:27, Richard Biener > wrote: >> >> On Fri, Oct 12, 2018 at 10:08 AM Christophe Lyon >> wrote: >>> >>> On Thu, 11 Oct 2018 at 23:07, Jeff Law wrote: On 10/9/18 5:29 PM, Giuliano Augusto Faulin Belinassi wrote: >

Re: [PATCH] Optimize sin(atan(x)) and cos(atan(x)), take 3 (PR tree-optimization/86829)

2018-10-12 Thread Christophe Lyon
On Fri, 12 Oct 2018 at 16:14, Jeff Law wrote: > > On 10/12/18 8:11 AM, Christophe Lyon wrote: > > On Fri, 12 Oct 2018 at 13:27, Richard Biener > > wrote: > >> > >> On Fri, Oct 12, 2018 at 10:08 AM Christophe Lyon > >> wrote: > >>> > >>> On Thu, 11 Oct 2018 at 23:07, Jeff Law wrote: > > >>

Re: [PATCH] Optimize sin(atan(x)) and cos(atan(x)), take 3 (PR tree-optimization/86829)

2018-10-12 Thread Giuliano Augusto Faulin Belinassi
Hello What is the output of these functions on such arch? Since the test didn't fail for the sinatan counterpart, an possible explanation would be that the calculation of the sqrf, sqrt and sqrtl (lines 62-64) yielded a number that is far behind of what it should be. However, I am still not su

Re: [PATCH] Optimize sin(atan(x)) and cos(atan(x)), take 3 (PR tree-optimization/86829)

2018-10-12 Thread Jeff Law
On 10/12/18 9:51 AM, Giuliano Augusto Faulin Belinassi wrote: > Hello > What is the output of these functions on such arch? Since the > test didn't fail for the sinatan counterpart, an possible explanation > would be that the calculation of the sqrf, sqrt and sqrtl (lines > 62-64) yielded a nu

Re: [PATCH] Optimize sin(atan(x)) and cos(atan(x)), take 3 (PR tree-optimization/86829)

2018-10-12 Thread Giuliano Augusto Faulin Belinassi
> fc is built with: >mov r0, #0 >movtr0, 24448 > so r0=0x5f80 (1.8446744E19) which looks ok this is correct. My x86_64 yields the same value > but then cosatanf is computed as (ie there's not call to cosatanf()): >movwr3, #48430 >movtr3, 45883 >

Re: [PATCH] Optimize sin(atan(x)) and cos(atan(x)), take 3 (PR tree-optimization/86829)

2018-10-12 Thread Christophe Lyon
On Fri, 12 Oct 2018 at 17:57, Jeff Law wrote: > > On 10/12/18 9:51 AM, Giuliano Augusto Faulin Belinassi wrote: > > Hello > > What is the output of these functions on such arch? Since the > > test didn't fail for the sinatan counterpart, an possible explanation > > would be that the calculati

Re: [PATCH] Optimize sin(atan(x)) and cos(atan(x)), take 3 (PR tree-optimization/86829)

2018-10-12 Thread Christophe Lyon
On Fri, 12 Oct 2018 at 20:01, Giuliano Augusto Faulin Belinassi wrote: > > > fc is built with: > >mov r0, #0 > >movtr0, 24448 > > so r0=0x5f80 (1.8446744E19) which looks ok > > this is correct. My x86_64 yields the same value > > > but then cosatanf is computed as (ie t

Re: [PATCH] Optimize sin(atan(x)) and cos(atan(x)), take 3 (PR tree-optimization/86829)

2018-10-16 Thread Giuliano Augusto Faulin Belinassi
Hello. Sorry for the late reply. > but then cosatanf is computed as (ie there's not call to cosatanf()): >movwr3, #48430 >movtr3, 45883 > so r3=0xb33bbd2e (-4.371139E-8) which is not zero. Does this behavior is still present if we change the line 58 to: int __attribute_

Re: [PATCH] Optimize sin(atan(x)) and cos(atan(x)), take 3 (PR tree-optimization/86829)

2018-10-16 Thread Christophe Lyon
On Tue, 16 Oct 2018 at 17:15, Giuliano Augusto Faulin Belinassi wrote: > > Hello. Sorry for the late reply. > > > but then cosatanf is computed as (ie there's not call to cosatanf()): > >movwr3, #48430 > >movtr3, 45883 > > so r3=0xb33bbd2e (-4.371139E-8) which is not zero.

Re: [PATCH] Optimize sin(atan(x)) and cos(atan(x)), take 3 (PR tree-optimization/86829)

2018-10-16 Thread Giuliano Augusto Faulin Belinassi
Hello, Christophe Could you please dump the assembly of cosatanf here? On Tue, Oct 16, 2018 at 12:23 PM Christophe Lyon wrote: > > On Tue, 16 Oct 2018 at 17:15, Giuliano Augusto Faulin Belinassi > wrote: > > > > Hello. Sorry for the late reply. > > > > > but then cosatanf is computed as (ie

Re: [PATCH] Optimize sin(atan(x)) and cos(atan(x)), take 3 (PR tree-optimization/86829)

2018-10-16 Thread Christophe Lyon
On Tue, 16 Oct 2018 at 18:04, Giuliano Augusto Faulin Belinassi wrote: > > Hello, Christophe > Could you please dump the assembly of cosatanf here? > > Sure: .global cosatanf .syntax unified .arm .fpu softvfp .type cosatanf, %function cosatanf: .LFB3:

Re: [PATCH] Optimize sin(atan(x)) and cos(atan(x)), take 3 (PR tree-optimization/86829)

2018-10-16 Thread Giuliano Augusto Faulin Belinassi
Hello, > cosatanf: > .LFB3: > .loc 1 44 1 is_stmt 1 > .cfi_startproc >@ args = 0, pretend = 0, frame = 0 > @ frame_needed = 0, uses_anonymous_args = 0 > .LVL50: > .loc 1 45 5 > .loc 1 44 1 is_stmt 0 > push{r4, lr} > .cfi_def_cfa_o

Re: [PATCH] Optimize sin(atan(x)) and cos(atan(x)), take 3 (PR tree-optimization/86829)

2018-10-16 Thread Christophe Lyon
On Tue, 16 Oct 2018 at 19:33, Giuliano Augusto Faulin Belinassi wrote: > > Hello, > > > cosatanf: > > .LFB3: > > .loc 1 44 1 is_stmt 1 > > .cfi_startproc > >@ args = 0, pretend = 0, frame = 0 > > @ frame_needed = 0, uses_anonymous_args = 0 > > .LVL50: > > .l