Hi all,

This patch adds codegen for FEAT_CSSC from the 2022 Architecture extensions.
It fits various existing optabs in GCC quite well.
There are instructions for scalar signed/unsigned min/max, abs, ctz, popcount.
We have expanders for these already, so they are wired up to emit single-insn
patterns for the new TARGET_CSSC.

These instructions are enabled by the +cssc command-line extension.
Bootstrapped and tested on aarch64-none-linux-gnu.

I'll push it once the Binutils patch from Andre for this gets committed

Thanks,
Kyrill

gcc/ChangeLog:

        * config/aarch64/aarch64-option-extensions.def (cssc): Define.
        * config/aarch64/aarch64.h (AARCH64_ISA_CSSC): Define.
        (TARGET_CSSC): Likewise.
        * config/aarch64/aarch64.md (aarch64_abs<mode>2_insn): New define_insn.
        (abs<mode>2): Adjust for the above.
        (aarch64_umax<mode>3_insn): New define_insn.
        (umax<mode>3): Adjust for the above.
        (aarch64_popcount<mode>2_insn): New define_insn.
        (popcount<mode>2): Adjust for the above.
        (<optab><mode>3): New define_insn.
        * config/aarch64/constraints.md (Usm): Define.
        (Uum): Likewise.
        * 
doc/gcc/gcc-command-options/machine-dependent-options/aarch64-options.rst:
        Document +cssc.
        * config/aarch64/iterators.md (MAXMIN_NOUMAX): New code iterator.
        * config/aarch64/predicates.md (aarch64_sminmax_immediate): Define.
        (aarch64_sminmax_operand): Likewise.
        (aarch64_uminmax_immediate): Likewise.
        (aarch64_uminmax_operand): Likewise.

gcc/testsuite/ChangeLog:

        * gcc.target/aarch64/cssc_1.c: New test.
        * gcc.target/aarch64/cssc_2.c: New test.
        * gcc.target/aarch64/cssc_3.c: New test.
        * gcc.target/aarch64/cssc_4.c: New test.
        * gcc.target/aarch64/cssc_5.c: New test.

Attachment: cssc.patch
Description: cssc.patch

Reply via email to