]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
s390x: Fix s390_md_asm_adjust handling of long doubles [PR112753]
authorJuergen Christ <jchrist@linux.ibm.com>
Fri, 1 Dec 2023 07:01:36 +0000 (08:01 +0100)
committerAndreas Krebbel <krebbel@linux.ibm.com>
Fri, 1 Dec 2023 07:17:15 +0000 (08:17 +0100)
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:

PR target/112753
* config/s390/s390.cc (s390_md_asm_adjust): Return after dealing
with the outputs, if no further processing of long doubles is
required.

gcc/testsuite/ChangeLog:

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

gcc/config/s390/s390.cc
gcc/testsuite/gcc.target/s390/pr112753.c [new file with mode: 0644]

index 4b16a75f8518cefde03ccf2d4fe870b1270eeacd..0a969ec419e66a084c96961a5237fa03172abfb0 100644 (file)
@@ -17605,6 +17605,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 (file)
index 0000000..7183b3f
--- /dev/null
@@ -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)); }