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

Reply via email to