Bug 108807 - [11/12 regression] gcc.target/powerpc/vsx-builtin-10d.c fails after r11-6857-gb29225597584b6 on power 9 BE
Summary: [11/12 regression] gcc.target/powerpc/vsx-builtin-10d.c fails after r11-6857-...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 11.3.1
: P2 normal
Target Milestone: 11.4
Assignee: Kewen Lin
URL:
Keywords: wrong-code
: 108814 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-02-15 19:16 UTC by seurer
Modified: 2023-04-17 09:10 UTC (History)
5 users (show)

See Also:
Host: powerpc64-linux-gnu
Target: powerpc64-linux-gnu
Build: powerpc64-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2023-02-16 00:00:00


Attachments
untested patch (1.38 KB, patch)
2023-02-17 04:09 UTC, Kewen Lin
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description seurer 2023-02-15 19:16:36 UTC
g:b29225597584b697762585e0b707b7cb4b427650
make  -k check-gcc RUNTESTFLAGS="powerpc.exp=gcc.target/powerpc/vsx-builtin-10d.c"
FAIL: gcc.target/powerpc/vsx-builtin-10d.c execution test
# of expected passes		1
# of unexpected failures	1

This fails on power 9 BE (only) and fails for trunk as well as gcc 12 and 11.  It works with gcc 10.  It started with this commit in gcc 11.

seurer@perfzep2:~/gcc/git/build/gcc-test$ gdb ./vsx-builtin-10d.exe 
(gdb) run
Starting program: /home/seurer/gcc/git/build/gcc-test/vsx-builtin-10d.exe 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/powerpc64-linux-gnu/libthread_db.so.1".

Program received signal SIGABRT, Aborted.
__pthread_kill_implementation (threadid=<optimized out>, signo=<optimized out>, no_tid=<optimized out>) at pthread_kill.c:44
44	pthread_kill.c: No such file or directory.
(gdb) where
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=<optimized out>, no_tid=<optimized out>) at pthread_kill.c:44
#1  0x00007ffff7c90cb4 in __GI_raise (sig=<optimized out>) at ../sysdeps/posix/raise.c:26
#2  0x00007ffff7c749ec in __GI_abort () at abort.c:79
#3  0x0000000010000670 in main (argc=<optimized out>, argv=<optimized out>) at /home/seurer/gcc/git/gcc-test/gcc/testsuite/gcc.target/powerpc/vsx-builtin-10d.c:124


  sv = ci (sv, 5, CONST6);
  if (sv [5] != CONST6)
    abort (); // line 124


There are actually a bunch of similar failures

FAIL: gcc.target/powerpc/vsx-builtin-10d.c execution test
FAIL: gcc.target/powerpc/vsx-builtin-10d.c execution test
FAIL: gcc.target/powerpc/vsx-builtin-11d.c execution test
FAIL: gcc.target/powerpc/vsx-builtin-11d.c execution test
FAIL: gcc.target/powerpc/vsx-builtin-14d.c execution test
FAIL: gcc.target/powerpc/vsx-builtin-14d.c execution test
FAIL: gcc.target/powerpc/vsx-builtin-16d.c execution test
FAIL: gcc.target/powerpc/vsx-builtin-16d.c execution test
FAIL: gcc.target/powerpc/vsx-builtin-18d.c execution test
FAIL: gcc.target/powerpc/vsx-builtin-18d.c execution test
FAIL: gcc.target/powerpc/vsx-builtin-9d.c execution test
FAIL: gcc.target/powerpc/vsx-builtin-9d.c execution test


commit b29225597584b697762585e0b707b7cb4b427650 (HEAD)
Author: Xionghu Luo <luoxhu@linux.ibm.com>
Date:   Thu Jan 21 21:01:24 2021 -0600

    rs6000: Support variable insert and Expand vec_insert in expander [PR79251]
Comment 1 Kewen Lin 2023-02-16 07:41:56 UTC
Confirmed.

It's likely an endianess issue, I'll have a look first.
Comment 2 Kewen Lin 2023-02-17 04:09:22 UTC
Created attachment 54478 [details]
untested patch

The lvsr and lvsl for generating permutation control vectors only works for LE as the element ordering is different on LE and BE. The proposed patch is to fix gen function for generating permutation control vectors by considering endianness.

It can fix the exposed failures on vsx-builtin-{9,10,11,14,16,18}d.c, and a full testing is ongoing.
Comment 3 Kewen Lin 2023-02-17 05:26:17 UTC
*** Bug 108814 has been marked as a duplicate of this bug. ***
Comment 4 GCC Commits 2023-04-04 05:13:42 UTC
The master branch has been updated by Kewen Lin <linkw@gcc.gnu.org>:

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

commit r13-6994-gd634e6088f139ee700d79ec73b1ad6436096a6ff
Author: Kewen Lin <linkw@linux.ibm.com>
Date:   Mon Apr 3 21:47:54 2023 -0500

    rs6000: Fix vector_set_var_p9 by considering BE [PR108807]
    
    As PR108807 exposes, the current handling in function
    rs6000_expand_vector_set_var_p9 doesn't take care of big
    endianness.  Currently the function is to rotate the
    target vector by moving element to-be-set to element 0,
    set element 0 with the given val, then rotate back.  To
    get the permutation control vector for the rotation, it
    makes use of lvsr and lvsl, but the element ordering is
    different for BE and LE (like element 0 is the most
    significant one on BE while the least significant one on
    LE), this patch is to add consideration for BE and make
    sure permutation control vectors for rotations are expected.
    
    As tested, it helped to fix the below failures:
    
    FAIL: gcc.target/powerpc/pr79251-run.p9.c execution test
    FAIL: gcc.target/powerpc/pr89765-mc.c execution test
    FAIL: gcc.target/powerpc/vsx-builtin-10d.c execution test
    FAIL: gcc.target/powerpc/vsx-builtin-11d.c execution test
    FAIL: gcc.target/powerpc/vsx-builtin-14d.c execution test
    FAIL: gcc.target/powerpc/vsx-builtin-16d.c execution test
    FAIL: gcc.target/powerpc/vsx-builtin-18d.c execution test
    FAIL: gcc.target/powerpc/vsx-builtin-9d.c execution test
            PR target/108807
    
    gcc/ChangeLog:
    
            * config/rs6000/rs6000.cc (rs6000_expand_vector_set_var_p9): Fix gen
            function for permutation control vector by considering big endianness.
Comment 5 Jeffrey A. Law 2023-04-14 15:33:23 UTC
Kewen, is this BZ fixed on the trunk?  If so we should update the title by dropping the "/13" so that's not flagged as a gcc-13 regression.
Comment 6 Kewen Lin 2023-04-15 09:55:55 UTC
(In reply to Jeffrey A. Law from comment #5)
> Kewen, is this BZ fixed on the trunk?  If so we should update the title by
> dropping the "/13" so that's not flagged as a gcc-13 regression.

Yes, thanks for reminding and tips! I didn't know this rule before, I had a related question that I'm going to backport the commit to gcc-11/gcc-12 soon, once it's done excepting for marking the status to resolved, should I also drop the remaining "[11/12 regression]"? Or for a bug in resolved status, not dropping it would be fine?
Comment 7 Jeffrey A. Law 2023-04-15 13:19:58 UTC
Once you've committed to the active release branches where this bug is active (11/12 in this case), you can just close the bug as resolved/fixed.  No need to update the summary/title in that case.

Thanks,
Jeff
Comment 8 GCC Commits 2023-04-17 09:06:40 UTC
The releases/gcc-12 branch has been updated by Kewen Lin <linkw@gcc.gnu.org>:

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

commit r12-9405-gd39451523912981e897faa7942a2634c058524fb
Author: Kewen Lin <linkw@linux.ibm.com>
Date:   Mon Apr 3 21:47:54 2023 -0500

    rs6000: Fix vector_set_var_p9 by considering BE [PR108807]
    
    As PR108807 exposes, the current handling in function
    rs6000_expand_vector_set_var_p9 doesn't take care of big
    endianness.  Currently the function is to rotate the
    target vector by moving element to-be-set to element 0,
    set element 0 with the given val, then rotate back.  To
    get the permutation control vector for the rotation, it
    makes use of lvsr and lvsl, but the element ordering is
    different for BE and LE (like element 0 is the most
    significant one on BE while the least significant one on
    LE), this patch is to add consideration for BE and make
    sure permutation control vectors for rotations are expected.
    
    As tested, it helped to fix the below failures:
    
    FAIL: gcc.target/powerpc/pr79251-run.p9.c execution test
    FAIL: gcc.target/powerpc/pr89765-mc.c execution test
    FAIL: gcc.target/powerpc/vsx-builtin-10d.c execution test
    FAIL: gcc.target/powerpc/vsx-builtin-11d.c execution test
    FAIL: gcc.target/powerpc/vsx-builtin-14d.c execution test
    FAIL: gcc.target/powerpc/vsx-builtin-16d.c execution test
    FAIL: gcc.target/powerpc/vsx-builtin-18d.c execution test
    FAIL: gcc.target/powerpc/vsx-builtin-9d.c execution test
            PR target/108807
    
    gcc/ChangeLog:
    
            * config/rs6000/rs6000.cc (rs6000_expand_vector_set_var_p9): Fix gen
            function for permutation control vector by considering big endianness.
    
    (cherry picked from commit d634e6088f139ee700d79ec73b1ad6436096a6ff)
Comment 9 GCC Commits 2023-04-17 09:08:05 UTC
The releases/gcc-11 branch has been updated by Kewen Lin <linkw@gcc.gnu.org>:

https://gcc.gnu.org/g:043cc707f449076ea704a12fff60e32f5861dfcb

commit r11-10627-g043cc707f449076ea704a12fff60e32f5861dfcb
Author: Kewen Lin <linkw@linux.ibm.com>
Date:   Mon Apr 3 21:47:54 2023 -0500

    rs6000: Fix vector_set_var_p9 by considering BE [PR108807]
    
    As PR108807 exposes, the current handling in function
    rs6000_expand_vector_set_var_p9 doesn't take care of big
    endianness.  Currently the function is to rotate the
    target vector by moving element to-be-set to element 0,
    set element 0 with the given val, then rotate back.  To
    get the permutation control vector for the rotation, it
    makes use of lvsr and lvsl, but the element ordering is
    different for BE and LE (like element 0 is the most
    significant one on BE while the least significant one on
    LE), this patch is to add consideration for BE and make
    sure permutation control vectors for rotations are expected.
    
    As tested, it helped to fix the below failures:
    
    FAIL: gcc.target/powerpc/pr79251-run.p9.c execution test
    FAIL: gcc.target/powerpc/pr89765-mc.c execution test
    FAIL: gcc.target/powerpc/vsx-builtin-10d.c execution test
    FAIL: gcc.target/powerpc/vsx-builtin-11d.c execution test
    FAIL: gcc.target/powerpc/vsx-builtin-14d.c execution test
    FAIL: gcc.target/powerpc/vsx-builtin-16d.c execution test
    FAIL: gcc.target/powerpc/vsx-builtin-18d.c execution test
    FAIL: gcc.target/powerpc/vsx-builtin-9d.c execution test
            PR target/108807
    
    gcc/ChangeLog:
    
            * config/rs6000/rs6000.c (rs6000_expand_vector_set_var_p9): Fix gen
            function for permutation control vector by considering big endianness.
    
    (cherry picked from commit d634e6088f139ee700d79ec73b1ad6436096a6ff)
Comment 10 Kewen Lin 2023-04-17 09:10:29 UTC
Fixed on trunk and related release branches.