PR target/78748: S/390: Fix ICE with ANDC splitter.
authorDominik Vogt <vogt@linux.vnet.ibm.com>
Mon, 19 Dec 2016 09:53:56 +0000 (09:53 +0000)
committerAndreas Krebbel <krebbel@gcc.gnu.org>
Mon, 19 Dec 2016 09:53:56 +0000 (09:53 +0000)
gcc/ChangeLog:

2016-12-19  Dominik Vogt  <vogt@linux.vnet.ibm.com>

PR target/78748
* config/s390/s390.md ("*andc_split_<mode>"): Allow memory destination
only if it coincides with operand 2.

gcc/testsuite/ChangeLog:

2016-12-19  Dominik Vogt  <vogt@linux.vnet.ibm.com>

PR target/78748
* gcc.c-torture/compile/pr78748.c: New test.

From-SVN: r243793

gcc/ChangeLog
gcc/config/s390/s390.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr78748.c [new file with mode: 0644]

index 3622483545c54a3a6127c7b1c675cd98616b6cd5..8255e501d9101ad7242d9cbe143f404851a7ac4f 100644 (file)
@@ -1,3 +1,9 @@
+2016-12-19  Dominik Vogt  <vogt@linux.vnet.ibm.com>
+
+       PR target/78748
+       * config/s390/s390.md ("*andc_split_<mode>"): Allow memory destination
+       only if it coincides with operand 2.
+
 2016-12-19  Dominik Vogt  <vogt@linux.vnet.ibm.com>
 
        * combine.c (change_zero_ext): Skip generation of redundant AND.
index 4f2effd93ff04511b7e37a370a982c0014f8a110..9d8e6b61a42b5f8dff6a3c8c9fe8adf117cc029b 100644 (file)
        (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"
   [
index 7b91b7b86b0601c82ee2be715eef1d7f77b6dfc3..53813b5ab2456d98263ea826b231dab8e7157718 100644 (file)
@@ -1,3 +1,8 @@
+2016-12-19  Dominik Vogt  <vogt@linux.vnet.ibm.com>
+
+       PR target/78748
+       * gcc.c-torture/compile/pr78748.c: New test.
+
 2016-12-18  Janus Weil  <janus@gcc.gnu.org>
 
        PR fortran/78848
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr78748.c b/gcc/testsuite/gcc.c-torture/compile/pr78748.c
new file mode 100644 (file)
index 0000000..032e78d
--- /dev/null
@@ -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;
+}