* [PATCH] PR target/78748: S/390: Fix ICE with ANDC splitter.
@ 2016-12-12 14:36 Dominik Vogt
2016-12-12 14:50 ` Jakub Jelinek
0 siblings, 1 reply; 4+ messages in thread
From: Dominik Vogt @ 2016-12-12 14:36 UTC (permalink / raw)
To: gcc-patches; +Cc: Andreas Krebbel
[-- Attachment #1: Type: text/plain, Size: 196 bytes --]
The attached patch fixes PR/78748. Bootstrapped and regression
tested on s390 and s390x.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78748
Ciao
Dominik ^_^ ^_^
--
Dominik Vogt
IBM Germany
[-- Attachment #2: 0001-ChangeLog --]
[-- Type: text/plain, Size: 246 bytes --]
gcc/ChangeLog-pr78748
PR target/78748
* config/s390/s390.md ("*andc_split_<mode>"): Allow memory destination
only if it coincides with operand 2.
gcc/testsuite/ChangeLog-pr78748
PR target/78748
* gcc.c-torture/compile/pr78748.c: New test.
[-- Attachment #3: 0001-PR-target-78748-S-390-Fix-ICE-with-ANDC-splitter.patch --]
[-- Type: text/plain, Size: 1589 bytes --]
From b48da97e3b2f5b0b49543ed35d8c667a607067cf Mon Sep 17 00:00:00 2001
From: Dominik Vogt <vogt@linux.vnet.ibm.com>
Date: Mon, 12 Dec 2016 10:35:21 +0100
Subject: [PATCH] PR target/78748: S/390: Fix ICE with ANDC splitter.
---
gcc/config/s390/s390.md | 6 +++++-
gcc/testsuite/gcc.c-torture/compile/pr78748.c | 16 ++++++++++++++++
2 files changed, 21 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr78748.c
diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md
index 4f2effd..9d8e6b6 100644
--- a/gcc/config/s390/s390.md
+++ b/gcc/config/s390/s390.md
@@ -7420,7 +7420,11 @@
(and:GPR (not:GPR (match_operand:GPR 1 "nonimmediate_operand" ""))
(match_operand:GPR 2 "general_operand" "")))
(clobber (reg:CC CC_REGNUM))]
- "! reload_completed && s390_logical_operator_ok_p (operands)"
+ "! reload_completed
+ && (GET_CODE (operands[0]) != MEM
+ /* Ensure that s390_logical_operator_ok_p will succeed even
+ on the split xor if (b & a) is stored into a pseudo. */
+ || rtx_equal_p (operands[0], operands[2]))"
"#"
"&& 1"
[
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr78748.c b/gcc/testsuite/gcc.c-torture/compile/pr78748.c
new file mode 100644
index 0000000..d24a334
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr78748.c
@@ -0,0 +1,16 @@
+/* PR target/78748 */
+/* { dg-options "-march=zEC12" { target { s390*-*-* } } } */
+
+void
+foo (int *p, int *q)
+{
+ *q = *p & ~*q;
+}
+
+#if 0 /*!!!*/
+void
+bar (int *p, int *q)
+{
+ *q = ~*p & *q;
+}
+#endif
--
2.3.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] PR target/78748: S/390: Fix ICE with ANDC splitter.
2016-12-12 14:36 [PATCH] PR target/78748: S/390: Fix ICE with ANDC splitter Dominik Vogt
@ 2016-12-12 14:50 ` Jakub Jelinek
2016-12-12 16:37 ` [PATCH v2] " Dominik Vogt
0 siblings, 1 reply; 4+ messages in thread
From: Jakub Jelinek @ 2016-12-12 14:50 UTC (permalink / raw)
To: vogt, gcc-patches, Andreas Krebbel
On Mon, Dec 12, 2016 at 03:36:01PM +0100, Dominik Vogt wrote:
> diff --git a/gcc/testsuite/gcc.c-torture/compile/pr78748.c b/gcc/testsuite/gcc.c-torture/compile/pr78748.c
> new file mode 100644
> index 0000000..d24a334
> --- /dev/null
> +++ b/gcc/testsuite/gcc.c-torture/compile/pr78748.c
> @@ -0,0 +1,16 @@
> +/* PR target/78748 */
> +/* { dg-options "-march=zEC12" { target { s390*-*-* } } } */
> +
> +void
> +foo (int *p, int *q)
> +{
> + *q = *p & ~*q;
> +}
> +
> +#if 0 /*!!!*/
> +void
> +bar (int *p, int *q)
> +{
> + *q = ~*p & *q;
> +}
> +#endif
Why the #if 0 /*!!!*/? The test just verifies the compiler doesn't ICE
and stuff assembles, I'd hope bar also compiles and assembles.
Jakub
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] PR target/78748: S/390: Fix ICE with ANDC splitter.
2016-12-12 14:50 ` Jakub Jelinek
@ 2016-12-12 16:37 ` Dominik Vogt
2016-12-19 10:10 ` Andreas Krebbel
0 siblings, 1 reply; 4+ messages in thread
From: Dominik Vogt @ 2016-12-12 16:37 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: gcc-patches, Andreas Krebbel
[-- Attachment #1: Type: text/plain, Size: 1062 bytes --]
On Mon, Dec 12, 2016 at 03:50:14PM +0100, Jakub Jelinek wrote:
> On Mon, Dec 12, 2016 at 03:36:01PM +0100, Dominik Vogt wrote:
> > diff --git a/gcc/testsuite/gcc.c-torture/compile/pr78748.c b/gcc/testsuite/gcc.c-torture/compile/pr78748.c
> > new file mode 100644
> > index 0000000..d24a334
> > --- /dev/null
> > +++ b/gcc/testsuite/gcc.c-torture/compile/pr78748.c
> > @@ -0,0 +1,16 @@
> > +/* PR target/78748 */
> > +/* { dg-options "-march=zEC12" { target { s390*-*-* } } } */
> > +
> > +void
> > +foo (int *p, int *q)
> > +{
> > + *q = *p & ~*q;
> > +}
> > +
> > +#if 0 /*!!!*/
> > +void
> > +bar (int *p, int *q)
> > +{
> > + *q = ~*p & *q;
> > +}
> > +#endif
>
> Why the #if 0 /*!!!*/?
The "!!!" is a to-do-marker. When doing too many things in
parallel I sometimes forget removing them. Sorry for that. Patch
without the marker attached.
> The test just verifies the compiler doesn't ICE
> and stuff assembles,
> I'd hope bar also compiles and assembles.
It does, with and without the patch.
Ciao
Dominik ^_^ ^_^
--
Dominik Vogt
IBM Germany
[-- Attachment #2: 0001-v2-ChangeLog --]
[-- Type: text/plain, Size: 246 bytes --]
gcc/ChangeLog-pr78748
PR target/78748
* config/s390/s390.md ("*andc_split_<mode>"): Allow memory destination
only if it coincides with operand 2.
gcc/testsuite/ChangeLog-pr78748
PR target/78748
* gcc.c-torture/compile/pr78748.c: New test.
[-- Attachment #3: 0001-v2-PR-target-78748-S-390-Fix-ICE-with-ANDC-splitter.patch --]
[-- Type: text/plain, Size: 1564 bytes --]
From 02cd9f64bb62c26248d013261ea0e037e60ed2a4 Mon Sep 17 00:00:00 2001
From: Dominik Vogt <vogt@linux.vnet.ibm.com>
Date: Mon, 12 Dec 2016 10:35:21 +0100
Subject: [PATCH] PR target/78748: S/390: Fix ICE with ANDC splitter.
---
gcc/config/s390/s390.md | 6 +++++-
gcc/testsuite/gcc.c-torture/compile/pr78748.c | 14 ++++++++++++++
2 files changed, 19 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr78748.c
diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md
index 4f2effd..9d8e6b6 100644
--- a/gcc/config/s390/s390.md
+++ b/gcc/config/s390/s390.md
@@ -7420,7 +7420,11 @@
(and:GPR (not:GPR (match_operand:GPR 1 "nonimmediate_operand" ""))
(match_operand:GPR 2 "general_operand" "")))
(clobber (reg:CC CC_REGNUM))]
- "! reload_completed && s390_logical_operator_ok_p (operands)"
+ "! reload_completed
+ && (GET_CODE (operands[0]) != MEM
+ /* Ensure that s390_logical_operator_ok_p will succeed even
+ on the split xor if (b & a) is stored into a pseudo. */
+ || rtx_equal_p (operands[0], operands[2]))"
"#"
"&& 1"
[
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr78748.c b/gcc/testsuite/gcc.c-torture/compile/pr78748.c
new file mode 100644
index 0000000..032e78d
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr78748.c
@@ -0,0 +1,14 @@
+/* PR target/78748 */
+/* { dg-options "-march=zEC12" { target { s390*-*-* } } } */
+
+void
+foo (int *p, int *q)
+{
+ *q = *p & ~*q;
+}
+
+void
+bar (int *p, int *q)
+{
+ *q = ~*p & *q;
+}
--
2.3.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] PR target/78748: S/390: Fix ICE with ANDC splitter.
2016-12-12 16:37 ` [PATCH v2] " Dominik Vogt
@ 2016-12-19 10:10 ` Andreas Krebbel
0 siblings, 0 replies; 4+ messages in thread
From: Andreas Krebbel @ 2016-12-19 10:10 UTC (permalink / raw)
To: Dominik Vogt; +Cc: gcc-patches
On Mon, Dec 12, 2016 at 05:37:03PM +0100, Dominik Vogt wrote:
> gcc/ChangeLog-pr78748
>
> PR target/78748
> * config/s390/s390.md ("*andc_split_<mode>"): Allow memory destination
> only if it coincides with operand 2.
> gcc/testsuite/ChangeLog-pr78748
>
> PR target/78748
> * gcc.c-torture/compile/pr78748.c: New test.
Applied. Thanks!
-Andreas-
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-12-19 9:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-12 14:36 [PATCH] PR target/78748: S/390: Fix ICE with ANDC splitter Dominik Vogt
2016-12-12 14:50 ` Jakub Jelinek
2016-12-12 16:37 ` [PATCH v2] " Dominik Vogt
2016-12-19 10:10 ` 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).