public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/99134] New: S390x: pfpo instructions are not used for dfp[128|64|32] to/from long double conversions
@ 2021-02-17 14:53 stli at linux dot ibm.com
  2021-02-20  0:50 ` [Bug c/99134] " cvs-commit at gcc dot gnu.org
  2021-02-22 14:29 ` stli at linux dot ibm.com
  0 siblings, 2 replies; 3+ messages in thread
From: stli at linux dot ibm.com @ 2021-02-17 14:53 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99134
           Summary: S390x: pfpo instructions are not used for
                    dfp[128|64|32] to/from long double conversions
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: stli at linux dot ibm.com
  Target Milestone: ---

Created attachment 50212
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50212&action=edit
Test which runs the dfpXYZ <-> long double conversions which are not performed
via pfpo instruction, but by calling __dpd_[trunc|extend] functions.

See libdfp-issue "s390x: 3 test failures on Fedora Rawhide #160"
https://github.com/libdfp/libdfp/issues/160
(Notice that Rawhide is using GCC 11 now.)

Reproduced the issues with gcc commit 78a6d0e30d7950216dc0c5be5d65d0cbed13924c
You have to configure gcc with --enable-decimal-float

All decimal-floating-point[128|64|32] <-> binary-floating-point[128|64|32]
conversions should emit the
pfpo (PERFORM FLOATING-POINT OPERATION) instruction as used in previous GCC
versions.

GCC 11 is not using the pfpo instruction if bfp128 (long double) is involved
in the conversion. In the libdfp implementation of dpd_extend/trunc functions,
this leads to be a recursive call to itself which segfaults as it runs out of
stack:
- bfp128 -> dfp128 (do__dpd_extendtftd(): brasl %r14,<__dpd_extendtftd>)
- bfp128 -> dfp64  (do_bfp128_to_dfp64(): brasl %r14,<__dpd_trunctfdd>)
- bfp128 -> dfp32  (do_bfp128_to_dfp32(): brasl %r14,<__dpd_trunctfsd>)

- dfp128 -> bfp128 (do__dpd_trunctdtf(): brasl %r14,<__dpd_trunctdtf>)
- dfp64  -> bfp128 (do_dfp64_to_bfp128(): brasl %r14,<__dpd_extendddtf>)
- dfp32  -> bfp128 (do_dfp32_to_bfp128(): brasl %r14,<__dpd_extendsdtf>)

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

* [Bug c/99134] S390x: pfpo instructions are not used for dfp[128|64|32] to/from long double conversions
  2021-02-17 14:53 [Bug c/99134] New: S390x: pfpo instructions are not used for dfp[128|64|32] to/from long double conversions stli at linux dot ibm.com
@ 2021-02-20  0:50 ` cvs-commit at gcc dot gnu.org
  2021-02-22 14:29 ` stli at linux dot ibm.com
  1 sibling, 0 replies; 3+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-02-20  0:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Ilya Leoshkevich <iii@gcc.gnu.org>:

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

commit r11-7310-gb6e446cb58183557a5a5d87dc866aae9613544f8
Author: Ilya Leoshkevich <iii@linux.ibm.com>
Date:   Wed Feb 17 14:40:03 2021 +0100

    IBM Z: Fix long double <-> DFP conversions

    When switching the s390 backend to store long doubles in vector
    registers, the patterns for long double <-> DFP conversions were
    forgotten.  This did not cause observable problems so far, because
    libdfp calls are emitted instead of pfpo.  However, when building
    libdfp itself, this leads to infinite recursion.

    gcc/ChangeLog:

            PR target/99134
            * config/s390/vector.md (trunctf<DFP_ALL:mode>2_vr): New
            pattern.
            (trunctf<DFP_ALL:mode>2): Likewise.
            (trunctdtf2_vr): Likewise.
            (trunctdtf2): Likewise.
            (extend<DFP_ALL:mode>tf2_vr): Likewise.
            (extend<DFP_ALL:mode>tf2): Likewise.
            (extendtftd2_vr): Likewise.
            (extendtftd2): Likewise.

    gcc/testsuite/ChangeLog:

            PR target/99134
            * gcc.target/s390/vector/long-double-from-decimal128.c: New test.
            * gcc.target/s390/vector/long-double-from-decimal32.c: New test.
            * gcc.target/s390/vector/long-double-from-decimal64.c: New test.
            * gcc.target/s390/vector/long-double-to-decimal128.c: New test.
            * gcc.target/s390/vector/long-double-to-decimal32.c: New test.
            * gcc.target/s390/vector/long-double-to-decimal64.c: New test.

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

* [Bug c/99134] S390x: pfpo instructions are not used for dfp[128|64|32] to/from long double conversions
  2021-02-17 14:53 [Bug c/99134] New: S390x: pfpo instructions are not used for dfp[128|64|32] to/from long double conversions stli at linux dot ibm.com
  2021-02-20  0:50 ` [Bug c/99134] " cvs-commit at gcc dot gnu.org
@ 2021-02-22 14:29 ` stli at linux dot ibm.com
  1 sibling, 0 replies; 3+ messages in thread
From: stli at linux dot ibm.com @ 2021-02-22 14:29 UTC (permalink / raw)
  To: gcc-bugs

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

stli at linux dot ibm.com <stli at linux dot ibm.com> changed:

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

--- Comment #2 from stli at linux dot ibm.com <stli at linux dot ibm.com> ---
I've just restested libdfp with gcc-head:
$ git log --oneline
60b99ee3bc0 (HEAD -> master, origin/master, origin/HEAD) Daily bump.
...
b6e446cb581 IBM Z: Fix long double <-> DFP conversions
a974b8a592e IBM Z: Improve FPRX2 <-> TF conversions


Now all the long double <-> _Decimal data-type conversions are using the pfpo
instruction.

Thanks.

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

end of thread, other threads:[~2021-02-22 14:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-17 14:53 [Bug c/99134] New: S390x: pfpo instructions are not used for dfp[128|64|32] to/from long double conversions stli at linux dot ibm.com
2021-02-20  0:50 ` [Bug c/99134] " cvs-commit at gcc dot gnu.org
2021-02-22 14:29 ` stli at linux dot ibm.com

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).