[Bug target/114224] popcount RTL cost seems wrong with cssc
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Mar 4 07:58:36 GMT 2024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114224
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
This is a matter of rtl costs.
.POPCOUNT expansion in expand_POPCOUNT expands the sequence both ways and asks
the backend what is cheaper:
/* If .POPCOUNT call has 2 arguments, match_single_bit_test marked it
because the result is only used in an equality comparison against 1.
Use rtx costs in that case to determine if .POPCOUNT (arg) == 1
or (arg ^ (arg - 1)) > arg - 1 is cheaper.
If .POPCOUNT second argument is 0, we additionally know that arg
is non-zero, so use arg & (arg - 1) == 0 instead. */
More information about the Gcc-bugs
mailing list