public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/108699] New: gcc.c-torture/execute/builtin-bitops-1.c fails on power 9 BE
@ 2023-02-07 15:01 seurer at gcc dot gnu.org
  2023-02-14 12:12 ` [Bug target/108699] " linkw at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: seurer at gcc dot gnu.org @ 2023-02-07 15:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108699

            Bug ID: 108699
           Summary: gcc.c-torture/execute/builtin-bitops-1.c fails on
                    power 9 BE
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: seurer at gcc dot gnu.org
  Target Milestone: ---

This fails for 32 bits powerpc64 BE on a power 9 (only) and it fails for trunk
and gcc 12, 11, and 10.

make  -k check-gcc RUNTESTFLAGS="--target_board=unix'{-m32}'
execute.exp=gcc.c-torture/execute/builtin-bitops-1.c"
FAIL: gcc.c-torture/execute/builtin-bitops-1.c   -Os  execution test
# of expected passes            15
# of unexpected failures        1

spawn -ignore SIGHUP 
^M
PASS: gcc.c-torture/execute/builtin-bitops-1.c   -Os  (test for excess errors)
Setting LD_LIBRARY_PATH to
:/home/seurer/gcc/git/build/gcc-test/gcc:/home/seurer/gcc/git/build/gcc-test/gcc/32::/home/seurer/gcc/git/build/gcc-test/gcc:/home/seurer/gcc/git/build/gcc-test/gcc/32:/home/seurer/gcc/git/build/gcc-test/./gmp/.libs:/home/seurer/gcc/git/build/gcc-test/./prev-gmp/.libs:/home/seurer/gcc/git/build/gcc-test/./mpfr/src/.libs:/home/seurer/gcc/git/build/gcc-test/./prev-mpfr/src/.libs:/home/seurer/gcc/git/build/gcc-test/./mpc/src/.libs:/home/seurer/gcc/git/build/gcc-test/./prev-mpc/src/.libs:/home/seurer/gcc/git/build/gcc-test/./isl/.libs:/home/seurer/gcc/git/build/gcc-test/./prev-isl/.libs
Execution timeout is: 300
spawn [open ...]^M
FAIL: gcc.c-torture/execute/builtin-bitops-1.c   -Os  execution test


(gdb) run
Starting program: /home/seurer/gcc/git/build/gcc-test/builtin-bitops-1.exe 
Program received signal SIGABRT, Aborted.
0x0fd737a0 in ?? () from /lib32/libc.so.6
(gdb) where
#0  0x0fd737a0 in ?? () from /lib32/libc.so.6
#1  0x0fd15424 in raise () from /lib32/libc.so.6
#2  0x0fcfa428 in abort () from /lib32/libc.so.6
#3  0x10000408 in main () at
/home/seurer/gcc/git/gcc-test/gcc/testsuite/gcc.c-torture/execute/builtin-bitops-1.c:182


There are a bunch of aborts in this test but the reported line # must be off.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/108699] gcc.c-torture/execute/builtin-bitops-1.c fails on power 9 BE
  2023-02-07 15:01 [Bug target/108699] New: gcc.c-torture/execute/builtin-bitops-1.c fails on power 9 BE seurer at gcc dot gnu.org
@ 2023-02-14 12:12 ` linkw at gcc dot gnu.org
  2023-02-14 17:39 ` segher at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: linkw at gcc dot gnu.org @ 2023-02-14 12:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108699

Kewen Lin <linkw at gcc dot gnu.org> 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 <linkw at gcc dot gnu.org> ---
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_parity<mode>2"
  [(set (match_operand:VParity 0 "register_operand" "=v")
        (parity:VParity (match_operand:VParity 1 "register_operand" "v")))]
  "TARGET_P9_VECTOR"
  "vprtyb<wd> %0,%1"
  [(set_attr "type" "vecsimple")])

The vprtyb[dwq] is for byte parity, it doesn't match the RTL parity semantic
directly.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/108699] gcc.c-torture/execute/builtin-bitops-1.c fails on power 9 BE
  2023-02-07 15:01 [Bug target/108699] New: gcc.c-torture/execute/builtin-bitops-1.c fails on power 9 BE seurer at gcc dot gnu.org
  2023-02-14 12:12 ` [Bug target/108699] " linkw at gcc dot gnu.org
@ 2023-02-14 17:39 ` segher at gcc dot gnu.org
  2023-02-15  2:34 ` linkw at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: segher at gcc dot gnu.org @ 2023-02-14 17:39 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108699

--- Comment #2 from Segher Boessenkool <segher at gcc dot gnu.org> ---
Right, it needs a vpopcntb or similar first.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/108699] gcc.c-torture/execute/builtin-bitops-1.c fails on power 9 BE
  2023-02-07 15:01 [Bug target/108699] New: gcc.c-torture/execute/builtin-bitops-1.c fails on power 9 BE seurer at gcc dot gnu.org
  2023-02-14 12:12 ` [Bug target/108699] " linkw at gcc dot gnu.org
  2023-02-14 17:39 ` segher at gcc dot gnu.org
@ 2023-02-15  2:34 ` linkw at gcc dot gnu.org
  2023-04-04  5:13 ` cvs-commit at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: linkw at gcc dot gnu.org @ 2023-02-15  2:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108699

--- Comment #3 from Kewen Lin <linkw at gcc dot gnu.org> ---
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]
  = {0x0000000000000000ULL, 0x0000000000000001ULL, 0x8000000000000000ULL,
     0x0000000000000002ULL, 0x4000000000000000ULL, 0x0000000100000000ULL,
     0x0000000080000000ULL, 0xa5a5a5a5a5a5a5a5ULL, 0x5a5a5a5a5a5a5a5aULL,
     0xcafecafe00000000ULL, 0x0000cafecafe0000ULL, 0x00000000cafecafeULL,
     0x8070600000000000ULL, 0xffffffffffffffffULL};

__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;
}

----

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/108699] gcc.c-torture/execute/builtin-bitops-1.c fails on power 9 BE
  2023-02-07 15:01 [Bug target/108699] New: gcc.c-torture/execute/builtin-bitops-1.c fails on power 9 BE seurer at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-02-15  2:34 ` linkw at gcc dot gnu.org
@ 2023-04-04  5:13 ` cvs-commit at gcc dot gnu.org
  2023-04-17  9:06 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-04  5:13 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108699

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Kewen Lin <linkw@gcc.gnu.org>:

https://gcc.gnu.org/g:cdd2d6643f7fef40e335a7027edfea7276cde608

commit r13-6993-gcdd2d6643f7fef40e335a7027edfea7276cde608
Author: Kewen Lin <linkw@linux.ibm.com>
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_parity<mode>2): Rename to ...
            (rs6000_vprtyb<mode>2): ... 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 (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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/108699] gcc.c-torture/execute/builtin-bitops-1.c fails on power 9 BE
  2023-02-07 15:01 [Bug target/108699] New: gcc.c-torture/execute/builtin-bitops-1.c fails on power 9 BE seurer at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-04-04  5:13 ` cvs-commit at gcc dot gnu.org
@ 2023-04-17  9:06 ` cvs-commit at gcc dot gnu.org
  2023-04-17  9:08 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-17  9:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108699

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Kewen Lin <linkw@gcc.gnu.org>:

https://gcc.gnu.org/g:de8f86e151d29c6c2ebb224b5587284714cd6cfa

commit r12-9406-gde8f86e151d29c6c2ebb224b5587284714cd6cfa
Author: Kewen Lin <linkw@linux.ibm.com>
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_parity<mode>2): Rename to ...
            (rs6000_vprtyb<mode>2): ... 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 (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)

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/108699] gcc.c-torture/execute/builtin-bitops-1.c fails on power 9 BE
  2023-02-07 15:01 [Bug target/108699] New: gcc.c-torture/execute/builtin-bitops-1.c fails on power 9 BE seurer at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2023-04-17  9:06 ` cvs-commit at gcc dot gnu.org
@ 2023-04-17  9:08 ` cvs-commit at gcc dot gnu.org
  2023-04-17  9:09 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-17  9:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108699

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Kewen Lin <linkw@gcc.gnu.org>:

https://gcc.gnu.org/g:6872f055d7d4fd36b804bdd9b5a8a128b01aacbc

commit r11-10628-g6872f055d7d4fd36b804bdd9b5a8a128b01aacbc
Author: Kewen Lin <linkw@linux.ibm.com>
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_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)

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/108699] gcc.c-torture/execute/builtin-bitops-1.c fails on power 9 BE
  2023-02-07 15:01 [Bug target/108699] New: gcc.c-torture/execute/builtin-bitops-1.c fails on power 9 BE seurer at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2023-04-17  9:08 ` cvs-commit at gcc dot gnu.org
@ 2023-04-17  9:09 ` cvs-commit at gcc dot gnu.org
  2023-06-02  4:15 ` bergner at gcc dot gnu.org
  2023-06-02  4:42 ` linkw at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-17  9:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108699

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Kewen Lin <linkw@gcc.gnu.org>:

https://gcc.gnu.org/g:d88e488ec9321e44291fcaf2a3b14333f64aac01

commit r10-11291-gd88e488ec9321e44291fcaf2a3b14333f64aac01
Author: Kewen Lin <linkw@linux.ibm.com>
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_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)

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/108699] gcc.c-torture/execute/builtin-bitops-1.c fails on power 9 BE
  2023-02-07 15:01 [Bug target/108699] New: gcc.c-torture/execute/builtin-bitops-1.c fails on power 9 BE seurer at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2023-04-17  9:09 ` cvs-commit at gcc dot gnu.org
@ 2023-06-02  4:15 ` bergner at gcc dot gnu.org
  2023-06-02  4:42 ` linkw at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: bergner at gcc dot gnu.org @ 2023-06-02  4:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108699

--- Comment #8 from Peter Bergner <bergner at gcc dot gnu.org> ---
Can this be marked as FIXED or is there more to do?

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/108699] gcc.c-torture/execute/builtin-bitops-1.c fails on power 9 BE
  2023-02-07 15:01 [Bug target/108699] New: gcc.c-torture/execute/builtin-bitops-1.c fails on power 9 BE seurer at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2023-06-02  4:15 ` bergner at gcc dot gnu.org
@ 2023-06-02  4:42 ` linkw at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: linkw at gcc dot gnu.org @ 2023-06-02  4:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108699

Kewen Lin <linkw at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #9 from Kewen Lin <linkw at gcc dot gnu.org> ---
(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!

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-06-02  4:42 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-07 15:01 [Bug target/108699] New: gcc.c-torture/execute/builtin-bitops-1.c fails on power 9 BE seurer at gcc dot gnu.org
2023-02-14 12:12 ` [Bug target/108699] " linkw at gcc dot gnu.org
2023-02-14 17:39 ` segher at gcc dot gnu.org
2023-02-15  2:34 ` linkw at gcc dot gnu.org
2023-04-04  5:13 ` cvs-commit at gcc dot gnu.org
2023-04-17  9:06 ` cvs-commit at gcc dot gnu.org
2023-04-17  9:08 ` cvs-commit at gcc dot gnu.org
2023-04-17  9:09 ` cvs-commit at gcc dot gnu.org
2023-06-02  4:15 ` bergner at gcc dot gnu.org
2023-06-02  4:42 ` linkw at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).