Bug 93709 - [10 regression] fortran.dg/minlocval_4.f90 fails on power 9 after r10-4161
Summary: [10 regression] fortran.dg/minlocval_4.f90 fails on power 9 after r10-4161
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 10.0
: P3 normal
Target Milestone: 10.0
Assignee: Jiu Fu Guo
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2020-02-12 16:56 UTC by seurer
Modified: 2024-03-27 04:25 UTC (History)
3 users (show)

See Also:
Host: powerpc64le-linux-gnu
Target: powerpc64le-linux-gnu
Build: powerpc64le-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2020-03-11 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description seurer 2020-02-12 16:56:28 UTC
g:cf20d00ca1ae5a0da9b329896d7b51e55381bdd7, r10-4160

fortran.dg/maxlocval_4.f90 also fails.  This only happens on power 9.

Executing on host: /home3/seurer/gcc/git/build/gcc-test2/gcc/testsuite/gfortran/../../gfortran -B/home3/seurer/gcc/git/build/gcc-test2/gcc/testsuite/gfortran/../../ -B/home3/seurer/gcc/git/build/gcc-test2/powerpc64le-unknown-linux-gnu/./libgfortran/ /home/seurer/gcc/git/gcc-test2/gcc/testsuite/gfortran.dg/minlocval_4.f90    -fno-diagnostics-show-caret -fno-diagnostics-show-line-numbers -fdiagnostics-color=never  -fdiagnostics-urls=never    -O2   -pedantic-errors  -B/home3/seurer/gcc/git/build/gcc-test2/powerpc64le-unknown-linux-gnu/./libgfortran/.libs -L/home3/seurer/gcc/git/build/gcc-test2/powerpc64le-unknown-linux-gnu/./libgfortran/.libs -L/home3/seurer/gcc/git/build/gcc-test2/powerpc64le-unknown-linux-gnu/./libgfortran/.libs -L/home3/seurer/gcc/git/build/gcc-test2/powerpc64le-unknown-linux-gnu/./libatomic/.libs -B/home3/seurer/gcc/git/build/gcc-test2/powerpc64le-unknown-linux-gnu/./libquadmath/.libs -L/home3/seurer/gcc/git/build/gcc-test2/powerpc64le-unknown-linux-gnu/./libquadmath/.libs -L/home3/seurer/gcc/git/build/gcc-test2/powerpc64le-unknown-linux-gnu/./libquadmath/.libs  -lm  -o ./minlocval_4.exe    (timeout = 300)
spawn -ignore SIGHUP /home3/seurer/gcc/git/build/gcc-test2/gcc/testsuite/gfortran/../../gfortran -B/home3/seurer/gcc/git/build/gcc-test2/gcc/testsuite/gfortran/../../ -B/home3/seurer/gcc/git/build/gcc-test2/powerpc64le-unknown-linux-gnu/./libgfortran/ /home/seurer/gcc/git/gcc-test2/gcc/testsuite/gfortran.dg/minlocval_4.f90 -fno-diagnostics-show-caret -fno-diagnostics-show-line-numbers -fdiagnostics-color=never -fdiagnostics-urls=never -O2 -pedantic-errors -B/home3/seurer/gcc/git/build/gcc-test2/powerpc64le-unknown-linux-gnu/./libgfortran/.libs -L/home3/seurer/gcc/git/build/gcc-test2/powerpc64le-unknown-linux-gnu/./libgfortran/.libs -L/home3/seurer/gcc/git/build/gcc-test2/powerpc64le-unknown-linux-gnu/./libgfortran/.libs -L/home3/seurer/gcc/git/build/gcc-test2/powerpc64le-unknown-linux-gnu/./libatomic/.libs -B/home3/seurer/gcc/git/build/gcc-test2/powerpc64le-unknown-linux-gnu/./libquadmath/.libs -L/home3/seurer/gcc/git/build/gcc-test2/powerpc64le-unknown-linux-gnu/./libquadmath/.libs -L/home3/seurer/gcc/git/build/gcc-test2/powerpc64le-unknown-linux-gnu/./libquadmath/.libs -lm -o ./minlocval_4.exe
PASS: gfortran.dg/minlocval_4.f90   -O2  (test for excess errors)
Setting LD_LIBRARY_PATH to .:/home3/seurer/gcc/git/build/gcc-test2/powerpc64le-unknown-linux-gnu/./libgfortran/.libs:/home3/seurer/gcc/git/build/gcc-test2/powerpc64le-unknown-linux-gnu/./libgfortran/.libs:/home3/seurer/gcc/git/build/gcc-test2/powerpc64le-unknown-linux-gnu/./libatomic/.libs:/home3/seurer/gcc/git/build/gcc-test2/powerpc64le-unknown-linux-gnu/./libquadmath/.libs:/home3/seurer/gcc/git/build/gcc-test2/powerpc64le-unknown-linux-gnu/./libquadmath/.libs:/home/seurer/gcc/git/build/gcc-test2/gcc:.:/home3/seurer/gcc/git/build/gcc-test2/powerpc64le-unknown-linux-gnu/./libgfortran/.libs:/home3/seurer/gcc/git/build/gcc-test2/powerpc64le-unknown-linux-gnu/./libgfortran/.libs:/home3/seurer/gcc/git/build/gcc-test2/powerpc64le-unknown-linux-gnu/./libatomic/.libs:/home3/seurer/gcc/git/build/gcc-test2/powerpc64le-unknown-linux-gnu/./libquadmath/.libs:/home3/seurer/gcc/git/build/gcc-test2/powerpc64le-unknown-linux-gnu/./libquadmath/.libs:/home/seurer/gcc/git/build/gcc-test2/gcc:/home/seurer/gcc/git/build/gcc-test2/./gmp/.libs:/home/seurer/gcc/git/build/gcc-test2/./prev-gmp/.libs:/home/seurer/gcc/git/build/gcc-test2/./mpfr/src/.libs:/home/seurer/gcc/git/build/gcc-test2/./prev-mpfr/src/.libs:/home/seurer/gcc/git/build/gcc-test2/./mpc/src/.libs:/home/seurer/gcc/git/build/gcc-test2/./prev-mpc/src/.libs:/home/seurer/gcc/git/build/gcc-test2/./isl/.libs:/home/seurer/gcc/git/build/gcc-test2/./prev-isl/.libs
Execution timeout is: 300
spawn [open ...]
Note: The following floating-point exceptions are signalling: IEEE_INVALID_FLAG IEEE_DIVIDE_BY_ZERO
STOP 70
FAIL: gfortran.dg/minlocval_4.f90   -O2  execution test
Comment 1 Bill Schmidt 2020-02-16 21:36:18 UTC
r10-4160 is the "daily bump" commit.  How confident are you in your bisection? :-)
Comment 2 seurer 2020-02-17 19:19:01 UTC
You are right, it was git g:6d099a76a0f6a040a3e678f2bce7fc69cc3257d8, r10-4161
Comment 3 Jiu Fu Guo 2020-02-20 11:27:09 UTC
This issue may relates to cunroll and cunrollli; after cunroll, for power9 some special instructions were selected.
In RTL, for power9, 'smax' is generated at ce1 pass; 
While for power8, 'smax' is not used.
Comment 4 Jiu Fu Guo 2020-02-20 11:45:42 UTC
This issue can be reproduced with GCC9 "-O2 -funroll-loops -mcpu=power9" or "-O3 -mcpu=power9".
Comment 5 Jiu Fu Guo 2020-02-21 09:50:07 UTC
There are below difference between data/instructions for P8 and P9: (maxlocval_4.f90)

f29=-inf
f30=-inf
f31=nan

P9:
xsmaxcdp vs31,vs29,vs31  ==> vs31/f31:nan (smax(-inf, nan)-->nan)
b       0x10004b60 <MAIN__+15760> 

P8:
fcmpu   cr0,f29,f31
blt     0x10004c20 <MAIN__+15952>  (not jump,  -inf < nan --> false"
fmr     f31,f29             ==>f31:-inf
b       0x10004c20 <MAIN__+15952>

On P9, 'f31' becomes ‘nan’ by instruction "xsmaxcdp".
While on P8, 'f31' becomes '-inf' through "fcmpu and blt".
Comment 6 Martin Liška 2020-03-11 12:05:16 UTC
commit r10-7114-g37e0df8a9be5a8232f4ccb73cdadb02121ba523f
Author: Jiufu Guo <guojiufu@linux.ibm.com>
Date:   Tue Mar 10 13:51:57 2020 +0800

    rs6000: Check -+0 and NaN for smax/smin generation
    
    PR93709 mentioned regressions on maxlocval_4.f90 and minlocval_f.f90 which
    relates to max of '-inf' and 'nan'. This regression occur on P9 because
    P9 new instruction 'xsmaxcdp' is generated.
    And for C code `a < b ? b : a` is also generated as `xsmaxcdp` under -O2
    for P9. While this instruction behavior more like C/C++ semantic (a>b?a:b).
    
    This generates prevents 'xsmaxcdp' to be generated for those cases.
    'xsmincdp' also is handled in patch.
    
    gcc/
    2020-03-10  Jiufu Guo  <guojiufu@linux.ibm.com>
    
            PR target/93709
            * gcc/config/rs6000/rs6000.c (rs6000_emit_p9_fp_minmax): Check
            NAN and SIGNED_ZEROR for smax/smin.
    
    gcc/testsuite
    2020-03-10  Jiufu Guo  <guojiufu@linux.ibm.com>
    
            PR target/93709
            * gcc.target/powerpc/p9-minmax-3.c: New test.
Comment 7 Bill Schmidt 2020-03-11 15:38:34 UTC
Confirmed, since fixed on trunk.  Do we want any backports?
Comment 8 GCC Commits 2020-03-19 04:58:49 UTC
The releases/gcc-9 branch has been updated by Jiu Fu Guo <guojiufu@gcc.gnu.org>:

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

commit r9-8401-gd01cb80e0fbe23510a861faab9909b76837faf98
Author: Jiufu Guo <guojiufu@linux.ibm.com>
Date:   Tue Mar 10 13:51:57 2020 +0800

    rs6000: Check -+0 and NaN for smax/smin generation
    
    PR93709 mentioned regressions on maxlocval_4.f90 and minlocval_f.f90 which
    relates to max of '-inf' and 'nan'. This regression occur on P9 because
    P9 new instruction 'xsmaxcdp' is generated.
    And for C code `a < b ? b : a` is also generated as `xsmaxcdp` under -O2
    for P9. While this instruction behavior more like C/C++ semantic (a>b?a:b).
    In GCC9, the issue also occur as the new test case shows.
    
    This generates prevents 'xsmaxcdp' to be generated for those cases.
    'xsmincdp' also is handled in patch.
    
    gcc/
    2020-03-19  Jiufu Guo  <guojiufu@linux.ibm.com>
    
            PR target/93709
            * gcc/config/rs6000/rs6000.c (rs6000_emit_p9_fp_minmax): Check
            NAN and SIGNED_ZEROR for smax/smin.
    
    gcc/testsuite
    2020-03-19  Jiufu Guo  <guojiufu@linux.ibm.com>
    
            PR target/93709
            * gcc.target/powerpc/p9-minmax-3.c: New test.
Comment 9 Jiu Fu Guo 2020-03-19 13:32:01 UTC
submit to trunk and GCC9.