Re: Cache reals for 1/4, 1/6 and 1/9

2015-10-07 Thread Richard Sandiford
Bernd Schmidt writes: > On 10/05/2015 07:00 PM, Richard Sandiford wrote: >> >> If my original patch isn't acceptable, > > I thought I'd approved it. In the end I applied the original version. We can look at a more C++ way of doing things once real_value itself becomes more

Re: Cache reals for 1/4, 1/6 and 1/9

2015-10-06 Thread Richard Biener
On Mon, Oct 5, 2015 at 4:47 PM, Richard Sandiford wrote: > Richard Biener writes: >> On Thu, Oct 1, 2015 at 3:59 PM, Bernd Schmidt wrote: >>> On 10/01/2015 03:51 PM, Richard Sandiford wrote: We have a global

Re: Cache reals for 1/4, 1/6 and 1/9

2015-10-05 Thread Mike Stump
On Oct 5, 2015, at 7:47 AM, Richard Sandiford wrote: > - return real_equal (_REAL_CST (expr), ) > + return real_equal (_REAL_CST (expr), <0> ()) On behalf of mere mortals, hiding the syntax <0> () into a header file as in implementation detail is entirely

Re: Cache reals for 1/4, 1/6 and 1/9

2015-10-05 Thread Marc Glisse
On Mon, 5 Oct 2015, Richard Sandiford wrote: I do believe you still have some code growth since the inline dconst function always expands code that will initialize the constant. IMO that's not desirable. I don't disagree. I find dconst0 much easier to read than dconst<0> (). In some ways I

Re: Cache reals for 1/4, 1/6 and 1/9

2015-10-05 Thread Richard Biener
On October 5, 2015 8:04:59 PM GMT+02:00, Mike Stump wrote: >On Oct 5, 2015, at 7:47 AM, Richard Sandiford > wrote: >> - return real_equal (_REAL_CST (expr), ) >> + return real_equal (_REAL_CST (expr), <0> ()) > >On behalf of mere

Re: Cache reals for 1/4, 1/6 and 1/9

2015-10-05 Thread Richard Sandiford
Marc Glisse writes: > On Mon, 5 Oct 2015, Richard Sandiford wrote: > >>> I do believe you still have some code growth since the inline dconst >>> function always expands code that will initialize the constant. IMO >>> that's not desirable. >> >> I don't disagree. I find

Re: Cache reals for 1/4, 1/6 and 1/9

2015-10-05 Thread Richard Sandiford
Richard Biener writes: > On Thu, Oct 1, 2015 at 3:59 PM, Bernd Schmidt wrote: >> On 10/01/2015 03:51 PM, Richard Sandiford wrote: >>> >>> We have a global 1/2 and a cached 1/3, but recalculate 1/4, 1/6 and 1/9 >>> each time we need them. That

Re: Cache reals for 1/4, 1/6 and 1/9

2015-10-05 Thread Bernd Schmidt
On 10/05/2015 04:47 PM, Richard Sandiford wrote: @@ -9536,7 +9520,7 @@ fold_builtin_classify (location_t loc, tree fndecl, tree arg, int builtin_index) { r = TREE_REAL_CST (arg); if (real_isinf ()) - return real_compare (GT_EXPR, , ) + return

Re: Cache reals for 1/4, 1/6 and 1/9

2015-10-05 Thread Richard Sandiford
Bernd Schmidt writes: > On 10/05/2015 04:47 PM, Richard Sandiford wrote: >> @@ -9536,7 +9520,7 @@ fold_builtin_classify (location_t loc, tree fndecl, >> tree arg, int builtin_index) >> { >>r = TREE_REAL_CST (arg); >>if (real_isinf ()) >> -return

Re: Cache reals for 1/4, 1/6 and 1/9

2015-10-05 Thread Bernd Schmidt
On 10/05/2015 05:22 PM, Richard Sandiford wrote: Bernd Schmidt writes: On 10/05/2015 04:47 PM, Richard Sandiford wrote: @@ -9536,7 +9520,7 @@ fold_builtin_classify (location_t loc, tree fndecl, tree arg, int builtin_index) { r = TREE_REAL_CST (arg);

Re: Cache reals for 1/4, 1/6 and 1/9

2015-10-05 Thread Richard Sandiford
Bernd Schmidt writes: > On 10/05/2015 05:22 PM, Richard Sandiford wrote: >> Bernd Schmidt writes: >>> On 10/05/2015 04:47 PM, Richard Sandiford wrote: @@ -9536,7 +9520,7 @@ fold_builtin_classify (location_t loc, tree fndecl, tree arg, int

Re: Cache reals for 1/4, 1/6 and 1/9

2015-10-05 Thread Bernd Schmidt
On 10/05/2015 07:00 PM, Richard Sandiford wrote: If my original patch isn't acceptable, I thought I'd approved it. another old-school way of doing it would be to have a .def file of all the constants that we want. They could then all be global variables, rather than having some that are and

Re: Cache reals for 1/4, 1/6 and 1/9

2015-10-02 Thread Richard Biener
On Thu, Oct 1, 2015 at 3:59 PM, Bernd Schmidt wrote: > On 10/01/2015 03:51 PM, Richard Sandiford wrote: >> >> We have a global 1/2 and a cached 1/3, but recalculate 1/4, 1/6 and 1/9 >> each time we need them. That seems a bit arbitrary and makes the folding >> code more

Re: Cache reals for 1/4, 1/6 and 1/9

2015-10-01 Thread Bernd Schmidt
On 10/01/2015 03:51 PM, Richard Sandiford wrote: We have a global 1/2 and a cached 1/3, but recalculate 1/4, 1/6 and 1/9 each time we need them. That seems a bit arbitrary and makes the folding code more noisy (especially once it's moved to match.pd). This patch caches the other three

Cache reals for 1/4, 1/6 and 1/9

2015-10-01 Thread Richard Sandiford
We have a global 1/2 and a cached 1/3, but recalculate 1/4, 1/6 and 1/9 each time we need them. That seems a bit arbitrary and makes the folding code more noisy (especially once it's moved to match.pd). This patch caches the other three constants too. Bootstrapped & regression-tested on