Re: RFC: Two minor optimization patterns

2015-01-14 Thread Richard Biener
On Wed, Jan 14, 2015 at 3:26 PM, Marc Glisse wrote: > On Wed, 14 Jan 2015, Richard Biener wrote: > >> On Wed, Jan 14, 2015 at 1:45 PM, Marc Glisse wrote: >>> >>> On Tue, 13 Jan 2015, Rasmus Villemoes wrote: >>> diff --git gcc/match.pd gcc/match.pd index 81c4ee6..04a0bc4 100644 ---

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 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 C

Re: RFC: Two minor optimization patterns

2015-01-14 Thread Richard Biener
On Wed, Jan 14, 2015 at 1:23 PM, Rasmus Villemoes wrote: > On Wed, Jan 14 2015, Richard Biener wrote: > >> On Tue, Jan 13, 2015 at 11:47 PM, Andrew Pinski wrote: >>> On Tue, Jan 13, 2015 at 2:41 PM, Rasmus Villemoes >>> wrote: [My first attempt at submitting a patch for gcc, so please fo

Re: RFC: Two minor optimization patterns

2015-01-14 Thread Richard Biener
On Wed, Jan 14, 2015 at 1:45 PM, Marc Glisse 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 >> (abs

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 */ +(si

Re: RFC: Two minor optimization patterns

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

Re: RFC: Two minor optimization patterns

2015-01-14 Thread Richard Biener
On Tue, Jan 13, 2015 at 11:47 PM, Andrew Pinski wrote: > On Tue, Jan 13, 2015 at 2:41 PM, Rasmus Villemoes > 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 tw

Re: RFC: Two minor optimization patterns

2015-01-13 Thread Andrew Pinski
On Tue, Jan 13, 2015 at 2:41 PM, Rasmus Villemoes 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 rounding a variable

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 equ