tree-ssa-math-opts: popcount (X) == 1 to (X ^ (X - 1)) > (X - 1) optimization for...
commit103a3966bc7b68f91b6cd3c5beb330c4b8570c90
authorJakub Jelinek <jakub@redhat.com>
Mon, 20 Nov 2023 09:03:20 +0000 (20 10:03 +0100)
committerJakub Jelinek <jakub@redhat.com>
Mon, 20 Nov 2023 09:03:20 +0000 (20 10:03 +0100)
tree5f926122f5850a4bc55de2a1efa2c50548735a10
parentd0b6b7f8a6b8115b033441590a6304fb088d193c
tree-ssa-math-opts: popcount (X) == 1 to (X ^ (X - 1)) > (X - 1) optimization for direct optab [PR90693]

On Fri, Nov 17, 2023 at 03:01:04PM +0100, Jakub Jelinek wrote:
> As a follow-up, I'm considering changing in this routine the popcount
> call to IFN_POPCOUNT with 2 arguments and during expansion test costs.

Here is the follow-up which does the rtx costs testing.

2023-11-20  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/90693
* tree-ssa-math-opts.cc (match_single_bit_test): Mark POPCOUNT with
result only used in equality comparison against 1 with direct optab
support as .POPCOUNT call with 2 arguments.
* internal-fn.h (expand_POPCOUNT): Declare.
* internal-fn.def (DEF_INTERNAL_INT_EXT_FN): New macro, document it,
undefine at the end.
(POPCOUNT): Use it instead of DEF_INTERNAL_INT_FN.
* internal-fn.cc (DEF_INTERNAL_INT_EXT_FN): Define to nothing before
inclusion to define expanders.
(expand_POPCOUNT): New function.
gcc/internal-fn.cc
gcc/internal-fn.def
gcc/internal-fn.h
gcc/tree-ssa-math-opts.cc