This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFC: Two minor optimization patterns
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Rasmus Villemoes <rv at rasmusvillemoes dot dk>
- Date: Wed, 14 Jan 2015 14:51:37 +0100
- Subject: Re: RFC: Two minor optimization patterns
- Authentication-results: sourceware.org; auth=none
- References: <877fwquwug dot fsf at rasmusvillemoes dot dk> <alpine dot DEB dot 2 dot 11 dot 1501141340340 dot 2186 at laptop-mg dot saclay dot inria dot fr>
On Wed, Jan 14, 2015 at 1:45 PM, Marc Glisse <marc.glisse@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
>> (abs tree_expr_nonnegative_p@0)
>> @0)
>>
>> +/* x + (x & 1) -> (x + 1) & ~1 */
>> +(simplify
>> + (plus @0 (bit_and @0 integer_onep@1))
>> + (bit_and (plus @0 @1) (bit_not @1)))
>> +
>> +/* x | ~(x | y) -> x | ~y */
>> +(simplify
>> + (bit_ior @0 (bit_not (bit_ior @0 @1)))
>> + (bit_ior @0 (bit_not @1)))
>
>
> You may want to consider using has_single_use (see other patterns).
Just to clarify, you mean on the (x | y) sub-expression?
Richard.
> --
> Marc Glisse