]> git.ipfire.org Git - thirdparty/gcc.git/commit
s390: arch15: Count leading/trailing zeros
authorStefan Schulze Frielinghaus <stefansf@gcc.gnu.org>
Mon, 20 Jan 2025 09:01:09 +0000 (10:01 +0100)
committerStefan Schulze Frielinghaus <stefansf@gcc.gnu.org>
Mon, 20 Jan 2025 09:01:09 +0000 (10:01 +0100)
commit0f0b91ef70218e2cb4ab795ef04725a68ea04b15
treea1bec0e971e9c762ce9c9cd81eab68b32dfccb86
parent41a69915d06a707bb6c80cc15555ebf5d1c1396d
s390: arch15: Count leading/trailing zeros

Add vector single element 128-bit integer support utilizing new
instructions vclzq and vctzq.  Furthermore, add scalar 64-bit integer
support utilizing new instructions clzg and ctzg.  For ctzg, also define
the resulting value if the input operand equals zero.

gcc/ChangeLog:

* config/s390/s390-builtins.def (s390_vec_cntlz): Add 128-bit
integer overloads.
(s390_vclzq): Add.
(s390_vec_cnttz): Add 128-bit integer overloads.
(s390_vctzq): Add.
* config/s390/s390-builtin-types.def: Update accordingly.
* config/s390/s390.h (CTZ_DEFINED_VALUE_AT_ZERO): Define.
* config/s390/s390.md (*clzg): New insn.
(clztidi2): Exploit new insn for target arch15.
(ctzdi2): New insn.
* config/s390/vector.md (clz<mode>2): Extend modes including
128-bit integer.
(ctz<mode>2): Likewise.
gcc/config/s390/s390-builtin-types.def
gcc/config/s390/s390-builtins.def
gcc/config/s390/s390.h
gcc/config/s390/s390.md
gcc/config/s390/vector.md