]> git.ipfire.org Git - thirdparty/gcc.git/commit
AArch64: Improve ctz and ffs
authorWilco Dijkstra <wilco.dijkstra@arm.com>
Thu, 6 Nov 2025 20:49:22 +0000 (20:49 +0000)
committerWilco Dijkstra <wilco.dijkstra@arm.com>
Thu, 27 Nov 2025 16:53:33 +0000 (16:53 +0000)
commit7fdfeb27c6945c98cff3edf399c855c6df44fa1e
tree142733712d19756d7909c6fc63b745a30d5fb65f
parenta3d141316c413256adc59f49cb9094d3f76a017f
AArch64: Improve ctz and ffs

Use the ctz insn in the ffs expansion so it uses ctz if CSSC
is available. Rather than splitting, keep ctz as a single
insn for simplicity and possible fusion opportunities.
Move clz, ctz, clrsb, rbit and ffs instructions together.

gcc:
* config/aarch64/aarch64.md (ffs<mode>2): Use gen_ctz.
(ctz<mode>2): Model ctz as a single target instruction.

gcc/testsuite:
* gcc.target/aarch64/ffs.c: Improve test.
gcc/config/aarch64/aarch64.md
gcc/testsuite/gcc.target/aarch64/ffs.c