public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Juergen Christ <jchrist@linux.ibm.com>
To: krebbel@linux.ibm.com, gcc-patches@gcc.gnu.org
Subject: [PATCH] s390x: Fix PR112753
Date: Thu, 30 Nov 2023 16:45:47 +0100	[thread overview]
Message-ID: <20231130154547.17694-1-jchrist@linux.ibm.com> (raw)

Commit 466b100e5fee808d77598e0f294654deec281150 introduced a bug in
s390_md_asm_adjust if vector extensions are not available.  Fix the control
flow of this function to not adjust long double values.

gcc/ChangeLog:

	* config/s390/s390.cc (s390_md_asm_adjust): Fix.

gcc/testsuite/ChangeLog:

	* gcc.target/s390/pr112753.c: New test.

Bootstrapped and tested on s390x.

Signed-off-by: Juergen Christ <jchrist@linux.ibm.com>
---
 gcc/config/s390/s390.cc                  | 4 ++++
 gcc/testsuite/gcc.target/s390/pr112753.c | 8 ++++++++
 2 files changed, 12 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/s390/pr112753.c

diff --git a/gcc/config/s390/s390.cc b/gcc/config/s390/s390.cc
index 29b5dc979207..3a4d2d346f0c 100644
--- a/gcc/config/s390/s390.cc
+++ b/gcc/config/s390/s390.cc
@@ -17604,6 +17604,10 @@ s390_md_asm_adjust (vec<rtx> &outputs, vec<rtx> &inputs,
       outputs[i] = fprx2;
     }
 
+  if (!TARGET_VXE)
+    /* Long doubles are stored in FPR pairs - nothing left to do.  */
+    return after_md_seq;
+
   for (unsigned i = 0; i < ninputs; i++)
     {
       if (GET_MODE (inputs[i]) != TFmode)
diff --git a/gcc/testsuite/gcc.target/s390/pr112753.c b/gcc/testsuite/gcc.target/s390/pr112753.c
new file mode 100644
index 000000000000..7183b3f12bed
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/pr112753.c
@@ -0,0 +1,8 @@
+/* This caused an ICE on s390x due to a bug in s390_md_asm_adjust when no
+   vector extension is available.  */
+
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=zEC12" } */
+
+long double ____strtold_l_internal___x;
+void ____strtold_l_internal() { __asm__("" : : "fm"(____strtold_l_internal___x)); }
-- 
2.39.3


             reply	other threads:[~2023-11-30 15:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-30 15:45 Juergen Christ [this message]
2023-12-01  7:20 ` Andreas Krebbel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231130154547.17694-1-jchrist@linux.ibm.com \
    --to=jchrist@linux.ibm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=krebbel@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).