]> git.ipfire.org Git - thirdparty/gcc.git/commit
rs6000: Fix vector parity support [PR108699]
authorKewen Lin <linkw@linux.ibm.com>
Tue, 4 Apr 2023 02:47:44 +0000 (21:47 -0500)
committerKewen Lin <linkw@linux.ibm.com>
Mon, 17 Apr 2023 05:26:00 +0000 (00:26 -0500)
commitd88e488ec9321e44291fcaf2a3b14333f64aac01
tree699cd115f2656ecf2595d546ec4395656e81af64
parent86aaa079904315f203ddc8cedd1dcfe748b75acc
rs6000: Fix vector parity support [PR108699]

The failures on the original failed case builtin-bitops-1.c
and the associated test case pr108699.c here show that the
current support of parity vector mode is wrong on Power.
The hardware insns vprtyb[wdq] which operate on the least
significant bit of each byte per element, they doesn't match
what RTL opcode parity needs, but the current implementation
expands it with them wrongly.

This patch is to fix the handling with one more insn vpopcntb.

PR target/108699

gcc/ChangeLog:

* config/rs6000/altivec.md (*p9v_parity<mode>2): Rename to ...
(rs6000_vprtyb<mode>2): ... this.
* config/rs6000/rs6000-builtin.def (VPRTYBD): Replace parityv2di2 with
rs6000_vprtybv2di2.
(VPRTYBW): Replace parityv4si2 with rs6000_vprtybv4si2.
(VPRTYBQ): Replace parityv1ti2 with rs6000_vprtybv1ti2.
* config/rs6000/vector.md (parity<mode>2 with VEC_IP): Expand with
popcountv16qi2 and the corresponding rs6000_vprtyb<mode>2.

gcc/testsuite/ChangeLog:

* gcc.target/powerpc/p9-vparity.c: Add scan-assembler-not for vpopcntb
to distinguish parity byte from parity.
* gcc.target/powerpc/pr108699.c: New test.

(cherry picked from commit cdd2d6643f7fef40e335a7027edfea7276cde608)
gcc/config/rs6000/altivec.md
gcc/config/rs6000/rs6000-builtin.def
gcc/config/rs6000/vector.md
gcc/testsuite/gcc.target/powerpc/p9-vparity.c
gcc/testsuite/gcc.target/powerpc/pr108699.c [new file with mode: 0644]