]> gcc.gnu.org Git - gcc.git/commit
range-ops: Calculate the popcount of a singleton.
authorAldy Hernandez <aldyh@redhat.com>
Tue, 27 Sep 2022 08:30:00 +0000 (10:30 +0200)
committerAldy Hernandez <aldyh@redhat.com>
Tue, 27 Sep 2022 15:02:11 +0000 (17:02 +0200)
commit001c60ccfeaf9a480a56203418af804ad42e88b9
tree6063fd6a3ed81175459c4f1a848f1fc625da8017
parent971bc0aae9cf52abe9a6fcab3b7c25d1fa94ad1e
range-ops: Calculate the popcount of a singleton.

The legacy popcount folding didn't actually fold singleton ranges.
I don't think anyone noticed because there are match.pd patterns that
fold __builtin_popcount using the global nonzero bits set by CCP.

It's good form to handle this, even without CCP's help.

Tested on x86-64 Linux.

gcc/ChangeLog:

* gimple-range-op.cc (cfn_popcount): Calculate the popcount of a
singleton.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/popcount6b.c: New test.
gcc/gimple-range-op.cc
gcc/testsuite/gcc.dg/tree-ssa/popcount6b.c [new file with mode: 0644]
This page took 0.061797 seconds and 6 git commands to generate.