fold-const.c (tree_nonzero_bits): New function.
authorRoger Sayle <roger@nextmovesoftware.com>
Thu, 24 May 2018 20:47:03 +0000 (20:47 +0000)
committerJeff Law <law@gcc.gnu.org>
Thu, 24 May 2018 20:47:03 +0000 (14:47 -0600)
commitba6557e2686306942b157c3350e7497e551afb80
tree4a8896b5cc8eb4200c03939215754c0b775e381e
parent520fe2e324da4b1aa2c1fbac29741bd45afa98c1
fold-const.c (tree_nonzero_bits): New function.

        * fold-const.c (tree_nonzero_bits): New function.
        * fold-const.h (tree_nonzero_bits): Likewise.
        * match.pd (POPCOUNT): New patterns to fold BUILTIN_POPCOUNT and
        friends.  POPCOUNT(x&1) => x&1, POPCOUNT(x)==0 => x==0, etc.

        * gcc.dg/fold-popcount-1.c: New testcase.
        * gcc.dg/fold-popcount-2.c: New testcase.
        * gcc.dg/fold-popcount-3.c: New testcase.
        * gcc.dg/fold-popcount-4.c: New testcase.

From-SVN: r260689
gcc/ChangeLog
gcc/fold-const.c
gcc/fold-const.h
gcc/match.pd
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/fold-popcount-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fold-popcount-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fold-popcount-3.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/fold-popcount-4.c [new file with mode: 0644]