]> git.ipfire.org Git - thirdparty/gcc.git/commit
aarch64: Improve popcount for bytes [PR113042]
authorAndrew Pinski <quic_apinski@quicinc.com>
Mon, 10 Jun 2024 00:39:54 +0000 (00:39 +0000)
committerAndrew Pinski <quic_apinski@quicinc.com>
Fri, 16 Aug 2024 06:55:55 +0000 (23:55 -0700)
commitfcc3af9949880476c4ed01a98bd7f5d7f29b7b16
treee7adab9130bc2f65d47994a4b379002813e405f6
parent1b8b53ef75c143cddc114705c97c74d9c8f7a64b
aarch64: Improve popcount for bytes [PR113042]

For popcount for bytes, we don't need the reduction addition
after the vector cnt instruction as we are only counting one
byte's popcount.
This changes the popcount extend to cover all ALLI rather than GPI.

Changes since v1:
* v2 - Use ALLI iterator and combine all into one pattern.
       Add new testcases popcnt[6-8].c.
* v3 - Simplify TARGET_CSSC path.
       Use convert_to_mode instead of gen_zero_extend* directly.
       Some other small cleanups.

Bootstrapped and tested on aarch64-linux-gnu with no regressions.

PR target/113042

gcc/ChangeLog:

* config/aarch64/aarch64.md (popcount<mode>2): Update pattern
to support ALLI modes.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/popcnt5.c: New test.
* gcc.target/aarch64/popcnt6.c: New test.
* gcc.target/aarch64/popcnt7.c: New test.
* gcc.target/aarch64/popcnt8.c: New test.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
gcc/config/aarch64/aarch64.md
gcc/testsuite/gcc.target/aarch64/popcnt5.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/popcnt6.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/popcnt7.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/popcnt8.c [new file with mode: 0644]