Re: RFC: Two minor optimization patterns

2015-01-14 Thread Richard Biener
On Wed, Jan 14, 2015 at 3:26 PM, Marc Glisse marc.gli...@inria.fr wrote: On Wed, 14 Jan 2015, Richard Biener wrote: On Wed, Jan 14, 2015 at 1:45 PM, Marc Glisse marc.gli...@inria.fr wrote: On Tue, 13 Jan 2015, Rasmus Villemoes wrote: diff --git gcc/match.pd gcc/match.pd index

Re: RFC: Two minor optimization patterns

2015-01-14 Thread Marc Glisse
On Wed, 14 Jan 2015, Richard Biener wrote: On Wed, Jan 14, 2015 at 1:45 PM, Marc Glisse marc.gli...@inria.fr wrote: On Tue, 13 Jan 2015, Rasmus Villemoes wrote: diff --git gcc/match.pd gcc/match.pd index 81c4ee6..04a0bc4 100644 --- gcc/match.pd +++ gcc/match.pd @@ -262,6 +262,16 @@ along

Re: RFC: Two minor optimization patterns

2015-01-14 Thread Richard Biener
On Tue, Jan 13, 2015 at 11:47 PM, Andrew Pinski pins...@gmail.com wrote: On Tue, Jan 13, 2015 at 2:41 PM, Rasmus Villemoes r...@rasmusvillemoes.dk wrote: [My first attempt at submitting a patch for gcc, so please forgive me if I'm not following the right protocol.] There are a few things

Re: RFC: Two minor optimization patterns

2015-01-14 Thread Richard Biener
On Wed, Jan 14, 2015 at 1:45 PM, Marc Glisse marc.gli...@inria.fr wrote: On Tue, 13 Jan 2015, Rasmus Villemoes wrote: diff --git gcc/match.pd gcc/match.pd index 81c4ee6..04a0bc4 100644 --- gcc/match.pd +++ gcc/match.pd @@ -262,6 +262,16 @@ along with GCC; see the file COPYING3. If not see

Re: RFC: Two minor optimization patterns

2015-01-14 Thread Richard Biener
On Wed, Jan 14, 2015 at 1:23 PM, Rasmus Villemoes r...@rasmusvillemoes.dk wrote: On Wed, Jan 14 2015, Richard Biener richard.guent...@gmail.com wrote: On Tue, Jan 13, 2015 at 11:47 PM, Andrew Pinski pins...@gmail.com wrote: On Tue, Jan 13, 2015 at 2:41 PM, Rasmus Villemoes

Re: RFC: Two minor optimization patterns

2015-01-14 Thread Rasmus Villemoes
On Wed, Jan 14 2015, Richard Biener richard.guent...@gmail.com wrote: On Tue, Jan 13, 2015 at 11:47 PM, Andrew Pinski pins...@gmail.com wrote: On Tue, Jan 13, 2015 at 2:41 PM, Rasmus Villemoes r...@rasmusvillemoes.dk wrote: [My first attempt at submitting a patch for gcc, so please forgive

Re: RFC: Two minor optimization patterns

2015-01-14 Thread Marc Glisse
On Tue, 13 Jan 2015, Rasmus Villemoes wrote: diff --git gcc/match.pd gcc/match.pd index 81c4ee6..04a0bc4 100644 --- gcc/match.pd +++ gcc/match.pd @@ -262,6 +262,16 @@ along with GCC; see the file COPYING3. If not see (abs tree_expr_nonnegative_p@0) @0) +/* x + (x 1) - (x + 1) ~1 */

RFC: Two minor optimization patterns

2015-01-13 Thread Rasmus Villemoes
[My first attempt at submitting a patch for gcc, so please forgive me if I'm not following the right protocol.] Sometimes rounding a variable to the next even integer is written x += x 1. This usually means using an extra register (and hence at least an extra mov instruction) compared to the

Re: RFC: Two minor optimization patterns

2015-01-13 Thread Andrew Pinski
On Tue, Jan 13, 2015 at 2:41 PM, Rasmus Villemoes r...@rasmusvillemoes.dk wrote: [My first attempt at submitting a patch for gcc, so please forgive me if I'm not following the right protocol.] There are a few things missing. For one, a testcase or two for the added optimizations. Sometimes