* [PATCH] s390x: Fix PR112753
@ 2023-11-30 15:45 Juergen Christ
2023-12-01 7:20 ` Andreas Krebbel
0 siblings, 1 reply; 2+ messages in thread
From: Juergen Christ @ 2023-11-30 15:45 UTC (permalink / raw)
To: krebbel, gcc-patches
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] s390x: Fix PR112753
2023-11-30 15:45 [PATCH] s390x: Fix PR112753 Juergen Christ
@ 2023-12-01 7:20 ` Andreas Krebbel
0 siblings, 0 replies; 2+ messages in thread
From: Andreas Krebbel @ 2023-12-01 7:20 UTC (permalink / raw)
To: Juergen Christ, gcc-patches
On 11/30/23 16:45, Juergen Christ wrote:
> 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.
Committed to mainline with a slightly more verbose changelog which also refers to the BZ. Thanks!
Andreas
>
> 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)); }
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-12-01 7:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-30 15:45 [PATCH] s390x: Fix PR112753 Juergen Christ
2023-12-01 7:20 ` Andreas Krebbel
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).