[patch fold-const.c]: Add some missing optimizations about binary and and truth-not

Richard Guenther richard.guenther@gmail.com
Mon Jun 20 11:50:00 GMT 2011


On Mon, Jun 20, 2011 at 12:23 PM, Kai Tietz <ktietz70@googlemail.com> wrote:
> Hello,
>
> this patch adds to fold_binary_loc some missing optimization for binary
> and operations on truth-not expressions.
> Added cases are:
>  (!X & X) is always zero.
>  (X & !X) is always zero.
>  (X == 0) & X is always zero.
>  X & (X == 0) is always zero.
>  !X & 1 is X == 0
>
> ChangeLog
>
> 2011-06-20  Kai Tietz  <ktietz@redhat.com>
>
>        * fold-const.c (fold_binary_loc): Add missing
>        folding for truth-not operations in combination
>        with binary and.
>
> ChangeLog
>
> 2011-06-20  Kai Tietz  <ktietz@redhat.com>
>
>        * gcc.dg/binop-notand1.c: New test.
>        * gcc.dg/binop-notand2.c: New test.
>        * gcc.dg/binop-notand3.c: New test.
>        * gcc.dg/binop-notand4.c: New test.
>        * gcc.dg/binop-notand5.c: New test.
>        * gcc.dg/binop-notand6.c: New test.
>
> Boostrapped and tested for x86_64-pc-linux-gnu. Ok for apply?

Ok.

Thanks,
Richard.

> Regards,
> Kai
>



More information about the Gcc-patches mailing list