diff mbox

PR target/78748: S/390: Fix ICE with ANDC splitter.

Message ID 20161212143601.GA2136@linux.vnet.ibm.com
State New
Headers show

Commit Message

Dominik Vogt Dec. 12, 2016, 2:36 p.m. UTC
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 ^_^  ^_^

Comments

Jakub Jelinek Dec. 12, 2016, 2:50 p.m. UTC | #1
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
diff mbox

Patch

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