[Bug target/108699] gcc.c-torture/execute/builtin-bitops-1.c fails on power 9 BE
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108699 Kewen Lin changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #9 from Kewen Lin --- (In reply to Peter Bergner from comment #8) > Can this be marked as FIXED or is there more to do? Yeah, the issue should be fixed everywhere, thanks for reminding!
[Bug target/108699] gcc.c-torture/execute/builtin-bitops-1.c fails on power 9 BE
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108699 --- Comment #8 from Peter Bergner --- Can this be marked as FIXED or is there more to do?
[Bug target/108699] gcc.c-torture/execute/builtin-bitops-1.c fails on power 9 BE
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108699 --- Comment #7 from CVS Commits --- The releases/gcc-10 branch has been updated by Kewen Lin : https://gcc.gnu.org/g:d88e488ec9321e44291fcaf2a3b14333f64aac01 commit r10-11291-gd88e488ec9321e44291fcaf2a3b14333f64aac01 Author: Kewen Lin Date: Mon Apr 3 21:47:44 2023 -0500 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_parity2): Rename to ... (rs6000_vprtyb2): ... 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 (parity2 with VEC_IP): Expand with popcountv16qi2 and the corresponding rs6000_vprtyb2. 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)
[Bug target/108699] gcc.c-torture/execute/builtin-bitops-1.c fails on power 9 BE
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108699 --- Comment #6 from CVS Commits --- The releases/gcc-11 branch has been updated by Kewen Lin : https://gcc.gnu.org/g:6872f055d7d4fd36b804bdd9b5a8a128b01aacbc commit r11-10628-g6872f055d7d4fd36b804bdd9b5a8a128b01aacbc Author: Kewen Lin Date: Sun Apr 16 22:31:01 2023 -0500 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_parity2): Rename to ... (rs6000_vprtyb2): ... 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 (parity2 with VEC_IP): Expand with popcountv16qi2 and the corresponding rs6000_vprtyb2. 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)
[Bug target/108699] gcc.c-torture/execute/builtin-bitops-1.c fails on power 9 BE
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108699 --- Comment #5 from CVS Commits --- The releases/gcc-12 branch has been updated by Kewen Lin : https://gcc.gnu.org/g:de8f86e151d29c6c2ebb224b5587284714cd6cfa commit r12-9406-gde8f86e151d29c6c2ebb224b5587284714cd6cfa Author: Kewen Lin Date: Mon Apr 3 21:47:44 2023 -0500 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_parity2): Rename to ... (rs6000_vprtyb2): ... this. * config/rs6000/rs6000-builtins.def (VPRTYBD): Replace parityv2di2 with rs6000_vprtybv2di2. (VPRTYBW): Replace parityv4si2 with rs6000_vprtybv4si2. (VPRTYBQ): Replace parityv1ti2 with rs6000_vprtybv1ti2. * config/rs6000/vector.md (parity2 with VEC_IP): Expand with popcountv16qi2 and the corresponding rs6000_vprtyb2. 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)
[Bug target/108699] gcc.c-torture/execute/builtin-bitops-1.c fails on power 9 BE
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108699 --- Comment #4 from CVS Commits --- The master branch has been updated by Kewen Lin : https://gcc.gnu.org/g:cdd2d6643f7fef40e335a7027edfea7276cde608 commit r13-6993-gcdd2d6643f7fef40e335a7027edfea7276cde608 Author: Kewen Lin Date: Mon Apr 3 21:47:44 2023 -0500 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_parity2): Rename to ... (rs6000_vprtyb2): ... this. * config/rs6000/rs6000-builtins.def (VPRTYBD): Replace parityv2di2 with rs6000_vprtybv2di2. (VPRTYBW): Replace parityv4si2 with rs6000_vprtybv4si2. (VPRTYBQ): Replace parityv1ti2 with rs6000_vprtybv1ti2. * config/rs6000/vector.md (parity2 with VEC_IP): Expand with popcountv16qi2 and the corresponding rs6000_vprtyb2. 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.
[Bug target/108699] gcc.c-torture/execute/builtin-bitops-1.c fails on power 9 BE
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108699 --- Comment #3 from Kewen Lin --- One more test case fail with abort on both LE & BE (with -Ofast -mcpu=power9): #define N 16 unsigned long long vals[N]; unsigned int res[N]; unsigned int expects[N] = {0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}; unsigned long long inputs[N] = {0xULL, 0x0001ULL, 0x8000ULL, 0x0002ULL, 0x4000ULL, 0x0001ULL, 0x8000ULL, 0xa5a5a5a5a5a5a5a5ULL, 0x5a5a5a5a5a5a5a5aULL, 0xcafecafeULL, 0xcafecafeULL, 0xcafecafeULL, 0x80706000ULL, 0xULL}; __attribute__ ((noipa)) void init () { for (int i = 0; i < N; i++) vals[i] = inputs[i]; } __attribute__ ((noipa)) void do_parity () { for (int i = 0; i < N; i++) res[i] = __builtin_parityll (vals[i]); } int main (void) { init (); do_parity (); for (int i = 0; i < N; i++) if (res[i] != expects[i]) __builtin_abort(); return 0; }
[Bug target/108699] gcc.c-torture/execute/builtin-bitops-1.c fails on power 9 BE
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108699 --- Comment #2 from Segher Boessenkool --- Right, it needs a vpopcntb or similar first.
[Bug target/108699] gcc.c-torture/execute/builtin-bitops-1.c fails on power 9 BE
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108699 Kewen Lin changed: What|Removed |Added Last reconfirmed||2023-02-14 CC||linkw at gcc dot gnu.org, ||meissner at gcc dot gnu.org, ||segher at gcc dot gnu.org Assignee|unassigned at gcc dot gnu.org |linkw at gcc dot gnu.org Ever confirmed|0 |1 Status|UNCONFIRMED |ASSIGNED --- Comment #1 from Kewen Lin --- Confirmed. This is due to one latent bug. When specifying -Os, it doesn't try to use SImode parity any more, but tries to use wider mode TImode parity instead, it resulted in the wrong result. The current vector parity (including TImode) support is wrong: ;; Vector parity (define_insn "*p9v_parity2" [(set (match_operand:VParity 0 "register_operand" "=v") (parity:VParity (match_operand:VParity 1 "register_operand" "v")))] "TARGET_P9_VECTOR" "vprtyb %0,%1" [(set_attr "type" "vecsimple")]) The vprtyb[dwq] is for byte parity, it doesn't match the RTL parity semantic directly.